file_name
stringlengths 5
52
| name
stringlengths 4
95
| original_source_type
stringlengths 0
23k
| source_type
stringlengths 9
23k
| source_definition
stringlengths 9
57.9k
| source
dict | source_range
dict | file_context
stringlengths 0
721k
| dependencies
dict | opens_and_abbrevs
listlengths 2
94
| vconfig
dict | interleaved
bool 1
class | verbose_type
stringlengths 1
7.42k
| effect
stringclasses 118
values | effect_flags
sequencelengths 0
2
| mutual_with
sequencelengths 0
11
| ideal_premises
sequencelengths 0
236
| proof_features
sequencelengths 0
1
| is_simple_lemma
bool 2
classes | is_div
bool 2
classes | is_proof
bool 2
classes | is_simply_typed
bool 2
classes | is_type
bool 2
classes | partial_definition
stringlengths 5
3.99k
| completed_definiton
stringlengths 1
1.63M
| isa_cross_project_example
bool 1
class |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
RW.fst | RW.join | val join : i1:idx -> i2:idx -> idx | val join : i1:idx -> i2:idx -> idx | let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 14,
"end_line": 27,
"start_col": 0,
"start_line": 24
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r} | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | i1: RW.idx -> i2: RW.idx -> RW.idx | Prims.Tot | [
"total"
] | [] | [
"RW.idx",
"FStar.Pervasives.Native.Mktuple2",
"RW.RO",
"RW.RW"
] | [] | false | false | false | true | false | let join i1 i2 =
| match i1, i2 with
| RO, RO -> RO
| _, _ -> RW | false |
RW.fst | RW.bind_pre | val bind_pre (#a: _) (i1 i2: idx) (pre: st_pre) (pre': (a -> st_pre)) (post: st_bpost a) : st_pre | val bind_pre (#a: _) (i1 i2: idx) (pre: st_pre) (pre': (a -> st_pre)) (post: st_bpost a) : st_pre | let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1) | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 65,
"end_line": 84,
"start_col": 0,
"start_line": 78
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
i1: RW.idx ->
i2: RW.idx ->
pre: FStar.ST.st_pre ->
pre': (_: a -> FStar.ST.st_pre) ->
post: RW.st_bpost a
-> FStar.ST.st_pre | Prims.Tot | [
"total"
] | [] | [
"RW.idx",
"FStar.ST.st_pre",
"RW.st_bpost",
"FStar.Monotonic.Heap.heap",
"Prims.l_and",
"Prims.l_Forall",
"Prims.l_imp",
"RW.real_post"
] | [] | false | false | false | true | false | let bind_pre #a (i1: idx) (i2: idx) (pre: st_pre) (pre': (a -> st_pre)) (post: st_bpost a) : st_pre =
| let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1) | false |
RW.fst | RW.real_post | val real_post (#a: _) (i: idx) (post: st_bpost a) : st_bpost a | val real_post (#a: _) (i: idx) (post: st_bpost a) : st_bpost a | let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 15,
"end_line": 67,
"start_col": 0,
"start_line": 63
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | i: RW.idx -> post: RW.st_bpost a -> RW.st_bpost a | Prims.Tot | [
"total"
] | [] | [
"RW.idx",
"RW.st_bpost",
"RW.ro_post"
] | [] | false | false | false | true | false | let real_post #a (i: idx) (post: st_bpost a) : st_bpost a =
| match i with
| RO -> ro_post post
| _ -> post | false |
RW.fst | RW.ite | val ite : p: Type0 -> q: Type0 -> r: Type0 -> Prims.logical | let ite (p q r : Type0) = (p ==> q) /\ (~p ==> r) | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 49,
"end_line": 130,
"start_col": 0,
"start_line": 130
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h
let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1
// how is subtyping handled? can I subtype on a?
// note that post is contravariant in a
let subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)
(i2:idx) (pre' : st_pre) (post' : st_bpost a)
(f : m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True))
= fun () -> f () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | p: Type0 -> q: Type0 -> r: Type0 -> Prims.logical | Prims.Tot | [
"total"
] | [] | [
"Prims.l_and",
"Prims.l_imp",
"Prims.l_not",
"Prims.logical"
] | [] | false | false | false | true | true | let ite (p q r: Type0) =
| (p ==> q) /\ (~p ==> r) | false |
|
RW.fst | RW.bind_post | val bind_post (#a #b: _) (i1 i2: idx) (pre: st_pre) (post: st_bpost a) (post': (a -> st_bpost b))
: st_bpost b | val bind_post (#a #b: _) (i1 i2: idx) (pre: st_pre) (post: st_bpost a) (post': (a -> st_bpost b))
: st_bpost b | let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2) | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 75,
"end_line": 94,
"start_col": 0,
"start_line": 87
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
i1: RW.idx ->
i2: RW.idx ->
pre: FStar.ST.st_pre ->
post: RW.st_bpost a ->
post': (_: a -> RW.st_bpost b)
-> RW.st_bpost b | Prims.Tot | [
"total"
] | [] | [
"RW.idx",
"FStar.ST.st_pre",
"RW.st_bpost",
"FStar.Monotonic.Heap.heap",
"Prims.l_and",
"Prims.l_Exists",
"RW.real_post"
] | [] | false | false | false | true | false | let bind_post #a #b (i1: idx) (i2: idx) (pre: st_pre) (post: st_bpost a) (post': (a -> st_bpost b))
: st_bpost b =
| let post:st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2) | false |
RW.fst | RW.m | val m (a: Type u#aa) (i: idx) (pre: st_pre) (post: st_bpost a) : Type0 | val m (a: Type u#aa) (i: idx) (pre: st_pre) (post: st_bpost a) : Type0 | let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post) | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 37,
"end_line": 72,
"start_col": 0,
"start_line": 71
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type -> i: RW.idx -> pre: FStar.ST.st_pre -> post: RW.st_bpost a -> Type0 | Prims.Tot | [
"total"
] | [] | [
"RW.idx",
"FStar.ST.st_pre",
"RW.st_bpost",
"Prims.unit",
"RW.real_post"
] | [] | false | false | false | true | true | let m (a: Type u#aa) (i: idx) (pre: st_pre) (post: st_bpost a) : Type0 =
| unit -> ST a pre (real_post i post) | false |
RW.fst | RW.pre_leq | val pre_leq : pre1: FStar.ST.st_pre -> pre2: FStar.ST.st_pre -> Prims.logical | let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 29,
"end_line": 114,
"start_col": 0,
"start_line": 113
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | pre1: FStar.ST.st_pre -> pre2: FStar.ST.st_pre -> Prims.logical | Prims.Tot | [
"total"
] | [] | [
"FStar.ST.st_pre",
"Prims.l_Forall",
"FStar.Monotonic.Heap.heap",
"Prims.l_imp",
"Prims.logical"
] | [] | false | false | false | true | true | let pre_leq (pre1 pre2: st_pre) =
| forall h. pre2 h ==> pre1 h | false |
|
RW.fst | RW.sp | val sp (#a: _) (wp: pure_wp a) : pure_post a | val sp (#a: _) (wp: pure_wp a) : pure_post a | let sp #a (wp : pure_wp a) : pure_post a =
fun x -> ~ (wp (fun y -> ~(x == y))) | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 38,
"end_line": 159,
"start_col": 0,
"start_line": 158
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h
let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1
// how is subtyping handled? can I subtype on a?
// note that post is contravariant in a
let subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)
(i2:idx) (pre' : st_pre) (post' : st_bpost a)
(f : m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True))
= fun () -> f ()
unfold
let ite (p q r : Type0) = (p ==> q) /\ (~p ==> r)
let if_then_else
(a : Type) (i1:idx)
(pre1:st_pre)
(post1 : st_bpost a)
(i2 : idx)
(pre2 : st_pre)
(post2 : st_bpost a)
(f : m a i1 pre1 post1) (g : m a i2 pre2 post2)
(p : bool)
: Type
= m a (join i1 i2)
(fun h0 -> ite p (pre1 h0) (pre2 h0))
(fun h0 x h1 -> ite p (post1 h0 x h1) (post2 h0 x h1))
reifiable
reflectable
effect {
RWI (a:Type) (i:idx) (_:st_pre) (_:st_bpost a)
with {repr = m;
return = return;
bind = bind;
subcomp = subcomp;
if_then_else = if_then_else}
} | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | wp: Prims.pure_wp a -> Prims.pure_post a | Prims.Tot | [
"total"
] | [] | [
"Prims.pure_wp",
"Prims.l_True",
"Prims.l_not",
"Prims.eq2",
"Prims.pure_post"
] | [] | false | false | false | true | false | let sp #a (wp: pure_wp a) : pure_post a =
| fun x -> ~(wp (fun y -> ~(x == y))) | false |
RW.fst | RW.post_leq | val post_leq : post1: (_: FStar.Monotonic.Heap.heap -> FStar.ST.st_post a) ->
post2: (_: FStar.Monotonic.Heap.heap -> FStar.ST.st_post a)
-> Prims.logical | let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1 | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 49,
"end_line": 117,
"start_col": 0,
"start_line": 116
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
post1: (_: FStar.Monotonic.Heap.heap -> FStar.ST.st_post a) ->
post2: (_: FStar.Monotonic.Heap.heap -> FStar.ST.st_post a)
-> Prims.logical | Prims.Tot | [
"total"
] | [] | [
"FStar.Monotonic.Heap.heap",
"FStar.ST.st_post",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.logical"
] | [] | false | false | false | true | true | let post_leq #a (post1: (H.heap -> st_post a)) (post2: (H.heap -> st_post a)) =
| forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1 | false |
|
TwoLockQueue.fst | TwoLockQueue.ghost_gather | val ghost_gather
(#a: Type)
(#u: _)
(#p0 #p1: perm)
(#p: perm{p == sum_perm p0 p1})
(x0 #x1: erased a)
(r: ghost_ref a)
: SteelGhost unit
u
((ghost_pts_to r p0 x0) `star` (ghost_pts_to r p1 x1))
(fun _ -> ghost_pts_to r p x0)
(requires fun _ -> True)
(ensures fun _ _ _ -> x0 == x1) | val ghost_gather
(#a: Type)
(#u: _)
(#p0 #p1: perm)
(#p: perm{p == sum_perm p0 p1})
(x0 #x1: erased a)
(r: ghost_ref a)
: SteelGhost unit
u
((ghost_pts_to r p0 x0) `star` (ghost_pts_to r p1 x1))
(fun _ -> ghost_pts_to r p x0)
(requires fun _ -> True)
(ensures fun _ _ _ -> x0 == x1) | let ghost_gather (#a:Type) (#u:_)
(#p0 #p1:perm) (#p:perm{p == sum_perm p0 p1})
(x0 #x1:erased a)
(r:ghost_ref a)
: SteelGhost unit u
(ghost_pts_to r p0 x0 `star`
ghost_pts_to r p1 x1)
(fun _ -> ghost_pts_to r p x0)
(requires fun _ -> True)
(ensures fun _ _ _ -> x0 == x1)
= let _ = ghost_gather_pt #a #u #p0 #p1 r in () | {
"file_name": "share/steel/examples/steel/TwoLockQueue.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 49,
"end_line": 52,
"start_col": 0,
"start_line": 42
} | module TwoLockQueue
open FStar.Ghost
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.FractionalPermission
open Steel.Reference
open Steel.SpinLock
module L = FStar.List.Tot
module U = Steel.Utils
module Q = Queue
/// This module provides an implementation of Michael and Scott's two lock queue, using the
/// abstract interface for queues provided in Queue.fsti.
/// This implementation allows an enqueue and a dequeue operation to safely operate in parallel.
/// There is a lock associated to both the enqueuer and the dequeuer, which guards each of those operation,
/// ensuring that at most one enqueue (resp. dequeue) is happening at any time
/// We only prove that this implementation is memory safe, and do not prove the functional correctness of the concurrent queue
#push-options "--ide_id_info_off"
/// Adding the definition of the vprop equivalence to the context, for proof purposes
let _: squash (forall p q. p `equiv` q <==> hp_of p `Steel.Memory.equiv` hp_of q) =
Classical.forall_intro_2 reveal_equiv
(* Some wrappers to reduce clutter in the code *)
[@@__reduce__]
let full = full_perm
[@@__reduce__]
let half = half_perm full
(* Wrappers around fst and snd to avoid overnormalization.
TODO: The frame inference tactic should not normalize fst and snd *)
let fst x = fst x
let snd x = snd x
(* Some wrappers around Steel functions which are easier to use inside this module *) | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.Reference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Queue.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "TwoLockQueue.fst"
} | [
{
"abbrev": true,
"full_module": "Queue",
"short_module": "Q"
},
{
"abbrev": true,
"full_module": "Steel.Utils",
"short_module": "U"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x0: FStar.Ghost.erased a -> r: Steel.Reference.ghost_ref a
-> Steel.Effect.Atomic.SteelGhost Prims.unit | Steel.Effect.Atomic.SteelGhost | [] | [] | [
"Steel.Memory.inames",
"Steel.FractionalPermission.perm",
"Prims.eq2",
"Steel.FractionalPermission.sum_perm",
"FStar.Ghost.erased",
"Steel.Reference.ghost_ref",
"Prims.unit",
"Steel.Reference.ghost_gather_pt",
"Steel.Effect.Common.star",
"Steel.Reference.ghost_pts_to",
"FStar.Ghost.reveal",
"Steel.Effect.Common.vprop",
"Steel.Effect.Common.rmem",
"Prims.l_True"
] | [] | false | true | false | false | false | let ghost_gather
(#a: Type)
(#u: _)
(#p0 #p1: perm)
(#p: perm{p == sum_perm p0 p1})
(x0 #x1: erased a)
(r: ghost_ref a)
: SteelGhost unit
u
((ghost_pts_to r p0 x0) `star` (ghost_pts_to r p1 x1))
(fun _ -> ghost_pts_to r p x0)
(requires fun _ -> True)
(ensures fun _ _ _ -> x0 == x1) =
| let _ = ghost_gather_pt #a #u #p0 #p1 r in
() | false |
MerkleTree.Low.fst | MerkleTree.Low.mt_get_path_ | val mt_get_path_:
#hsz:hash_size_t ->
lv:uint32_t{lv <= merkle_tree_size_lg} ->
mtr:HH.rid ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
rhs:hash_vec #hsz {V.size_of rhs = merkle_tree_size_lg} ->
i:index_t -> j:index_t{i <= j /\ U32.v j < pow2 (32 - U32.v lv)} ->
k:index_t{i <= k && k <= j} ->
p:path_p ->
actd:bool ->
HST.ST unit
(requires (fun h0 ->
HH.includes mtr (V.frameOf hs) /\
HH.includes mtr (V.frameOf rhs) /\
RV.rv_inv h0 hs /\ RV.rv_inv h0 rhs /\
mt_safe_elts h0 lv hs i j /\
path_safe h0 mtr p /\
Path?.hash_size (B.get h0 p 0) = hsz /\
V.size_of (phashes h0 p) <= lv + 1ul))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (path_loc p) h0 h1 /\
path_safe h1 mtr p /\
V.size_of (phashes h1 p) ==
V.size_of (phashes h0 p) + mt_path_length lv k j actd /\
// correctness
(mt_safe_elts_spec h0 lv hs i j;
(let hsz0 = Path?.hash_size (B.get h0 p 0) in
let hsz1 = Path?.hash_size (B.get h1 p 0) in
let before:(S.seq (MTH.hash #(U32.v hsz0))) = lift_path h0 mtr p in
let after:(S.seq (MTH.hash #(U32.v hsz1))) = lift_path h1 mtr p in
hsz = hsz0 /\ hsz = hsz1 /\
S.equal after
(MTH.mt_get_path_ (U32.v lv) (RV.as_seq h0 hs) (RV.as_seq h0 rhs)
(U32.v i) (U32.v j) (U32.v k) before actd)))))
(decreases (32 - U32.v lv)) | val mt_get_path_:
#hsz:hash_size_t ->
lv:uint32_t{lv <= merkle_tree_size_lg} ->
mtr:HH.rid ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
rhs:hash_vec #hsz {V.size_of rhs = merkle_tree_size_lg} ->
i:index_t -> j:index_t{i <= j /\ U32.v j < pow2 (32 - U32.v lv)} ->
k:index_t{i <= k && k <= j} ->
p:path_p ->
actd:bool ->
HST.ST unit
(requires (fun h0 ->
HH.includes mtr (V.frameOf hs) /\
HH.includes mtr (V.frameOf rhs) /\
RV.rv_inv h0 hs /\ RV.rv_inv h0 rhs /\
mt_safe_elts h0 lv hs i j /\
path_safe h0 mtr p /\
Path?.hash_size (B.get h0 p 0) = hsz /\
V.size_of (phashes h0 p) <= lv + 1ul))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (path_loc p) h0 h1 /\
path_safe h1 mtr p /\
V.size_of (phashes h1 p) ==
V.size_of (phashes h0 p) + mt_path_length lv k j actd /\
// correctness
(mt_safe_elts_spec h0 lv hs i j;
(let hsz0 = Path?.hash_size (B.get h0 p 0) in
let hsz1 = Path?.hash_size (B.get h1 p 0) in
let before:(S.seq (MTH.hash #(U32.v hsz0))) = lift_path h0 mtr p in
let after:(S.seq (MTH.hash #(U32.v hsz1))) = lift_path h1 mtr p in
hsz = hsz0 /\ hsz = hsz1 /\
S.equal after
(MTH.mt_get_path_ (U32.v lv) (RV.as_seq h0 hs) (RV.as_seq h0 rhs)
(U32.v i) (U32.v j) (U32.v k) before actd)))))
(decreases (32 - U32.v lv)) | let rec mt_get_path_ #hsz lv mtr hs rhs i j k p actd =
let hh0 = HST.get () in
mt_safe_elts_spec hh0 lv hs i j;
let ofs = offset_of i in
if j = 0ul then ()
else
(mt_make_path_step lv mtr hs rhs i j k p actd;
let hh1 = HST.get () in
mt_safe_elts_spec hh0 lv hs i j;
assert (S.equal (lift_path hh1 mtr p)
(MTH.mt_make_path_step
(U32.v lv) (RV.as_seq hh0 hs) (RV.as_seq hh0 rhs)
(U32.v i) (U32.v j) (U32.v k)
(lift_path hh0 mtr p) actd));
RV.rv_inv_preserved hs (path_loc p) hh0 hh1;
RV.rv_inv_preserved rhs (path_loc p) hh0 hh1;
RV.as_seq_preserved hs (path_loc p) hh0 hh1;
RV.as_seq_preserved rhs (path_loc p) hh0 hh1;
V.loc_vector_within_included hs lv (V.size_of hs);
mt_safe_elts_preserved lv hs i j (path_loc p) hh0 hh1;
assert (mt_safe_elts hh1 lv hs i j);
mt_safe_elts_rec hh1 lv hs i j;
mt_safe_elts_spec hh1 (lv + 1ul) hs (i / 2ul) (j / 2ul);
mt_get_path_ (lv + 1ul) mtr hs rhs (i / 2ul) (j / 2ul) (k / 2ul) p
(if j % 2ul = 0ul then actd else true);
let hh2 = HST.get () in
assert (S.equal (lift_path hh2 mtr p)
(MTH.mt_get_path_ (U32.v lv + 1)
(RV.as_seq hh1 hs) (RV.as_seq hh1 rhs)
(U32.v i / 2) (U32.v j / 2) (U32.v k / 2)
(lift_path hh1 mtr p)
(if U32.v j % 2 = 0 then actd else true)));
assert (S.equal (lift_path hh2 mtr p)
(MTH.mt_get_path_ (U32.v lv)
(RV.as_seq hh0 hs) (RV.as_seq hh0 rhs)
(U32.v i) (U32.v j) (U32.v k)
(lift_path hh0 mtr p) actd))) | {
"file_name": "src/MerkleTree.Low.fst",
"git_rev": "7d7bdc20f2033171e279c176b26e84f9069d23c6",
"git_url": "https://github.com/hacl-star/merkle-tree.git",
"project_name": "merkle-tree"
} | {
"end_col": 51,
"end_line": 1975,
"start_col": 0,
"start_line": 1934
} | module MerkleTree.Low
open EverCrypt.Helpers
open FStar.All
open FStar.Integers
open FStar.Mul
open LowStar.Buffer
open LowStar.BufferOps
open LowStar.Vector
open LowStar.Regional
open LowStar.RVector
open LowStar.Regional.Instances
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module MHS = FStar.Monotonic.HyperStack
module HH = FStar.Monotonic.HyperHeap
module B = LowStar.Buffer
module CB = LowStar.ConstBuffer
module V = LowStar.Vector
module RV = LowStar.RVector
module RVI = LowStar.Regional.Instances
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module MTH = MerkleTree.New.High
module MTS = MerkleTree.Spec
open Lib.IntTypes
open MerkleTree.Low.Datastructures
open MerkleTree.Low.Hashfunctions
open MerkleTree.Low.VectorExtras
#set-options "--z3rlimit 10 --initial_fuel 0 --max_fuel 0 --initial_ifuel 0 --max_ifuel 0"
type const_pointer (a:Type0) = b:CB.const_buffer a{CB.length b == 1 /\ CB.qual_of b == CB.MUTABLE}
/// Low-level Merkle tree data structure
///
// NOTE: because of a lack of 64-bit LowStar.Buffer support, currently
// we cannot change below to some other types.
type index_t = uint32_t
let uint32_32_max = 4294967295ul
inline_for_extraction
let uint32_max = 4294967295UL
let uint64_max = 18446744073709551615UL
let offset_range_limit = uint32_max
type offset_t = uint64_t
inline_for_extraction noextract unfold let u32_64 = Int.Cast.uint32_to_uint64
inline_for_extraction noextract unfold let u64_32 = Int.Cast.uint64_to_uint32
private inline_for_extraction
let offsets_connect (x:offset_t) (y:offset_t): Tot bool = y >= x && (y - x) <= offset_range_limit
private inline_for_extraction
let split_offset (tree:offset_t) (index:offset_t{offsets_connect tree index}): Tot index_t =
[@inline_let] let diff = U64.sub_mod index tree in
assert (diff <= offset_range_limit);
Int.Cast.uint64_to_uint32 diff
private inline_for_extraction
let add64_fits (x:offset_t) (i:index_t): Tot bool = uint64_max - x >= (u32_64 i)
private inline_for_extraction
let join_offset (tree:offset_t) (i:index_t{add64_fits tree i}): Tot (r:offset_t{offsets_connect tree r}) =
U64.add tree (u32_64 i)
inline_for_extraction val merkle_tree_size_lg: uint32_t
let merkle_tree_size_lg = 32ul
// A Merkle tree `MT i j hs rhs_ok rhs` stores all necessary hashes to generate
// a Merkle path for each element from the index `i` to `j-1`.
// - Parameters
// `hs`: a 2-dim store for hashes, where `hs[0]` contains leaf hash values.
// `rhs_ok`: to check the rightmost hashes are up-to-date
// `rhs`: a store for "rightmost" hashes, manipulated only when required to
// calculate some merkle paths that need the rightmost hashes
// as a part of them.
// `mroot`: during the construction of `rhs` we can also calculate the Merkle
// root of the tree. If `rhs_ok` is true then it has the up-to-date
// root value.
noeq type merkle_tree =
| MT: hash_size:hash_size_t ->
offset:offset_t ->
i:index_t -> j:index_t{i <= j /\ add64_fits offset j} ->
hs:hash_vv hash_size {V.size_of hs = merkle_tree_size_lg} ->
rhs_ok:bool ->
rhs:hash_vec #hash_size {V.size_of rhs = merkle_tree_size_lg} ->
mroot:hash #hash_size ->
hash_spec:Ghost.erased (MTS.hash_fun_t #(U32.v hash_size)) ->
hash_fun:hash_fun_t #hash_size #hash_spec ->
merkle_tree
type mt_p = B.pointer merkle_tree
type const_mt_p = const_pointer merkle_tree
inline_for_extraction
let merkle_tree_conditions (#hsz:Ghost.erased hash_size_t) (offset:uint64_t) (i j:uint32_t) (hs:hash_vv hsz) (rhs_ok:bool) (rhs:hash_vec #hsz) (mroot:hash #hsz): Tot bool =
j >= i && add64_fits offset j &&
V.size_of hs = merkle_tree_size_lg &&
V.size_of rhs = merkle_tree_size_lg
// The maximum number of currently held elements in the tree is (2^32 - 1).
// cwinter: even when using 64-bit indices, we fail if the underlying 32-bit
// vector is full; this can be fixed if necessary.
private inline_for_extraction
val mt_not_full_nst: mtv:merkle_tree -> Tot bool
let mt_not_full_nst mtv = MT?.j mtv < uint32_32_max
val mt_not_full: HS.mem -> mt_p -> GTot bool
let mt_not_full h mt = mt_not_full_nst (B.get h mt 0)
/// (Memory) Safety
val offset_of: i:index_t -> Tot index_t
let offset_of i = if i % 2ul = 0ul then i else i - 1ul
// `mt_safe_elts` says that it is safe to access an element from `i` to `j - 1`
// at level `lv` in the Merkle tree, i.e., hs[lv][k] (i <= k < j) is a valid
// element.
inline_for_extraction noextract
val mt_safe_elts:
#hsz:hash_size_t ->
h:HS.mem -> lv:uint32_t{lv <= merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
i:index_t -> j:index_t{j >= i} ->
GTot Type0 (decreases (32 - U32.v lv))
let rec mt_safe_elts #hsz h lv hs i j =
if lv = merkle_tree_size_lg then true
else (let ofs = offset_of i in
V.size_of (V.get h hs lv) == j - ofs /\
mt_safe_elts #hsz h (lv + 1ul) hs (i / 2ul) (j / 2ul))
#push-options "--initial_fuel 1 --max_fuel 1"
val mt_safe_elts_constr:
#hsz:hash_size_t ->
h:HS.mem -> lv:uint32_t{lv < merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
i:index_t -> j:index_t{j >= i} ->
Lemma (requires (V.size_of (V.get h hs lv) == j - offset_of i /\
mt_safe_elts #hsz h (lv + 1ul) hs (i / 2ul) (j / 2ul)))
(ensures (mt_safe_elts #hsz h lv hs i j))
let mt_safe_elts_constr #_ h lv hs i j = ()
val mt_safe_elts_head:
#hsz:hash_size_t ->
h:HS.mem -> lv:uint32_t{lv < merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
i:index_t -> j:index_t{j >= i} ->
Lemma (requires (mt_safe_elts #hsz h lv hs i j))
(ensures (V.size_of (V.get h hs lv) == j - offset_of i))
let mt_safe_elts_head #_ h lv hs i j = ()
val mt_safe_elts_rec:
#hsz:hash_size_t ->
h:HS.mem -> lv:uint32_t{lv < merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
i:index_t -> j:index_t{j >= i} ->
Lemma (requires (mt_safe_elts #hsz h lv hs i j))
(ensures (mt_safe_elts #hsz h (lv + 1ul) hs (i / 2ul) (j / 2ul)))
let mt_safe_elts_rec #_ h lv hs i j = ()
val mt_safe_elts_init:
#hsz:hash_size_t ->
h:HS.mem -> lv:uint32_t{lv <= merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
Lemma (requires (V.forall_ h hs lv (V.size_of hs)
(fun hv -> V.size_of hv = 0ul)))
(ensures (mt_safe_elts #hsz h lv hs 0ul 0ul))
(decreases (32 - U32.v lv))
let rec mt_safe_elts_init #hsz h lv hs =
if lv = merkle_tree_size_lg then ()
else mt_safe_elts_init #hsz h (lv + 1ul) hs
#pop-options
val mt_safe_elts_preserved:
#hsz:hash_size_t ->
lv:uint32_t{lv <= merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
i:index_t -> j:index_t{j >= i} ->
p:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma (requires (V.live h0 hs /\
mt_safe_elts #hsz h0 lv hs i j /\
loc_disjoint p (V.loc_vector_within hs lv (V.size_of hs)) /\
modifies p h0 h1))
(ensures (mt_safe_elts #hsz h1 lv hs i j))
(decreases (32 - U32.v lv))
[SMTPat (V.live h0 hs);
SMTPat (mt_safe_elts #hsz h0 lv hs i j);
SMTPat (loc_disjoint p (RV.loc_rvector hs));
SMTPat (modifies p h0 h1)]
#push-options "--z3rlimit 100 --initial_fuel 2 --max_fuel 2"
let rec mt_safe_elts_preserved #hsz lv hs i j p h0 h1 =
if lv = merkle_tree_size_lg then ()
else (V.get_preserved hs lv p h0 h1;
mt_safe_elts_preserved #hsz (lv + 1ul) hs (i / 2ul) (j / 2ul) p h0 h1)
#pop-options
// `mt_safe` is the invariant of a Merkle tree through its lifetime.
// It includes liveness, regionality, disjointness (to each data structure),
// and valid element access (`mt_safe_elts`).
inline_for_extraction noextract
val mt_safe: HS.mem -> mt_p -> GTot Type0
let mt_safe h mt =
B.live h mt /\ B.freeable mt /\
(let mtv = B.get h mt 0 in
// Liveness & Accessibility
RV.rv_inv h (MT?.hs mtv) /\
RV.rv_inv h (MT?.rhs mtv) /\
Rgl?.r_inv (hreg (MT?.hash_size mtv)) h (MT?.mroot mtv) /\
mt_safe_elts h 0ul (MT?.hs mtv) (MT?.i mtv) (MT?.j mtv) /\
// Regionality
HH.extends (V.frameOf (MT?.hs mtv)) (B.frameOf mt) /\
HH.extends (V.frameOf (MT?.rhs mtv)) (B.frameOf mt) /\
HH.extends (B.frameOf (MT?.mroot mtv)) (B.frameOf mt) /\
HH.disjoint (V.frameOf (MT?.hs mtv)) (V.frameOf (MT?.rhs mtv)) /\
HH.disjoint (V.frameOf (MT?.hs mtv)) (B.frameOf (MT?.mroot mtv)) /\
HH.disjoint (V.frameOf (MT?.rhs mtv)) (B.frameOf (MT?.mroot mtv)))
// Since a Merkle tree satisfies regionality, it's ok to take all regions from
// a tree pointer as a location of the tree.
val mt_loc: mt_p -> GTot loc
let mt_loc mt = B.loc_all_regions_from false (B.frameOf mt)
val mt_safe_preserved:
mt:mt_p -> p:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma (requires (mt_safe h0 mt /\
loc_disjoint p (mt_loc mt) /\
modifies p h0 h1))
(ensures (B.get h0 mt 0 == B.get h1 mt 0 /\
mt_safe h1 mt))
let mt_safe_preserved mt p h0 h1 =
assert (loc_includes (mt_loc mt) (B.loc_buffer mt));
let mtv = B.get h0 mt 0 in
assert (loc_includes (mt_loc mt) (RV.loc_rvector (MT?.hs mtv)));
assert (loc_includes (mt_loc mt) (RV.loc_rvector (MT?.rhs mtv)));
assert (loc_includes (mt_loc mt) (V.loc_vector (MT?.hs mtv)));
assert (loc_includes (mt_loc mt)
(B.loc_all_regions_from false (B.frameOf (MT?.mroot mtv))));
RV.rv_inv_preserved (MT?.hs mtv) p h0 h1;
RV.rv_inv_preserved (MT?.rhs mtv) p h0 h1;
Rgl?.r_sep (hreg (MT?.hash_size mtv)) (MT?.mroot mtv) p h0 h1;
V.loc_vector_within_included (MT?.hs mtv) 0ul (V.size_of (MT?.hs mtv));
mt_safe_elts_preserved 0ul (MT?.hs mtv) (MT?.i mtv) (MT?.j mtv) p h0 h1
/// Lifting to a high-level Merkle tree structure
val mt_safe_elts_spec:
#hsz:hash_size_t ->
h:HS.mem ->
lv:uint32_t{lv <= merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
i:index_t ->
j:index_t{j >= i} ->
Lemma (requires (RV.rv_inv h hs /\
mt_safe_elts #hsz h lv hs i j))
(ensures (MTH.hs_wf_elts #(U32.v hsz)
(U32.v lv) (RV.as_seq h hs)
(U32.v i) (U32.v j)))
(decreases (32 - U32.v lv))
#push-options "--z3rlimit 100 --initial_fuel 2 --max_fuel 2"
let rec mt_safe_elts_spec #_ h lv hs i j =
if lv = merkle_tree_size_lg then ()
else mt_safe_elts_spec h (lv + 1ul) hs (i / 2ul) (j / 2ul)
#pop-options
val merkle_tree_lift:
h:HS.mem ->
mtv:merkle_tree{
RV.rv_inv h (MT?.hs mtv) /\
RV.rv_inv h (MT?.rhs mtv) /\
Rgl?.r_inv (hreg (MT?.hash_size mtv)) h (MT?.mroot mtv) /\
mt_safe_elts #(MT?.hash_size mtv) h 0ul (MT?.hs mtv) (MT?.i mtv) (MT?.j mtv)} ->
GTot (r:MTH.merkle_tree #(U32.v (MT?.hash_size mtv)) {MTH.mt_wf_elts #_ r})
let merkle_tree_lift h mtv =
mt_safe_elts_spec h 0ul (MT?.hs mtv) (MT?.i mtv) (MT?.j mtv);
MTH.MT #(U32.v (MT?.hash_size mtv))
(U32.v (MT?.i mtv))
(U32.v (MT?.j mtv))
(RV.as_seq h (MT?.hs mtv))
(MT?.rhs_ok mtv)
(RV.as_seq h (MT?.rhs mtv))
(Rgl?.r_repr (hreg (MT?.hash_size mtv)) h (MT?.mroot mtv))
(Ghost.reveal (MT?.hash_spec mtv))
val mt_lift:
h:HS.mem -> mt:mt_p{mt_safe h mt} ->
GTot (r:MTH.merkle_tree #(U32.v (MT?.hash_size (B.get h mt 0))) {MTH.mt_wf_elts #_ r})
let mt_lift h mt =
merkle_tree_lift h (B.get h mt 0)
val mt_preserved:
mt:mt_p -> p:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma (requires (mt_safe h0 mt /\
loc_disjoint p (mt_loc mt) /\
modifies p h0 h1))
(ensures (mt_safe_preserved mt p h0 h1;
mt_lift h0 mt == mt_lift h1 mt))
let mt_preserved mt p h0 h1 =
assert (loc_includes (B.loc_all_regions_from false (B.frameOf mt))
(B.loc_buffer mt));
B.modifies_buffer_elim mt p h0 h1;
assert (B.get h0 mt 0 == B.get h1 mt 0);
assert (loc_includes (B.loc_all_regions_from false (B.frameOf mt))
(RV.loc_rvector (MT?.hs (B.get h0 mt 0))));
assert (loc_includes (B.loc_all_regions_from false (B.frameOf mt))
(RV.loc_rvector (MT?.rhs (B.get h0 mt 0))));
assert (loc_includes (B.loc_all_regions_from false (B.frameOf mt))
(B.loc_buffer (MT?.mroot (B.get h0 mt 0))));
RV.as_seq_preserved (MT?.hs (B.get h0 mt 0)) p h0 h1;
RV.as_seq_preserved (MT?.rhs (B.get h0 mt 0)) p h0 h1;
B.modifies_buffer_elim (MT?.mroot (B.get h0 mt 0)) p h0 h1
/// Construction
// Note that the public function for creation is `mt_create` defined below,
// which builds a tree with an initial hash.
#push-options "--z3rlimit 100 --initial_fuel 1 --max_fuel 1 --initial_ifuel 1 --max_ifuel 1"
private
val create_empty_mt:
hash_size:hash_size_t ->
hash_spec:Ghost.erased (MTS.hash_fun_t #(U32.v hash_size)) ->
hash_fun:hash_fun_t #hash_size #hash_spec ->
r:HST.erid ->
HST.ST mt_p
(requires (fun _ -> true))
(ensures (fun h0 mt h1 ->
let dmt = B.get h1 mt 0 in
// memory safety
B.frameOf mt = r /\
modifies (mt_loc mt) h0 h1 /\
mt_safe h1 mt /\
mt_not_full h1 mt /\
// correctness
MT?.hash_size dmt = hash_size /\
MT?.offset dmt = 0UL /\
merkle_tree_lift h1 dmt == MTH.create_empty_mt #_ #(Ghost.reveal hash_spec) ()))
let create_empty_mt hsz hash_spec hash_fun r =
[@inline_let] let hrg = hreg hsz in
[@inline_let] let hvrg = hvreg hsz in
[@inline_let] let hvvrg = hvvreg hsz in
let hs_region = HST.new_region r in
let hs = RV.alloc_rid hvrg merkle_tree_size_lg hs_region in
let h0 = HST.get () in
mt_safe_elts_init #hsz h0 0ul hs;
let rhs_region = HST.new_region r in
let rhs = RV.alloc_rid hrg merkle_tree_size_lg rhs_region in
let h1 = HST.get () in
assert (RV.as_seq h1 rhs == S.create 32 (MTH.hash_init #(U32.v hsz)));
RV.rv_inv_preserved hs (V.loc_vector rhs) h0 h1;
RV.as_seq_preserved hs (V.loc_vector rhs) h0 h1;
V.loc_vector_within_included hs 0ul (V.size_of hs);
mt_safe_elts_preserved #hsz 0ul hs 0ul 0ul (V.loc_vector rhs) h0 h1;
let mroot_region = HST.new_region r in
let mroot = rg_alloc hrg mroot_region in
let h2 = HST.get () in
RV.as_seq_preserved hs loc_none h1 h2;
RV.as_seq_preserved rhs loc_none h1 h2;
mt_safe_elts_preserved #hsz 0ul hs 0ul 0ul loc_none h1 h2;
let mt = B.malloc r (MT hsz 0UL 0ul 0ul hs false rhs mroot hash_spec hash_fun) 1ul in
let h3 = HST.get () in
RV.as_seq_preserved hs loc_none h2 h3;
RV.as_seq_preserved rhs loc_none h2 h3;
Rgl?.r_sep hrg mroot loc_none h2 h3;
mt_safe_elts_preserved #hsz 0ul hs 0ul 0ul loc_none h2 h3;
mt
#pop-options
/// Destruction (free)
val mt_free: mt:mt_p ->
HST.ST unit
(requires (fun h0 -> mt_safe h0 mt))
(ensures (fun h0 _ h1 -> modifies (mt_loc mt) h0 h1))
#push-options "--z3rlimit 100"
let mt_free mt =
let mtv = !*mt in
RV.free (MT?.hs mtv);
RV.free (MT?.rhs mtv);
[@inline_let] let rg = hreg (MT?.hash_size mtv) in
rg_free rg (MT?.mroot mtv);
B.free mt
#pop-options
/// Insertion
private
val as_seq_sub_upd:
#a:Type0 -> #rst:Type -> #rg:regional rst a ->
h:HS.mem -> rv:rvector #a #rst rg ->
i:uint32_t{i < V.size_of rv} -> v:Rgl?.repr rg ->
Lemma (requires (RV.rv_inv h rv))
(ensures (S.equal (S.upd (RV.as_seq h rv) (U32.v i) v)
(S.append
(RV.as_seq_sub h rv 0ul i)
(S.cons v (RV.as_seq_sub h rv (i + 1ul) (V.size_of rv))))))
#push-options "--z3rlimit 20"
let as_seq_sub_upd #a #rst #rg h rv i v =
Seq.Properties.slice_upd (RV.as_seq h rv) 0 (U32.v i) (U32.v i) v;
Seq.Properties.slice_upd (RV.as_seq h rv) (U32.v i + 1) (U32.v (V.size_of rv)) (U32.v i) v;
RV.as_seq_seq_slice rg h (V.as_seq h rv)
0 (U32.v (V.size_of rv)) 0 (U32.v i);
assert (S.equal (S.slice (RV.as_seq h rv) 0 (U32.v i))
(RV.as_seq_sub h rv 0ul i));
RV.as_seq_seq_slice rg h (V.as_seq h rv)
0 (U32.v (V.size_of rv)) (U32.v i + 1) (U32.v (V.size_of rv));
assert (S.equal (S.slice (RV.as_seq h rv) (U32.v i + 1) (U32.v (V.size_of rv)))
(RV.as_seq_sub h rv (i + 1ul) (V.size_of rv)));
assert (S.index (S.upd (RV.as_seq h rv) (U32.v i) v) (U32.v i) == v)
#pop-options
// `hash_vv_insert_copy` inserts a hash element at a level `lv`, by copying
// and pushing its content to `hs[lv]`. For detailed insertion procedure, see
// `insert_` and `mt_insert`.
#push-options "--z3rlimit 100 --initial_fuel 1 --max_fuel 1"
private
inline_for_extraction
val hash_vv_insert_copy:
#hsz:hash_size_t ->
lv:uint32_t{lv < merkle_tree_size_lg} ->
i:Ghost.erased index_t ->
j:index_t{
Ghost.reveal i <= j &&
U32.v j < pow2 (32 - U32.v lv) - 1 &&
j < uint32_32_max} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
v:hash #hsz ->
HST.ST unit
(requires (fun h0 ->
RV.rv_inv h0 hs /\
Rgl?.r_inv (hreg hsz) h0 v /\
HH.disjoint (V.frameOf hs) (B.frameOf v) /\
mt_safe_elts #hsz h0 lv hs (Ghost.reveal i) j))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq h0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
h0 h1 /\
RV.rv_inv h1 hs /\
Rgl?.r_inv (hreg hsz) h1 v /\
V.size_of (V.get h1 hs lv) == j + 1ul - offset_of (Ghost.reveal i) /\
V.size_of (V.get h1 hs lv) == V.size_of (V.get h0 hs lv) + 1ul /\
mt_safe_elts #hsz h1 (lv + 1ul) hs (Ghost.reveal i / 2ul) (j / 2ul) /\
RV.rv_loc_elems h0 hs (lv + 1ul) (V.size_of hs) ==
RV.rv_loc_elems h1 hs (lv + 1ul) (V.size_of hs) /\
// correctness
(mt_safe_elts_spec #hsz h0 lv hs (Ghost.reveal i) j;
S.equal (RV.as_seq h1 hs)
(MTH.hashess_insert
(U32.v lv) (U32.v (Ghost.reveal i)) (U32.v j)
(RV.as_seq h0 hs) (Rgl?.r_repr (hreg hsz) h0 v))) /\
S.equal (S.index (RV.as_seq h1 hs) (U32.v lv))
(S.snoc (S.index (RV.as_seq h0 hs) (U32.v lv))
(Rgl?.r_repr (hreg hsz) h0 v))))
let hash_vv_insert_copy #hsz lv i j hs v =
let hh0 = HST.get () in
mt_safe_elts_rec hh0 lv hs (Ghost.reveal i) j;
/// 1) Insert an element at the level `lv`, where the new vector is not yet
/// connected to `hs`.
let ihv = RV.insert_copy (hcpy hsz) (V.index hs lv) v in
let hh1 = HST.get () in
// 1-0) Basic disjointness conditions
V.forall2_forall_left hh0 hs 0ul (V.size_of hs) lv
(fun b1 b2 -> HH.disjoint (Rgl?.region_of (hvreg hsz) b1)
(Rgl?.region_of (hvreg hsz) b2));
V.forall2_forall_right hh0 hs 0ul (V.size_of hs) lv
(fun b1 b2 -> HH.disjoint (Rgl?.region_of (hvreg hsz) b1)
(Rgl?.region_of (hvreg hsz) b2));
V.loc_vector_within_included hs lv (lv + 1ul);
V.loc_vector_within_included hs (lv + 1ul) (V.size_of hs);
V.loc_vector_within_disjoint hs lv (lv + 1ul) (lv + 1ul) (V.size_of hs);
// 1-1) For the `modifies` postcondition.
assert (modifies (RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv)) hh0 hh1);
// 1-2) Preservation
Rgl?.r_sep (hreg hsz) v (RV.loc_rvector (V.get hh0 hs lv)) hh0 hh1;
RV.rv_loc_elems_preserved
hs (lv + 1ul) (V.size_of hs)
(RV.loc_rvector (V.get hh0 hs lv)) hh0 hh1;
// 1-3) For `mt_safe_elts`
assert (V.size_of ihv == j + 1ul - offset_of (Ghost.reveal i)); // head updated
mt_safe_elts_preserved
(lv + 1ul) hs (Ghost.reveal i / 2ul) (j / 2ul)
(RV.loc_rvector (V.get hh0 hs lv)) hh0 hh1; // tail not yet
// 1-4) For the `rv_inv` postcondition
RV.rs_loc_elems_elem_disj
(hvreg hsz) (V.as_seq hh0 hs) (V.frameOf hs)
0 (U32.v (V.size_of hs)) 0 (U32.v lv) (U32.v lv);
RV.rs_loc_elems_parent_disj
(hvreg hsz) (V.as_seq hh0 hs) (V.frameOf hs)
0 (U32.v lv);
RV.rv_elems_inv_preserved
hs 0ul lv (RV.loc_rvector (V.get hh0 hs lv))
hh0 hh1;
assert (RV.rv_elems_inv hh1 hs 0ul lv);
RV.rs_loc_elems_elem_disj
(hvreg hsz) (V.as_seq hh0 hs) (V.frameOf hs)
0 (U32.v (V.size_of hs))
(U32.v lv + 1) (U32.v (V.size_of hs))
(U32.v lv);
RV.rs_loc_elems_parent_disj
(hvreg hsz) (V.as_seq hh0 hs) (V.frameOf hs)
(U32.v lv + 1) (U32.v (V.size_of hs));
RV.rv_elems_inv_preserved
hs (lv + 1ul) (V.size_of hs) (RV.loc_rvector (V.get hh0 hs lv))
hh0 hh1;
assert (RV.rv_elems_inv hh1 hs (lv + 1ul) (V.size_of hs));
// assert (rv_itself_inv hh1 hs);
// assert (elems_reg hh1 hs);
// 1-5) Correctness
assert (S.equal (RV.as_seq hh1 ihv)
(S.snoc (RV.as_seq hh0 (V.get hh0 hs lv)) (Rgl?.r_repr (hreg hsz) hh0 v)));
/// 2) Assign the updated vector to `hs` at the level `lv`.
RV.assign hs lv ihv;
let hh2 = HST.get () in
// 2-1) For the `modifies` postcondition.
assert (modifies (V.loc_vector_within hs lv (lv + 1ul)) hh1 hh2);
assert (modifies (loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul))) hh0 hh2);
// 2-2) Preservation
Rgl?.r_sep (hreg hsz) v (RV.loc_rvector hs) hh1 hh2;
RV.rv_loc_elems_preserved
hs (lv + 1ul) (V.size_of hs)
(V.loc_vector_within hs lv (lv + 1ul)) hh1 hh2;
// 2-3) For `mt_safe_elts`
assert (V.size_of (V.get hh2 hs lv) == j + 1ul - offset_of (Ghost.reveal i));
mt_safe_elts_preserved
(lv + 1ul) hs (Ghost.reveal i / 2ul) (j / 2ul)
(V.loc_vector_within hs lv (lv + 1ul)) hh1 hh2;
// 2-4) Correctness
RV.as_seq_sub_preserved hs 0ul lv (loc_rvector ihv) hh0 hh1;
RV.as_seq_sub_preserved hs (lv + 1ul) merkle_tree_size_lg (loc_rvector ihv) hh0 hh1;
assert (S.equal (RV.as_seq hh2 hs)
(S.append
(RV.as_seq_sub hh0 hs 0ul lv)
(S.cons (RV.as_seq hh1 ihv)
(RV.as_seq_sub hh0 hs (lv + 1ul) merkle_tree_size_lg))));
as_seq_sub_upd hh0 hs lv (RV.as_seq hh1 ihv)
#pop-options
private
val insert_index_helper_even:
lv:uint32_t{lv < merkle_tree_size_lg} ->
j:index_t{U32.v j < pow2 (32 - U32.v lv) - 1} ->
Lemma (requires (j % 2ul <> 1ul))
(ensures (U32.v j % 2 <> 1 /\ j / 2ul == (j + 1ul) / 2ul))
let insert_index_helper_even lv j = ()
#push-options "--z3rlimit 100 --initial_fuel 1 --max_fuel 1 --initial_ifuel 1 --max_ifuel 1"
private
val insert_index_helper_odd:
lv:uint32_t{lv < merkle_tree_size_lg} ->
i:index_t ->
j:index_t{i <= j && U32.v j < pow2 (32 - U32.v lv) - 1} ->
Lemma (requires (j % 2ul = 1ul /\
j < uint32_32_max))
(ensures (U32.v j % 2 = 1 /\
U32.v (j / 2ul) < pow2 (32 - U32.v (lv + 1ul)) - 1 /\
(j + 1ul) / 2ul == j / 2ul + 1ul /\
j - offset_of i > 0ul))
let insert_index_helper_odd lv i j = ()
#pop-options
private
val loc_union_assoc_4:
a:loc -> b:loc -> c:loc -> d:loc ->
Lemma (loc_union (loc_union a b) (loc_union c d) ==
loc_union (loc_union a c) (loc_union b d))
let loc_union_assoc_4 a b c d =
loc_union_assoc (loc_union a b) c d;
loc_union_assoc a b c;
loc_union_assoc a c b;
loc_union_assoc (loc_union a c) b d
private
val insert_modifies_rec_helper:
#hsz:hash_size_t ->
lv:uint32_t{lv < merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
aloc:loc ->
h:HS.mem ->
Lemma (loc_union
(loc_union
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq h hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
aloc)
(loc_union
(loc_union
(RV.rv_loc_elems h hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)))
aloc) ==
loc_union
(loc_union
(RV.rv_loc_elems h hs lv (V.size_of hs))
(V.loc_vector_within hs lv (V.size_of hs)))
aloc)
#push-options "--z3rlimit 100 --initial_fuel 2 --max_fuel 2"
let insert_modifies_rec_helper #hsz lv hs aloc h =
assert (V.loc_vector_within hs lv (V.size_of hs) ==
loc_union (V.loc_vector_within hs lv (lv + 1ul))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)));
RV.rs_loc_elems_rec_inverse (hvreg hsz) (V.as_seq h hs) (U32.v lv) (U32.v (V.size_of hs));
assert (RV.rv_loc_elems h hs lv (V.size_of hs) ==
loc_union (RV.rs_loc_elem (hvreg hsz) (V.as_seq h hs) (U32.v lv))
(RV.rv_loc_elems h hs (lv + 1ul) (V.size_of hs)));
// Applying some association rules...
loc_union_assoc
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq h hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul))) aloc
(loc_union
(loc_union
(RV.rv_loc_elems h hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)))
aloc);
loc_union_assoc
(loc_union
(RV.rv_loc_elems h hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs))) aloc aloc;
loc_union_assoc
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq h hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
(loc_union
(RV.rv_loc_elems h hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)))
aloc;
loc_union_assoc_4
(RV.rs_loc_elem (hvreg hsz) (V.as_seq h hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul))
(RV.rv_loc_elems h hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs))
#pop-options
private
val insert_modifies_union_loc_weakening:
l1:loc -> l2:loc -> l3:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma (requires (modifies l1 h0 h1))
(ensures (modifies (loc_union (loc_union l1 l2) l3) h0 h1))
let insert_modifies_union_loc_weakening l1 l2 l3 h0 h1 =
B.loc_includes_union_l l1 l2 l1;
B.loc_includes_union_l (loc_union l1 l2) l3 (loc_union l1 l2)
private
val insert_snoc_last_helper:
#a:Type -> s:S.seq a{S.length s > 0} -> v:a ->
Lemma (S.index (S.snoc s v) (S.length s - 1) == S.last s)
let insert_snoc_last_helper #a s v = ()
private
val rv_inv_rv_elems_reg:
#a:Type0 -> #rst:Type -> #rg:regional rst a ->
h:HS.mem -> rv:rvector rg ->
i:uint32_t -> j:uint32_t{i <= j && j <= V.size_of rv} ->
Lemma (requires (RV.rv_inv h rv))
(ensures (RV.rv_elems_reg h rv i j))
let rv_inv_rv_elems_reg #a #rst #rg h rv i j = ()
// `insert_` recursively inserts proper hashes to each level `lv` by
// accumulating a compressed hash. For example, if there are three leaf elements
// in the tree, `insert_` will change `hs` as follow:
// (`hij` is a compressed hash from `hi` to `hj`)
//
// BEFORE INSERTION AFTER INSERTION
// lv
// 0 h0 h1 h2 ====> h0 h1 h2 h3
// 1 h01 h01 h23
// 2 h03
//
private
val insert_:
#hsz:hash_size_t ->
#hash_spec:Ghost.erased (MTS.hash_fun_t #(U32.v hsz)) ->
lv:uint32_t{lv < merkle_tree_size_lg} ->
i:Ghost.erased index_t ->
j:index_t{
Ghost.reveal i <= j &&
U32.v j < pow2 (32 - U32.v lv) - 1 &&
j < uint32_32_max} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
acc:hash #hsz ->
hash_fun:hash_fun_t #hsz #hash_spec ->
HST.ST unit
(requires (fun h0 ->
RV.rv_inv h0 hs /\
Rgl?.r_inv (hreg hsz) h0 acc /\
HH.disjoint (V.frameOf hs) (B.frameOf acc) /\
mt_safe_elts h0 lv hs (Ghost.reveal i) j))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (loc_union
(loc_union
(RV.rv_loc_elems h0 hs lv (V.size_of hs))
(V.loc_vector_within hs lv (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf acc)))
h0 h1 /\
RV.rv_inv h1 hs /\
Rgl?.r_inv (hreg hsz) h1 acc /\
mt_safe_elts h1 lv hs (Ghost.reveal i) (j + 1ul) /\
// correctness
(mt_safe_elts_spec h0 lv hs (Ghost.reveal i) j;
S.equal (RV.as_seq h1 hs)
(MTH.insert_ #(U32.v hsz) #hash_spec (U32.v lv) (U32.v (Ghost.reveal i)) (U32.v j)
(RV.as_seq h0 hs) (Rgl?.r_repr (hreg hsz) h0 acc)))))
(decreases (U32.v j))
#push-options "--z3rlimit 800 --initial_fuel 1 --max_fuel 1 --initial_ifuel 1 --max_ifuel 1"
let rec insert_ #hsz #hash_spec lv i j hs acc hash_fun =
let hh0 = HST.get () in
hash_vv_insert_copy lv i j hs acc;
let hh1 = HST.get () in
// Base conditions
V.loc_vector_within_included hs lv (lv + 1ul);
V.loc_vector_within_included hs (lv + 1ul) (V.size_of hs);
V.loc_vector_within_disjoint hs lv (lv + 1ul) (lv + 1ul) (V.size_of hs);
assert (V.size_of (V.get hh1 hs lv) == j + 1ul - offset_of (Ghost.reveal i));
assert (mt_safe_elts hh1 (lv + 1ul) hs (Ghost.reveal i / 2ul) (j / 2ul));
if j % 2ul = 1ul
then (insert_index_helper_odd lv (Ghost.reveal i) j;
assert (S.length (S.index (RV.as_seq hh0 hs) (U32.v lv)) > 0);
let lvhs = V.index hs lv in
assert (U32.v (V.size_of lvhs) ==
S.length (S.index (RV.as_seq hh0 hs) (U32.v lv)) + 1);
assert (V.size_of lvhs > 1ul);
/// 3) Update the accumulator `acc`.
hash_vec_rv_inv_r_inv hh1 (V.get hh1 hs lv) (V.size_of (V.get hh1 hs lv) - 2ul);
assert (Rgl?.r_inv (hreg hsz) hh1 acc);
hash_fun (V.index lvhs (V.size_of lvhs - 2ul)) acc acc;
let hh2 = HST.get () in
// 3-1) For the `modifies` postcondition
assert (modifies (B.loc_all_regions_from false (B.frameOf acc)) hh1 hh2);
assert (modifies
(loc_union
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
(B.loc_all_regions_from false (B.frameOf acc)))
hh0 hh2);
// 3-2) Preservation
RV.rv_inv_preserved
hs (B.loc_region_only false (B.frameOf acc)) hh1 hh2;
RV.as_seq_preserved
hs (B.loc_region_only false (B.frameOf acc)) hh1 hh2;
RV.rv_loc_elems_preserved
hs (lv + 1ul) (V.size_of hs)
(B.loc_region_only false (B.frameOf acc)) hh1 hh2;
assert (RV.rv_inv hh2 hs);
assert (Rgl?.r_inv (hreg hsz) hh2 acc);
// 3-3) For `mt_safe_elts`
V.get_preserved hs lv
(B.loc_region_only false (B.frameOf acc)) hh1 hh2; // head preserved
mt_safe_elts_preserved
(lv + 1ul) hs (Ghost.reveal i / 2ul) (j / 2ul)
(B.loc_region_only false (B.frameOf acc)) hh1 hh2; // tail preserved
// 3-4) Correctness
insert_snoc_last_helper
(RV.as_seq hh0 (V.get hh0 hs lv))
(Rgl?.r_repr (hreg hsz) hh0 acc);
assert (S.equal (Rgl?.r_repr (hreg hsz) hh2 acc) // `nacc` in `MTH.insert_`
((Ghost.reveal hash_spec)
(S.last (S.index (RV.as_seq hh0 hs) (U32.v lv)))
(Rgl?.r_repr (hreg hsz) hh0 acc)));
/// 4) Recursion
insert_ (lv + 1ul)
(Ghost.hide (Ghost.reveal i / 2ul)) (j / 2ul)
hs acc hash_fun;
let hh3 = HST.get () in
// 4-0) Memory safety brought from the postcondition of the recursion
assert (RV.rv_inv hh3 hs);
assert (Rgl?.r_inv (hreg hsz) hh3 acc);
assert (modifies (loc_union
(loc_union
(RV.rv_loc_elems hh0 hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf acc)))
hh2 hh3);
assert (modifies
(loc_union
(loc_union
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
(B.loc_all_regions_from false (B.frameOf acc)))
(loc_union
(loc_union
(RV.rv_loc_elems hh0 hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf acc))))
hh0 hh3);
// 4-1) For `mt_safe_elts`
rv_inv_rv_elems_reg hh2 hs (lv + 1ul) (V.size_of hs);
RV.rv_loc_elems_included hh2 hs (lv + 1ul) (V.size_of hs);
assert (loc_disjoint
(V.loc_vector_within hs lv (lv + 1ul))
(RV.rv_loc_elems hh2 hs (lv + 1ul) (V.size_of hs)));
assert (loc_disjoint
(V.loc_vector_within hs lv (lv + 1ul))
(B.loc_all_regions_from false (B.frameOf acc)));
V.get_preserved hs lv
(loc_union
(loc_union
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs))
(RV.rv_loc_elems hh2 hs (lv + 1ul) (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf acc)))
hh2 hh3;
assert (V.size_of (V.get hh3 hs lv) ==
j + 1ul - offset_of (Ghost.reveal i)); // head preserved
assert (mt_safe_elts hh3 (lv + 1ul) hs
(Ghost.reveal i / 2ul) (j / 2ul + 1ul)); // tail by recursion
mt_safe_elts_constr hh3 lv hs (Ghost.reveal i) (j + 1ul);
assert (mt_safe_elts hh3 lv hs (Ghost.reveal i) (j + 1ul));
// 4-2) Correctness
mt_safe_elts_spec hh2 (lv + 1ul) hs (Ghost.reveal i / 2ul) (j / 2ul);
assert (S.equal (RV.as_seq hh3 hs)
(MTH.insert_ #(U32.v hsz) #(Ghost.reveal hash_spec) (U32.v lv + 1) (U32.v (Ghost.reveal i) / 2) (U32.v j / 2)
(RV.as_seq hh2 hs) (Rgl?.r_repr (hreg hsz) hh2 acc)));
mt_safe_elts_spec hh0 lv hs (Ghost.reveal i) j;
MTH.insert_rec #(U32.v hsz) #(Ghost.reveal hash_spec) (U32.v lv) (U32.v (Ghost.reveal i)) (U32.v j)
(RV.as_seq hh0 hs) (Rgl?.r_repr (hreg hsz) hh0 acc);
assert (S.equal (RV.as_seq hh3 hs)
(MTH.insert_ #(U32.v hsz) #(Ghost.reveal hash_spec) (U32.v lv) (U32.v (Ghost.reveal i)) (U32.v j)
(RV.as_seq hh0 hs) (Rgl?.r_repr (hreg hsz) hh0 acc))))
else (insert_index_helper_even lv j;
// memory safety
assert (mt_safe_elts hh1 (lv + 1ul) hs (Ghost.reveal i / 2ul) ((j + 1ul) / 2ul));
mt_safe_elts_constr hh1 lv hs (Ghost.reveal i) (j + 1ul);
assert (mt_safe_elts hh1 lv hs (Ghost.reveal i) (j + 1ul));
assert (modifies
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
hh0 hh1);
insert_modifies_union_loc_weakening
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
(B.loc_all_regions_from false (B.frameOf acc))
(loc_union
(loc_union
(RV.rv_loc_elems hh0 hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf acc)))
hh0 hh1;
// correctness
mt_safe_elts_spec hh0 lv hs (Ghost.reveal i) j;
MTH.insert_base #(U32.v hsz) #(Ghost.reveal hash_spec) (U32.v lv) (U32.v (Ghost.reveal i)) (U32.v j)
(RV.as_seq hh0 hs) (Rgl?.r_repr (hreg hsz) hh0 acc);
assert (S.equal (RV.as_seq hh1 hs)
(MTH.insert_ #(U32.v hsz) #(Ghost.reveal hash_spec) (U32.v lv) (U32.v (Ghost.reveal i)) (U32.v j)
(RV.as_seq hh0 hs) (Rgl?.r_repr (hreg hsz) hh0 acc))));
/// 5) Proving the postcondition after recursion
let hh4 = HST.get () in
// 5-1) For the `modifies` postcondition.
assert (modifies
(loc_union
(loc_union
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
(B.loc_all_regions_from false (B.frameOf acc)))
(loc_union
(loc_union
(RV.rv_loc_elems hh0 hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf acc))))
hh0 hh4);
insert_modifies_rec_helper
lv hs (B.loc_all_regions_from false (B.frameOf acc)) hh0;
// 5-2) For `mt_safe_elts`
assert (mt_safe_elts hh4 lv hs (Ghost.reveal i) (j + 1ul));
// 5-3) Preservation
assert (RV.rv_inv hh4 hs);
assert (Rgl?.r_inv (hreg hsz) hh4 acc);
// 5-4) Correctness
mt_safe_elts_spec hh0 lv hs (Ghost.reveal i) j;
assert (S.equal (RV.as_seq hh4 hs)
(MTH.insert_ #(U32.v hsz) #hash_spec (U32.v lv) (U32.v (Ghost.reveal i)) (U32.v j)
(RV.as_seq hh0 hs) (Rgl?.r_repr (hreg hsz) hh0 acc))) // QED
#pop-options
private inline_for_extraction
val mt_insert_pre_nst: mtv:merkle_tree -> v:hash #(MT?.hash_size mtv) -> Tot bool
let mt_insert_pre_nst mtv v = mt_not_full_nst mtv && add64_fits (MT?.offset mtv) ((MT?.j mtv) + 1ul)
val mt_insert_pre: #hsz:Ghost.erased hash_size_t -> mt:const_mt_p -> v:hash #hsz -> HST.ST bool
(requires (fun h0 -> mt_safe h0 (CB.cast mt) /\ (MT?.hash_size (B.get h0 (CB.cast mt) 0)) = Ghost.reveal hsz))
(ensures (fun _ _ _ -> True))
let mt_insert_pre #hsz mt v =
let mt = !*(CB.cast mt) in
assert (MT?.hash_size mt == (MT?.hash_size mt));
mt_insert_pre_nst mt v
// `mt_insert` inserts a hash to a Merkle tree. Note that this operation
// manipulates the content in `v`, since it uses `v` as an accumulator during
// insertion.
#push-options "--z3rlimit 100 --initial_fuel 1 --max_fuel 1 --initial_ifuel 1 --max_ifuel 1"
val mt_insert:
hsz:Ghost.erased hash_size_t ->
mt:mt_p -> v:hash #hsz ->
HST.ST unit
(requires (fun h0 ->
let dmt = B.get h0 mt 0 in
mt_safe h0 mt /\
Rgl?.r_inv (hreg hsz) h0 v /\
HH.disjoint (B.frameOf mt) (B.frameOf v) /\
MT?.hash_size dmt = Ghost.reveal hsz /\
mt_insert_pre_nst dmt v))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (loc_union
(mt_loc mt)
(B.loc_all_regions_from false (B.frameOf v)))
h0 h1 /\
mt_safe h1 mt /\
// correctness
MT?.hash_size (B.get h1 mt 0) = Ghost.reveal hsz /\
mt_lift h1 mt == MTH.mt_insert (mt_lift h0 mt) (Rgl?.r_repr (hreg hsz) h0 v)))
#pop-options
#push-options "--z3rlimit 40"
let mt_insert hsz mt v =
let hh0 = HST.get () in
let mtv = !*mt in
let hs = MT?.hs mtv in
let hsz = MT?.hash_size mtv in
insert_ #hsz #(Ghost.reveal (MT?.hash_spec mtv)) 0ul (Ghost.hide (MT?.i mtv)) (MT?.j mtv) hs v (MT?.hash_fun mtv);
let hh1 = HST.get () in
RV.rv_loc_elems_included hh0 (MT?.hs mtv) 0ul (V.size_of hs);
V.loc_vector_within_included hs 0ul (V.size_of hs);
RV.rv_inv_preserved
(MT?.rhs mtv)
(loc_union
(loc_union
(RV.rv_loc_elems hh0 hs 0ul (V.size_of hs))
(V.loc_vector_within hs 0ul (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf v)))
hh0 hh1;
RV.as_seq_preserved
(MT?.rhs mtv)
(loc_union
(loc_union
(RV.rv_loc_elems hh0 hs 0ul (V.size_of hs))
(V.loc_vector_within hs 0ul (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf v)))
hh0 hh1;
Rgl?.r_sep (hreg hsz) (MT?.mroot mtv)
(loc_union
(loc_union
(RV.rv_loc_elems hh0 hs 0ul (V.size_of hs))
(V.loc_vector_within hs 0ul (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf v)))
hh0 hh1;
mt *= MT (MT?.hash_size mtv)
(MT?.offset mtv)
(MT?.i mtv)
(MT?.j mtv + 1ul)
(MT?.hs mtv)
false // `rhs` is always deprecated right after an insertion.
(MT?.rhs mtv)
(MT?.mroot mtv)
(MT?.hash_spec mtv)
(MT?.hash_fun mtv);
let hh2 = HST.get () in
RV.rv_inv_preserved
(MT?.hs mtv) (B.loc_buffer mt) hh1 hh2;
RV.rv_inv_preserved
(MT?.rhs mtv) (B.loc_buffer mt) hh1 hh2;
RV.as_seq_preserved
(MT?.hs mtv) (B.loc_buffer mt) hh1 hh2;
RV.as_seq_preserved
(MT?.rhs mtv) (B.loc_buffer mt) hh1 hh2;
Rgl?.r_sep (hreg hsz) (MT?.mroot mtv) (B.loc_buffer mt) hh1 hh2;
mt_safe_elts_preserved
0ul (MT?.hs mtv) (MT?.i mtv) (MT?.j mtv + 1ul) (B.loc_buffer mt)
hh1 hh2
#pop-options
// `mt_create` initiates a Merkle tree with a given initial hash `init`.
// A valid Merkle tree should contain at least one element.
val mt_create_custom:
hsz:hash_size_t ->
hash_spec:Ghost.erased (MTS.hash_fun_t #(U32.v hsz)) ->
r:HST.erid -> init:hash #hsz -> hash_fun:hash_fun_t #hsz #hash_spec -> HST.ST mt_p
(requires (fun h0 ->
Rgl?.r_inv (hreg hsz) h0 init /\
HH.disjoint r (B.frameOf init)))
(ensures (fun h0 mt h1 ->
// memory safety
modifies (loc_union (mt_loc mt) (B.loc_all_regions_from false (B.frameOf init))) h0 h1 /\
mt_safe h1 mt /\
// correctness
MT?.hash_size (B.get h1 mt 0) = hsz /\
mt_lift h1 mt == MTH.mt_create (U32.v hsz) (Ghost.reveal hash_spec) (Rgl?.r_repr (hreg hsz) h0 init)))
#push-options "--z3rlimit 40"
let mt_create_custom hsz hash_spec r init hash_fun =
let hh0 = HST.get () in
let mt = create_empty_mt hsz hash_spec hash_fun r in
mt_insert hsz mt init;
let hh2 = HST.get () in
mt
#pop-options
/// Construction and Destruction of paths
// Since each element pointer in `path` is from the target Merkle tree and
// each element has different location in `MT?.hs` (thus different region id),
// we cannot use the regionality property for `path`s. Hence here we manually
// define invariants and representation.
noeq type path =
| Path: hash_size:hash_size_t ->
hashes:V.vector (hash #hash_size) ->
path
type path_p = B.pointer path
type const_path_p = const_pointer path
private
let phashes (h:HS.mem) (p:path_p)
: GTot (V.vector (hash #(Path?.hash_size (B.get h p 0))))
= Path?.hashes (B.get h p 0)
// Memory safety of a path as an invariant
inline_for_extraction noextract
val path_safe:
h:HS.mem -> mtr:HH.rid -> p:path_p -> GTot Type0
let path_safe h mtr p =
B.live h p /\ B.freeable p /\
V.live h (phashes h p) /\ V.freeable (phashes h p) /\
HST.is_eternal_region (V.frameOf (phashes h p)) /\
(let hsz = Path?.hash_size (B.get h p 0) in
V.forall_all h (phashes h p)
(fun hp -> Rgl?.r_inv (hreg hsz) h hp /\
HH.includes mtr (Rgl?.region_of (hreg hsz) hp)) /\
HH.extends (V.frameOf (phashes h p)) (B.frameOf p) /\
HH.disjoint mtr (B.frameOf p))
val path_loc: path_p -> GTot loc
let path_loc p = B.loc_all_regions_from false (B.frameOf p)
val lift_path_:
#hsz:hash_size_t ->
h:HS.mem ->
hs:S.seq (hash #hsz) ->
i:nat ->
j:nat{
i <= j /\ j <= S.length hs /\
V.forall_seq hs i j (fun hp -> Rgl?.r_inv (hreg hsz) h hp)} ->
GTot (hp:MTH.path #(U32.v hsz) {S.length hp = j - i}) (decreases j)
let rec lift_path_ #hsz h hs i j =
if i = j then S.empty
else (S.snoc (lift_path_ h hs i (j - 1))
(Rgl?.r_repr (hreg hsz) h (S.index hs (j - 1))))
// Representation of a path
val lift_path:
#hsz:hash_size_t ->
h:HS.mem -> mtr:HH.rid -> p:path_p {path_safe h mtr p /\ (Path?.hash_size (B.get h p 0)) = hsz} ->
GTot (hp:MTH.path #(U32.v hsz) {S.length hp = U32.v (V.size_of (phashes h p))})
let lift_path #hsz h mtr p =
lift_path_ h (V.as_seq h (phashes h p))
0 (S.length (V.as_seq h (phashes h p)))
val lift_path_index_:
#hsz:hash_size_t ->
h:HS.mem ->
hs:S.seq (hash #hsz) ->
i:nat -> j:nat{i <= j && j <= S.length hs} ->
k:nat{i <= k && k < j} ->
Lemma (requires (V.forall_seq hs i j (fun hp -> Rgl?.r_inv (hreg hsz) h hp)))
(ensures (Rgl?.r_repr (hreg hsz) h (S.index hs k) ==
S.index (lift_path_ h hs i j) (k - i)))
(decreases j)
[SMTPat (S.index (lift_path_ h hs i j) (k - i))]
#push-options "--initial_fuel 1 --max_fuel 1 --initial_ifuel 1 --max_ifuel 1"
let rec lift_path_index_ #hsz h hs i j k =
if i = j then ()
else if k = j - 1 then ()
else lift_path_index_ #hsz h hs i (j - 1) k
#pop-options
val lift_path_index:
h:HS.mem -> mtr:HH.rid ->
p:path_p -> i:uint32_t ->
Lemma (requires (path_safe h mtr p /\
i < V.size_of (phashes h p)))
(ensures (let hsz = Path?.hash_size (B.get h p 0) in
Rgl?.r_repr (hreg hsz) h (V.get h (phashes h p) i) ==
S.index (lift_path #(hsz) h mtr p) (U32.v i)))
let lift_path_index h mtr p i =
lift_path_index_ h (V.as_seq h (phashes h p))
0 (S.length (V.as_seq h (phashes h p))) (U32.v i)
val lift_path_eq:
#hsz:hash_size_t ->
h:HS.mem ->
hs1:S.seq (hash #hsz) -> hs2:S.seq (hash #hsz) ->
i:nat -> j:nat ->
Lemma (requires (i <= j /\ j <= S.length hs1 /\ j <= S.length hs2 /\
S.equal (S.slice hs1 i j) (S.slice hs2 i j) /\
V.forall_seq hs1 i j (fun hp -> Rgl?.r_inv (hreg hsz) h hp) /\
V.forall_seq hs2 i j (fun hp -> Rgl?.r_inv (hreg hsz) h hp)))
(ensures (S.equal (lift_path_ h hs1 i j) (lift_path_ h hs2 i j)))
let lift_path_eq #hsz h hs1 hs2 i j =
assert (forall (k:nat{i <= k && k < j}).
S.index (lift_path_ h hs1 i j) (k - i) ==
Rgl?.r_repr (hreg hsz) h (S.index hs1 k));
assert (forall (k:nat{i <= k && k < j}).
S.index (lift_path_ h hs2 i j) (k - i) ==
Rgl?.r_repr (hreg hsz) h (S.index hs2 k));
assert (forall (k:nat{k < j - i}).
S.index (lift_path_ h hs1 i j) k ==
Rgl?.r_repr (hreg hsz) h (S.index hs1 (k + i)));
assert (forall (k:nat{k < j - i}).
S.index (lift_path_ h hs2 i j) k ==
Rgl?.r_repr (hreg hsz) h (S.index hs2 (k + i)));
assert (forall (k:nat{k < j - i}).
S.index (S.slice hs1 i j) k == S.index (S.slice hs2 i j) k);
assert (forall (k:nat{i <= k && k < j}).
S.index (S.slice hs1 i j) (k - i) == S.index (S.slice hs2 i j) (k - i))
private
val path_safe_preserved_:
#hsz:hash_size_t ->
mtr:HH.rid -> hs:S.seq (hash #hsz) ->
i:nat -> j:nat{i <= j && j <= S.length hs} ->
dl:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma
(requires (V.forall_seq hs i j
(fun hp ->
Rgl?.r_inv (hreg hsz) h0 hp /\
HH.includes mtr (Rgl?.region_of (hreg hsz) hp)) /\
loc_disjoint dl (B.loc_all_regions_from false mtr) /\
modifies dl h0 h1))
(ensures (V.forall_seq hs i j
(fun hp ->
Rgl?.r_inv (hreg hsz) h1 hp /\
HH.includes mtr (Rgl?.region_of (hreg hsz) hp))))
(decreases j)
let rec path_safe_preserved_ #hsz mtr hs i j dl h0 h1 =
if i = j then ()
else (assert (loc_includes
(B.loc_all_regions_from false mtr)
(B.loc_all_regions_from false
(Rgl?.region_of (hreg hsz) (S.index hs (j - 1)))));
Rgl?.r_sep (hreg hsz) (S.index hs (j - 1)) dl h0 h1;
path_safe_preserved_ mtr hs i (j - 1) dl h0 h1)
val path_safe_preserved:
mtr:HH.rid -> p:path_p ->
dl:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma (requires (path_safe h0 mtr p /\
loc_disjoint dl (path_loc p) /\
loc_disjoint dl (B.loc_all_regions_from false mtr) /\
modifies dl h0 h1))
(ensures (path_safe h1 mtr p))
let path_safe_preserved mtr p dl h0 h1 =
assert (loc_includes (path_loc p) (B.loc_buffer p));
assert (loc_includes (path_loc p) (V.loc_vector (phashes h0 p)));
path_safe_preserved_
mtr (V.as_seq h0 (phashes h0 p))
0 (S.length (V.as_seq h0 (phashes h0 p))) dl h0 h1
val path_safe_init_preserved:
mtr:HH.rid -> p:path_p ->
dl:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma (requires (path_safe h0 mtr p /\
V.size_of (phashes h0 p) = 0ul /\
B.loc_disjoint dl (path_loc p) /\
modifies dl h0 h1))
(ensures (path_safe h1 mtr p /\
V.size_of (phashes h1 p) = 0ul))
let path_safe_init_preserved mtr p dl h0 h1 =
assert (loc_includes (path_loc p) (B.loc_buffer p));
assert (loc_includes (path_loc p) (V.loc_vector (phashes h0 p)))
val path_preserved_:
#hsz:hash_size_t ->
mtr:HH.rid ->
hs:S.seq (hash #hsz) ->
i:nat -> j:nat{i <= j && j <= S.length hs} ->
dl:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma (requires (V.forall_seq hs i j
(fun hp -> Rgl?.r_inv (hreg hsz) h0 hp /\
HH.includes mtr (Rgl?.region_of (hreg hsz) hp)) /\
loc_disjoint dl (B.loc_all_regions_from false mtr) /\
modifies dl h0 h1))
(ensures (path_safe_preserved_ mtr hs i j dl h0 h1;
S.equal (lift_path_ h0 hs i j)
(lift_path_ h1 hs i j)))
(decreases j)
#push-options "--initial_fuel 1 --max_fuel 1 --initial_ifuel 1 --max_ifuel 1"
let rec path_preserved_ #hsz mtr hs i j dl h0 h1 =
if i = j then ()
else (path_safe_preserved_ mtr hs i (j - 1) dl h0 h1;
path_preserved_ mtr hs i (j - 1) dl h0 h1;
assert (loc_includes
(B.loc_all_regions_from false mtr)
(B.loc_all_regions_from false
(Rgl?.region_of (hreg hsz) (S.index hs (j - 1)))));
Rgl?.r_sep (hreg hsz) (S.index hs (j - 1)) dl h0 h1)
#pop-options
val path_preserved:
mtr:HH.rid -> p:path_p ->
dl:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma (requires (path_safe h0 mtr p /\
loc_disjoint dl (path_loc p) /\
loc_disjoint dl (B.loc_all_regions_from false mtr) /\
modifies dl h0 h1))
(ensures (path_safe_preserved mtr p dl h0 h1;
let hsz0 = (Path?.hash_size (B.get h0 p 0)) in
let hsz1 = (Path?.hash_size (B.get h1 p 0)) in
let b:MTH.path = lift_path #hsz0 h0 mtr p in
let a:MTH.path = lift_path #hsz1 h1 mtr p in
hsz0 = hsz1 /\ S.equal b a))
let path_preserved mtr p dl h0 h1 =
assert (loc_includes (path_loc p) (B.loc_buffer p));
assert (loc_includes (path_loc p) (V.loc_vector (phashes h0 p)));
path_preserved_ mtr (V.as_seq h0 (phashes h0 p))
0 (S.length (V.as_seq h0 (phashes h0 p)))
dl h0 h1
val init_path:
hsz:hash_size_t ->
mtr:HH.rid -> r:HST.erid ->
HST.ST path_p
(requires (fun h0 -> HH.disjoint mtr r))
(ensures (fun h0 p h1 ->
// memory safety
path_safe h1 mtr p /\
// correctness
Path?.hash_size (B.get h1 p 0) = hsz /\
S.equal (lift_path #hsz h1 mtr p) S.empty))
let init_path hsz mtr r =
let nrid = HST.new_region r in
(B.malloc r (Path hsz (rg_alloc (hvreg hsz) nrid)) 1ul)
val clear_path:
mtr:HH.rid -> p:path_p ->
HST.ST unit
(requires (fun h0 -> path_safe h0 mtr p))
(ensures (fun h0 _ h1 ->
// memory safety
path_safe h1 mtr p /\
// correctness
V.size_of (phashes h1 p) = 0ul /\
S.equal (lift_path #(Path?.hash_size (B.get h1 p 0)) h1 mtr p) S.empty))
let clear_path mtr p =
let pv = !*p in
p *= Path (Path?.hash_size pv) (V.clear (Path?.hashes pv))
val free_path:
p:path_p ->
HST.ST unit
(requires (fun h0 ->
B.live h0 p /\ B.freeable p /\
V.live h0 (phashes h0 p) /\ V.freeable (phashes h0 p) /\
HH.extends (V.frameOf (phashes h0 p)) (B.frameOf p)))
(ensures (fun h0 _ h1 ->
modifies (path_loc p) h0 h1))
let free_path p =
let pv = !*p in
V.free (Path?.hashes pv);
B.free p
/// Getting the Merkle root and path
// Construct "rightmost hashes" for a given (incomplete) Merkle tree.
// This function calculates the Merkle root as well, which is the final
// accumulator value.
private
val construct_rhs:
#hsz:hash_size_t ->
#hash_spec:Ghost.erased (MTS.hash_fun_t #(U32.v hsz)) ->
lv:uint32_t{lv <= merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
rhs:hash_vec #hsz {V.size_of rhs = merkle_tree_size_lg} ->
i:index_t ->
j:index_t{i <= j && (U32.v j) < pow2 (32 - U32.v lv)} ->
acc:hash #hsz ->
actd:bool ->
hash_fun:hash_fun_t #hsz #(Ghost.reveal hash_spec) ->
HST.ST unit
(requires (fun h0 ->
RV.rv_inv h0 hs /\ RV.rv_inv h0 rhs /\
HH.disjoint (V.frameOf hs) (V.frameOf rhs) /\
Rgl?.r_inv (hreg hsz) h0 acc /\
HH.disjoint (B.frameOf acc) (V.frameOf hs) /\
HH.disjoint (B.frameOf acc) (V.frameOf rhs) /\
mt_safe_elts #hsz h0 lv hs i j))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (loc_union
(RV.loc_rvector rhs)
(B.loc_all_regions_from false (B.frameOf acc)))
h0 h1 /\
RV.rv_inv h1 rhs /\
Rgl?.r_inv (hreg hsz) h1 acc /\
// correctness
(mt_safe_elts_spec #hsz h0 lv hs i j;
MTH.construct_rhs #(U32.v hsz) #(Ghost.reveal hash_spec)
(U32.v lv)
(Rgl?.r_repr (hvvreg hsz) h0 hs)
(Rgl?.r_repr (hvreg hsz) h0 rhs)
(U32.v i) (U32.v j)
(Rgl?.r_repr (hreg hsz) h0 acc) actd ==
(Rgl?.r_repr (hvreg hsz) h1 rhs, Rgl?.r_repr (hreg hsz) h1 acc)
)))
(decreases (U32.v j))
#push-options "--z3rlimit 250 --initial_fuel 1 --max_fuel 1 --initial_ifuel 1 --max_ifuel 1"
let rec construct_rhs #hsz #hash_spec lv hs rhs i j acc actd hash_fun =
let hh0 = HST.get () in
if j = 0ul then begin
assert (RV.rv_inv hh0 hs);
assert (mt_safe_elts #hsz hh0 lv hs i j);
mt_safe_elts_spec #hsz hh0 lv hs 0ul 0ul;
assert (MTH.hs_wf_elts #(U32.v hsz)
(U32.v lv) (RV.as_seq hh0 hs)
(U32.v i) (U32.v j));
let hh1 = HST.get() in
assert (MTH.construct_rhs #(U32.v hsz) #(Ghost.reveal hash_spec)
(U32.v lv)
(Rgl?.r_repr (hvvreg hsz) hh0 hs)
(Rgl?.r_repr (hvreg hsz) hh0 rhs)
(U32.v i) (U32.v j)
(Rgl?.r_repr (hreg hsz) hh0 acc) actd ==
(Rgl?.r_repr (hvreg hsz) hh1 rhs, Rgl?.r_repr (hreg hsz) hh1 acc))
end
else
let ofs = offset_of i in
begin
(if j % 2ul = 0ul
then begin
Math.Lemmas.pow2_double_mult (32 - U32.v lv - 1);
mt_safe_elts_rec #hsz hh0 lv hs i j;
construct_rhs #hsz #hash_spec (lv + 1ul) hs rhs (i / 2ul) (j / 2ul) acc actd hash_fun;
let hh1 = HST.get () in
// correctness
mt_safe_elts_spec #hsz hh0 lv hs i j;
MTH.construct_rhs_even #(U32.v hsz) #hash_spec
(U32.v lv) (Rgl?.r_repr (hvvreg hsz) hh0 hs) (Rgl?.r_repr (hvreg hsz) hh0 rhs)
(U32.v i) (U32.v j) (Rgl?.r_repr (hreg hsz) hh0 acc) actd;
assert (MTH.construct_rhs #(U32.v hsz) #hash_spec
(U32.v lv)
(Rgl?.r_repr (hvvreg hsz) hh0 hs)
(Rgl?.r_repr (hvreg hsz) hh0 rhs)
(U32.v i) (U32.v j)
(Rgl?.r_repr (hreg hsz) hh0 acc)
actd ==
(Rgl?.r_repr (hvreg hsz) hh1 rhs, Rgl?.r_repr (hreg hsz) hh1 acc))
end
else begin
if actd
then begin
RV.assign_copy (hcpy hsz) rhs lv acc;
let hh1 = HST.get () in
// memory safety
Rgl?.r_sep (hreg hsz) acc
(B.loc_all_regions_from false (V.frameOf rhs)) hh0 hh1;
RV.rv_inv_preserved
hs (B.loc_all_regions_from false (V.frameOf rhs))
hh0 hh1;
RV.as_seq_preserved
hs (B.loc_all_regions_from false (V.frameOf rhs))
hh0 hh1;
RV.rv_inv_preserved
(V.get hh0 hs lv) (B.loc_all_regions_from false (V.frameOf rhs))
hh0 hh1;
V.loc_vector_within_included hs lv (V.size_of hs);
mt_safe_elts_preserved lv hs i j
(B.loc_all_regions_from false (V.frameOf rhs))
hh0 hh1;
mt_safe_elts_head hh1 lv hs i j;
hash_vv_rv_inv_r_inv hh1 hs lv (j - 1ul - ofs);
// correctness
assert (S.equal (RV.as_seq hh1 rhs)
(S.upd (RV.as_seq hh0 rhs) (U32.v lv)
(Rgl?.r_repr (hreg hsz) hh0 acc)));
hash_fun (V.index (V.index hs lv) (j - 1ul - ofs)) acc acc;
let hh2 = HST.get () in
// memory safety
mt_safe_elts_preserved lv hs i j
(B.loc_all_regions_from false (B.frameOf acc)) hh1 hh2;
RV.rv_inv_preserved
hs (B.loc_region_only false (B.frameOf acc)) hh1 hh2;
RV.rv_inv_preserved
rhs (B.loc_region_only false (B.frameOf acc)) hh1 hh2;
RV.as_seq_preserved
hs (B.loc_region_only false (B.frameOf acc)) hh1 hh2;
RV.as_seq_preserved
rhs (B.loc_region_only false (B.frameOf acc)) hh1 hh2;
// correctness
hash_vv_as_seq_get_index hh0 hs lv (j - 1ul - ofs);
assert (Rgl?.r_repr (hreg hsz) hh2 acc ==
(Ghost.reveal hash_spec) (S.index (S.index (RV.as_seq hh0 hs) (U32.v lv))
(U32.v j - 1 - U32.v ofs))
(Rgl?.r_repr (hreg hsz) hh0 acc))
end
else begin
mt_safe_elts_head hh0 lv hs i j;
hash_vv_rv_inv_r_inv hh0 hs lv (j - 1ul - ofs);
hash_vv_rv_inv_disjoint hh0 hs lv (j - 1ul - ofs) (B.frameOf acc);
Cpy?.copy (hcpy hsz) hsz (V.index (V.index hs lv) (j - 1ul - ofs)) acc;
let hh1 = HST.get () in
// memory safety
V.loc_vector_within_included hs lv (V.size_of hs);
mt_safe_elts_preserved lv hs i j
(B.loc_all_regions_from false (B.frameOf acc)) hh0 hh1;
RV.rv_inv_preserved
hs (B.loc_all_regions_from false (B.frameOf acc)) hh0 hh1;
RV.rv_inv_preserved
rhs (B.loc_all_regions_from false (B.frameOf acc)) hh0 hh1;
RV.as_seq_preserved
hs (B.loc_all_regions_from false (B.frameOf acc)) hh0 hh1;
RV.as_seq_preserved
rhs (B.loc_all_regions_from false (B.frameOf acc)) hh0 hh1;
// correctness
hash_vv_as_seq_get_index hh0 hs lv (j - 1ul - ofs);
assert (Rgl?.r_repr (hreg hsz) hh1 acc ==
S.index (S.index (RV.as_seq hh0 hs) (U32.v lv))
(U32.v j - 1 - U32.v ofs))
end;
let hh3 = HST.get () in
assert (S.equal (RV.as_seq hh3 hs) (RV.as_seq hh0 hs));
assert (S.equal (RV.as_seq hh3 rhs)
(if actd
then S.upd (RV.as_seq hh0 rhs) (U32.v lv)
(Rgl?.r_repr (hreg hsz) hh0 acc)
else RV.as_seq hh0 rhs));
assert (Rgl?.r_repr (hreg hsz) hh3 acc ==
(if actd
then (Ghost.reveal hash_spec) (S.index (S.index (RV.as_seq hh0 hs) (U32.v lv))
(U32.v j - 1 - U32.v ofs))
(Rgl?.r_repr (hreg hsz) hh0 acc)
else S.index (S.index (RV.as_seq hh0 hs) (U32.v lv))
(U32.v j - 1 - U32.v ofs)));
mt_safe_elts_rec hh3 lv hs i j;
construct_rhs #hsz #hash_spec (lv + 1ul) hs rhs (i / 2ul) (j / 2ul) acc true hash_fun;
let hh4 = HST.get () in
mt_safe_elts_spec hh3 (lv + 1ul) hs (i / 2ul) (j / 2ul);
assert (MTH.construct_rhs #(U32.v hsz) #hash_spec
(U32.v lv + 1)
(Rgl?.r_repr (hvvreg hsz) hh3 hs)
(Rgl?.r_repr (hvreg hsz) hh3 rhs)
(U32.v i / 2) (U32.v j / 2)
(Rgl?.r_repr (hreg hsz) hh3 acc) true ==
(Rgl?.r_repr (hvreg hsz) hh4 rhs, Rgl?.r_repr (hreg hsz) hh4 acc));
mt_safe_elts_spec hh0 lv hs i j;
MTH.construct_rhs_odd #(U32.v hsz) #hash_spec
(U32.v lv) (Rgl?.r_repr (hvvreg hsz) hh0 hs) (Rgl?.r_repr (hvreg hsz) hh0 rhs)
(U32.v i) (U32.v j) (Rgl?.r_repr (hreg hsz) hh0 acc) actd;
assert (MTH.construct_rhs #(U32.v hsz) #hash_spec
(U32.v lv)
(Rgl?.r_repr (hvvreg hsz) hh0 hs)
(Rgl?.r_repr (hvreg hsz) hh0 rhs)
(U32.v i) (U32.v j)
(Rgl?.r_repr (hreg hsz) hh0 acc) actd ==
(Rgl?.r_repr (hvreg hsz) hh4 rhs, Rgl?.r_repr (hreg hsz) hh4 acc))
end)
end
#pop-options
private inline_for_extraction
val mt_get_root_pre_nst: mtv:merkle_tree -> rt:hash #(MT?.hash_size mtv) -> Tot bool
let mt_get_root_pre_nst mtv rt = true
val mt_get_root_pre:
#hsz:Ghost.erased hash_size_t ->
mt:const_mt_p ->
rt:hash #hsz ->
HST.ST bool
(requires (fun h0 ->
let mt = CB.cast mt in
MT?.hash_size (B.get h0 mt 0) = Ghost.reveal hsz /\
mt_safe h0 mt /\ Rgl?.r_inv (hreg hsz) h0 rt /\
HH.disjoint (B.frameOf mt) (B.frameOf rt)))
(ensures (fun _ _ _ -> True))
let mt_get_root_pre #hsz mt rt =
let mt = CB.cast mt in
let mt = !*mt in
let hsz = MT?.hash_size mt in
assert (MT?.hash_size mt = hsz);
mt_get_root_pre_nst mt rt
// `mt_get_root` returns the Merkle root. If it's already calculated with
// up-to-date hashes, the root is returned immediately. Otherwise it calls
// `construct_rhs` to build rightmost hashes and to calculate the Merkle root
// as well.
val mt_get_root:
#hsz:Ghost.erased hash_size_t ->
mt:const_mt_p ->
rt:hash #hsz ->
HST.ST unit
(requires (fun h0 ->
let mt = CB.cast mt in
let dmt = B.get h0 mt 0 in
MT?.hash_size dmt = (Ghost.reveal hsz) /\
mt_get_root_pre_nst dmt rt /\
mt_safe h0 mt /\ Rgl?.r_inv (hreg hsz) h0 rt /\
HH.disjoint (B.frameOf mt) (B.frameOf rt)))
(ensures (fun h0 _ h1 ->
let mt = CB.cast mt in
// memory safety
modifies (loc_union
(mt_loc mt)
(B.loc_all_regions_from false (B.frameOf rt)))
h0 h1 /\
mt_safe h1 mt /\
(let mtv0 = B.get h0 mt 0 in
let mtv1 = B.get h1 mt 0 in
MT?.hash_size mtv0 = (Ghost.reveal hsz) /\
MT?.hash_size mtv1 = (Ghost.reveal hsz) /\
MT?.i mtv1 = MT?.i mtv0 /\ MT?.j mtv1 = MT?.j mtv0 /\
MT?.hs mtv1 == MT?.hs mtv0 /\ MT?.rhs mtv1 == MT?.rhs mtv0 /\
MT?.offset mtv1 == MT?.offset mtv0 /\
MT?.rhs_ok mtv1 = true /\
Rgl?.r_inv (hreg hsz) h1 rt /\
// correctness
MTH.mt_get_root (mt_lift h0 mt) (Rgl?.r_repr (hreg hsz) h0 rt) ==
(mt_lift h1 mt, Rgl?.r_repr (hreg hsz) h1 rt))))
#push-options "--z3rlimit 150 --initial_fuel 1 --max_fuel 1"
let mt_get_root #hsz mt rt =
let mt = CB.cast mt in
let hh0 = HST.get () in
let mtv = !*mt in
let prefix = MT?.offset mtv in
let i = MT?.i mtv in
let j = MT?.j mtv in
let hs = MT?.hs mtv in
let rhs = MT?.rhs mtv in
let mroot = MT?.mroot mtv in
let hash_size = MT?.hash_size mtv in
let hash_spec = MT?.hash_spec mtv in
let hash_fun = MT?.hash_fun mtv in
if MT?.rhs_ok mtv
then begin
Cpy?.copy (hcpy hash_size) hash_size mroot rt;
let hh1 = HST.get () in
mt_safe_preserved mt
(B.loc_all_regions_from false (Rgl?.region_of (hreg hsz) rt)) hh0 hh1;
mt_preserved mt
(B.loc_all_regions_from false (Rgl?.region_of (hreg hsz) rt)) hh0 hh1;
MTH.mt_get_root_rhs_ok_true
(mt_lift hh0 mt) (Rgl?.r_repr (hreg hsz) hh0 rt);
assert (MTH.mt_get_root (mt_lift hh0 mt) (Rgl?.r_repr (hreg hsz) hh0 rt) ==
(mt_lift hh1 mt, Rgl?.r_repr (hreg hsz) hh1 rt))
end
else begin
construct_rhs #hash_size #hash_spec 0ul hs rhs i j rt false hash_fun;
let hh1 = HST.get () in
// memory safety
assert (RV.rv_inv hh1 rhs);
assert (Rgl?.r_inv (hreg hsz) hh1 rt);
assert (B.live hh1 mt);
RV.rv_inv_preserved
hs (loc_union
(RV.loc_rvector rhs)
(B.loc_all_regions_from false (B.frameOf rt)))
hh0 hh1;
RV.as_seq_preserved
hs (loc_union
(RV.loc_rvector rhs)
(B.loc_all_regions_from false (B.frameOf rt)))
hh0 hh1;
V.loc_vector_within_included hs 0ul (V.size_of hs);
mt_safe_elts_preserved 0ul hs i j
(loc_union
(RV.loc_rvector rhs)
(B.loc_all_regions_from false (B.frameOf rt)))
hh0 hh1;
// correctness
mt_safe_elts_spec hh0 0ul hs i j;
assert (MTH.construct_rhs #(U32.v hash_size) #hash_spec 0
(Rgl?.r_repr (hvvreg hsz) hh0 hs)
(Rgl?.r_repr (hvreg hsz) hh0 rhs)
(U32.v i) (U32.v j)
(Rgl?.r_repr (hreg hsz) hh0 rt) false ==
(Rgl?.r_repr (hvreg hsz) hh1 rhs, Rgl?.r_repr (hreg hsz) hh1 rt));
Cpy?.copy (hcpy hash_size) hash_size rt mroot;
let hh2 = HST.get () in
// memory safety
RV.rv_inv_preserved
hs (B.loc_all_regions_from false (B.frameOf mroot))
hh1 hh2;
RV.rv_inv_preserved
rhs (B.loc_all_regions_from false (B.frameOf mroot))
hh1 hh2;
RV.as_seq_preserved
hs (B.loc_all_regions_from false (B.frameOf mroot))
hh1 hh2;
RV.as_seq_preserved
rhs (B.loc_all_regions_from false (B.frameOf mroot))
hh1 hh2;
B.modifies_buffer_elim
rt (B.loc_all_regions_from false (B.frameOf mroot))
hh1 hh2;
mt_safe_elts_preserved 0ul hs i j
(B.loc_all_regions_from false (B.frameOf mroot))
hh1 hh2;
// correctness
assert (Rgl?.r_repr (hreg hsz) hh2 mroot == Rgl?.r_repr (hreg hsz) hh1 rt);
mt *= MT hash_size prefix i j hs true rhs mroot hash_spec hash_fun;
let hh3 = HST.get () in
// memory safety
Rgl?.r_sep (hreg hsz) rt (B.loc_buffer mt) hh2 hh3;
RV.rv_inv_preserved hs (B.loc_buffer mt) hh2 hh3;
RV.rv_inv_preserved rhs (B.loc_buffer mt) hh2 hh3;
RV.as_seq_preserved hs (B.loc_buffer mt) hh2 hh3;
RV.as_seq_preserved rhs (B.loc_buffer mt) hh2 hh3;
Rgl?.r_sep (hreg hsz) mroot (B.loc_buffer mt) hh2 hh3;
mt_safe_elts_preserved 0ul hs i j
(B.loc_buffer mt) hh2 hh3;
assert (mt_safe hh3 mt);
// correctness
MTH.mt_get_root_rhs_ok_false
(mt_lift hh0 mt) (Rgl?.r_repr (hreg hsz) hh0 rt);
assert (MTH.mt_get_root (mt_lift hh0 mt) (Rgl?.r_repr (hreg hsz) hh0 rt) ==
(MTH.MT #(U32.v hash_size)
(U32.v i) (U32.v j)
(RV.as_seq hh0 hs)
true
(RV.as_seq hh1 rhs)
(Rgl?.r_repr (hreg hsz) hh1 rt)
hash_spec,
Rgl?.r_repr (hreg hsz) hh1 rt));
assert (MTH.mt_get_root (mt_lift hh0 mt) (Rgl?.r_repr (hreg hsz) hh0 rt) ==
(mt_lift hh3 mt, Rgl?.r_repr (hreg hsz) hh3 rt))
end
#pop-options
inline_for_extraction
val mt_path_insert:
#hsz:hash_size_t ->
mtr:HH.rid -> p:path_p -> hp:hash #hsz ->
HST.ST unit
(requires (fun h0 ->
path_safe h0 mtr p /\
not (V.is_full (phashes h0 p)) /\
Rgl?.r_inv (hreg hsz) h0 hp /\
HH.disjoint mtr (B.frameOf p) /\
HH.includes mtr (B.frameOf hp) /\
Path?.hash_size (B.get h0 p 0) = hsz))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (path_loc p) h0 h1 /\
path_safe h1 mtr p /\
// correctness
(let hsz0 = Path?.hash_size (B.get h0 p 0) in
let hsz1 = Path?.hash_size (B.get h1 p 0) in
(let before:(S.seq (MTH.hash #(U32.v hsz0))) = lift_path h0 mtr p in
let after:(S.seq (MTH.hash #(U32.v hsz1))) = lift_path h1 mtr p in
V.size_of (phashes h1 p) = V.size_of (phashes h0 p) + 1ul /\
hsz = hsz0 /\ hsz = hsz1 /\
(let hspec:(S.seq (MTH.hash #(U32.v hsz))) = (MTH.path_insert #(U32.v hsz) before (Rgl?.r_repr (hreg hsz) h0 hp)) in
S.equal hspec after)))))
#push-options "--z3rlimit 20 --initial_fuel 1 --max_fuel 1"
let mt_path_insert #hsz mtr p hp =
let pth = !*p in
let pv = Path?.hashes pth in
let hh0 = HST.get () in
let ipv = V.insert pv hp in
let hh1 = HST.get () in
path_safe_preserved_
mtr (V.as_seq hh0 pv) 0 (S.length (V.as_seq hh0 pv))
(B.loc_all_regions_from false (V.frameOf ipv)) hh0 hh1;
path_preserved_
mtr (V.as_seq hh0 pv) 0 (S.length (V.as_seq hh0 pv))
(B.loc_all_regions_from false (V.frameOf ipv)) hh0 hh1;
Rgl?.r_sep (hreg hsz) hp
(B.loc_all_regions_from false (V.frameOf ipv)) hh0 hh1;
p *= Path hsz ipv;
let hh2 = HST.get () in
path_safe_preserved_
mtr (V.as_seq hh1 ipv) 0 (S.length (V.as_seq hh1 ipv))
(B.loc_region_only false (B.frameOf p)) hh1 hh2;
path_preserved_
mtr (V.as_seq hh1 ipv) 0 (S.length (V.as_seq hh1 ipv))
(B.loc_region_only false (B.frameOf p)) hh1 hh2;
Rgl?.r_sep (hreg hsz) hp
(B.loc_region_only false (B.frameOf p)) hh1 hh2;
assert (S.equal (lift_path hh2 mtr p)
(lift_path_ hh1 (S.snoc (V.as_seq hh0 pv) hp)
0 (S.length (V.as_seq hh1 ipv))));
lift_path_eq hh1 (S.snoc (V.as_seq hh0 pv) hp) (V.as_seq hh0 pv)
0 (S.length (V.as_seq hh0 pv))
#pop-options
// For given a target index `k`, the number of elements (in the tree) `j`,
// and a boolean flag (to check the existence of rightmost hashes), we can
// calculate a required Merkle path length.
//
// `mt_path_length` is a postcondition of `mt_get_path`, and a precondition
// of `mt_verify`. For detailed description, see `mt_get_path` and `mt_verify`.
private
val mt_path_length_step:
k:index_t ->
j:index_t{k <= j} ->
actd:bool ->
Tot (sl:uint32_t{U32.v sl = MTH.mt_path_length_step (U32.v k) (U32.v j) actd})
let mt_path_length_step k j actd =
if j = 0ul then 0ul
else (if k % 2ul = 0ul
then (if j = k || (j = k + 1ul && not actd) then 0ul else 1ul)
else 1ul)
private inline_for_extraction
val mt_path_length:
lv:uint32_t{lv <= merkle_tree_size_lg} ->
k:index_t ->
j:index_t{k <= j && U32.v j < pow2 (32 - U32.v lv)} ->
actd:bool ->
Tot (l:uint32_t{
U32.v l = MTH.mt_path_length (U32.v k) (U32.v j) actd &&
l <= 32ul - lv})
(decreases (U32.v j))
#push-options "--z3rlimit 10 --initial_fuel 1 --max_fuel 1"
let rec mt_path_length lv k j actd =
if j = 0ul then 0ul
else (let nactd = actd || (j % 2ul = 1ul) in
mt_path_length_step k j actd +
mt_path_length (lv + 1ul) (k / 2ul) (j / 2ul) nactd)
#pop-options
val mt_get_path_length:
mtr:HH.rid ->
p:const_path_p ->
HST.ST uint32_t
(requires (fun h0 -> path_safe h0 mtr (CB.cast p)))
(ensures (fun h0 _ h1 -> True))
let mt_get_path_length mtr p =
let pd = !*(CB.cast p) in
V.size_of (Path?.hashes pd)
private inline_for_extraction
val mt_make_path_step:
#hsz:hash_size_t ->
lv:uint32_t{lv <= merkle_tree_size_lg} ->
mtr:HH.rid ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
rhs:hash_vec #hsz {V.size_of rhs = merkle_tree_size_lg} ->
i:index_t ->
j:index_t{j <> 0ul /\ i <= j /\ U32.v j < pow2 (32 - U32.v lv)} ->
k:index_t{i <= k && k <= j} ->
p:path_p ->
actd:bool ->
HST.ST unit
(requires (fun h0 ->
HH.includes mtr (V.frameOf hs) /\
HH.includes mtr (V.frameOf rhs) /\
RV.rv_inv h0 hs /\ RV.rv_inv h0 rhs /\
mt_safe_elts h0 lv hs i j /\
path_safe h0 mtr p /\
Path?.hash_size (B.get h0 p 0) = hsz /\
V.size_of (phashes h0 p) <= lv + 1ul))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (path_loc p) h0 h1 /\
path_safe h1 mtr p /\
V.size_of (phashes h1 p) == V.size_of (phashes h0 p) + mt_path_length_step k j actd /\
V.size_of (phashes h1 p) <= lv + 2ul /\
// correctness
(mt_safe_elts_spec h0 lv hs i j;
(let hsz0 = Path?.hash_size (B.get h0 p 0) in
let hsz1 = Path?.hash_size (B.get h1 p 0) in
let before:(S.seq (MTH.hash #(U32.v hsz0))) = lift_path h0 mtr p in
let after:(S.seq (MTH.hash #(U32.v hsz1))) = lift_path h1 mtr p in
hsz = hsz0 /\ hsz = hsz1 /\
S.equal after
(MTH.mt_make_path_step
(U32.v lv) (RV.as_seq h0 hs) (RV.as_seq h0 rhs)
(U32.v i) (U32.v j) (U32.v k) before actd)))))
#push-options "--z3rlimit 100 --initial_fuel 1 --max_fuel 1 --initial_ifuel 2 --max_ifuel 2"
let mt_make_path_step #hsz lv mtr hs rhs i j k p actd =
let pth = !*p in
let hh0 = HST.get () in
let ofs = offset_of i in
if k % 2ul = 1ul
then begin
hash_vv_rv_inv_includes hh0 hs lv (k - 1ul - ofs);
assert (HH.includes mtr
(B.frameOf (V.get hh0 (V.get hh0 hs lv) (k - 1ul - ofs))));
assert(Path?.hash_size pth = hsz);
mt_path_insert #hsz mtr p (V.index (V.index hs lv) (k - 1ul - ofs))
end
else begin
if k = j then ()
else if k + 1ul = j
then (if actd
then (assert (HH.includes mtr (B.frameOf (V.get hh0 rhs lv)));
mt_path_insert mtr p (V.index rhs lv)))
else (hash_vv_rv_inv_includes hh0 hs lv (k + 1ul - ofs);
assert (HH.includes mtr
(B.frameOf (V.get hh0 (V.get hh0 hs lv) (k + 1ul - ofs))));
mt_path_insert mtr p (V.index (V.index hs lv) (k + 1ul - ofs)))
end
#pop-options
private inline_for_extraction
val mt_get_path_step_pre_nst:
#hsz:Ghost.erased hash_size_t ->
mtr:HH.rid ->
p:path ->
i:uint32_t ->
Tot bool
let mt_get_path_step_pre_nst #hsz mtr p i =
i < V.size_of (Path?.hashes p)
val mt_get_path_step_pre:
#hsz:Ghost.erased hash_size_t ->
mtr:HH.rid ->
p:const_path_p ->
i:uint32_t ->
HST.ST bool
(requires (fun h0 ->
path_safe h0 mtr (CB.cast p) /\
(let pv = B.get h0 (CB.cast p) 0 in
Path?.hash_size pv = Ghost.reveal hsz /\
live h0 (Path?.hashes pv) /\
mt_get_path_step_pre_nst #hsz mtr pv i)))
(ensures (fun _ _ _ -> True))
let mt_get_path_step_pre #hsz mtr p i =
let p = CB.cast p in
mt_get_path_step_pre_nst #hsz mtr !*p i
val mt_get_path_step:
#hsz:Ghost.erased hash_size_t ->
mtr:HH.rid ->
p:const_path_p ->
i:uint32_t ->
HST.ST (hash #hsz)
(requires (fun h0 ->
path_safe h0 mtr (CB.cast p) /\
(let pv = B.get h0 (CB.cast p) 0 in
Path?.hash_size pv = Ghost.reveal hsz /\
live h0 (Path?.hashes pv) /\
i < V.size_of (Path?.hashes pv))))
(ensures (fun h0 r h1 -> True ))
let mt_get_path_step #hsz mtr p i =
let pd = !*(CB.cast p) in
V.index #(hash #(Path?.hash_size pd)) (Path?.hashes pd) i
private
val mt_get_path_:
#hsz:hash_size_t ->
lv:uint32_t{lv <= merkle_tree_size_lg} ->
mtr:HH.rid ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
rhs:hash_vec #hsz {V.size_of rhs = merkle_tree_size_lg} ->
i:index_t -> j:index_t{i <= j /\ U32.v j < pow2 (32 - U32.v lv)} ->
k:index_t{i <= k && k <= j} ->
p:path_p ->
actd:bool ->
HST.ST unit
(requires (fun h0 ->
HH.includes mtr (V.frameOf hs) /\
HH.includes mtr (V.frameOf rhs) /\
RV.rv_inv h0 hs /\ RV.rv_inv h0 rhs /\
mt_safe_elts h0 lv hs i j /\
path_safe h0 mtr p /\
Path?.hash_size (B.get h0 p 0) = hsz /\
V.size_of (phashes h0 p) <= lv + 1ul))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (path_loc p) h0 h1 /\
path_safe h1 mtr p /\
V.size_of (phashes h1 p) ==
V.size_of (phashes h0 p) + mt_path_length lv k j actd /\
// correctness
(mt_safe_elts_spec h0 lv hs i j;
(let hsz0 = Path?.hash_size (B.get h0 p 0) in
let hsz1 = Path?.hash_size (B.get h1 p 0) in
let before:(S.seq (MTH.hash #(U32.v hsz0))) = lift_path h0 mtr p in
let after:(S.seq (MTH.hash #(U32.v hsz1))) = lift_path h1 mtr p in
hsz = hsz0 /\ hsz = hsz1 /\
S.equal after
(MTH.mt_get_path_ (U32.v lv) (RV.as_seq h0 hs) (RV.as_seq h0 rhs)
(U32.v i) (U32.v j) (U32.v k) before actd)))))
(decreases (32 - U32.v lv)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MerkleTree.Spec.fst.checked",
"MerkleTree.New.High.fst.checked",
"MerkleTree.Low.VectorExtras.fst.checked",
"MerkleTree.Low.Hashfunctions.fst.checked",
"MerkleTree.Low.Datastructures.fst.checked",
"LowStar.Vector.fst.checked",
"LowStar.RVector.fst.checked",
"LowStar.Regional.Instances.fst.checked",
"LowStar.Regional.fst.checked",
"LowStar.ConstBuffer.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Properties.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.HyperStack.fsti.checked",
"FStar.Monotonic.HyperHeap.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Integers.fst.checked",
"FStar.Int.Cast.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.All.fst.checked",
"EverCrypt.Helpers.fsti.checked"
],
"interface_file": false,
"source_file": "MerkleTree.Low.fst"
} | [
{
"abbrev": false,
"full_module": "MerkleTree.Low.VectorExtras",
"short_module": null
},
{
"abbrev": false,
"full_module": "MerkleTree.Low.Hashfunctions",
"short_module": null
},
{
"abbrev": false,
"full_module": "MerkleTree.Low.Datastructures",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": true,
"full_module": "MerkleTree.Spec",
"short_module": "MTS"
},
{
"abbrev": true,
"full_module": "MerkleTree.New.High",
"short_module": "MTH"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Regional.Instances",
"short_module": "RVI"
},
{
"abbrev": true,
"full_module": "LowStar.RVector",
"short_module": "RV"
},
{
"abbrev": true,
"full_module": "LowStar.Vector",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "LowStar.ConstBuffer",
"short_module": "CB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.Monotonic.HyperHeap",
"short_module": "HH"
},
{
"abbrev": true,
"full_module": "FStar.Monotonic.HyperStack",
"short_module": "MHS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "LowStar.Regional.Instances",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.RVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Regional",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Vector",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "MerkleTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "MerkleTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 2,
"max_fuel": 1,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 300,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
lv: LowStar.Vector.uint32_t{lv <= MerkleTree.Low.merkle_tree_size_lg} ->
mtr: FStar.Monotonic.HyperHeap.rid ->
hs:
MerkleTree.Low.Datastructures.hash_vv hsz
{LowStar.Vector.size_of hs = MerkleTree.Low.merkle_tree_size_lg} ->
rhs:
MerkleTree.Low.Datastructures.hash_vec
{LowStar.Vector.size_of rhs = MerkleTree.Low.merkle_tree_size_lg} ->
i: MerkleTree.Low.index_t ->
j: MerkleTree.Low.index_t{i <= j /\ FStar.UInt32.v j < Prims.pow2 (32 - FStar.UInt32.v lv)} ->
k: MerkleTree.Low.index_t{i <= k && k <= j} ->
p: MerkleTree.Low.path_p ->
actd: Prims.bool
-> FStar.HyperStack.ST.ST Prims.unit | FStar.HyperStack.ST.ST | [
""
] | [] | [
"MerkleTree.Low.Datastructures.hash_size_t",
"LowStar.Vector.uint32_t",
"Prims.b2t",
"FStar.Integers.op_Less_Equals",
"FStar.Integers.Unsigned",
"FStar.Integers.W32",
"MerkleTree.Low.merkle_tree_size_lg",
"FStar.Monotonic.HyperHeap.rid",
"MerkleTree.Low.Datastructures.hash_vv",
"Prims.op_Equality",
"LowStar.Vector.size_of",
"MerkleTree.Low.Datastructures.hash_vec",
"MerkleTree.Low.Datastructures.hash",
"MerkleTree.Low.index_t",
"Prims.l_and",
"FStar.Integers.op_Less",
"FStar.Integers.Signed",
"FStar.Integers.Winfinite",
"FStar.UInt32.v",
"Prims.pow2",
"FStar.Integers.op_Subtraction",
"Prims.op_AmpAmp",
"MerkleTree.Low.path_p",
"Prims.bool",
"FStar.UInt32.t",
"FStar.UInt32.__uint_to_t",
"Prims.unit",
"Prims._assert",
"FStar.Seq.Base.equal",
"MerkleTree.New.High.hash",
"MerkleTree.Low.lift_path",
"MerkleTree.New.High.mt_get_path_",
"LowStar.RVector.as_seq",
"MerkleTree.Low.Datastructures.hvreg",
"MerkleTree.Low.Datastructures.hreg",
"FStar.Integers.op_Plus",
"FStar.Integers.op_Slash",
"Prims.int",
"FStar.Integers.op_Percent",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"MerkleTree.Low.mt_get_path_",
"MerkleTree.Low.mt_safe_elts_spec",
"MerkleTree.Low.mt_safe_elts_rec",
"MerkleTree.Low.mt_safe_elts",
"MerkleTree.Low.mt_safe_elts_preserved",
"MerkleTree.Low.path_loc",
"LowStar.Vector.loc_vector_within_included",
"LowStar.RVector.as_seq_preserved",
"LowStar.RVector.rv_inv_preserved",
"MerkleTree.New.High.mt_make_path_step",
"MerkleTree.Low.mt_make_path_step",
"MerkleTree.Low.offset_of"
] | [
"recursion"
] | false | true | false | false | false | let rec mt_get_path_ #hsz lv mtr hs rhs i j k p actd =
| let hh0 = HST.get () in
mt_safe_elts_spec hh0 lv hs i j;
let ofs = offset_of i in
if j = 0ul
then ()
else
(mt_make_path_step lv mtr hs rhs i j k p actd;
let hh1 = HST.get () in
mt_safe_elts_spec hh0 lv hs i j;
assert (S.equal (lift_path hh1 mtr p)
(MTH.mt_make_path_step (U32.v lv)
(RV.as_seq hh0 hs)
(RV.as_seq hh0 rhs)
(U32.v i)
(U32.v j)
(U32.v k)
(lift_path hh0 mtr p)
actd));
RV.rv_inv_preserved hs (path_loc p) hh0 hh1;
RV.rv_inv_preserved rhs (path_loc p) hh0 hh1;
RV.as_seq_preserved hs (path_loc p) hh0 hh1;
RV.as_seq_preserved rhs (path_loc p) hh0 hh1;
V.loc_vector_within_included hs lv (V.size_of hs);
mt_safe_elts_preserved lv hs i j (path_loc p) hh0 hh1;
assert (mt_safe_elts hh1 lv hs i j);
mt_safe_elts_rec hh1 lv hs i j;
mt_safe_elts_spec hh1 (lv + 1ul) hs (i / 2ul) (j / 2ul);
mt_get_path_ (lv + 1ul)
mtr
hs
rhs
(i / 2ul)
(j / 2ul)
(k / 2ul)
p
(if j % 2ul = 0ul then actd else true);
let hh2 = HST.get () in
assert (S.equal (lift_path hh2 mtr p)
(MTH.mt_get_path_ (U32.v lv + 1)
(RV.as_seq hh1 hs)
(RV.as_seq hh1 rhs)
(U32.v i / 2)
(U32.v j / 2)
(U32.v k / 2)
(lift_path hh1 mtr p)
(if U32.v j % 2 = 0 then actd else true)));
assert (S.equal (lift_path hh2 mtr p)
(MTH.mt_get_path_ (U32.v lv)
(RV.as_seq hh0 hs)
(RV.as_seq hh0 rhs)
(U32.v i)
(U32.v j)
(U32.v k)
(lift_path hh0 mtr p)
actd))) | false |
Vale.AES.X64.AESopt.fsti | Vale.AES.X64.AESopt.va_quick_Loop6x | val va_quick_Loop6x
(alg: algorithm)
(h_LE y_orig y_prev: quad32)
(count: nat)
(iv_b in0_b in_b out_b scratch_b: buffer128)
(plain_quads: (seq quad32))
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(ctr_BE_orig ctr_BE: quad32)
: (va_quickCode quad32 (va_code_Loop6x alg)) | val va_quick_Loop6x
(alg: algorithm)
(h_LE y_orig y_prev: quad32)
(count: nat)
(iv_b in0_b in_b out_b scratch_b: buffer128)
(plain_quads: (seq quad32))
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(ctr_BE_orig ctr_BE: quad32)
: (va_quickCode quad32 (va_code_Loop6x alg)) | let va_quick_Loop6x (alg:algorithm) (h_LE:quad32) (y_orig:quad32) (y_prev:quad32) (count:nat)
(iv_b:buffer128) (in0_b:buffer128) (in_b:buffer128) (out_b:buffer128) (scratch_b:buffer128)
(plain_quads:(seq quad32)) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128)
(hkeys_b:buffer128) (ctr_BE_orig:quad32) (ctr_BE:quad32) : (va_quickCode quad32 (va_code_Loop6x
alg)) =
(va_QProc (va_code_Loop6x alg) ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2;
va_Mod_mem_heaplet 6; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm
11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR14;
va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_reg64 rRdx;
va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_mem]) (va_wp_Loop6x alg h_LE y_orig y_prev count
iv_b in0_b in_b out_b scratch_b plain_quads key_words round_keys keys_b hkeys_b ctr_BE_orig
ctr_BE) (va_wpProof_Loop6x alg h_LE y_orig y_prev count iv_b in0_b in_b out_b scratch_b
plain_quads key_words round_keys keys_b hkeys_b ctr_BE_orig ctr_BE)) | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 72,
"end_line": 896,
"start_col": 0,
"start_line": 883
} | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let aes_reqs0
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ pclmulqdq_enabled /\ avx_enabled /\
alg = AES_128 /\
//(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
buffer128_as_seq heap0 keys_b == round_keys
let aes_reqs_offset
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ avx_enabled /\ pclmulqdq_enabled /\
(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
s128 heap0 keys_b == round_keys
let six_of (a:Type0) = a & a & a & a & a & a
let quad32_6 = six_of quad32
unfold let make_six_of (#a:Type0) (f:(n:nat{n < 6}) -> GTot a) : GTot (six_of a) =
(f 0, f 1, f 2, f 3, f 4, f 5)
unfold let map_six_of (#a #b:Type0) (x:six_of a) (f:a -> GTot b) : GTot (six_of b) =
let (x0, x1, x2, x3, x4, x5) = x in
(f x0, f x1, f x2, f x3, f x4, f x5)
unfold let map2_six_of (#a #b #c:Type0) (x:six_of a) (y:six_of b) (f:a -> b -> GTot c) : GTot (six_of c) =
let (x0, x1, x2, x3, x4, x5) = x in
let (y0, y1, y2, y3, y4, y5) = y in
(f x0 y0, f x1 y1, f x2 y2, f x3 y3, f x4 y4, f x5 y5)
let rounds_opaque_6 (init:quad32_6) (round_keys:seq quad32) (rnd:nat{rnd < length round_keys}) : GTot quad32_6 =
map_six_of init (fun x -> eval_rounds x round_keys rnd)
let xor_reverse_inc32lite_6 (n i0:int) (ctr_BE rndkey:quad32) : GTot quad32_6 =
make_six_of (fun i ->
let r = reverse_bytes_quad32 (inc32lite ctr_BE (i0 + i)) in
if i < n then quad32_xor r rndkey else r)
//let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
// count * 6 + 6 <= length s /\ (
// let data = slice s (count * 6) (count * 6 + 6) in
// z3 == reverse_bytes_quad32 (index data 5) /\
// scratch_b_blocks true true scratch_b 8 5 heap3 data)
let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
count * 6 + 6 <= length s /\ (
let data = slice s (count * 6) (count * 6 + 6) in
z3 == reverse_bytes_quad32 (index data 5) /\
buffer128_read scratch_b 3 heap3 == reverse_bytes_quad32 (index data 4) /\
buffer128_read scratch_b 4 heap3 == reverse_bytes_quad32 (index data 3) /\
buffer128_read scratch_b 5 heap3 == reverse_bytes_quad32 (index data 2) /\
buffer128_read scratch_b 6 heap3 == reverse_bytes_quad32 (index data 1) /\
buffer128_read scratch_b 7 heap3 == reverse_bytes_quad32 (index data 0))
//-- Load_two_lsb
val va_code_Load_two_lsb : dst:va_operand_xmm -> Tot va_code
val va_codegen_success_Load_two_lsb : dst:va_operand_xmm -> Tot va_pbool
val va_lemma_Load_two_lsb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_two_lsb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@ va_qattr]
let va_wp_Load_two_lsb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 ==> va_k va_sM (())))
val va_wpProof_Load_two_lsb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_two_lsb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_two_lsb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Load_two_lsb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_two_lsb dst)) =
(va_QProc (va_code_Load_two_lsb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_two_lsb dst) (va_wpProof_Load_two_lsb dst))
//--
//-- Load_one_lsb
val va_code_Load_one_lsb : dst:va_operand_xmm -> Tot va_code
val va_codegen_success_Load_one_lsb : dst:va_operand_xmm -> Tot va_pbool
val va_lemma_Load_one_lsb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_one_lsb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@ va_qattr]
let va_wp_Load_one_lsb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 ==> va_k va_sM (())))
val va_wpProof_Load_one_lsb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_one_lsb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_one_lsb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Load_one_lsb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_one_lsb dst)) =
(va_QProc (va_code_Load_one_lsb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_one_lsb dst) (va_wpProof_Load_one_lsb dst))
//--
//-- Loop6x_final
val va_code_Loop6x_final : alg:algorithm -> Tot va_code
val va_codegen_success_Loop6x_final : alg:algorithm -> Tot va_pbool
val va_lemma_Loop6x_final : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> iv_b:buffer128 ->
scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
ctr_orig:quad32 -> init:quad32_6 -> ctrs:quad32_6 -> plain:quad32_6 -> inb:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop6x_final alg) va_s0 /\ va_get_ok va_s0 /\
(sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validDstAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0)
Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\ va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\
aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0
va_s0) (va_get_mem_layout va_s0) /\ init == map_six_of #quad32 #quad32 ctrs (fun (c:quad32) ->
Vale.Def.Types_s.quad32_xor c (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0)) /\
(va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm
13 va_s0, va_get_xmm 14 va_s0) == rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg
- 1) /\ va_get_reg64 rR13 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64
inb) /\ va_get_reg64 rR12 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64
inb) /\ (let rk = FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in
(va_get_xmm 2 va_s0, va_get_xmm 0 va_s0, va_get_xmm 5 va_s0, va_get_xmm 6 va_s0, va_get_xmm 7
va_s0, va_get_xmm 3 va_s0) == map_six_of #quad32 #quad32 plain (fun (p:quad32) ->
Vale.Def.Types_s.quad32_xor rk p) /\ Vale.X64.Decls.buffer128_read scratch_b 8
(va_get_mem_heaplet 3 va_s0) == Vale.Def.Types_s.reverse_bytes_quad32 ctr_orig))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 7 7 /\ Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 inb /\ (va_get_xmm 9
va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM,
va_get_xmm 14 va_sM) == map2_six_of #quad32 #quad32 #quad32 plain ctrs (fun (p:quad32)
(c:quad32) -> Vale.Def.Types_s.quad32_xor p (Vale.AES.AES_s.aes_encrypt_LE alg key_words c)) /\
va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_reg64 rRdi va_sM ==
va_get_reg64 rRdi va_s0 + 96 /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96 /\
va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_sM == Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) /\
(let ctr = Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_orig `op_Modulus` 256 in ctr + 6 <
256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM,
va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 0 ctr_orig (va_get_xmm 15
va_sM))) /\ va_state_eq va_sM (va_update_mem_heaplet 3 va_sM (va_update_flags va_sM
(va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM
(va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 7 va_sM
(va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12
va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Loop6x_final (alg:algorithm) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (ctr_orig:quad32) (init:quad32_6)
(ctrs:quad32_6) (plain:quad32_6) (inb:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0))
: Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 2 va_s0)
(va_get_reg64 rR8 va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0)
scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\
va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\ aes_reqs_offset alg key_words round_keys keys_b
(va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ init ==
map_six_of #quad32 #quad32 ctrs (fun (c:quad32) -> Vale.Def.Types_s.quad32_xor c
(FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0)) /\ (va_get_xmm 9 va_s0,
va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm
14 va_s0) == rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64
rR13 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 inb) /\ va_get_reg64
rR12 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 inb) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_s0,
va_get_xmm 0 va_s0, va_get_xmm 5 va_s0, va_get_xmm 6 va_s0, va_get_xmm 7 va_s0, va_get_xmm 3
va_s0) == map_six_of #quad32 #quad32 plain (fun (p:quad32) -> Vale.Def.Types_s.quad32_xor rk p)
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) ==
Vale.Def.Types_s.reverse_bytes_quad32 ctr_orig)) /\ (forall (va_x_mem:vale_heap)
(va_x_rdi:nat64) (va_x_rsi:nat64) (va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm5:quad32)
(va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32)
(va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32)
(va_x_xmm15:quad32) (va_x_efl:Vale.X64.Flags.t) (va_x_heap3:vale_heap) . let va_sM =
va_upd_mem_heaplet 3 va_x_heap3 (va_upd_flags va_x_efl (va_upd_xmm 15 va_x_xmm15 (va_upd_xmm 14
va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11
(va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6
va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1
va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR13 va_x_r13 (va_upd_reg64 rR12 va_x_r12
(va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRsi va_x_rsi (va_upd_reg64 rRdi va_x_rdi (va_upd_mem
va_x_mem va_s0))))))))))))))))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 7 7 /\ Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 inb /\ (va_get_xmm 9
va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM,
va_get_xmm 14 va_sM) == map2_six_of #quad32 #quad32 #quad32 plain ctrs (fun (p:quad32)
(c:quad32) -> Vale.Def.Types_s.quad32_xor p (Vale.AES.AES_s.aes_encrypt_LE alg key_words c)) /\
va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_reg64 rRdi va_sM ==
va_get_reg64 rRdi va_s0 + 96 /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96 /\
va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_sM == Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) /\
(let ctr = Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_orig `op_Modulus` 256 in ctr + 6 <
256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM,
va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 0 ctr_orig (va_get_xmm 15
va_sM))) ==> va_k va_sM (())))
val va_wpProof_Loop6x_final : alg:algorithm -> iv_b:buffer128 -> scratch_b:buffer128 ->
key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> ctr_orig:quad32 ->
init:quad32_6 -> ctrs:quad32_6 -> plain:quad32_6 -> inb:quad32 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop6x_final alg iv_b scratch_b key_words round_keys
keys_b ctr_orig init ctrs plain inb va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_final alg) ([va_Mod_mem_heaplet
3; va_Mod_flags; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11;
va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm
2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11;
va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop6x_final (alg:algorithm) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (ctr_orig:quad32) (init:quad32_6)
(ctrs:quad32_6) (plain:quad32_6) (inb:quad32) : (va_quickCode unit (va_code_Loop6x_final alg)) =
(va_QProc (va_code_Loop6x_final alg) ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 15;
va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRsi; va_Mod_reg64
rRdi; va_Mod_mem]) (va_wp_Loop6x_final alg iv_b scratch_b key_words round_keys keys_b ctr_orig
init ctrs plain inb) (va_wpProof_Loop6x_final alg iv_b scratch_b key_words round_keys keys_b
ctr_orig init ctrs plain inb))
//--
//-- Loop6x_save_output
val va_code_Loop6x_save_output : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop6x_save_output : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop6x_save_output : va_b0:va_code -> va_s0:va_state -> count:nat -> out_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop6x_save_output ()) va_s0 /\ va_get_ok va_s0 /\
(avx_enabled /\ sse_enabled /\ Vale.X64.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rRsi va_s0 - 96) out_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0)
Secret)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) (count `op_Multiply` 6 + 0) (count `op_Multiply` 6 + 5) /\
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 6 va_sM) out_b) 0 (6 `op_Multiply` count) == FStar.Seq.Base.slice
#Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 6 va_s0) out_b) 0
(6 `op_Multiply` count) /\ (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0,
va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == make_six_of #quad32 (fun
(i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read out_b (count `op_Multiply` 6 + i)
(va_get_mem_heaplet 6 va_sM)) /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM,
va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == (Vale.Def.Types_s.quad32_xor
(va_get_xmm 1 va_sM) (va_get_xmm 15 va_sM), va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm
6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM)) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_mem_heaplet 6 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm
12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0))))))))))))
[@ va_qattr]
let va_wp_Loop6x_save_output (count:nat) (out_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit
-> Type0)) : Type0 =
(va_get_ok va_s0 /\ (avx_enabled /\ sse_enabled /\ Vale.X64.Decls.validDstAddrsOffset128
(va_get_mem_heaplet 6 va_s0) (va_get_reg64 rRsi va_s0 - 96) out_b (count `op_Multiply` 6) 6
(va_get_mem_layout va_s0) Secret) /\ (forall (va_x_mem:vale_heap) (va_x_xmm9:quad32)
(va_x_xmm10:quad32) (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32)
(va_x_xmm14:quad32) (va_x_heap6:vale_heap) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_mem_heaplet 6 va_x_heap6 (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13
va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10 va_x_xmm10
(va_upd_xmm 9 va_x_xmm9 (va_upd_mem va_x_mem va_s0)))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) (count `op_Multiply` 6 + 0) (count `op_Multiply` 6 + 5) /\
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 6 va_sM) out_b) 0 (6 `op_Multiply` count) == FStar.Seq.Base.slice
#Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 6 va_s0) out_b) 0
(6 `op_Multiply` count) /\ (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0,
va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == make_six_of #quad32 (fun
(i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read out_b (count `op_Multiply` 6 + i)
(va_get_mem_heaplet 6 va_sM)) /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM,
va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == (Vale.Def.Types_s.quad32_xor
(va_get_xmm 1 va_sM) (va_get_xmm 15 va_sM), va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm
6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM)) ==> va_k va_sM (())))
val va_wpProof_Loop6x_save_output : count:nat -> out_b:buffer128 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop6x_save_output count out_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_save_output ()) ([va_Mod_flags;
va_Mod_mem_heaplet 6; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm
10; va_Mod_xmm 9; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop6x_save_output (count:nat) (out_b:buffer128) : (va_quickCode unit
(va_code_Loop6x_save_output ())) =
(va_QProc (va_code_Loop6x_save_output ()) ([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_xmm 14;
va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_mem])
(va_wp_Loop6x_save_output count out_b) (va_wpProof_Loop6x_save_output count out_b))
//--
//-- Loop6x_partial
val va_code_untransformedoriginal_Loop6x_partial : alg:algorithm -> Tot va_code
val va_codegen_success_untransformedoriginal_Loop6x_partial : alg:algorithm -> Tot va_pbool
val va_lemma_untransformedoriginal_Loop6x_partial : va_b0:va_code -> va_s0:va_state ->
alg:algorithm -> h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32) -> count:nat -> in0_count:nat
-> iv_b:buffer128 -> in0_b:buffer128 -> in_b:buffer128 -> scratch_b:buffer128 -> key_words:(seq
nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE:quad32
-> Ghost (va_state & va_fuel & quad32_6)
(requires (va_require_total va_b0 (va_code_untransformedoriginal_Loop6x_partial alg) va_s0 /\
va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in sse_enabled
/\ movbe_enabled /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0
16777216 /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 6 va_s0) (va_get_reg64 rR14 va_s0) in0_b (in0_count `op_Multiply` 6) 6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp
va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64
/\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 15 va_s0 ==
FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx
va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9
va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256
==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15
va_s0)) /\ FStar.Seq.Base.length #quad32 data == 6 /\ hkeys_b_powers hkeys_b
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\
scratch_b_data true true scratch_b 8 5 (va_get_mem_heaplet 3 va_s0) (va_get_mem_layout va_s0)
(va_get_reg64 rRbp va_s0) data /\ va_get_xmm 7 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data 5) /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_s0))) == prev)))
(ensures (fun (va_sM, va_fM, init) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in
Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 1 8 /\ Vale.X64.Decls.modifies_buffer_specific128 iv_b
(va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) 0 0 /\ (0 <= va_get_reg64 rRbx va_sM
/\ va_get_reg64 rRbx va_sM < 256) /\ va_get_reg64 rRbx va_sM ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256
/\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM,
va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys
(Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64 rR13 va_sM ==
Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ va_get_reg64 rR12 va_sM ==
Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_sM,
va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3
va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor rk
(Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)))
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\
Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 5) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 3
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 4) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 4 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 3) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 5
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 2) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 6 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 1) (va_get_mem_heaplet 6 va_s0)) /\ init == make_six_of #quad32 (fun
(n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE n)) (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys
0)) /\ (let eventual_Xi = add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_sM)))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)) in
eventual_Xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data))))) /\ va_state_eq va_sM (va_update_flags
va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM (va_update_xmm 15 va_sM
(va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM
(va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM
(va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM
(va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13
va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))))
val va_transform_Loop6x_partial : alg:algorithm -> Tot va_transformation_result
val va_code_Loop6x_partial : alg:algorithm -> Tot va_code
val va_codegen_success_Loop6x_partial : alg:algorithm -> Tot va_pbool
val va_lemma_Loop6x_partial : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> h_LE:quad32 ->
y_prev:quad32 -> data:(seq quad32) -> count:nat -> in0_count:nat -> iv_b:buffer128 ->
in0_b:buffer128 -> in_b:buffer128 -> scratch_b:buffer128 -> key_words:(seq nat32) ->
round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE:quad32
-> Ghost (va_state & va_fuel & quad32_6)
(requires (va_require_total va_b0 (va_code_Loop6x_partial alg) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in sse_enabled
/\ movbe_enabled /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0
16777216 /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 6 va_s0) (va_get_reg64 rR14 va_s0) in0_b (in0_count `op_Multiply` 6) 6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp
va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64
/\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 15 va_s0 ==
FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx
va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9
va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256
==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15
va_s0)) /\ FStar.Seq.Base.length #quad32 data == 6 /\ hkeys_b_powers hkeys_b
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\
scratch_b_data true true scratch_b 8 5 (va_get_mem_heaplet 3 va_s0) (va_get_mem_layout va_s0)
(va_get_reg64 rRbp va_s0) data /\ va_get_xmm 7 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data 5) /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_s0))) == prev)))
(ensures (fun (va_sM, va_fM, init) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in
Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 1 8 /\ Vale.X64.Decls.modifies_buffer_specific128 iv_b
(va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) 0 0 /\ (0 <= va_get_reg64 rRbx va_sM
/\ va_get_reg64 rRbx va_sM < 256) /\ va_get_reg64 rRbx va_sM ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256
/\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM,
va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys
(Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64 rR13 va_sM ==
Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ va_get_reg64 rR12 va_sM ==
Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_sM,
va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3
va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor rk
(Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)))
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\
Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 5) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 3
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 4) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 4 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 3) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 5
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 2) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 6 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 1) (va_get_mem_heaplet 6 va_s0)) /\ init == make_six_of #quad32 (fun
(n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE n)) (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys
0)) /\ (let eventual_Xi = add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_sM)))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)) in
eventual_Xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data))))) /\ va_state_eq va_sM (va_update_flags
va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM (va_update_xmm 15 va_sM
(va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM
(va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM
(va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM
(va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13
va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Loop6x_partial (alg:algorithm) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(count:nat) (in0_count:nat) (iv_b:buffer128) (in0_b:buffer128) (in_b:buffer128)
(scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128)
(hkeys_b:buffer128) (ctr_BE:quad32) (va_s0:va_state) (va_k:(va_state -> quad32_6 -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in sse_enabled
/\ movbe_enabled /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0
16777216 /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 6 va_s0) (va_get_reg64 rR14 va_s0) in0_b (in0_count `op_Multiply` 6) 6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp
va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64
/\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 15 va_s0 ==
FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx
va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9
va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256
==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15
va_s0)) /\ FStar.Seq.Base.length #quad32 data == 6 /\ hkeys_b_powers hkeys_b
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\
scratch_b_data true true scratch_b 8 5 (va_get_mem_heaplet 3 va_s0) (va_get_mem_layout va_s0)
(va_get_reg64 rRbp va_s0) data /\ va_get_xmm 7 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data 5) /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_s0))) == prev) /\ (forall (va_x_mem:vale_heap) (va_x_rbx:nat64)
(va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32)
(va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32)
(va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32)
(va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32)
(va_x_xmm15:quad32) (va_x_heap2:vale_heap) (va_x_heap3:vale_heap) (va_x_efl:Vale.X64.Flags.t)
(init:quad32_6) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 3 va_x_heap3
(va_upd_mem_heaplet 2 va_x_heap2 (va_upd_xmm 15 va_x_xmm15 (va_upd_xmm 14 va_x_xmm14
(va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10
va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm
6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm
2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR13 va_x_r13
(va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRbx va_x_rbx (va_upd_mem
va_x_mem va_s0))))))))))))))))))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in Vale.X64.Decls.modifies_buffer_specific128
scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 1 8 /\
Vale.X64.Decls.modifies_buffer_specific128 iv_b (va_get_mem_heaplet 2 va_s0)
(va_get_mem_heaplet 2 va_sM) 0 0 /\ (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM <
256) /\ va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0
(Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256 /\ (va_get_xmm 9 va_sM, va_get_xmm 10
va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) ==
rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64 rR13 va_sM
== Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 (Vale.X64.Decls.buffer128_read
in0_b (in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ va_get_reg64 rR12 va_sM
== Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 (Vale.X64.Decls.buffer128_read
in0_b (in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_sM,
va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3
va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor rk
(Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)))
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\
Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 5) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 3
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 4) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 4 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 3) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 5
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 2) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 6 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 1) (va_get_mem_heaplet 6 va_s0)) /\ init == make_six_of #quad32 (fun
(n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE n)) (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys
0)) /\ (let eventual_Xi = add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_sM)))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)) in
eventual_Xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data))))) ==> va_k va_sM ((init))))
val va_wpProof_Loop6x_partial : alg:algorithm -> h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32)
-> count:nat -> in0_count:nat -> iv_b:buffer128 -> in0_b:buffer128 -> in_b:buffer128 ->
scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128 -> ctr_BE:quad32 -> va_s0:va_state -> va_k:(va_state -> quad32_6 -> Type0)
-> Ghost (va_state & va_fuel & quad32_6)
(requires (va_t_require va_s0 /\ va_wp_Loop6x_partial alg h_LE y_prev data count in0_count iv_b
in0_b in_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_partial alg) ([va_Mod_flags;
va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13;
va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_mem])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop6x_partial (alg:algorithm) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(count:nat) (in0_count:nat) (iv_b:buffer128) (in0_b:buffer128) (in_b:buffer128)
(scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128)
(hkeys_b:buffer128) (ctr_BE:quad32) : (va_quickCode quad32_6 (va_code_Loop6x_partial alg)) =
(va_QProc (va_code_Loop6x_partial alg) ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet
2; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10;
va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm
3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64
rR11; va_Mod_reg64 rRbx; va_Mod_mem]) (va_wp_Loop6x_partial alg h_LE y_prev data count
in0_count iv_b in0_b in_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE)
(va_wpProof_Loop6x_partial alg h_LE y_prev data count in0_count iv_b in0_b in_b scratch_b
key_words round_keys keys_b hkeys_b ctr_BE))
//--
#reset-options "--z3rlimit 50"
//-- Loop6x
val va_code_Loop6x : alg:algorithm -> Tot va_code
val va_codegen_success_Loop6x : alg:algorithm -> Tot va_pbool
val va_lemma_Loop6x : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> h_LE:quad32 ->
y_orig:quad32 -> y_prev:quad32 -> count:nat -> iv_b:buffer128 -> in0_b:buffer128 ->
in_b:buffer128 -> out_b:buffer128 -> scratch_b:buffer128 -> plain_quads:(seq quad32) ->
key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 ->
ctr_BE_orig:quad32 -> ctr_BE:quad32
-> Ghost (va_state & va_fuel & quad32)
(requires (va_require_total va_b0 (va_code_Loop6x alg) va_s0 /\ va_get_ok va_s0 /\ (sse_enabled
/\ movbe_enabled /\ count >= 2 /\ va_get_reg64 rRdx va_s0 >= 6 /\ va_get_xmm 2 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8 va_s0) iv_b 1
(va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rR14 va_s0) in0_b ((count - 1) `op_Multiply` 6) 6 (va_get_mem_layout
va_s0) Secret /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6 va_s0)
(va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 6 va_s0) (va_get_reg64 rRsi va_s0)
out_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0)
scratch_b 9 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ Vale.AES.GCTR.partial_seq_agreement plain_quads (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_s0) in_b) (count `op_Multiply` 6) (count `op_Multiply` 6 + 6) /\
(Vale.X64.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ in0_b == out_b /\
va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\ va_get_reg64 rR14 va_s0 + 96 < pow2_64 /\
va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\ aes_reqs_offset alg key_words round_keys keys_b
(va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm
15 va_s0 == FStar.Seq.Base.index #quad32 round_keys 0 /\ pclmulqdq_enabled /\ h_LE ==
Vale.AES.AES_s.aes_encrypt_LE alg key_words (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0
0 0 0) /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0)
hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ scratch_reqs scratch_b (count - 2)
(va_get_mem_heaplet 3 va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in0_b)
(va_get_xmm 7 va_s0) /\ y_prev == Vale.AES.GHash.ghash_incremental0 h_LE y_orig
(FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0)
in0_b) 0 ((count - 2) `op_Multiply` 6)) /\ y_prev == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 (add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8
va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_s0))))) /\ count `op_Multiply` 6 + 6 < pow2_32 /\ ctr_BE ==
Vale.AES.GCTR.inc32lite ctr_BE_orig (count `op_Multiply` 6) /\ va_get_xmm 2 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx
va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9
va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256
==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15
va_s0)) /\ Vale.AES.GCTR.gctr_partial alg (6 `op_Multiply` count) plain_quads
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) out_b) key_words ctr_BE_orig)))
(ensures (fun (va_sM, va_fM, y_new) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ ((va_get_reg64 rRdx va_sM > 0 ==> Vale.X64.Decls.modifies_buffer_specific128 out_b
(va_get_mem_heaplet 6 va_s0) (va_get_mem_heaplet 6 va_sM) (count `op_Multiply` 6 + 0) (count
`op_Multiply` 6 + 5)) /\ (va_get_reg64 rRdx va_sM == 0 ==> va_get_mem_heaplet 6 va_sM ==
va_get_mem_heaplet 6 va_s0) /\ Vale.X64.Decls.modifies_buffer_specific128 scratch_b
(va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 1 8 /\
Vale.X64.Decls.modifies_buffer_specific128 iv_b (va_get_mem_heaplet 2 va_s0)
(va_get_mem_heaplet 2 va_sM) 0 0 /\ va_get_reg64 rRdx va_sM == va_get_reg64 rRdx va_s0 - 6 /\
va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0 + 96 /\ va_get_reg64 rR14 va_sM ==
va_get_reg64 rR14 va_s0 + 96 /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96 /\
va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_sM ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\ (let z3' = (if
(va_get_reg64 rRdx va_sM = 0) then va_get_xmm 7 va_sM else
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 10)) in (va_get_reg64
rRbx va_sM + 6 < 256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM,
va_get_xmm 6 va_sM, z3', va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 6 ctr_BE (va_get_xmm
15 va_sM)) /\ va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0
(Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256 /\ (va_get_reg64 rRdx va_sM == 0 ==>
Vale.AES.GCTR.gctr_registers (va_get_xmm 9 va_sM) (va_get_xmm 10 va_sM) (va_get_xmm 11 va_sM)
(va_get_xmm 12 va_sM) (va_get_xmm 13 va_sM) (va_get_xmm 14 va_sM) plain_quads alg key_words
ctr_BE_orig count) /\ (let inout4' = (if (va_get_reg64 rRbx va_sM + 6 < 256) then
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 10) else va_get_xmm 13
va_sM) in (va_get_reg64 rRdx va_sM > 0 ==> (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm
11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) ==
(Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite
ctr_BE 6)) (va_get_xmm 15 va_sM), va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM,
inout4', va_get_xmm 3 va_sM)) /\ (va_get_reg64 rRdx va_sM > 0 ==> make_six_of
#Vale.X64.Decls.quad32 (fun (i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read out_b
(count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)) == make_six_of #Vale.X64.Decls.quad32
(fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.X64.Decls.buffer128_read in_b
(count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_s0)) (Vale.AES.GCTR.aes_encrypt_BE alg
key_words (Vale.AES.GCTR.inc32lite ctr_BE i)))) /\ (va_get_reg64 rRdx va_sM > 0 ==>
Vale.AES.GCTR.gctr_partial alg (6 `op_Multiply` (count + 1)) plain_quads (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_sM) out_b) key_words ctr_BE_orig) /\ y_new ==
Vale.AES.GHash.ghash_incremental0 h_LE y_orig (FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) in0_b) 0 ((count - 1) `op_Multiply` 6)) /\
(va_get_reg64 rRdx va_sM > 0 ==> y_new == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 (add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8
va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_sM)))))) /\ (va_get_reg64 rRdx va_sM == 0 ==> va_get_xmm 8 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 y_new) /\ (va_get_reg64 rRdx va_sM > 0 ==> scratch_reqs
scratch_b (count - 1) (va_get_mem_heaplet 3 va_sM) (Vale.X64.Decls.s128 (va_get_mem_heaplet 6
va_s0) in0_b) (va_get_xmm 7 va_sM)) /\ (va_get_reg64 rRdx va_sM == 0 ==> scratch_reqs scratch_b
(count - 1) (va_get_mem_heaplet 3 va_sM) (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0)
in0_b) (Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM)))))) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet
2 va_sM (va_update_mem_heaplet 6 va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM
(va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM
(va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM
(va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13
va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Loop6x (alg:algorithm) (h_LE:quad32) (y_orig:quad32) (y_prev:quad32) (count:nat)
(iv_b:buffer128) (in0_b:buffer128) (in_b:buffer128) (out_b:buffer128) (scratch_b:buffer128)
(plain_quads:(seq quad32)) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128)
(hkeys_b:buffer128) (ctr_BE_orig:quad32) (ctr_BE:quad32) (va_s0:va_state) (va_k:(va_state ->
quad32 -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ movbe_enabled /\ count >= 2 /\ va_get_reg64 rRdx va_s0 >= 6
/\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8 va_s0) iv_b 1
(va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rR14 va_s0) in0_b ((count - 1) `op_Multiply` 6) 6 (va_get_mem_layout
va_s0) Secret /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6 va_s0)
(va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 6 va_s0) (va_get_reg64 rRsi va_s0)
out_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0)
scratch_b 9 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ Vale.AES.GCTR.partial_seq_agreement plain_quads (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_s0) in_b) (count `op_Multiply` 6) (count `op_Multiply` 6 + 6) /\
(Vale.X64.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ in0_b == out_b /\
va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\ va_get_reg64 rR14 va_s0 + 96 < pow2_64 /\
va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\ aes_reqs_offset alg key_words round_keys keys_b
(va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm
15 va_s0 == FStar.Seq.Base.index #quad32 round_keys 0 /\ pclmulqdq_enabled /\ h_LE ==
Vale.AES.AES_s.aes_encrypt_LE alg key_words (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0
0 0 0) /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0)
hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ scratch_reqs scratch_b (count - 2)
(va_get_mem_heaplet 3 va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in0_b)
(va_get_xmm 7 va_s0) /\ y_prev == Vale.AES.GHash.ghash_incremental0 h_LE y_orig
(FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0)
in0_b) 0 ((count - 2) `op_Multiply` 6)) /\ y_prev == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 (add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8
va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_s0))))) /\ count `op_Multiply` 6 + 6 < pow2_32 /\ ctr_BE ==
Vale.AES.GCTR.inc32lite ctr_BE_orig (count `op_Multiply` 6) /\ va_get_xmm 2 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx
va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9
va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256
==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15
va_s0)) /\ Vale.AES.GCTR.gctr_partial alg (6 `op_Multiply` count) plain_quads
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) out_b) key_words ctr_BE_orig) /\ (forall
(va_x_mem:vale_heap) (va_x_rdi:nat64) (va_x_rsi:nat64) (va_x_rdx:nat64) (va_x_rbx:nat64)
(va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64) (va_x_r14:nat64) (va_x_xmm0:quad32)
(va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32)
(va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32)
(va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32)
(va_x_xmm15:quad32) (va_x_heap6:vale_heap) (va_x_heap2:vale_heap) (va_x_heap3:vale_heap)
(va_x_efl:Vale.X64.Flags.t) (y_new:quad32) . let va_sM = va_upd_flags va_x_efl
(va_upd_mem_heaplet 3 va_x_heap3 (va_upd_mem_heaplet 2 va_x_heap2 (va_upd_mem_heaplet 6
va_x_heap6 (va_upd_xmm 15 va_x_xmm15 (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13 va_x_xmm13
(va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9
va_x_xmm9 (va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5
va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1
va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR14 va_x_r14 (va_upd_reg64 rR13 va_x_r13
(va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRsi va_x_rsi (va_upd_reg64 rRdi va_x_rdi (va_upd_mem
va_x_mem va_s0)))))))))))))))))))))))))))) in va_get_ok va_sM /\ ((va_get_reg64 rRdx va_sM > 0
==> Vale.X64.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) (count `op_Multiply` 6 + 0) (count `op_Multiply` 6 + 5)) /\
(va_get_reg64 rRdx va_sM == 0 ==> va_get_mem_heaplet 6 va_sM == va_get_mem_heaplet 6 va_s0) /\
Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 1 8 /\ Vale.X64.Decls.modifies_buffer_specific128 iv_b
(va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) 0 0 /\ va_get_reg64 rRdx va_sM ==
va_get_reg64 rRdx va_s0 - 6 /\ va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0 + 96 /\
va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0 + 96 /\ va_get_reg64 rRsi va_sM ==
va_get_reg64 rRsi va_s0 + 96 /\ va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys
0 /\ va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6)
/\ (let z3' = va_if (va_get_reg64 rRdx va_sM = 0) (fun _ -> va_get_xmm 7 va_sM) (fun _ ->
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 10)) in (va_get_reg64
rRbx va_sM + 6 < 256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM,
va_get_xmm 6 va_sM, z3', va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 6 ctr_BE (va_get_xmm
15 va_sM)) /\ va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0
(Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256 /\ (va_get_reg64 rRdx va_sM == 0 ==>
Vale.AES.GCTR.gctr_registers (va_get_xmm 9 va_sM) (va_get_xmm 10 va_sM) (va_get_xmm 11 va_sM)
(va_get_xmm 12 va_sM) (va_get_xmm 13 va_sM) (va_get_xmm 14 va_sM) plain_quads alg key_words
ctr_BE_orig count) /\ (let inout4' = va_if (va_get_reg64 rRbx va_sM + 6 < 256) (fun _ ->
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 10)) (fun _ -> va_get_xmm
13 va_sM) in (va_get_reg64 rRdx va_sM > 0 ==> (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM,
va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) ==
(Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite
ctr_BE 6)) (va_get_xmm 15 va_sM), va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM,
inout4', va_get_xmm 3 va_sM)) /\ (va_get_reg64 rRdx va_sM > 0 ==> make_six_of
#Vale.X64.Decls.quad32 (fun (i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read out_b
(count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)) == make_six_of #Vale.X64.Decls.quad32
(fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.X64.Decls.buffer128_read in_b
(count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_s0)) (Vale.AES.GCTR.aes_encrypt_BE alg
key_words (Vale.AES.GCTR.inc32lite ctr_BE i)))) /\ (va_get_reg64 rRdx va_sM > 0 ==>
Vale.AES.GCTR.gctr_partial alg (6 `op_Multiply` (count + 1)) plain_quads (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_sM) out_b) key_words ctr_BE_orig) /\ y_new ==
Vale.AES.GHash.ghash_incremental0 h_LE y_orig (FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) in0_b) 0 ((count - 1) `op_Multiply` 6)) /\
(va_get_reg64 rRdx va_sM > 0 ==> y_new == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 (add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8
va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_sM)))))) /\ (va_get_reg64 rRdx va_sM == 0 ==> va_get_xmm 8 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 y_new) /\ (va_get_reg64 rRdx va_sM > 0 ==> scratch_reqs
scratch_b (count - 1) (va_get_mem_heaplet 3 va_sM) (Vale.X64.Decls.s128 (va_get_mem_heaplet 6
va_s0) in0_b) (va_get_xmm 7 va_sM)) /\ (va_get_reg64 rRdx va_sM == 0 ==> scratch_reqs scratch_b
(count - 1) (va_get_mem_heaplet 3 va_sM) (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0)
in0_b) (Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM)))))) ==> va_k
va_sM ((y_new))))
val va_wpProof_Loop6x : alg:algorithm -> h_LE:quad32 -> y_orig:quad32 -> y_prev:quad32 -> count:nat
-> iv_b:buffer128 -> in0_b:buffer128 -> in_b:buffer128 -> out_b:buffer128 -> scratch_b:buffer128
-> plain_quads:(seq quad32) -> key_words:(seq nat32) -> round_keys:(seq quad32) ->
keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE_orig:quad32 -> ctr_BE:quad32 -> va_s0:va_state ->
va_k:(va_state -> quad32 -> Type0)
-> Ghost (va_state & va_fuel & quad32)
(requires (va_t_require va_s0 /\ va_wp_Loop6x alg h_LE y_orig y_prev count iv_b in0_b in_b out_b
scratch_b plain_quads key_words round_keys keys_b hkeys_b ctr_BE_orig ctr_BE va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x alg) ([va_Mod_flags;
va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 6; va_Mod_xmm 15; va_Mod_xmm 14;
va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11;
va_Mod_reg64 rRbx; va_Mod_reg64 rRdx; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_mem]) va_s0
va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Transformers.Transform.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESGCM_expected_code.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
alg: Vale.AES.AES_common_s.algorithm ->
h_LE: Vale.X64.Decls.quad32 ->
y_orig: Vale.X64.Decls.quad32 ->
y_prev: Vale.X64.Decls.quad32 ->
count: Prims.nat ->
iv_b: Vale.X64.Memory.buffer128 ->
in0_b: Vale.X64.Memory.buffer128 ->
in_b: Vale.X64.Memory.buffer128 ->
out_b: Vale.X64.Memory.buffer128 ->
scratch_b: Vale.X64.Memory.buffer128 ->
plain_quads: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
key_words: FStar.Seq.Base.seq Vale.X64.Memory.nat32 ->
round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
keys_b: Vale.X64.Memory.buffer128 ->
hkeys_b: Vale.X64.Memory.buffer128 ->
ctr_BE_orig: Vale.X64.Decls.quad32 ->
ctr_BE: Vale.X64.Decls.quad32
-> Vale.X64.QuickCode.va_quickCode Vale.X64.Decls.quad32 (Vale.AES.X64.AESopt.va_code_Loop6x alg) | Prims.Tot | [
"total"
] | [] | [
"Vale.AES.AES_common_s.algorithm",
"Vale.X64.Decls.quad32",
"Prims.nat",
"Vale.X64.Memory.buffer128",
"FStar.Seq.Base.seq",
"Vale.X64.Memory.nat32",
"Vale.X64.QuickCode.va_QProc",
"Vale.AES.X64.AESopt.va_code_Loop6x",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_mem_heaplet",
"Vale.X64.QuickCode.va_Mod_xmm",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR14",
"Vale.X64.Machine_s.rR13",
"Vale.X64.Machine_s.rR12",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRsi",
"Vale.X64.Machine_s.rRdi",
"Vale.X64.QuickCode.va_Mod_mem",
"Prims.Nil",
"Vale.AES.X64.AESopt.va_wp_Loop6x",
"Vale.AES.X64.AESopt.va_wpProof_Loop6x",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Loop6x
(alg: algorithm)
(h_LE y_orig y_prev: quad32)
(count: nat)
(iv_b in0_b in_b out_b scratch_b: buffer128)
(plain_quads: (seq quad32))
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(ctr_BE_orig ctr_BE: quad32)
: (va_quickCode quad32 (va_code_Loop6x alg)) =
| (va_QProc (va_code_Loop6x alg)
([
va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 6;
va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10;
va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4;
va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR14; va_Mod_reg64 rR13;
va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_reg64 rRdx;
va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_mem
])
(va_wp_Loop6x alg h_LE y_orig y_prev count iv_b in0_b in_b out_b scratch_b plain_quads key_words
round_keys keys_b hkeys_b ctr_BE_orig ctr_BE)
(va_wpProof_Loop6x alg h_LE y_orig y_prev count iv_b in0_b in_b out_b scratch_b plain_quads
key_words round_keys keys_b hkeys_b ctr_BE_orig ctr_BE)) | false |
RW.fst | RW.return | val return (a: Type) (x: a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) | val return (a: Type) (x: a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) | let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 13,
"end_line": 75,
"start_col": 0,
"start_line": 74
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type -> x: a -> RW.m a RW.RO (fun _ -> Prims.l_True) (fun h0 y h1 -> y == x /\ h1 == h0) | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"RW.m",
"RW.RO",
"FStar.Monotonic.Heap.heap",
"Prims.l_True",
"Prims.l_and",
"Prims.eq2"
] | [] | false | false | false | false | false | let return (a: Type) (x: a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
| fun () -> x | false |
RW.fst | RW.get | val get : _: Prims.unit -> RW.RWI FStar.Monotonic.Heap.heap | let get = get_r | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 15,
"end_line": 260,
"start_col": 0,
"start_line": 260
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h
let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1
// how is subtyping handled? can I subtype on a?
// note that post is contravariant in a
let subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)
(i2:idx) (pre' : st_pre) (post' : st_bpost a)
(f : m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True))
= fun () -> f ()
unfold
let ite (p q r : Type0) = (p ==> q) /\ (~p ==> r)
let if_then_else
(a : Type) (i1:idx)
(pre1:st_pre)
(post1 : st_bpost a)
(i2 : idx)
(pre2 : st_pre)
(post2 : st_bpost a)
(f : m a i1 pre1 post1) (g : m a i2 pre2 post2)
(p : bool)
: Type
= m a (join i1 i2)
(fun h0 -> ite p (pre1 h0) (pre2 h0))
(fun h0 x h1 -> ite p (post1 h0 x h1) (post2 h0 x h1))
reifiable
reflectable
effect {
RWI (a:Type) (i:idx) (_:st_pre) (_:st_bpost a)
with {repr = m;
return = return;
bind = bind;
subcomp = subcomp;
if_then_else = if_then_else}
}
unfold
let sp #a (wp : pure_wp a) : pure_post a =
fun x -> ~ (wp (fun y -> ~(x == y)))
let lift_pure_rwi
(a:Type)
(wp : pure_wp a)
(f :unit -> PURE a wp)
// with the index-polymorphic bind above, this has to be in RO,
// or unification will usually not find the index here
: m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\ h1 == h0)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun () -> f ()
sub_effect PURE ~> RWI = lift_pure_rwi
let test_rrr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_rrw #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_rwr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_rww #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wrr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_wrw #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wwr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_www #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
let rec map #a #b
(f : a -> RWI b RO (fun _ -> True) (fun _ _ _ -> True))
(xs : list a)
: RWI (list b) RO (fun _ -> True) (fun _ _ _ -> True)
= match xs with
| [] -> []
| x::xs -> (f x)::(map f xs)
let app #a #b #i #pre #post (f : a -> RWI b i pre post) (x : a) : RWI b i pre post = f x
// can't resolve an index, providing it explicitly with #i makes it explode too
// update: actually, putting a dollar sign on f makes it work... why? I can see
// why it helps to find the index but why doesn't it explode too?
(*
* AR: Could not resolve #i in the recursive call
*)
let rec appn #a #i
(n:nat)
(f : a -> RWI a i (fun _ -> True) (fun _ _ _ -> True))
(x : a)
: RWI a i (fun _ -> True) (fun _ _ _ -> True)
= match n with
| 0 -> x
| _ -> begin
appn #_ #i (n-1) f (f x)
end
let labs0 (n:int) : RWI int RO (fun _ -> True) (fun h0 x h1 -> x >= 0 /\ h1 == h0) =
if n < 0
then -n
else n
let labs (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
if n < 0
then -n
else n
let rwi_assert (p:Type0) : RWI unit RO (fun _ -> p) (fun h0 () h1 -> h0 == h1) =
// assert p // fails
RWI?.reflect (fun () -> assert p)
let rwi_assume (p:Type0) : RWI unit RO (fun _ -> True) (fun h0 () h1 -> h0 == h1 /\ p) =
RWI?.reflect (fun () -> assume p)
let test_abs0 (n:int) : RWI int RO (fun _ -> True) (fun h0 r h1 -> r >= 0) =
let r = labs0 n in
();
();
r
let test_abs0' (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
let r = labs0 n in
let r : nat = r in // need this! an ascription won't work!
r
let test_abs (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
let r = labs n in
r
// just a test
let get_indexed (#i:idx) () : RWI H.heap i (fun _ -> True) (fun h0 x h1 -> x == h0 /\ h1 == h0) =
RWI?.reflect (fun () -> ST.get ())
let get_r () : RWI H.heap RO (fun _ -> True) (fun h0 x h1 -> x == h0 /\ h1 == h0) =
RWI?.reflect (fun () -> ST.get ()) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit -> RW.RWI FStar.Monotonic.Heap.heap | RW.RWI | [] | [] | [
"RW.get_r"
] | [] | false | true | false | false | false | let get =
| get_r | false |
|
RW.fst | RW.ro_sanity_check | val ro_sanity_check : post: (_: FStar.Monotonic.Heap.heap -> FStar.ST.st_post a) -> Prims.unit | let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post)) | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 36,
"end_line": 61,
"start_col": 0,
"start_line": 60
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | post: (_: FStar.Monotonic.Heap.heap -> FStar.ST.st_post a) -> Prims.unit | Prims.Tot | [
"total"
] | [] | [
"FStar.Monotonic.Heap.heap",
"FStar.ST.st_post",
"Prims._assert",
"RW.is_ro_post",
"RW.ro_post",
"Prims.unit"
] | [] | false | false | false | true | false | let ro_sanity_check #a (post: (H.heap -> st_post a)) =
| assert (is_ro_post (ro_post post)) | false |
|
RW.fst | RW.coerce | val coerce (#a #b: _) (x: a{a == b}) : b | val coerce (#a #b: _) (x: a{a == b}) : b | let coerce #a #b (x:a{a == b}) : b = x | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 38,
"end_line": 30,
"start_col": 0,
"start_line": 30
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: a{a == b} -> b | Prims.Tot | [
"total"
] | [] | [
"Prims.eq2"
] | [] | false | false | false | false | false | let coerce #a #b (x: a{a == b}) : b =
| x | false |
Vale.AES.X64.AESopt.fsti | Vale.AES.X64.AESopt.va_wp_Loop6x_partial | val va_wp_Loop6x_partial
(alg: algorithm)
(h_LE y_prev: quad32)
(data: (seq quad32))
(count in0_count: nat)
(iv_b in0_b in_b scratch_b: buffer128)
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(ctr_BE: quad32)
(va_s0: va_state)
(va_k: (va_state -> quad32_6 -> Type0))
: Type0 | val va_wp_Loop6x_partial
(alg: algorithm)
(h_LE y_prev: quad32)
(data: (seq quad32))
(count in0_count: nat)
(iv_b in0_b in_b scratch_b: buffer128)
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(ctr_BE: quad32)
(va_s0: va_state)
(va_k: (va_state -> quad32_6 -> Type0))
: Type0 | let va_wp_Loop6x_partial (alg:algorithm) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(count:nat) (in0_count:nat) (iv_b:buffer128) (in0_b:buffer128) (in_b:buffer128)
(scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128)
(hkeys_b:buffer128) (ctr_BE:quad32) (va_s0:va_state) (va_k:(va_state -> quad32_6 -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in sse_enabled
/\ movbe_enabled /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0
16777216 /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 6 va_s0) (va_get_reg64 rR14 va_s0) in0_b (in0_count `op_Multiply` 6) 6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp
va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64
/\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 15 va_s0 ==
FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx
va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9
va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256
==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15
va_s0)) /\ FStar.Seq.Base.length #quad32 data == 6 /\ hkeys_b_powers hkeys_b
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\
scratch_b_data true true scratch_b 8 5 (va_get_mem_heaplet 3 va_s0) (va_get_mem_layout va_s0)
(va_get_reg64 rRbp va_s0) data /\ va_get_xmm 7 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data 5) /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_s0))) == prev) /\ (forall (va_x_mem:vale_heap) (va_x_rbx:nat64)
(va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32)
(va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32)
(va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32)
(va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32)
(va_x_xmm15:quad32) (va_x_heap2:vale_heap) (va_x_heap3:vale_heap) (va_x_efl:Vale.X64.Flags.t)
(init:quad32_6) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 3 va_x_heap3
(va_upd_mem_heaplet 2 va_x_heap2 (va_upd_xmm 15 va_x_xmm15 (va_upd_xmm 14 va_x_xmm14
(va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10
va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm
6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm
2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR13 va_x_r13
(va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRbx va_x_rbx (va_upd_mem
va_x_mem va_s0))))))))))))))))))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in Vale.X64.Decls.modifies_buffer_specific128
scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 1 8 /\
Vale.X64.Decls.modifies_buffer_specific128 iv_b (va_get_mem_heaplet 2 va_s0)
(va_get_mem_heaplet 2 va_sM) 0 0 /\ (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM <
256) /\ va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0
(Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256 /\ (va_get_xmm 9 va_sM, va_get_xmm 10
va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) ==
rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64 rR13 va_sM
== Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 (Vale.X64.Decls.buffer128_read
in0_b (in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ va_get_reg64 rR12 va_sM
== Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 (Vale.X64.Decls.buffer128_read
in0_b (in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_sM,
va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3
va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor rk
(Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)))
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\
Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 5) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 3
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 4) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 4 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 3) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 5
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 2) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 6 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 1) (va_get_mem_heaplet 6 va_s0)) /\ init == make_six_of #quad32 (fun
(n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE n)) (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys
0)) /\ (let eventual_Xi = add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_sM)))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)) in
eventual_Xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data))))) ==> va_k va_sM ((init)))) | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 85,
"end_line": 619,
"start_col": 0,
"start_line": 533
} | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let aes_reqs0
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ pclmulqdq_enabled /\ avx_enabled /\
alg = AES_128 /\
//(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
buffer128_as_seq heap0 keys_b == round_keys
let aes_reqs_offset
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ avx_enabled /\ pclmulqdq_enabled /\
(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
s128 heap0 keys_b == round_keys
let six_of (a:Type0) = a & a & a & a & a & a
let quad32_6 = six_of quad32
unfold let make_six_of (#a:Type0) (f:(n:nat{n < 6}) -> GTot a) : GTot (six_of a) =
(f 0, f 1, f 2, f 3, f 4, f 5)
unfold let map_six_of (#a #b:Type0) (x:six_of a) (f:a -> GTot b) : GTot (six_of b) =
let (x0, x1, x2, x3, x4, x5) = x in
(f x0, f x1, f x2, f x3, f x4, f x5)
unfold let map2_six_of (#a #b #c:Type0) (x:six_of a) (y:six_of b) (f:a -> b -> GTot c) : GTot (six_of c) =
let (x0, x1, x2, x3, x4, x5) = x in
let (y0, y1, y2, y3, y4, y5) = y in
(f x0 y0, f x1 y1, f x2 y2, f x3 y3, f x4 y4, f x5 y5)
let rounds_opaque_6 (init:quad32_6) (round_keys:seq quad32) (rnd:nat{rnd < length round_keys}) : GTot quad32_6 =
map_six_of init (fun x -> eval_rounds x round_keys rnd)
let xor_reverse_inc32lite_6 (n i0:int) (ctr_BE rndkey:quad32) : GTot quad32_6 =
make_six_of (fun i ->
let r = reverse_bytes_quad32 (inc32lite ctr_BE (i0 + i)) in
if i < n then quad32_xor r rndkey else r)
//let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
// count * 6 + 6 <= length s /\ (
// let data = slice s (count * 6) (count * 6 + 6) in
// z3 == reverse_bytes_quad32 (index data 5) /\
// scratch_b_blocks true true scratch_b 8 5 heap3 data)
let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
count * 6 + 6 <= length s /\ (
let data = slice s (count * 6) (count * 6 + 6) in
z3 == reverse_bytes_quad32 (index data 5) /\
buffer128_read scratch_b 3 heap3 == reverse_bytes_quad32 (index data 4) /\
buffer128_read scratch_b 4 heap3 == reverse_bytes_quad32 (index data 3) /\
buffer128_read scratch_b 5 heap3 == reverse_bytes_quad32 (index data 2) /\
buffer128_read scratch_b 6 heap3 == reverse_bytes_quad32 (index data 1) /\
buffer128_read scratch_b 7 heap3 == reverse_bytes_quad32 (index data 0))
//-- Load_two_lsb
val va_code_Load_two_lsb : dst:va_operand_xmm -> Tot va_code
val va_codegen_success_Load_two_lsb : dst:va_operand_xmm -> Tot va_pbool
val va_lemma_Load_two_lsb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_two_lsb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@ va_qattr]
let va_wp_Load_two_lsb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 ==> va_k va_sM (())))
val va_wpProof_Load_two_lsb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_two_lsb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_two_lsb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Load_two_lsb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_two_lsb dst)) =
(va_QProc (va_code_Load_two_lsb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_two_lsb dst) (va_wpProof_Load_two_lsb dst))
//--
//-- Load_one_lsb
val va_code_Load_one_lsb : dst:va_operand_xmm -> Tot va_code
val va_codegen_success_Load_one_lsb : dst:va_operand_xmm -> Tot va_pbool
val va_lemma_Load_one_lsb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_one_lsb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@ va_qattr]
let va_wp_Load_one_lsb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 ==> va_k va_sM (())))
val va_wpProof_Load_one_lsb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_one_lsb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_one_lsb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Load_one_lsb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_one_lsb dst)) =
(va_QProc (va_code_Load_one_lsb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_one_lsb dst) (va_wpProof_Load_one_lsb dst))
//--
//-- Loop6x_final
val va_code_Loop6x_final : alg:algorithm -> Tot va_code
val va_codegen_success_Loop6x_final : alg:algorithm -> Tot va_pbool
val va_lemma_Loop6x_final : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> iv_b:buffer128 ->
scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
ctr_orig:quad32 -> init:quad32_6 -> ctrs:quad32_6 -> plain:quad32_6 -> inb:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop6x_final alg) va_s0 /\ va_get_ok va_s0 /\
(sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validDstAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0)
Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\ va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\
aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0
va_s0) (va_get_mem_layout va_s0) /\ init == map_six_of #quad32 #quad32 ctrs (fun (c:quad32) ->
Vale.Def.Types_s.quad32_xor c (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0)) /\
(va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm
13 va_s0, va_get_xmm 14 va_s0) == rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg
- 1) /\ va_get_reg64 rR13 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64
inb) /\ va_get_reg64 rR12 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64
inb) /\ (let rk = FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in
(va_get_xmm 2 va_s0, va_get_xmm 0 va_s0, va_get_xmm 5 va_s0, va_get_xmm 6 va_s0, va_get_xmm 7
va_s0, va_get_xmm 3 va_s0) == map_six_of #quad32 #quad32 plain (fun (p:quad32) ->
Vale.Def.Types_s.quad32_xor rk p) /\ Vale.X64.Decls.buffer128_read scratch_b 8
(va_get_mem_heaplet 3 va_s0) == Vale.Def.Types_s.reverse_bytes_quad32 ctr_orig))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 7 7 /\ Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 inb /\ (va_get_xmm 9
va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM,
va_get_xmm 14 va_sM) == map2_six_of #quad32 #quad32 #quad32 plain ctrs (fun (p:quad32)
(c:quad32) -> Vale.Def.Types_s.quad32_xor p (Vale.AES.AES_s.aes_encrypt_LE alg key_words c)) /\
va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_reg64 rRdi va_sM ==
va_get_reg64 rRdi va_s0 + 96 /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96 /\
va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_sM == Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) /\
(let ctr = Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_orig `op_Modulus` 256 in ctr + 6 <
256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM,
va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 0 ctr_orig (va_get_xmm 15
va_sM))) /\ va_state_eq va_sM (va_update_mem_heaplet 3 va_sM (va_update_flags va_sM
(va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM
(va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 7 va_sM
(va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12
va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Loop6x_final (alg:algorithm) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (ctr_orig:quad32) (init:quad32_6)
(ctrs:quad32_6) (plain:quad32_6) (inb:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0))
: Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 2 va_s0)
(va_get_reg64 rR8 va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0)
scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\
va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\ aes_reqs_offset alg key_words round_keys keys_b
(va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ init ==
map_six_of #quad32 #quad32 ctrs (fun (c:quad32) -> Vale.Def.Types_s.quad32_xor c
(FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0)) /\ (va_get_xmm 9 va_s0,
va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm
14 va_s0) == rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64
rR13 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 inb) /\ va_get_reg64
rR12 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 inb) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_s0,
va_get_xmm 0 va_s0, va_get_xmm 5 va_s0, va_get_xmm 6 va_s0, va_get_xmm 7 va_s0, va_get_xmm 3
va_s0) == map_six_of #quad32 #quad32 plain (fun (p:quad32) -> Vale.Def.Types_s.quad32_xor rk p)
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) ==
Vale.Def.Types_s.reverse_bytes_quad32 ctr_orig)) /\ (forall (va_x_mem:vale_heap)
(va_x_rdi:nat64) (va_x_rsi:nat64) (va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm5:quad32)
(va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32)
(va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32)
(va_x_xmm15:quad32) (va_x_efl:Vale.X64.Flags.t) (va_x_heap3:vale_heap) . let va_sM =
va_upd_mem_heaplet 3 va_x_heap3 (va_upd_flags va_x_efl (va_upd_xmm 15 va_x_xmm15 (va_upd_xmm 14
va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11
(va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6
va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1
va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR13 va_x_r13 (va_upd_reg64 rR12 va_x_r12
(va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRsi va_x_rsi (va_upd_reg64 rRdi va_x_rdi (va_upd_mem
va_x_mem va_s0))))))))))))))))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 7 7 /\ Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 inb /\ (va_get_xmm 9
va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM,
va_get_xmm 14 va_sM) == map2_six_of #quad32 #quad32 #quad32 plain ctrs (fun (p:quad32)
(c:quad32) -> Vale.Def.Types_s.quad32_xor p (Vale.AES.AES_s.aes_encrypt_LE alg key_words c)) /\
va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_reg64 rRdi va_sM ==
va_get_reg64 rRdi va_s0 + 96 /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96 /\
va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_sM == Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) /\
(let ctr = Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_orig `op_Modulus` 256 in ctr + 6 <
256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM,
va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 0 ctr_orig (va_get_xmm 15
va_sM))) ==> va_k va_sM (())))
val va_wpProof_Loop6x_final : alg:algorithm -> iv_b:buffer128 -> scratch_b:buffer128 ->
key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> ctr_orig:quad32 ->
init:quad32_6 -> ctrs:quad32_6 -> plain:quad32_6 -> inb:quad32 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop6x_final alg iv_b scratch_b key_words round_keys
keys_b ctr_orig init ctrs plain inb va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_final alg) ([va_Mod_mem_heaplet
3; va_Mod_flags; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11;
va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm
2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11;
va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop6x_final (alg:algorithm) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (ctr_orig:quad32) (init:quad32_6)
(ctrs:quad32_6) (plain:quad32_6) (inb:quad32) : (va_quickCode unit (va_code_Loop6x_final alg)) =
(va_QProc (va_code_Loop6x_final alg) ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 15;
va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRsi; va_Mod_reg64
rRdi; va_Mod_mem]) (va_wp_Loop6x_final alg iv_b scratch_b key_words round_keys keys_b ctr_orig
init ctrs plain inb) (va_wpProof_Loop6x_final alg iv_b scratch_b key_words round_keys keys_b
ctr_orig init ctrs plain inb))
//--
//-- Loop6x_save_output
val va_code_Loop6x_save_output : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop6x_save_output : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop6x_save_output : va_b0:va_code -> va_s0:va_state -> count:nat -> out_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop6x_save_output ()) va_s0 /\ va_get_ok va_s0 /\
(avx_enabled /\ sse_enabled /\ Vale.X64.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rRsi va_s0 - 96) out_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0)
Secret)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) (count `op_Multiply` 6 + 0) (count `op_Multiply` 6 + 5) /\
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 6 va_sM) out_b) 0 (6 `op_Multiply` count) == FStar.Seq.Base.slice
#Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 6 va_s0) out_b) 0
(6 `op_Multiply` count) /\ (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0,
va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == make_six_of #quad32 (fun
(i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read out_b (count `op_Multiply` 6 + i)
(va_get_mem_heaplet 6 va_sM)) /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM,
va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == (Vale.Def.Types_s.quad32_xor
(va_get_xmm 1 va_sM) (va_get_xmm 15 va_sM), va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm
6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM)) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_mem_heaplet 6 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm
12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0))))))))))))
[@ va_qattr]
let va_wp_Loop6x_save_output (count:nat) (out_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit
-> Type0)) : Type0 =
(va_get_ok va_s0 /\ (avx_enabled /\ sse_enabled /\ Vale.X64.Decls.validDstAddrsOffset128
(va_get_mem_heaplet 6 va_s0) (va_get_reg64 rRsi va_s0 - 96) out_b (count `op_Multiply` 6) 6
(va_get_mem_layout va_s0) Secret) /\ (forall (va_x_mem:vale_heap) (va_x_xmm9:quad32)
(va_x_xmm10:quad32) (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32)
(va_x_xmm14:quad32) (va_x_heap6:vale_heap) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_mem_heaplet 6 va_x_heap6 (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13
va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10 va_x_xmm10
(va_upd_xmm 9 va_x_xmm9 (va_upd_mem va_x_mem va_s0)))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) (count `op_Multiply` 6 + 0) (count `op_Multiply` 6 + 5) /\
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 6 va_sM) out_b) 0 (6 `op_Multiply` count) == FStar.Seq.Base.slice
#Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 6 va_s0) out_b) 0
(6 `op_Multiply` count) /\ (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0,
va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == make_six_of #quad32 (fun
(i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read out_b (count `op_Multiply` 6 + i)
(va_get_mem_heaplet 6 va_sM)) /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM,
va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == (Vale.Def.Types_s.quad32_xor
(va_get_xmm 1 va_sM) (va_get_xmm 15 va_sM), va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm
6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM)) ==> va_k va_sM (())))
val va_wpProof_Loop6x_save_output : count:nat -> out_b:buffer128 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop6x_save_output count out_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_save_output ()) ([va_Mod_flags;
va_Mod_mem_heaplet 6; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm
10; va_Mod_xmm 9; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop6x_save_output (count:nat) (out_b:buffer128) : (va_quickCode unit
(va_code_Loop6x_save_output ())) =
(va_QProc (va_code_Loop6x_save_output ()) ([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_xmm 14;
va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_mem])
(va_wp_Loop6x_save_output count out_b) (va_wpProof_Loop6x_save_output count out_b))
//--
//-- Loop6x_partial
val va_code_untransformedoriginal_Loop6x_partial : alg:algorithm -> Tot va_code
val va_codegen_success_untransformedoriginal_Loop6x_partial : alg:algorithm -> Tot va_pbool
val va_lemma_untransformedoriginal_Loop6x_partial : va_b0:va_code -> va_s0:va_state ->
alg:algorithm -> h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32) -> count:nat -> in0_count:nat
-> iv_b:buffer128 -> in0_b:buffer128 -> in_b:buffer128 -> scratch_b:buffer128 -> key_words:(seq
nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE:quad32
-> Ghost (va_state & va_fuel & quad32_6)
(requires (va_require_total va_b0 (va_code_untransformedoriginal_Loop6x_partial alg) va_s0 /\
va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in sse_enabled
/\ movbe_enabled /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0
16777216 /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 6 va_s0) (va_get_reg64 rR14 va_s0) in0_b (in0_count `op_Multiply` 6) 6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp
va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64
/\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 15 va_s0 ==
FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx
va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9
va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256
==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15
va_s0)) /\ FStar.Seq.Base.length #quad32 data == 6 /\ hkeys_b_powers hkeys_b
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\
scratch_b_data true true scratch_b 8 5 (va_get_mem_heaplet 3 va_s0) (va_get_mem_layout va_s0)
(va_get_reg64 rRbp va_s0) data /\ va_get_xmm 7 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data 5) /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_s0))) == prev)))
(ensures (fun (va_sM, va_fM, init) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in
Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 1 8 /\ Vale.X64.Decls.modifies_buffer_specific128 iv_b
(va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) 0 0 /\ (0 <= va_get_reg64 rRbx va_sM
/\ va_get_reg64 rRbx va_sM < 256) /\ va_get_reg64 rRbx va_sM ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256
/\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM,
va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys
(Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64 rR13 va_sM ==
Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ va_get_reg64 rR12 va_sM ==
Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_sM,
va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3
va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor rk
(Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)))
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\
Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 5) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 3
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 4) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 4 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 3) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 5
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 2) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 6 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 1) (va_get_mem_heaplet 6 va_s0)) /\ init == make_six_of #quad32 (fun
(n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE n)) (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys
0)) /\ (let eventual_Xi = add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_sM)))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)) in
eventual_Xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data))))) /\ va_state_eq va_sM (va_update_flags
va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM (va_update_xmm 15 va_sM
(va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM
(va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM
(va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM
(va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13
va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))))
val va_transform_Loop6x_partial : alg:algorithm -> Tot va_transformation_result
val va_code_Loop6x_partial : alg:algorithm -> Tot va_code
val va_codegen_success_Loop6x_partial : alg:algorithm -> Tot va_pbool
val va_lemma_Loop6x_partial : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> h_LE:quad32 ->
y_prev:quad32 -> data:(seq quad32) -> count:nat -> in0_count:nat -> iv_b:buffer128 ->
in0_b:buffer128 -> in_b:buffer128 -> scratch_b:buffer128 -> key_words:(seq nat32) ->
round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE:quad32
-> Ghost (va_state & va_fuel & quad32_6)
(requires (va_require_total va_b0 (va_code_Loop6x_partial alg) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in sse_enabled
/\ movbe_enabled /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0
16777216 /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 6 va_s0) (va_get_reg64 rR14 va_s0) in0_b (in0_count `op_Multiply` 6) 6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp
va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64
/\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 15 va_s0 ==
FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx
va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9
va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256
==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15
va_s0)) /\ FStar.Seq.Base.length #quad32 data == 6 /\ hkeys_b_powers hkeys_b
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\
scratch_b_data true true scratch_b 8 5 (va_get_mem_heaplet 3 va_s0) (va_get_mem_layout va_s0)
(va_get_reg64 rRbp va_s0) data /\ va_get_xmm 7 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data 5) /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_s0))) == prev)))
(ensures (fun (va_sM, va_fM, init) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in
Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 1 8 /\ Vale.X64.Decls.modifies_buffer_specific128 iv_b
(va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) 0 0 /\ (0 <= va_get_reg64 rRbx va_sM
/\ va_get_reg64 rRbx va_sM < 256) /\ va_get_reg64 rRbx va_sM ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256
/\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM,
va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys
(Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64 rR13 va_sM ==
Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ va_get_reg64 rR12 va_sM ==
Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_sM,
va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3
va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor rk
(Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)))
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\
Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 5) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 3
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 4) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 4 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 3) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 5
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 2) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 6 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 1) (va_get_mem_heaplet 6 va_s0)) /\ init == make_six_of #quad32 (fun
(n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE n)) (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys
0)) /\ (let eventual_Xi = add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_sM)))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)) in
eventual_Xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data))))) /\ va_state_eq va_sM (va_update_flags
va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM (va_update_xmm 15 va_sM
(va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM
(va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM
(va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM
(va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13
va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Transformers.Transform.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESGCM_expected_code.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
alg: Vale.AES.AES_common_s.algorithm ->
h_LE: Vale.X64.Decls.quad32 ->
y_prev: Vale.X64.Decls.quad32 ->
data: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
count: Prims.nat ->
in0_count: Prims.nat ->
iv_b: Vale.X64.Memory.buffer128 ->
in0_b: Vale.X64.Memory.buffer128 ->
in_b: Vale.X64.Memory.buffer128 ->
scratch_b: Vale.X64.Memory.buffer128 ->
key_words: FStar.Seq.Base.seq Vale.X64.Memory.nat32 ->
round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
keys_b: Vale.X64.Memory.buffer128 ->
hkeys_b: Vale.X64.Memory.buffer128 ->
ctr_BE: Vale.X64.Decls.quad32 ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Vale.AES.X64.AESopt.quad32_6 -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.AES.AES_common_s.algorithm",
"Vale.X64.Decls.quad32",
"FStar.Seq.Base.seq",
"Prims.nat",
"Vale.X64.Memory.buffer128",
"Vale.X64.Memory.nat32",
"Vale.X64.Decls.va_state",
"Vale.AES.X64.AESopt.quad32_6",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.X64.CPU_Features_s.sse_enabled",
"Vale.X64.CPU_Features_s.movbe_enabled",
"Prims.eq2",
"Vale.Def.Words_s.four",
"Vale.Def.Types_s.nat32",
"Vale.X64.Decls.va_get_xmm",
"Vale.Def.Words_s.Mkfour",
"Vale.X64.Decls.validDstAddrs128",
"Vale.X64.Decls.va_get_mem_heaplet",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rR8",
"Vale.X64.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Public",
"Vale.X64.Decls.validSrcAddrsOffset128",
"Vale.X64.Machine_s.rR14",
"Prims.op_Multiply",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.X64.Machine_s.rRdi",
"Vale.X64.Machine_s.rRbp",
"Prims.op_LessThan",
"Prims.op_Addition",
"Vale.X64.Machine_s.pow2_64",
"Vale.AES.X64.AESopt.aes_reqs_offset",
"Vale.X64.Machine_s.rRcx",
"FStar.Seq.Base.index",
"Vale.Def.Types_s.quad32",
"Vale.Def.Types_s.reverse_bytes_quad32",
"Vale.AES.GCTR.inc32lite",
"Prims.int",
"Vale.X64.Machine_s.rRbx",
"Prims.op_Modulus",
"Vale.Def.Words_s.__proj__Mkfour__item__lo0",
"Vale.Def.Types_s.quad32_xor",
"Prims.l_imp",
"FStar.Pervasives.Native.tuple6",
"FStar.Pervasives.Native.Mktuple6",
"Vale.AES.X64.AESopt.xor_reverse_inc32lite_6",
"FStar.Seq.Base.length",
"Vale.AES.X64.AESopt2.hkeys_b_powers",
"Prims.op_Subtraction",
"Vale.X64.Machine_s.rR9",
"Vale.AES.X64.AESopt2.scratch_b_data",
"Vale.AES.X64.AESopt2.va_subscript_FStar__Seq__Base__seq",
"Vale.Math.Poly2_s.poly",
"Vale.Math.Poly2_s.add",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Vale.X64.Decls.buffer128_read",
"Prims.l_Forall",
"Vale.X64.InsBasic.vale_heap",
"Vale.X64.Memory.nat64",
"Vale.X64.Flags.t",
"Vale.X64.Decls.modifies_buffer_specific128",
"Prims.op_LessThanOrEqual",
"Vale.AES.X64.AESopt.rounds_opaque_6",
"Vale.AES.AES_common_s.nr",
"Vale.Def.Types_s.nat64",
"Vale.X64.Machine_s.rR13",
"Vale.Def.Types_s.reverse_bytes_nat64",
"Vale.Arch.Types.hi64",
"Vale.X64.Machine_s.rR12",
"Vale.Arch.Types.lo64",
"Vale.AES.X64.AESopt.make_six_of",
"Vale.X64.Decls.va_int_range",
"Vale.AES.X64.AESopt.six_of",
"Vale.AES.GHash.ghash_incremental",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_mem_heaplet",
"Vale.X64.Decls.va_upd_xmm",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Decls.va_upd_mem"
] | [] | false | false | false | true | true | let va_wp_Loop6x_partial
(alg: algorithm)
(h_LE y_prev: quad32)
(data: (seq quad32))
(count in0_count: nat)
(iv_b in0_b in_b scratch_b: buffer128)
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(ctr_BE: quad32)
(va_s0: va_state)
(va_k: (va_state -> quad32_6 -> Type0))
: Type0 =
| (va_get_ok va_s0 /\
(let h:Vale.Math.Poly2_s.poly =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE)
in
let prev:Vale.Math.Poly2_s.poly =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev)
in
sse_enabled /\ movbe_enabled /\
va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0)
(va_get_reg64 rR8 va_s0)
iv_b
1
(va_get_mem_layout va_s0)
Public /\
Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6 va_s0)
(va_get_reg64 rR14 va_s0)
in0_b
(in0_count `op_Multiply` 6)
6
(va_get_mem_layout va_s0)
Secret /\
Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6 va_s0)
(va_get_reg64 rRdi va_s0)
in_b
(count `op_Multiply` 6)
6
(va_get_mem_layout va_s0)
Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0)
(va_get_reg64 rRbp va_s0)
scratch_b
9
(va_get_mem_layout va_s0)
Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\
aes_reqs_offset alg
key_words
round_keys
keys_b
(va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0)
(va_get_mem_layout va_s0) /\ va_get_xmm 15 va_s0 == FStar.Seq.Base.index #quad32 round_keys 0 /\
va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\
va_get_reg64 rRbx va_s0 == (Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE) `op_Modulus` 256 /\
va_get_xmm 9 va_s0 ==
Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE
0))
(va_get_xmm 15 va_s0) /\
(va_get_reg64 rRbx va_s0 + 6 < 256 ==>
(va_get_xmm 9 va_s0,
va_get_xmm 10 va_s0,
va_get_xmm 11 va_s0,
va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0,
va_get_xmm 14 va_s0) ==
xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15 va_s0)) /\
FStar.Seq.Base.length #quad32 data == 6 /\
hkeys_b_powers hkeys_b
(va_get_mem_heaplet 0 va_s0)
(va_get_mem_layout va_s0)
(va_get_reg64 rR9 va_s0 - 32)
h /\
scratch_b_data true
true
scratch_b
8
5
(va_get_mem_heaplet 3 va_s0)
(va_get_mem_layout va_s0)
(va_get_reg64 rRbp va_s0)
data /\
va_get_xmm 7 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (va_subscript_FStar__Seq__Base__seq data 5) /\
add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b
1
(va_get_mem_heaplet 3 va_s0))) ==
prev) /\
(forall (va_x_mem: vale_heap) (va_x_rbx: nat64) (va_x_r11: nat64) (va_x_r12: nat64)
(va_x_r13: nat64) (va_x_xmm0: quad32) (va_x_xmm1: quad32) (va_x_xmm2: quad32)
(va_x_xmm3: quad32) (va_x_xmm4: quad32) (va_x_xmm5: quad32) (va_x_xmm6: quad32)
(va_x_xmm7: quad32) (va_x_xmm8: quad32) (va_x_xmm9: quad32) (va_x_xmm10: quad32)
(va_x_xmm11: quad32) (va_x_xmm12: quad32) (va_x_xmm13: quad32) (va_x_xmm14: quad32)
(va_x_xmm15: quad32) (va_x_heap2: vale_heap) (va_x_heap3: vale_heap)
(va_x_efl: Vale.X64.Flags.t) (init: quad32_6).
let va_sM =
va_upd_flags va_x_efl
(va_upd_mem_heaplet 3
va_x_heap3
(va_upd_mem_heaplet 2
va_x_heap2
(va_upd_xmm 15
va_x_xmm15
(va_upd_xmm 14
va_x_xmm14
(va_upd_xmm 13
va_x_xmm13
(va_upd_xmm 12
va_x_xmm12
(va_upd_xmm 11
va_x_xmm11
(va_upd_xmm 10
va_x_xmm10
(va_upd_xmm 9
va_x_xmm9
(va_upd_xmm 8
va_x_xmm8
(va_upd_xmm 7
va_x_xmm7
(va_upd_xmm 6
va_x_xmm6
(va_upd_xmm 5
va_x_xmm5
(va_upd_xmm 4
va_x_xmm4
(va_upd_xmm 3
va_x_xmm3
(va_upd_xmm 2
va_x_xmm2
(va_upd_xmm 1
va_x_xmm1
(va_upd_xmm 0
va_x_xmm0
(va_upd_reg64 rR13
va_x_r13
(va_upd_reg64 rR12
va_x_r12
(va_upd_reg64
rR11
va_x_r11
(va_upd_reg64
rRbx
va_x_rbx
(va_upd_mem
va_x_mem
va_s0
))
))))))))))
)))))))))))
in
va_get_ok va_sM /\
(let h:Vale.Math.Poly2_s.poly =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE)
in
let prev:Vale.Math.Poly2_s.poly =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev)
in
Vale.X64.Decls.modifies_buffer_specific128 scratch_b
(va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM)
1
8 /\
Vale.X64.Decls.modifies_buffer_specific128 iv_b
(va_get_mem_heaplet 2 va_s0)
(va_get_mem_heaplet 2 va_sM)
0
0 /\ (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM < 256) /\
va_get_reg64 rRbx va_sM ==
(Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6))
`op_Modulus`
256 /\
(va_get_xmm 9 va_sM,
va_get_xmm 10 va_sM,
va_get_xmm 11 va_sM,
va_get_xmm 12 va_sM,
va_get_xmm 13 va_sM,
va_get_xmm 14 va_sM) ==
rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg - 1) /\
va_get_reg64 rR13 va_sM ==
Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 0)
(va_get_mem_heaplet 6 va_sM))) /\
va_get_reg64 rR12 va_sM ==
Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 0)
(va_get_mem_heaplet 6 va_sM))) /\
(let rk = FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in
(va_get_xmm 2 va_sM,
va_get_xmm 0 va_sM,
va_get_xmm 5 va_sM,
va_get_xmm 6 va_sM,
va_get_xmm 7 va_sM,
va_get_xmm 3 va_sM) ==
make_six_of #quad32
(fun (i: (va_int_range 0 5)) ->
Vale.Def.Types_s.quad32_xor rk
(Vale.X64.Decls.buffer128_read in_b
(count `op_Multiply` 6 + i)
(va_get_mem_heaplet 6 va_sM))) /\
Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\
Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 5)
(va_get_mem_heaplet 6 va_s0)) /\
Vale.X64.Decls.buffer128_read scratch_b 3 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 4)
(va_get_mem_heaplet 6 va_s0)) /\
Vale.X64.Decls.buffer128_read scratch_b 4 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 3)
(va_get_mem_heaplet 6 va_s0)) /\
Vale.X64.Decls.buffer128_read scratch_b 5 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 2)
(va_get_mem_heaplet 6 va_s0)) /\
Vale.X64.Decls.buffer128_read scratch_b 6 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 1)
(va_get_mem_heaplet 6 va_s0)) /\
init ==
make_six_of #quad32
(fun (n: (va_int_range 0 5)) ->
Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite
ctr_BE
n))
(FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0)) /\
(let eventual_Xi =
add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b
1
(va_get_mem_heaplet 3 va_sM))))
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM))
in
eventual_Xi ==
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental
h_LE
y_prev
data))))) ==>
va_k va_sM ((init)))) | false |
RW.fst | RW.test_rww | val test_rww
(#pre #post: _)
(b: bool)
(f: (unit -> RWI int RO pre post))
(g: (unit -> RWI int RW pre post))
: RWI int RW pre post | val test_rww
(#pre #post: _)
(b: bool)
(f: (unit -> RWI int RO pre post))
(g: (unit -> RWI int RW pre post))
: RWI int RW pre post | let test_rww #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g () | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 149,
"end_line": 180,
"start_col": 0,
"start_line": 180
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h
let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1
// how is subtyping handled? can I subtype on a?
// note that post is contravariant in a
let subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)
(i2:idx) (pre' : st_pre) (post' : st_bpost a)
(f : m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True))
= fun () -> f ()
unfold
let ite (p q r : Type0) = (p ==> q) /\ (~p ==> r)
let if_then_else
(a : Type) (i1:idx)
(pre1:st_pre)
(post1 : st_bpost a)
(i2 : idx)
(pre2 : st_pre)
(post2 : st_bpost a)
(f : m a i1 pre1 post1) (g : m a i2 pre2 post2)
(p : bool)
: Type
= m a (join i1 i2)
(fun h0 -> ite p (pre1 h0) (pre2 h0))
(fun h0 x h1 -> ite p (post1 h0 x h1) (post2 h0 x h1))
reifiable
reflectable
effect {
RWI (a:Type) (i:idx) (_:st_pre) (_:st_bpost a)
with {repr = m;
return = return;
bind = bind;
subcomp = subcomp;
if_then_else = if_then_else}
}
unfold
let sp #a (wp : pure_wp a) : pure_post a =
fun x -> ~ (wp (fun y -> ~(x == y)))
let lift_pure_rwi
(a:Type)
(wp : pure_wp a)
(f :unit -> PURE a wp)
// with the index-polymorphic bind above, this has to be in RO,
// or unification will usually not find the index here
: m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\ h1 == h0)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun () -> f ()
sub_effect PURE ~> RWI = lift_pure_rwi
let test_rrr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_rrw #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_rwr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | b: Prims.bool -> f: (_: Prims.unit -> RW.RWI Prims.int) -> g: (_: Prims.unit -> RW.RWI Prims.int)
-> RW.RWI Prims.int | RW.RWI | [] | [] | [
"FStar.ST.st_pre",
"RW.st_bpost",
"Prims.int",
"Prims.bool",
"Prims.unit",
"RW.RO",
"RW.RW"
] | [] | false | true | false | false | false | let test_rww
#pre
#post
(b: bool)
(f: (unit -> RWI int RO pre post))
(g: (unit -> RWI int RW pre post))
: RWI int RW pre post =
| if b then f () else g () | false |
RW.fst | RW.subcomp | val subcomp
(a: Type)
(i1: idx)
(pre: st_pre)
(post: st_bpost a)
(i2: idx)
(pre': st_pre)
(post': st_bpost a)
(f: m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True)) | val subcomp
(a: Type)
(i1: idx)
(pre: st_pre)
(post: st_bpost a)
(i2: idx)
(pre': st_pre)
(post': st_bpost a)
(f: m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True)) | let subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)
(i2:idx) (pre' : st_pre) (post' : st_bpost a)
(f : m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True))
= fun () -> f () | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 18,
"end_line": 127,
"start_col": 0,
"start_line": 121
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h
let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1
// how is subtyping handled? can I subtype on a? | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Type ->
i1: RW.idx ->
pre: FStar.ST.st_pre ->
post: RW.st_bpost a ->
i2: RW.idx ->
pre': FStar.ST.st_pre ->
post': RW.st_bpost a ->
f: RW.m a i1 pre post
-> Prims.Pure (RW.m a i2 pre' post') | Prims.Pure | [] | [] | [
"RW.idx",
"FStar.ST.st_pre",
"RW.st_bpost",
"RW.m",
"Prims.unit",
"Prims.l_and",
"RW.flows",
"RW.pre_leq",
"RW.post_leq",
"Prims.l_True"
] | [] | false | false | false | false | false | let subcomp
(a: Type)
(i1: idx)
(pre: st_pre)
(post: st_bpost a)
(i2: idx)
(pre': st_pre)
(post': st_bpost a)
(f: m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True)) =
| fun () -> f () | false |
RW.fst | RW.bind | val bind
(a b: Type)
(i: idx)
(pre: st_pre)
(post: st_bpost a)
(i': idx)
(pre': (a -> st_pre))
(post': (a -> st_bpost b))
(c: m a i pre post)
(f: (x: a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post')) | val bind
(a b: Type)
(i: idx)
(pre: st_pre)
(post: st_bpost a)
(i': idx)
(pre': (a -> st_pre))
(post': (a -> st_bpost b))
(c: m a i pre post)
(f: (x: a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post')) | let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x () | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 36,
"end_line": 103,
"start_col": 0,
"start_line": 96
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Type ->
b: Type ->
i: RW.idx ->
pre: FStar.ST.st_pre ->
post: RW.st_bpost a ->
i': RW.idx ->
pre': (_: a -> FStar.ST.st_pre) ->
post': (_: a -> RW.st_bpost b) ->
c: RW.m a i pre post ->
f: (x: a -> RW.m b i' (pre' x) (post' x))
-> RW.m b (RW.join i i') (RW.bind_pre i i' pre pre' post) (RW.bind_post i i' pre post post') | Prims.Tot | [
"total"
] | [] | [
"RW.idx",
"FStar.ST.st_pre",
"RW.st_bpost",
"RW.m",
"Prims.unit",
"RW.join",
"RW.bind_pre",
"RW.bind_post"
] | [] | false | false | false | false | false | let bind
(a b: Type)
(i: idx)
(pre: st_pre)
(post: st_bpost a)
(i': idx)
(pre': (a -> st_pre))
(post': (a -> st_bpost b))
(c: m a i pre post)
(f: (x: a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post')) =
| fun () ->
let x = c () in
f x () | false |
RW.fst | RW.rwi_subtype | val rwi_subtype (a b: Type) (inj: (a -> b)) (i: idx) (pre: _) (post: st_bpost a) (c: m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) | val rwi_subtype (a b: Type) (inj: (a -> b)) (i: idx) (pre: _) (post: st_bpost a) (c: m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) | let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x)) | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 56,
"end_line": 111,
"start_col": 0,
"start_line": 106
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Type ->
b: Type ->
inj: (_: a -> b) ->
i: RW.idx ->
pre: FStar.ST.st_pre ->
post: RW.st_bpost a ->
c: RW.m a i pre post
-> RW.m b i pre (fun h0 x h1 -> exists (x0: a). x == inj x0 /\ post h0 x0 h1) | Prims.Tot | [
"total"
] | [] | [
"RW.idx",
"FStar.ST.st_pre",
"RW.st_bpost",
"RW.m",
"RW.bind",
"RW.RO",
"FStar.Monotonic.Heap.heap",
"Prims.l_True",
"Prims.l_and",
"Prims.eq2",
"RW.return",
"Prims.l_Exists"
] | [] | false | false | false | false | false | let rwi_subtype (a b: Type) (inj: (a -> b)) (i: idx) (pre: _) (post: st_bpost a) (c: m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
| bind _ _ _ _ _ _ _ _ c (fun (x: a) -> return _ (inj x)) | false |
Hacl.Impl.FFDHE.fst | Hacl.Impl.FFDHE.ffdhe_compute_exp | val ffdhe_compute_exp:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t ->
ffdhe_compute_exp_st t a len ke | val ffdhe_compute_exp:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t ->
ffdhe_compute_exp_st t a len ke | let ffdhe_compute_exp #t a len ke p_r2_n sk_n b_n res =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let r2_n = sub p_r2_n nLen nLen in
let res_n = create nLen (uint #t #SEC 0) in
let h1 = ST.get () in
S.ffdhe_p_lemma a;
assert_norm (pow2 4 = 16);
assert_norm (pow2 10 = 1024);
Math.Lemmas.pow2_plus 4 10;
Math.Lemmas.pow2_lt_compat 32 14;
SD.bn_eval_bound #t (as_seq h1 sk_n) (v nLen);
BE.mk_bn_mod_exp_precompr2 nLen ke.BE.exp_ct_precomp p_n r2_n b_n (size (bits t) *! nLen) sk_n res_n; //b_n ^ sk_n % p_n
let h2 = ST.get () in
BN.bn_to_bytes_be len res_n res;
SB.bn_to_bytes_be_lemma (v len) (as_seq h2 res_n);
pop_frame () | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 14,
"end_line": 264,
"start_col": 0,
"start_line": 243
} | module Hacl.Impl.FFDHE
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.FFDHE.Constants
open Hacl.Bignum.Definitions
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module S = Spec.FFDHE
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Lemmas = Hacl.Spec.FFDHE.Lemmas
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module BE = Hacl.Bignum.Exponentiation
module SB = Hacl.Spec.Bignum
module SM = Hacl.Spec.Bignum.Montgomery
module SE = Hacl.Spec.Bignum.Exponentiation
module SD = Hacl.Spec.Bignum.Definitions
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let size_pos = x:size_t{v x > 0}
[@CInline]
let ffdhe_len (a:S.ffdhe_alg) : x:size_pos{v x = S.ffdhe_len a} =
allow_inversion S.ffdhe_alg;
match a with
| S.FFDHE2048 -> 256ul
| S.FFDHE3072 -> 384ul
| S.FFDHE4096 -> 512ul
| S.FFDHE6144 -> 768ul
| S.FFDHE8192 -> 1024ul
inline_for_extraction noextract
let get_ffdhe_p (a:S.ffdhe_alg) :x:glbuffer pub_uint8 (ffdhe_len a)
{witnessed x (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) /\ recallable x}
=
allow_inversion S.ffdhe_alg;
match a with
| S.FFDHE2048 -> ffdhe_p2048
| S.FFDHE3072 -> ffdhe_p3072
| S.FFDHE4096 -> ffdhe_p4096
| S.FFDHE6144 -> ffdhe_p6144
| S.FFDHE8192 -> ffdhe_p8192
inline_for_extraction noextract
val ffdhe_p_to_ps:
a:S.ffdhe_alg
-> p_s:lbuffer uint8 (ffdhe_len a) ->
Stack unit
(requires fun h -> live h p_s)
(ensures fun h0 _ h1 -> modifies (loc p_s) h0 h1 /\
BSeq.nat_from_intseq_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) ==
BSeq.nat_from_intseq_be (as_seq h1 p_s))
let ffdhe_p_to_ps a p_s =
let p = get_ffdhe_p a in
recall_contents p (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a));
let len = ffdhe_len a in
mapT len p_s secret p;
BSeq.nat_from_intseq_be_public_to_secret (v len) (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a))
inline_for_extraction noextract
let ffdhe_bn_from_g_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) =
g_n:lbignum t (blocks len (size (numbytes t))) ->
Stack unit
(requires fun h ->
live h g_n /\
v len = S.ffdhe_len a /\
as_seq h g_n == LSeq.create (v (blocks len (size (numbytes t)))) (uint #t 0))
(ensures fun h0 _ h1 -> modifies (loc g_n) h0 h1 /\
bn_v h1 g_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_g (S.get_ffdhe_params a)))
inline_for_extraction noextract
val ffdhe_bn_from_g: #t:limb_t -> a:S.ffdhe_alg -> len:size_pos -> ffdhe_bn_from_g_st t a len
let ffdhe_bn_from_g #t a len g_n =
recall_contents ffdhe_g2 S.ffdhe_g2;
[@inline_let] let nLen = blocks len (size (numbytes t)) in
push_frame ();
let g = create 1ul (u8 0) in
mapT 1ul g secret ffdhe_g2;
BSeq.nat_from_intseq_be_public_to_secret 1 S.ffdhe_g2;
let h0 = ST.get () in
update_sub_f h0 g_n 0ul 1ul
(fun h -> SB.bn_from_bytes_be 1 (as_seq h0 g))
(fun _ -> BN.bn_from_bytes_be 1ul g (sub g_n 0ul 1ul));
let h1 = ST.get () in
SD.bn_eval_update_sub #t 1 (SB.bn_from_bytes_be 1 (as_seq h0 g)) (v nLen);
assert (bn_v h1 g_n == SD.bn_v (SB.bn_from_bytes_be #t 1 (as_seq h0 g)));
SB.bn_from_bytes_be_lemma #t 1 (as_seq h0 g);
assert (bn_v h1 g_n == BSeq.nat_from_bytes_be (as_seq h0 g));
pop_frame ()
inline_for_extraction noextract
let ffdhe_precomp_inv (#t:limb_t) (#len:size_nat{0 < len /\ len + len <= max_size_t})
(a:S.ffdhe_alg) (p_r2_n:SD.lbignum t (len + len))
=
let p_n = LSeq.sub p_r2_n 0 len in
let r2_n = LSeq.sub p_r2_n len len in
SD.bn_v p_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) /\
0 < SD.bn_v p_n /\ SD.bn_v r2_n == pow2 (2 * bits t * len) % SD.bn_v p_n
inline_for_extraction noextract
let ffdhe_precomp_p_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen) ->
Stack unit
(requires fun h ->
live h p_r2_n /\
v len = S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen)
(ensures fun h0 _ h1 -> modifies (loc p_r2_n) h0 h1 /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h1 p_r2_n))
inline_for_extraction noextract
val ffdhe_precomp_p:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t ->
ffdhe_precomp_p_st t a len ke
let ffdhe_precomp_p #t a len ke p_r2_n =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let r2_n = sub p_r2_n nLen nLen in
let p_s = create len (u8 0) in
ffdhe_p_to_ps a p_s;
let h0 = ST.get () in
BN.bn_from_bytes_be len p_s p_n;
let h1 = ST.get () in
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 p_s);
assert (bn_v h1 p_n == BSeq.nat_from_bytes_be (as_seq h0 p_s));
S.ffdhe_p_lemma a;
Lemmas.ffdhe_p_bits_lemma a;
ke.BE.precompr2 (8ul *! len -! 1ul) p_n r2_n;
SM.bn_precomp_r2_mod_n_lemma (8 * v len - 1) (as_seq h1 p_n);
pop_frame ()
inline_for_extraction noextract
let new_ffdhe_precomp_p_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
r:HS.rid ->
ST (B.buffer (limb t))
(requires fun h ->
ST.is_eternal_region r /\
v len = S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen)
(ensures fun h0 res h1 ->
B.(modifies loc_none h0 h1) /\
not (B.g_is_null res) ==> (
B.len res == nLen +! nLen /\
B.(fresh_loc (loc_buffer res) h0 h1) /\
B.(loc_includes (loc_region_only false r) (loc_buffer res)) /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h1 (res <: lbignum t (nLen +! nLen)))))
inline_for_extraction noextract
val new_ffdhe_precomp_p:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_precomp_p:ffdhe_precomp_p_st t a len ke ->
new_ffdhe_precomp_p_st t a len ke
let new_ffdhe_precomp_p #t a len ke ffdhe_precomp_p r =
let h0 = ST.get () in
let nLen = blocks len (size (numbytes t)) in
assert (v (nLen +! nLen) > 0);
let res = LowStar.Monotonic.Buffer.mmalloc_partial r (uint #t #SEC 0) (nLen +! nLen) in
if B.is_null res then
res
else
let h1 = ST.get () in
B.(modifies_only_not_unused_in loc_none h0 h1);
assert (B.len res == nLen +! nLen);
let res: Lib.Buffer.buffer (limb t) = res in
assert (B.length res == v nLen + v nLen);
let res: lbignum t (nLen +! nLen) = res in
ffdhe_precomp_p res;
let h2 = ST.get () in
B.(modifies_only_not_unused_in loc_none h0 h2);
res
inline_for_extraction noextract
let ffdhe_compute_exp_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen)
-> sk_n:lbignum t nLen
-> b_n:lbignum t nLen
-> res:lbuffer uint8 len ->
Stack unit
(requires fun h ->
live h p_r2_n /\ live h sk_n /\ live h b_n /\ live h res /\
disjoint p_r2_n res /\ disjoint sk_n res /\ disjoint b_n res /\
disjoint p_r2_n b_n /\ disjoint p_r2_n sk_n /\
v len == S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h p_r2_n) /\
bn_v h b_n < bn_v h (gsub p_r2_n 0ul nLen) - 1 /\
1 < bn_v h sk_n)
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
(S.ffdhe_p_lemma a;
let res_n = Lib.NatMod.pow_mod #(bn_v h0 (gsub p_r2_n 0ul nLen)) (bn_v h0 b_n) (bn_v h0 sk_n) in
as_seq h1 res == BSeq.nat_to_bytes_be (v len) res_n))
#push-options "--z3rlimit 100"
inline_for_extraction noextract
val ffdhe_compute_exp:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t ->
ffdhe_compute_exp_st t a len ke | {
"checked_file": "/",
"dependencies": [
"Spec.FFDHE.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.FFDHE.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.Exponentiation.fsti.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"Hacl.Impl.FFDHE.Constants.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Base.fst.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.FFDHE.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Exponentiation",
"short_module": "SE"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "SM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "SB"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.FFDHE.Lemmas",
"short_module": "Lemmas"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "Spec.FFDHE",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.FFDHE.Constants",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Spec.FFDHE.ffdhe_alg -> len: Hacl.Impl.FFDHE.size_pos -> ke: Hacl.Bignum.Exponentiation.exp t
-> Hacl.Impl.FFDHE.ffdhe_compute_exp_st t a len ke | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Definitions.limb_t",
"Spec.FFDHE.ffdhe_alg",
"Hacl.Impl.FFDHE.size_pos",
"Hacl.Bignum.Exponentiation.exp",
"Hacl.Bignum.Definitions.lbignum",
"Lib.IntTypes.op_Plus_Bang",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Hacl.Bignum.Definitions.blocks",
"Lib.IntTypes.size",
"Lib.IntTypes.numbytes",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.HyperStack.ST.pop_frame",
"Prims.unit",
"Hacl.Spec.Bignum.bn_to_bytes_be_lemma",
"Lib.IntTypes.v",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"Hacl.Bignum.Definitions.limb",
"Hacl.Bignum.bn_to_bytes_be",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Hacl.Bignum.Exponentiation.mk_bn_mod_exp_precompr2",
"Hacl.Bignum.Exponentiation.__proj__Mkexp__item__exp_ct_precomp",
"Lib.IntTypes.op_Star_Bang",
"Lib.IntTypes.bits",
"Hacl.Spec.Bignum.Definitions.bn_eval_bound",
"FStar.Math.Lemmas.pow2_lt_compat",
"FStar.Math.Lemmas.pow2_plus",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.pow2",
"Spec.FFDHE.ffdhe_p_lemma",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.create",
"Lib.IntTypes.uint",
"Lib.IntTypes.SEC",
"Lib.Buffer.sub",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.int_t",
"Prims.eq2",
"Prims.l_or",
"Lib.IntTypes.range",
"Prims.l_and",
"Prims.op_GreaterThan",
"Prims.op_LessThanOrEqual",
"Prims.op_Subtraction",
"Prims.op_Multiply",
"Lib.IntTypes.mk_int",
"Hacl.Spec.Bignum.Definitions.blocks",
"FStar.HyperStack.ST.push_frame"
] | [] | false | false | false | false | false | let ffdhe_compute_exp #t a len ke p_r2_n sk_n b_n res =
| push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let r2_n = sub p_r2_n nLen nLen in
let res_n = create nLen (uint #t #SEC 0) in
let h1 = ST.get () in
S.ffdhe_p_lemma a;
assert_norm (pow2 4 = 16);
assert_norm (pow2 10 = 1024);
Math.Lemmas.pow2_plus 4 10;
Math.Lemmas.pow2_lt_compat 32 14;
SD.bn_eval_bound #t (as_seq h1 sk_n) (v nLen);
BE.mk_bn_mod_exp_precompr2 nLen ke.BE.exp_ct_precomp p_n r2_n b_n (size (bits t) *! nLen) sk_n res_n;
let h2 = ST.get () in
BN.bn_to_bytes_be len res_n res;
SB.bn_to_bytes_be_lemma (v len) (as_seq h2 res_n);
pop_frame () | false |
Hacl.Impl.FFDHE.fst | Hacl.Impl.FFDHE.ffdhe_secret_to_public_precomp | val ffdhe_secret_to_public_precomp:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_compute_exp:ffdhe_compute_exp_st t a len ke ->
ffdhe_secret_to_public_precomp_st t a len ke | val ffdhe_secret_to_public_precomp:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_compute_exp:ffdhe_compute_exp_st t a len ke ->
ffdhe_secret_to_public_precomp_st t a len ke | let ffdhe_secret_to_public_precomp #t a len ke ffdhe_compute_exp p_r2_n sk pk =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let g_n = create nLen (uint #t #SEC 0) in
ffdhe_bn_from_g a len g_n;
let sk_n = create nLen (uint #t #SEC 0) in
let h0 = ST.get () in
BN.bn_from_bytes_be len sk sk_n;
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 sk);
S.ffdhe_g2_lemma ();
S.ffdhe_p_lemma a;
ffdhe_compute_exp p_r2_n sk_n g_n pk;
pop_frame () | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 14,
"end_line": 310,
"start_col": 0,
"start_line": 296
} | module Hacl.Impl.FFDHE
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.FFDHE.Constants
open Hacl.Bignum.Definitions
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module S = Spec.FFDHE
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Lemmas = Hacl.Spec.FFDHE.Lemmas
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module BE = Hacl.Bignum.Exponentiation
module SB = Hacl.Spec.Bignum
module SM = Hacl.Spec.Bignum.Montgomery
module SE = Hacl.Spec.Bignum.Exponentiation
module SD = Hacl.Spec.Bignum.Definitions
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let size_pos = x:size_t{v x > 0}
[@CInline]
let ffdhe_len (a:S.ffdhe_alg) : x:size_pos{v x = S.ffdhe_len a} =
allow_inversion S.ffdhe_alg;
match a with
| S.FFDHE2048 -> 256ul
| S.FFDHE3072 -> 384ul
| S.FFDHE4096 -> 512ul
| S.FFDHE6144 -> 768ul
| S.FFDHE8192 -> 1024ul
inline_for_extraction noextract
let get_ffdhe_p (a:S.ffdhe_alg) :x:glbuffer pub_uint8 (ffdhe_len a)
{witnessed x (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) /\ recallable x}
=
allow_inversion S.ffdhe_alg;
match a with
| S.FFDHE2048 -> ffdhe_p2048
| S.FFDHE3072 -> ffdhe_p3072
| S.FFDHE4096 -> ffdhe_p4096
| S.FFDHE6144 -> ffdhe_p6144
| S.FFDHE8192 -> ffdhe_p8192
inline_for_extraction noextract
val ffdhe_p_to_ps:
a:S.ffdhe_alg
-> p_s:lbuffer uint8 (ffdhe_len a) ->
Stack unit
(requires fun h -> live h p_s)
(ensures fun h0 _ h1 -> modifies (loc p_s) h0 h1 /\
BSeq.nat_from_intseq_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) ==
BSeq.nat_from_intseq_be (as_seq h1 p_s))
let ffdhe_p_to_ps a p_s =
let p = get_ffdhe_p a in
recall_contents p (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a));
let len = ffdhe_len a in
mapT len p_s secret p;
BSeq.nat_from_intseq_be_public_to_secret (v len) (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a))
inline_for_extraction noextract
let ffdhe_bn_from_g_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) =
g_n:lbignum t (blocks len (size (numbytes t))) ->
Stack unit
(requires fun h ->
live h g_n /\
v len = S.ffdhe_len a /\
as_seq h g_n == LSeq.create (v (blocks len (size (numbytes t)))) (uint #t 0))
(ensures fun h0 _ h1 -> modifies (loc g_n) h0 h1 /\
bn_v h1 g_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_g (S.get_ffdhe_params a)))
inline_for_extraction noextract
val ffdhe_bn_from_g: #t:limb_t -> a:S.ffdhe_alg -> len:size_pos -> ffdhe_bn_from_g_st t a len
let ffdhe_bn_from_g #t a len g_n =
recall_contents ffdhe_g2 S.ffdhe_g2;
[@inline_let] let nLen = blocks len (size (numbytes t)) in
push_frame ();
let g = create 1ul (u8 0) in
mapT 1ul g secret ffdhe_g2;
BSeq.nat_from_intseq_be_public_to_secret 1 S.ffdhe_g2;
let h0 = ST.get () in
update_sub_f h0 g_n 0ul 1ul
(fun h -> SB.bn_from_bytes_be 1 (as_seq h0 g))
(fun _ -> BN.bn_from_bytes_be 1ul g (sub g_n 0ul 1ul));
let h1 = ST.get () in
SD.bn_eval_update_sub #t 1 (SB.bn_from_bytes_be 1 (as_seq h0 g)) (v nLen);
assert (bn_v h1 g_n == SD.bn_v (SB.bn_from_bytes_be #t 1 (as_seq h0 g)));
SB.bn_from_bytes_be_lemma #t 1 (as_seq h0 g);
assert (bn_v h1 g_n == BSeq.nat_from_bytes_be (as_seq h0 g));
pop_frame ()
inline_for_extraction noextract
let ffdhe_precomp_inv (#t:limb_t) (#len:size_nat{0 < len /\ len + len <= max_size_t})
(a:S.ffdhe_alg) (p_r2_n:SD.lbignum t (len + len))
=
let p_n = LSeq.sub p_r2_n 0 len in
let r2_n = LSeq.sub p_r2_n len len in
SD.bn_v p_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) /\
0 < SD.bn_v p_n /\ SD.bn_v r2_n == pow2 (2 * bits t * len) % SD.bn_v p_n
inline_for_extraction noextract
let ffdhe_precomp_p_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen) ->
Stack unit
(requires fun h ->
live h p_r2_n /\
v len = S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen)
(ensures fun h0 _ h1 -> modifies (loc p_r2_n) h0 h1 /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h1 p_r2_n))
inline_for_extraction noextract
val ffdhe_precomp_p:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t ->
ffdhe_precomp_p_st t a len ke
let ffdhe_precomp_p #t a len ke p_r2_n =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let r2_n = sub p_r2_n nLen nLen in
let p_s = create len (u8 0) in
ffdhe_p_to_ps a p_s;
let h0 = ST.get () in
BN.bn_from_bytes_be len p_s p_n;
let h1 = ST.get () in
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 p_s);
assert (bn_v h1 p_n == BSeq.nat_from_bytes_be (as_seq h0 p_s));
S.ffdhe_p_lemma a;
Lemmas.ffdhe_p_bits_lemma a;
ke.BE.precompr2 (8ul *! len -! 1ul) p_n r2_n;
SM.bn_precomp_r2_mod_n_lemma (8 * v len - 1) (as_seq h1 p_n);
pop_frame ()
inline_for_extraction noextract
let new_ffdhe_precomp_p_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
r:HS.rid ->
ST (B.buffer (limb t))
(requires fun h ->
ST.is_eternal_region r /\
v len = S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen)
(ensures fun h0 res h1 ->
B.(modifies loc_none h0 h1) /\
not (B.g_is_null res) ==> (
B.len res == nLen +! nLen /\
B.(fresh_loc (loc_buffer res) h0 h1) /\
B.(loc_includes (loc_region_only false r) (loc_buffer res)) /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h1 (res <: lbignum t (nLen +! nLen)))))
inline_for_extraction noextract
val new_ffdhe_precomp_p:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_precomp_p:ffdhe_precomp_p_st t a len ke ->
new_ffdhe_precomp_p_st t a len ke
let new_ffdhe_precomp_p #t a len ke ffdhe_precomp_p r =
let h0 = ST.get () in
let nLen = blocks len (size (numbytes t)) in
assert (v (nLen +! nLen) > 0);
let res = LowStar.Monotonic.Buffer.mmalloc_partial r (uint #t #SEC 0) (nLen +! nLen) in
if B.is_null res then
res
else
let h1 = ST.get () in
B.(modifies_only_not_unused_in loc_none h0 h1);
assert (B.len res == nLen +! nLen);
let res: Lib.Buffer.buffer (limb t) = res in
assert (B.length res == v nLen + v nLen);
let res: lbignum t (nLen +! nLen) = res in
ffdhe_precomp_p res;
let h2 = ST.get () in
B.(modifies_only_not_unused_in loc_none h0 h2);
res
inline_for_extraction noextract
let ffdhe_compute_exp_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen)
-> sk_n:lbignum t nLen
-> b_n:lbignum t nLen
-> res:lbuffer uint8 len ->
Stack unit
(requires fun h ->
live h p_r2_n /\ live h sk_n /\ live h b_n /\ live h res /\
disjoint p_r2_n res /\ disjoint sk_n res /\ disjoint b_n res /\
disjoint p_r2_n b_n /\ disjoint p_r2_n sk_n /\
v len == S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h p_r2_n) /\
bn_v h b_n < bn_v h (gsub p_r2_n 0ul nLen) - 1 /\
1 < bn_v h sk_n)
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
(S.ffdhe_p_lemma a;
let res_n = Lib.NatMod.pow_mod #(bn_v h0 (gsub p_r2_n 0ul nLen)) (bn_v h0 b_n) (bn_v h0 sk_n) in
as_seq h1 res == BSeq.nat_to_bytes_be (v len) res_n))
#push-options "--z3rlimit 100"
inline_for_extraction noextract
val ffdhe_compute_exp:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t ->
ffdhe_compute_exp_st t a len ke
let ffdhe_compute_exp #t a len ke p_r2_n sk_n b_n res =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let r2_n = sub p_r2_n nLen nLen in
let res_n = create nLen (uint #t #SEC 0) in
let h1 = ST.get () in
S.ffdhe_p_lemma a;
assert_norm (pow2 4 = 16);
assert_norm (pow2 10 = 1024);
Math.Lemmas.pow2_plus 4 10;
Math.Lemmas.pow2_lt_compat 32 14;
SD.bn_eval_bound #t (as_seq h1 sk_n) (v nLen);
BE.mk_bn_mod_exp_precompr2 nLen ke.BE.exp_ct_precomp p_n r2_n b_n (size (bits t) *! nLen) sk_n res_n; //b_n ^ sk_n % p_n
let h2 = ST.get () in
BN.bn_to_bytes_be len res_n res;
SB.bn_to_bytes_be_lemma (v len) (as_seq h2 res_n);
pop_frame ()
#pop-options
inline_for_extraction noextract
let ffdhe_secret_to_public_precomp_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen)
-> sk:lbuffer uint8 len
-> pk:lbuffer uint8 len ->
Stack unit
(requires fun h ->
live h sk /\ live h pk /\ live h p_r2_n /\
disjoint sk pk /\ disjoint sk p_r2_n /\ disjoint pk p_r2_n /\
v len == S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen /\
1 < Lib.ByteSequence.nat_from_bytes_be (as_seq h sk) /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h p_r2_n))
(ensures fun h0 _ h1 -> modifies (loc pk) h0 h1 /\
as_seq h1 pk == S.ffdhe_secret_to_public a (as_seq h0 sk))
//TODO: pass sBits?
inline_for_extraction noextract
val ffdhe_secret_to_public_precomp:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_compute_exp:ffdhe_compute_exp_st t a len ke ->
ffdhe_secret_to_public_precomp_st t a len ke | {
"checked_file": "/",
"dependencies": [
"Spec.FFDHE.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.FFDHE.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.Exponentiation.fsti.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"Hacl.Impl.FFDHE.Constants.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Base.fst.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.FFDHE.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Exponentiation",
"short_module": "SE"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "SM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "SB"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.FFDHE.Lemmas",
"short_module": "Lemmas"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "Spec.FFDHE",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.FFDHE.Constants",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Spec.FFDHE.ffdhe_alg ->
len: Hacl.Impl.FFDHE.size_pos ->
ke: Hacl.Bignum.Exponentiation.exp t ->
ffdhe_compute_exp: Hacl.Impl.FFDHE.ffdhe_compute_exp_st t a len ke
-> Hacl.Impl.FFDHE.ffdhe_secret_to_public_precomp_st t a len ke | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Definitions.limb_t",
"Spec.FFDHE.ffdhe_alg",
"Hacl.Impl.FFDHE.size_pos",
"Hacl.Bignum.Exponentiation.exp",
"Hacl.Impl.FFDHE.ffdhe_compute_exp_st",
"Hacl.Bignum.Definitions.lbignum",
"Lib.IntTypes.op_Plus_Bang",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Hacl.Bignum.Definitions.blocks",
"Lib.IntTypes.size",
"Lib.IntTypes.numbytes",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.HyperStack.ST.pop_frame",
"Prims.unit",
"Spec.FFDHE.ffdhe_p_lemma",
"Spec.FFDHE.ffdhe_g2_lemma",
"Hacl.Spec.Bignum.bn_from_bytes_be_lemma",
"Lib.IntTypes.v",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"Hacl.Bignum.bn_from_bytes_be",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Lib.Buffer.lbuffer_t",
"Hacl.Bignum.Definitions.limb",
"Lib.Buffer.create",
"Lib.IntTypes.uint",
"Lib.IntTypes.SEC",
"Hacl.Impl.FFDHE.ffdhe_bn_from_g",
"Lib.IntTypes.int_t",
"Prims.eq2",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Prims.l_and",
"Prims.b2t",
"Prims.op_GreaterThan",
"Prims.op_LessThanOrEqual",
"Prims.op_Subtraction",
"Prims.pow2",
"Prims.op_Multiply",
"Lib.IntTypes.mk_int",
"Hacl.Spec.Bignum.Definitions.blocks",
"FStar.HyperStack.ST.push_frame"
] | [] | false | false | false | false | false | let ffdhe_secret_to_public_precomp #t a len ke ffdhe_compute_exp p_r2_n sk pk =
| push_frame ();
let nLen = blocks len (size (numbytes t)) in
let g_n = create nLen (uint #t #SEC 0) in
ffdhe_bn_from_g a len g_n;
let sk_n = create nLen (uint #t #SEC 0) in
let h0 = ST.get () in
BN.bn_from_bytes_be len sk sk_n;
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 sk);
S.ffdhe_g2_lemma ();
S.ffdhe_p_lemma a;
ffdhe_compute_exp p_r2_n sk_n g_n pk;
pop_frame () | false |
LowStar.Buffer.fst | LowStar.Buffer.null | val null (#a: Type0) : buffer a | val null (#a: Type0) : buffer a | let null (#a:Type0) :buffer a = mnull #a #(trivial_preorder a) #(trivial_preorder a) | {
"file_name": "ulib/LowStar.Buffer.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 91,
"end_line": 37,
"start_col": 7,
"start_line": 37
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module LowStar.Buffer
include LowStar.Monotonic.Buffer
module P = FStar.Preorder
module G = FStar.Ghost
module U32 = FStar.UInt32
module Seq = FStar.Seq
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
(*
* Wrapper over LowStar.Monotonic.Buffer, with trivial preorders
* -- functions that take explicit preorder as arguments (e.g. sub etc.)
* -- these include allocation functions also
*)
let trivial_preorder (a:Type0) :srel a = fun _ _ -> True
type buffer (a:Type0) = mbuffer a (trivial_preorder a) (trivial_preorder a) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Preorder.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LowStar.Buffer.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.Preorder",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | LowStar.Buffer.buffer a | Prims.Tot | [
"total"
] | [] | [
"LowStar.Monotonic.Buffer.mnull",
"LowStar.Buffer.trivial_preorder",
"LowStar.Buffer.buffer"
] | [] | false | false | false | true | false | let null (#a: Type0) : buffer a =
| mnull #a #(trivial_preorder a) #(trivial_preorder a) | false |
Pulse.Typing.Combinators.fsti | Pulse.Typing.Combinators.vprop_as_list | val vprop_as_list (vp: term) : list term | val vprop_as_list (vp: term) : list term | let rec vprop_as_list (vp:term)
: list term
= match vp.t with
| Tm_Emp -> []
| Tm_Star vp0 vp1 -> vprop_as_list vp0 @ vprop_as_list vp1
| _ -> [vp] | {
"file_name": "lib/steel/pulse/Pulse.Typing.Combinators.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 15,
"end_line": 106,
"start_col": 0,
"start_line": 101
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Typing.Combinators
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Typing
let st_comp_with_pre (st:st_comp) (pre:term) : st_comp = { st with pre }
let nvar_as_binder (x:nvar) (t:term) : binder =
mk_binder_ppname t (fst x)
val vprop_equiv_typing (#g:_) (#t0 #t1:term) (v:vprop_equiv g t0 t1)
: GTot ((tot_typing g t0 tm_vprop -> tot_typing g t1 tm_vprop) &
(tot_typing g t1 tm_vprop -> tot_typing g t0 tm_vprop))
val mk_bind (g:env)
(pre:term)
(e1:st_term)
(e2:st_term)
(c1:comp_st)
(c2:comp_st)
(px:nvar { ~ (Set.mem (snd px) (dom g)) })
(d_e1:st_typing g e1 c1)
(d_c1res:tot_typing g (comp_res c1) (tm_type (comp_u c1)))
(d_e2:st_typing (push_binding g (snd px) (fst px) (comp_res c1)) (open_st_term_nv e2 px) c2)
(res_typing:universe_of g (comp_res c2) (comp_u c2))
(post_typing:tot_typing (push_binding g (snd px) (fst px) (comp_res c2))
(open_term_nv (comp_post c2) px)
tm_vprop)
(bias_towards_continuation:bool)
: T.TacH (t:st_term &
c:comp_st { st_comp_of_comp c == st_comp_with_pre (st_comp_of_comp c2) pre /\
(bias_towards_continuation ==> effect_annot_of_comp c == effect_annot_of_comp c2) } &
st_typing g t c)
(requires fun _ ->
let _, x = px in
comp_pre c1 == pre /\
None? (lookup g x) /\
(~(x `Set.mem` freevars_st e2)) /\
open_term (comp_post c1) x == comp_pre c2 /\
(~ (x `Set.mem` freevars (comp_post c2))))
(ensures fun _ _ -> True)
val bind_res_and_post_typing (g:env) (s2:comp_st) (x:var { fresh_wrt x g (freevars (comp_post s2)) })
(post_hint:post_hint_opt g { comp_post_matches_hint s2 post_hint })
: T.Tac (universe_of g (comp_res s2) (comp_u s2) &
tot_typing (push_binding g x ppname_default (comp_res s2)) (open_term_nv (comp_post s2) (v_as_nv x)) tm_vprop)
val add_frame (#g:env) (#t:st_term) (#c:comp_st) (t_typing:st_typing g t c)
(#frame:vprop)
(frame_typing:tot_typing g frame tm_vprop)
: t':st_term &
c':comp_st { c' == add_frame c frame } &
st_typing g t' c'
let frame_for_req_in_ctxt (g:env) (ctxt:term) (req:term)
= (frame:term &
tot_typing g frame tm_vprop &
vprop_equiv g (tm_star req frame) ctxt)
let frame_of #g #ctxt #req (f:frame_for_req_in_ctxt g ctxt req) =
let (| frame, _, _ |) = f in frame
val apply_frame (#g:env)
(#t:st_term)
(#ctxt:term)
(ctxt_typing: tot_typing g ctxt tm_vprop)
(#c:comp { stateful_comp c })
(t_typing: st_typing g t c)
(frame_t:frame_for_req_in_ctxt g ctxt (comp_pre c))
: Tot (c':comp_st { comp_pre c' == ctxt /\
comp_res c' == comp_res c /\
comp_u c' == comp_u c /\
comp_post c' == tm_star (comp_post c) (frame_of frame_t) } &
st_typing g t c')
type st_typing_in_ctxt (g:env) (ctxt:vprop) (post_hint:post_hint_opt g) =
t:st_term &
c:comp_st { comp_pre c == ctxt /\ comp_post_matches_hint c post_hint } &
st_typing g t c | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Typing.Combinators.fsti"
} | [
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | vp: Pulse.Syntax.Base.term -> Prims.list Pulse.Syntax.Base.term | Prims.Tot | [
"total"
] | [] | [
"Pulse.Syntax.Base.term",
"Pulse.Syntax.Base.__proj__Mkterm__item__t",
"Prims.Nil",
"FStar.List.Tot.Base.op_At",
"Pulse.Typing.Combinators.vprop_as_list",
"Pulse.Syntax.Base.term'",
"Prims.Cons",
"Prims.list"
] | [
"recursion"
] | false | false | false | true | false | let rec vprop_as_list (vp: term) : list term =
| match vp.t with
| Tm_Emp -> []
| Tm_Star vp0 vp1 -> vprop_as_list vp0 @ vprop_as_list vp1
| _ -> [vp] | false |
LowStar.Buffer.fst | LowStar.Buffer.gsub | val gsub : b:
LowStar.Monotonic.Buffer.mbuffer a
(LowStar.Buffer.trivial_preorder a)
(LowStar.Buffer.trivial_preorder a) ->
i: FStar.UInt32.t ->
len: FStar.UInt32.t
-> Prims.Ghost
(LowStar.Monotonic.Buffer.mbuffer a
(LowStar.Buffer.trivial_preorder a)
(LowStar.Buffer.trivial_preorder a)) | let gsub (#a:Type0) = mgsub #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a) | {
"file_name": "ulib/LowStar.Buffer.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 102,
"end_line": 39,
"start_col": 7,
"start_line": 39
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module LowStar.Buffer
include LowStar.Monotonic.Buffer
module P = FStar.Preorder
module G = FStar.Ghost
module U32 = FStar.UInt32
module Seq = FStar.Seq
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
(*
* Wrapper over LowStar.Monotonic.Buffer, with trivial preorders
* -- functions that take explicit preorder as arguments (e.g. sub etc.)
* -- these include allocation functions also
*)
let trivial_preorder (a:Type0) :srel a = fun _ _ -> True
type buffer (a:Type0) = mbuffer a (trivial_preorder a) (trivial_preorder a)
unfold let null (#a:Type0) :buffer a = mnull #a #(trivial_preorder a) #(trivial_preorder a) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Preorder.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LowStar.Buffer.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.Preorder",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
b:
LowStar.Monotonic.Buffer.mbuffer a
(LowStar.Buffer.trivial_preorder a)
(LowStar.Buffer.trivial_preorder a) ->
i: FStar.UInt32.t ->
len: FStar.UInt32.t
-> Prims.Ghost
(LowStar.Monotonic.Buffer.mbuffer a
(LowStar.Buffer.trivial_preorder a)
(LowStar.Buffer.trivial_preorder a)) | Prims.Ghost | [] | [] | [
"LowStar.Monotonic.Buffer.mgsub",
"LowStar.Buffer.trivial_preorder",
"LowStar.Monotonic.Buffer.mbuffer",
"FStar.UInt32.t",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"FStar.UInt32.v",
"LowStar.Monotonic.Buffer.length",
"Prims.l_True"
] | [] | false | false | false | false | false | let gsub (#a: Type0) =
| mgsub #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a) | false |
|
RW.fst | RW.lift_pure_rwi | val lift_pure_rwi (a: Type) (wp: pure_wp a) (f: (unit -> PURE a wp))
: m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\ h1 == h0) | val lift_pure_rwi (a: Type) (wp: pure_wp a) (f: (unit -> PURE a wp))
: m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\ h1 == h0) | let lift_pure_rwi
(a:Type)
(wp : pure_wp a)
(f :unit -> PURE a wp)
// with the index-polymorphic bind above, this has to be in RO,
// or unification will usually not find the index here
: m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\ h1 == h0)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun () -> f () | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 17,
"end_line": 169,
"start_col": 0,
"start_line": 161
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h
let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1
// how is subtyping handled? can I subtype on a?
// note that post is contravariant in a
let subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)
(i2:idx) (pre' : st_pre) (post' : st_bpost a)
(f : m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True))
= fun () -> f ()
unfold
let ite (p q r : Type0) = (p ==> q) /\ (~p ==> r)
let if_then_else
(a : Type) (i1:idx)
(pre1:st_pre)
(post1 : st_bpost a)
(i2 : idx)
(pre2 : st_pre)
(post2 : st_bpost a)
(f : m a i1 pre1 post1) (g : m a i2 pre2 post2)
(p : bool)
: Type
= m a (join i1 i2)
(fun h0 -> ite p (pre1 h0) (pre2 h0))
(fun h0 x h1 -> ite p (post1 h0 x h1) (post2 h0 x h1))
reifiable
reflectable
effect {
RWI (a:Type) (i:idx) (_:st_pre) (_:st_bpost a)
with {repr = m;
return = return;
bind = bind;
subcomp = subcomp;
if_then_else = if_then_else}
}
unfold
let sp #a (wp : pure_wp a) : pure_post a =
fun x -> ~ (wp (fun y -> ~(x == y))) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type -> wp: Prims.pure_wp a -> f: (_: Prims.unit -> Prims.PURE a)
-> RW.m a RW.RO (fun _ -> wp (fun _ -> Prims.l_True)) (fun h0 x h1 -> RW.sp wp x /\ h1 == h0) | Prims.Tot | [
"total"
] | [] | [
"Prims.pure_wp",
"Prims.unit",
"FStar.Monotonic.Pure.elim_pure_wp_monotonicity",
"RW.m",
"RW.RO",
"FStar.Monotonic.Heap.heap",
"Prims.l_True",
"Prims.l_and",
"RW.sp",
"Prims.eq2"
] | [] | false | false | false | false | false | let lift_pure_rwi (a: Type) (wp: pure_wp a) (f: (unit -> PURE a wp))
: m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\ h1 == h0) =
| FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun () -> f () | false |
RW.fst | RW.test_rrw | val test_rrw (#pre #post: _) (b: bool) (f g: (unit -> RWI int RO pre post)) : RWI int RW pre post | val test_rrw (#pre #post: _) (b: bool) (f g: (unit -> RWI int RO pre post)) : RWI int RW pre post | let test_rrw #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g () | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 149,
"end_line": 175,
"start_col": 0,
"start_line": 175
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h
let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1
// how is subtyping handled? can I subtype on a?
// note that post is contravariant in a
let subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)
(i2:idx) (pre' : st_pre) (post' : st_bpost a)
(f : m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True))
= fun () -> f ()
unfold
let ite (p q r : Type0) = (p ==> q) /\ (~p ==> r)
let if_then_else
(a : Type) (i1:idx)
(pre1:st_pre)
(post1 : st_bpost a)
(i2 : idx)
(pre2 : st_pre)
(post2 : st_bpost a)
(f : m a i1 pre1 post1) (g : m a i2 pre2 post2)
(p : bool)
: Type
= m a (join i1 i2)
(fun h0 -> ite p (pre1 h0) (pre2 h0))
(fun h0 x h1 -> ite p (post1 h0 x h1) (post2 h0 x h1))
reifiable
reflectable
effect {
RWI (a:Type) (i:idx) (_:st_pre) (_:st_bpost a)
with {repr = m;
return = return;
bind = bind;
subcomp = subcomp;
if_then_else = if_then_else}
}
unfold
let sp #a (wp : pure_wp a) : pure_post a =
fun x -> ~ (wp (fun y -> ~(x == y)))
let lift_pure_rwi
(a:Type)
(wp : pure_wp a)
(f :unit -> PURE a wp)
// with the index-polymorphic bind above, this has to be in RO,
// or unification will usually not find the index here
: m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\ h1 == h0)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun () -> f ()
sub_effect PURE ~> RWI = lift_pure_rwi
let test_rrr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | b: Prims.bool -> f: (_: Prims.unit -> RW.RWI Prims.int) -> g: (_: Prims.unit -> RW.RWI Prims.int)
-> RW.RWI Prims.int | RW.RWI | [] | [] | [
"FStar.ST.st_pre",
"RW.st_bpost",
"Prims.int",
"Prims.bool",
"Prims.unit",
"RW.RO",
"RW.RW"
] | [] | false | true | false | false | false | let test_rrw
#pre
#post
(b: bool)
(f: (unit -> RWI int RO pre post))
(g: (unit -> RWI int RO pre post))
: RWI int RW pre post =
| if b then f () else g () | false |
RW.fst | RW.test_www | val test_www (#pre #post: _) (b: bool) (f g: (unit -> RWI int RW pre post)) : RWI int RW pre post | val test_www (#pre #post: _) (b: bool) (f g: (unit -> RWI int RW pre post)) : RWI int RW pre post | let test_www #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g () | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 149,
"end_line": 190,
"start_col": 0,
"start_line": 190
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h
let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1
// how is subtyping handled? can I subtype on a?
// note that post is contravariant in a
let subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)
(i2:idx) (pre' : st_pre) (post' : st_bpost a)
(f : m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True))
= fun () -> f ()
unfold
let ite (p q r : Type0) = (p ==> q) /\ (~p ==> r)
let if_then_else
(a : Type) (i1:idx)
(pre1:st_pre)
(post1 : st_bpost a)
(i2 : idx)
(pre2 : st_pre)
(post2 : st_bpost a)
(f : m a i1 pre1 post1) (g : m a i2 pre2 post2)
(p : bool)
: Type
= m a (join i1 i2)
(fun h0 -> ite p (pre1 h0) (pre2 h0))
(fun h0 x h1 -> ite p (post1 h0 x h1) (post2 h0 x h1))
reifiable
reflectable
effect {
RWI (a:Type) (i:idx) (_:st_pre) (_:st_bpost a)
with {repr = m;
return = return;
bind = bind;
subcomp = subcomp;
if_then_else = if_then_else}
}
unfold
let sp #a (wp : pure_wp a) : pure_post a =
fun x -> ~ (wp (fun y -> ~(x == y)))
let lift_pure_rwi
(a:Type)
(wp : pure_wp a)
(f :unit -> PURE a wp)
// with the index-polymorphic bind above, this has to be in RO,
// or unification will usually not find the index here
: m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\ h1 == h0)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun () -> f ()
sub_effect PURE ~> RWI = lift_pure_rwi
let test_rrr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_rrw #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_rwr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_rww #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wrr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_wrw #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wwr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | b: Prims.bool -> f: (_: Prims.unit -> RW.RWI Prims.int) -> g: (_: Prims.unit -> RW.RWI Prims.int)
-> RW.RWI Prims.int | RW.RWI | [] | [] | [
"FStar.ST.st_pre",
"RW.st_bpost",
"Prims.int",
"Prims.bool",
"Prims.unit",
"RW.RW"
] | [] | false | true | false | false | false | let test_www
#pre
#post
(b: bool)
(f: (unit -> RWI int RW pre post))
(g: (unit -> RWI int RW pre post))
: RWI int RW pre post =
| if b then f () else g () | false |
LowStar.Buffer.fst | LowStar.Buffer.sub | val sub : b:
LowStar.Monotonic.Buffer.mbuffer a
(LowStar.Buffer.trivial_preorder a)
(LowStar.Buffer.trivial_preorder a) ->
i: FStar.UInt32.t ->
len: FStar.Ghost.erased FStar.UInt32.t
-> FStar.HyperStack.ST.Stack
(LowStar.Monotonic.Buffer.mbuffer a
(LowStar.Buffer.trivial_preorder a)
(LowStar.Buffer.trivial_preorder a)) | let sub (#a:Type0) = msub #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a) | {
"file_name": "ulib/LowStar.Buffer.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 115,
"end_line": 50,
"start_col": 22,
"start_line": 50
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module LowStar.Buffer
include LowStar.Monotonic.Buffer
module P = FStar.Preorder
module G = FStar.Ghost
module U32 = FStar.UInt32
module Seq = FStar.Seq
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
(*
* Wrapper over LowStar.Monotonic.Buffer, with trivial preorders
* -- functions that take explicit preorder as arguments (e.g. sub etc.)
* -- these include allocation functions also
*)
let trivial_preorder (a:Type0) :srel a = fun _ _ -> True
type buffer (a:Type0) = mbuffer a (trivial_preorder a) (trivial_preorder a)
unfold let null (#a:Type0) :buffer a = mnull #a #(trivial_preorder a) #(trivial_preorder a)
unfold let gsub (#a:Type0) = mgsub #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a)
unfold let gsub_inj (#a:Type0) = mgsub_inj #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a) (trivial_preorder a)
[@@unifier_hint_injective]
inline_for_extraction
type pointer (a:Type0) = b:buffer a{length b == 1}
inline_for_extraction
type pointer_or_null (a:Type0) = b:buffer a{if g_is_null b then True else length b == 1} | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Preorder.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LowStar.Buffer.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.Preorder",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
b:
LowStar.Monotonic.Buffer.mbuffer a
(LowStar.Buffer.trivial_preorder a)
(LowStar.Buffer.trivial_preorder a) ->
i: FStar.UInt32.t ->
len: FStar.Ghost.erased FStar.UInt32.t
-> FStar.HyperStack.ST.Stack
(LowStar.Monotonic.Buffer.mbuffer a
(LowStar.Buffer.trivial_preorder a)
(LowStar.Buffer.trivial_preorder a)) | FStar.HyperStack.ST.Stack | [] | [] | [
"LowStar.Monotonic.Buffer.msub",
"LowStar.Buffer.trivial_preorder",
"LowStar.Monotonic.Buffer.mbuffer",
"FStar.UInt32.t",
"FStar.Ghost.erased",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"FStar.UInt32.v",
"FStar.Ghost.reveal",
"LowStar.Monotonic.Buffer.length",
"Prims.l_Forall",
"FStar.Seq.Base.seq",
"Prims.l_imp",
"Prims.eq2",
"Prims.nat",
"FStar.Seq.Base.length",
"FStar.Seq.Base.slice",
"Prims.int",
"Prims.op_Subtraction",
"FStar.Seq.Properties.replace_subseq",
"LowStar.Monotonic.Buffer.live",
"LowStar.Monotonic.Buffer.mgsub"
] | [] | false | true | false | false | false | let sub (#a: Type0) =
| msub #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a) | false |
|
RW.fst | RW.test_wrw | val test_wrw
(#pre #post: _)
(b: bool)
(f: (unit -> RWI int RW pre post))
(g: (unit -> RWI int RO pre post))
: RWI int RW pre post | val test_wrw
(#pre #post: _)
(b: bool)
(f: (unit -> RWI int RW pre post))
(g: (unit -> RWI int RO pre post))
: RWI int RW pre post | let test_wrw #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g () | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 149,
"end_line": 185,
"start_col": 0,
"start_line": 185
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h
let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1
// how is subtyping handled? can I subtype on a?
// note that post is contravariant in a
let subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)
(i2:idx) (pre' : st_pre) (post' : st_bpost a)
(f : m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True))
= fun () -> f ()
unfold
let ite (p q r : Type0) = (p ==> q) /\ (~p ==> r)
let if_then_else
(a : Type) (i1:idx)
(pre1:st_pre)
(post1 : st_bpost a)
(i2 : idx)
(pre2 : st_pre)
(post2 : st_bpost a)
(f : m a i1 pre1 post1) (g : m a i2 pre2 post2)
(p : bool)
: Type
= m a (join i1 i2)
(fun h0 -> ite p (pre1 h0) (pre2 h0))
(fun h0 x h1 -> ite p (post1 h0 x h1) (post2 h0 x h1))
reifiable
reflectable
effect {
RWI (a:Type) (i:idx) (_:st_pre) (_:st_bpost a)
with {repr = m;
return = return;
bind = bind;
subcomp = subcomp;
if_then_else = if_then_else}
}
unfold
let sp #a (wp : pure_wp a) : pure_post a =
fun x -> ~ (wp (fun y -> ~(x == y)))
let lift_pure_rwi
(a:Type)
(wp : pure_wp a)
(f :unit -> PURE a wp)
// with the index-polymorphic bind above, this has to be in RO,
// or unification will usually not find the index here
: m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\ h1 == h0)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun () -> f ()
sub_effect PURE ~> RWI = lift_pure_rwi
let test_rrr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_rrw #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_rwr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_rww #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wrr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | b: Prims.bool -> f: (_: Prims.unit -> RW.RWI Prims.int) -> g: (_: Prims.unit -> RW.RWI Prims.int)
-> RW.RWI Prims.int | RW.RWI | [] | [] | [
"FStar.ST.st_pre",
"RW.st_bpost",
"Prims.int",
"Prims.bool",
"Prims.unit",
"RW.RW",
"RW.RO"
] | [] | false | true | false | false | false | let test_wrw
#pre
#post
(b: bool)
(f: (unit -> RWI int RW pre post))
(g: (unit -> RWI int RO pre post))
: RWI int RW pre post =
| if b then f () else g () | false |
LowStar.Buffer.fst | LowStar.Buffer.gsub_inj | val gsub_inj : b1:
LowStar.Monotonic.Buffer.mbuffer a
(LowStar.Buffer.trivial_preorder a)
(LowStar.Buffer.trivial_preorder a) ->
b2:
LowStar.Monotonic.Buffer.mbuffer a
(LowStar.Buffer.trivial_preorder a)
(LowStar.Buffer.trivial_preorder a) ->
i1: FStar.UInt32.t ->
i2: FStar.UInt32.t ->
len1: FStar.UInt32.t ->
len2: FStar.UInt32.t
-> FStar.Pervasives.Lemma
(requires
FStar.UInt32.v i1 + FStar.UInt32.v len1 <= LowStar.Monotonic.Buffer.length b1 /\
FStar.UInt32.v i2 + FStar.UInt32.v len2 <= LowStar.Monotonic.Buffer.length b2 /\
LowStar.Monotonic.Buffer.mgsub (LowStar.Buffer.trivial_preorder a) b1 i1 len1 ===
LowStar.Monotonic.Buffer.mgsub (LowStar.Buffer.trivial_preorder a) b2 i2 len2)
(ensures
len1 == len2 /\ (b1 == b2 ==> i1 == i2) /\
(i1 == i2 /\ LowStar.Monotonic.Buffer.length b1 == LowStar.Monotonic.Buffer.length b2 ==>
b1 == b2)) | let gsub_inj (#a:Type0) = mgsub_inj #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a) (trivial_preorder a) | {
"file_name": "ulib/LowStar.Buffer.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 131,
"end_line": 41,
"start_col": 7,
"start_line": 41
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module LowStar.Buffer
include LowStar.Monotonic.Buffer
module P = FStar.Preorder
module G = FStar.Ghost
module U32 = FStar.UInt32
module Seq = FStar.Seq
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
(*
* Wrapper over LowStar.Monotonic.Buffer, with trivial preorders
* -- functions that take explicit preorder as arguments (e.g. sub etc.)
* -- these include allocation functions also
*)
let trivial_preorder (a:Type0) :srel a = fun _ _ -> True
type buffer (a:Type0) = mbuffer a (trivial_preorder a) (trivial_preorder a)
unfold let null (#a:Type0) :buffer a = mnull #a #(trivial_preorder a) #(trivial_preorder a)
unfold let gsub (#a:Type0) = mgsub #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Preorder.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LowStar.Buffer.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.Preorder",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
b1:
LowStar.Monotonic.Buffer.mbuffer a
(LowStar.Buffer.trivial_preorder a)
(LowStar.Buffer.trivial_preorder a) ->
b2:
LowStar.Monotonic.Buffer.mbuffer a
(LowStar.Buffer.trivial_preorder a)
(LowStar.Buffer.trivial_preorder a) ->
i1: FStar.UInt32.t ->
i2: FStar.UInt32.t ->
len1: FStar.UInt32.t ->
len2: FStar.UInt32.t
-> FStar.Pervasives.Lemma
(requires
FStar.UInt32.v i1 + FStar.UInt32.v len1 <= LowStar.Monotonic.Buffer.length b1 /\
FStar.UInt32.v i2 + FStar.UInt32.v len2 <= LowStar.Monotonic.Buffer.length b2 /\
LowStar.Monotonic.Buffer.mgsub (LowStar.Buffer.trivial_preorder a) b1 i1 len1 ===
LowStar.Monotonic.Buffer.mgsub (LowStar.Buffer.trivial_preorder a) b2 i2 len2)
(ensures
len1 == len2 /\ (b1 == b2 ==> i1 == i2) /\
(i1 == i2 /\ LowStar.Monotonic.Buffer.length b1 == LowStar.Monotonic.Buffer.length b2 ==>
b1 == b2)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"LowStar.Monotonic.Buffer.mgsub_inj",
"LowStar.Buffer.trivial_preorder",
"LowStar.Monotonic.Buffer.mbuffer",
"FStar.UInt32.t",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"FStar.UInt32.v",
"LowStar.Monotonic.Buffer.length",
"Prims.op_Equals_Equals_Equals",
"LowStar.Monotonic.Buffer.mgsub",
"Prims.squash",
"Prims.eq2",
"Prims.l_imp",
"Prims.nat",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | true | false | true | false | false | let gsub_inj (#a: Type0) =
| mgsub_inj #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a) (trivial_preorder a) | false |
|
LowStar.Buffer.fst | LowStar.Buffer.malloc | val malloc : r: FStar.Monotonic.HyperHeap.rid -> init: a -> len: FStar.UInt32.t
-> FStar.HyperStack.ST.ST
(b:
(b:
LowStar.Monotonic.Buffer.mbuffer a
(LowStar.Buffer.trivial_preorder a)
(LowStar.Buffer.trivial_preorder a)
{ LowStar.Monotonic.Buffer.length b == FStar.UInt32.v len /\
Prims.op_Negation (LowStar.Monotonic.Buffer.g_is_null b) })
{LowStar.Monotonic.Buffer.frameOf b == r /\ LowStar.Monotonic.Buffer.freeable b}) | let malloc (#a:Type0) = mmalloc #a #(trivial_preorder a) | {
"file_name": "ulib/LowStar.Buffer.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 78,
"end_line": 58,
"start_col": 22,
"start_line": 58
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module LowStar.Buffer
include LowStar.Monotonic.Buffer
module P = FStar.Preorder
module G = FStar.Ghost
module U32 = FStar.UInt32
module Seq = FStar.Seq
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
(*
* Wrapper over LowStar.Monotonic.Buffer, with trivial preorders
* -- functions that take explicit preorder as arguments (e.g. sub etc.)
* -- these include allocation functions also
*)
let trivial_preorder (a:Type0) :srel a = fun _ _ -> True
type buffer (a:Type0) = mbuffer a (trivial_preorder a) (trivial_preorder a)
unfold let null (#a:Type0) :buffer a = mnull #a #(trivial_preorder a) #(trivial_preorder a)
unfold let gsub (#a:Type0) = mgsub #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a)
unfold let gsub_inj (#a:Type0) = mgsub_inj #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a) (trivial_preorder a)
[@@unifier_hint_injective]
inline_for_extraction
type pointer (a:Type0) = b:buffer a{length b == 1}
inline_for_extraction
type pointer_or_null (a:Type0) = b:buffer a{if g_is_null b then True else length b == 1}
inline_for_extraction let sub (#a:Type0) = msub #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a)
inline_for_extraction let offset (#a:Type0) = moffset #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a)
unfold let lbuffer (a:Type0) (len:nat) = lmbuffer a (trivial_preorder a) (trivial_preorder a) len
inline_for_extraction let gcmalloc (#a:Type0) = mgcmalloc #a #(trivial_preorder a) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Preorder.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LowStar.Buffer.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.Preorder",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | r: FStar.Monotonic.HyperHeap.rid -> init: a -> len: FStar.UInt32.t
-> FStar.HyperStack.ST.ST
(b:
(b:
LowStar.Monotonic.Buffer.mbuffer a
(LowStar.Buffer.trivial_preorder a)
(LowStar.Buffer.trivial_preorder a)
{ LowStar.Monotonic.Buffer.length b == FStar.UInt32.v len /\
Prims.op_Negation (LowStar.Monotonic.Buffer.g_is_null b) })
{LowStar.Monotonic.Buffer.frameOf b == r /\ LowStar.Monotonic.Buffer.freeable b}) | FStar.HyperStack.ST.ST | [] | [] | [
"LowStar.Monotonic.Buffer.mmalloc",
"LowStar.Buffer.trivial_preorder",
"FStar.Monotonic.HyperHeap.rid",
"FStar.UInt32.t",
"LowStar.Monotonic.Buffer.mbuffer",
"Prims.l_and",
"Prims.eq2",
"Prims.nat",
"LowStar.Monotonic.Buffer.length",
"FStar.UInt32.v",
"Prims.b2t",
"Prims.op_Negation",
"LowStar.Monotonic.Buffer.g_is_null",
"LowStar.Monotonic.Buffer.frameOf",
"LowStar.Monotonic.Buffer.freeable",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.is_eternal_region",
"Prims.op_GreaterThan",
"LowStar.Monotonic.Buffer.live",
"LowStar.Monotonic.Buffer.unused_in",
"FStar.Set.equal",
"FStar.Map.domain",
"FStar.Monotonic.Heap.heap",
"FStar.Monotonic.HyperStack.get_hmap",
"FStar.Monotonic.HyperStack.get_tip",
"LowStar.Monotonic.Buffer.modifies",
"LowStar.Monotonic.Buffer.loc_none",
"FStar.Seq.Base.seq",
"LowStar.Monotonic.Buffer.as_seq",
"FStar.Seq.Base.create"
] | [] | false | true | false | false | false | let malloc (#a: Type0) =
| mmalloc #a #(trivial_preorder a) | false |
|
LowStar.Buffer.fst | LowStar.Buffer.offset | val offset : b:
LowStar.Monotonic.Buffer.mbuffer a
(LowStar.Buffer.trivial_preorder a)
(LowStar.Buffer.trivial_preorder a) ->
i: FStar.UInt32.t
-> FStar.HyperStack.ST.Stack
(LowStar.Monotonic.Buffer.mbuffer a
(LowStar.Buffer.trivial_preorder a)
(LowStar.Buffer.trivial_preorder a)) | let offset (#a:Type0) = moffset #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a) | {
"file_name": "ulib/LowStar.Buffer.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 121,
"end_line": 52,
"start_col": 22,
"start_line": 52
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module LowStar.Buffer
include LowStar.Monotonic.Buffer
module P = FStar.Preorder
module G = FStar.Ghost
module U32 = FStar.UInt32
module Seq = FStar.Seq
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
(*
* Wrapper over LowStar.Monotonic.Buffer, with trivial preorders
* -- functions that take explicit preorder as arguments (e.g. sub etc.)
* -- these include allocation functions also
*)
let trivial_preorder (a:Type0) :srel a = fun _ _ -> True
type buffer (a:Type0) = mbuffer a (trivial_preorder a) (trivial_preorder a)
unfold let null (#a:Type0) :buffer a = mnull #a #(trivial_preorder a) #(trivial_preorder a)
unfold let gsub (#a:Type0) = mgsub #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a)
unfold let gsub_inj (#a:Type0) = mgsub_inj #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a) (trivial_preorder a)
[@@unifier_hint_injective]
inline_for_extraction
type pointer (a:Type0) = b:buffer a{length b == 1}
inline_for_extraction
type pointer_or_null (a:Type0) = b:buffer a{if g_is_null b then True else length b == 1}
inline_for_extraction let sub (#a:Type0) = msub #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Preorder.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LowStar.Buffer.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.Preorder",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
b:
LowStar.Monotonic.Buffer.mbuffer a
(LowStar.Buffer.trivial_preorder a)
(LowStar.Buffer.trivial_preorder a) ->
i: FStar.UInt32.t
-> FStar.HyperStack.ST.Stack
(LowStar.Monotonic.Buffer.mbuffer a
(LowStar.Buffer.trivial_preorder a)
(LowStar.Buffer.trivial_preorder a)) | FStar.HyperStack.ST.Stack | [] | [] | [
"LowStar.Monotonic.Buffer.moffset",
"LowStar.Buffer.trivial_preorder",
"LowStar.Monotonic.Buffer.mbuffer",
"FStar.UInt32.t",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.UInt32.v",
"LowStar.Monotonic.Buffer.length",
"Prims.l_Forall",
"FStar.Seq.Base.seq",
"Prims.l_imp",
"Prims.eq2",
"Prims.nat",
"FStar.Seq.Base.length",
"FStar.Seq.Base.slice",
"Prims.op_Addition",
"FStar.UInt32.sub",
"LowStar.Monotonic.Buffer.len",
"Prims.int",
"Prims.op_Subtraction",
"FStar.Seq.Properties.replace_subseq",
"LowStar.Monotonic.Buffer.live",
"LowStar.Monotonic.Buffer.mgsub"
] | [] | false | true | false | false | false | let offset (#a: Type0) =
| moffset #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a) | false |
|
RW.fst | RW.get_r | val get_r: Prims.unit -> RWI H.heap RO (fun _ -> True) (fun h0 x h1 -> x == h0 /\ h1 == h0) | val get_r: Prims.unit -> RWI H.heap RO (fun _ -> True) (fun h0 x h1 -> x == h0 /\ h1 == h0) | let get_r () : RWI H.heap RO (fun _ -> True) (fun h0 x h1 -> x == h0 /\ h1 == h0) =
RWI?.reflect (fun () -> ST.get ()) | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 36,
"end_line": 257,
"start_col": 0,
"start_line": 256
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h
let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1
// how is subtyping handled? can I subtype on a?
// note that post is contravariant in a
let subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)
(i2:idx) (pre' : st_pre) (post' : st_bpost a)
(f : m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True))
= fun () -> f ()
unfold
let ite (p q r : Type0) = (p ==> q) /\ (~p ==> r)
let if_then_else
(a : Type) (i1:idx)
(pre1:st_pre)
(post1 : st_bpost a)
(i2 : idx)
(pre2 : st_pre)
(post2 : st_bpost a)
(f : m a i1 pre1 post1) (g : m a i2 pre2 post2)
(p : bool)
: Type
= m a (join i1 i2)
(fun h0 -> ite p (pre1 h0) (pre2 h0))
(fun h0 x h1 -> ite p (post1 h0 x h1) (post2 h0 x h1))
reifiable
reflectable
effect {
RWI (a:Type) (i:idx) (_:st_pre) (_:st_bpost a)
with {repr = m;
return = return;
bind = bind;
subcomp = subcomp;
if_then_else = if_then_else}
}
unfold
let sp #a (wp : pure_wp a) : pure_post a =
fun x -> ~ (wp (fun y -> ~(x == y)))
let lift_pure_rwi
(a:Type)
(wp : pure_wp a)
(f :unit -> PURE a wp)
// with the index-polymorphic bind above, this has to be in RO,
// or unification will usually not find the index here
: m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\ h1 == h0)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun () -> f ()
sub_effect PURE ~> RWI = lift_pure_rwi
let test_rrr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_rrw #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_rwr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_rww #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wrr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_wrw #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wwr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_www #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
let rec map #a #b
(f : a -> RWI b RO (fun _ -> True) (fun _ _ _ -> True))
(xs : list a)
: RWI (list b) RO (fun _ -> True) (fun _ _ _ -> True)
= match xs with
| [] -> []
| x::xs -> (f x)::(map f xs)
let app #a #b #i #pre #post (f : a -> RWI b i pre post) (x : a) : RWI b i pre post = f x
// can't resolve an index, providing it explicitly with #i makes it explode too
// update: actually, putting a dollar sign on f makes it work... why? I can see
// why it helps to find the index but why doesn't it explode too?
(*
* AR: Could not resolve #i in the recursive call
*)
let rec appn #a #i
(n:nat)
(f : a -> RWI a i (fun _ -> True) (fun _ _ _ -> True))
(x : a)
: RWI a i (fun _ -> True) (fun _ _ _ -> True)
= match n with
| 0 -> x
| _ -> begin
appn #_ #i (n-1) f (f x)
end
let labs0 (n:int) : RWI int RO (fun _ -> True) (fun h0 x h1 -> x >= 0 /\ h1 == h0) =
if n < 0
then -n
else n
let labs (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
if n < 0
then -n
else n
let rwi_assert (p:Type0) : RWI unit RO (fun _ -> p) (fun h0 () h1 -> h0 == h1) =
// assert p // fails
RWI?.reflect (fun () -> assert p)
let rwi_assume (p:Type0) : RWI unit RO (fun _ -> True) (fun h0 () h1 -> h0 == h1 /\ p) =
RWI?.reflect (fun () -> assume p)
let test_abs0 (n:int) : RWI int RO (fun _ -> True) (fun h0 r h1 -> r >= 0) =
let r = labs0 n in
();
();
r
let test_abs0' (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
let r = labs0 n in
let r : nat = r in // need this! an ascription won't work!
r
let test_abs (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
let r = labs n in
r
// just a test
let get_indexed (#i:idx) () : RWI H.heap i (fun _ -> True) (fun h0 x h1 -> x == h0 /\ h1 == h0) =
RWI?.reflect (fun () -> ST.get ()) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit -> RW.RWI FStar.Monotonic.Heap.heap | RW.RWI | [] | [] | [
"Prims.unit",
"FStar.ST.get",
"FStar.Monotonic.Heap.heap",
"RW.RO",
"Prims.l_True",
"Prims.l_and",
"Prims.eq2"
] | [] | false | true | false | false | false | let get_r () : RWI H.heap RO (fun _ -> True) (fun h0 x h1 -> x == h0 /\ h1 == h0) =
| RWI?.reflect (fun () -> ST.get ()) | false |
RW.fst | RW.app | val app (#a #b #i #pre #post: _) (f: (a -> RWI b i pre post)) (x: a) : RWI b i pre post | val app (#a #b #i #pre #post: _) (f: (a -> RWI b i pre post)) (x: a) : RWI b i pre post | let app #a #b #i #pre #post (f : a -> RWI b i pre post) (x : a) : RWI b i pre post = f x | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 88,
"end_line": 200,
"start_col": 0,
"start_line": 200
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h
let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1
// how is subtyping handled? can I subtype on a?
// note that post is contravariant in a
let subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)
(i2:idx) (pre' : st_pre) (post' : st_bpost a)
(f : m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True))
= fun () -> f ()
unfold
let ite (p q r : Type0) = (p ==> q) /\ (~p ==> r)
let if_then_else
(a : Type) (i1:idx)
(pre1:st_pre)
(post1 : st_bpost a)
(i2 : idx)
(pre2 : st_pre)
(post2 : st_bpost a)
(f : m a i1 pre1 post1) (g : m a i2 pre2 post2)
(p : bool)
: Type
= m a (join i1 i2)
(fun h0 -> ite p (pre1 h0) (pre2 h0))
(fun h0 x h1 -> ite p (post1 h0 x h1) (post2 h0 x h1))
reifiable
reflectable
effect {
RWI (a:Type) (i:idx) (_:st_pre) (_:st_bpost a)
with {repr = m;
return = return;
bind = bind;
subcomp = subcomp;
if_then_else = if_then_else}
}
unfold
let sp #a (wp : pure_wp a) : pure_post a =
fun x -> ~ (wp (fun y -> ~(x == y)))
let lift_pure_rwi
(a:Type)
(wp : pure_wp a)
(f :unit -> PURE a wp)
// with the index-polymorphic bind above, this has to be in RO,
// or unification will usually not find the index here
: m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\ h1 == h0)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun () -> f ()
sub_effect PURE ~> RWI = lift_pure_rwi
let test_rrr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_rrw #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_rwr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_rww #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wrr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_wrw #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wwr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_www #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
let rec map #a #b
(f : a -> RWI b RO (fun _ -> True) (fun _ _ _ -> True))
(xs : list a)
: RWI (list b) RO (fun _ -> True) (fun _ _ _ -> True)
= match xs with
| [] -> []
| x::xs -> (f x)::(map f xs) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | f: (_: a -> RW.RWI b) -> x: a -> RW.RWI b | RW.RWI | [] | [] | [
"RW.idx",
"FStar.ST.st_pre",
"RW.st_bpost"
] | [] | false | true | false | false | false | let app #a #b #i #pre #post (f: (a -> RWI b i pre post)) (x: a) : RWI b i pre post =
| f x | false |
RW.fst | RW.test_rrr | val test_rrr (#pre #post: _) (b: bool) (f g: (unit -> RWI int RO pre post)) : RWI int RO pre post | val test_rrr (#pre #post: _) (b: bool) (f g: (unit -> RWI int RO pre post)) : RWI int RO pre post | let test_rrr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g () | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 149,
"end_line": 173,
"start_col": 0,
"start_line": 173
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h
let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1
// how is subtyping handled? can I subtype on a?
// note that post is contravariant in a
let subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)
(i2:idx) (pre' : st_pre) (post' : st_bpost a)
(f : m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True))
= fun () -> f ()
unfold
let ite (p q r : Type0) = (p ==> q) /\ (~p ==> r)
let if_then_else
(a : Type) (i1:idx)
(pre1:st_pre)
(post1 : st_bpost a)
(i2 : idx)
(pre2 : st_pre)
(post2 : st_bpost a)
(f : m a i1 pre1 post1) (g : m a i2 pre2 post2)
(p : bool)
: Type
= m a (join i1 i2)
(fun h0 -> ite p (pre1 h0) (pre2 h0))
(fun h0 x h1 -> ite p (post1 h0 x h1) (post2 h0 x h1))
reifiable
reflectable
effect {
RWI (a:Type) (i:idx) (_:st_pre) (_:st_bpost a)
with {repr = m;
return = return;
bind = bind;
subcomp = subcomp;
if_then_else = if_then_else}
}
unfold
let sp #a (wp : pure_wp a) : pure_post a =
fun x -> ~ (wp (fun y -> ~(x == y)))
let lift_pure_rwi
(a:Type)
(wp : pure_wp a)
(f :unit -> PURE a wp)
// with the index-polymorphic bind above, this has to be in RO,
// or unification will usually not find the index here
: m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\ h1 == h0)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun () -> f ()
sub_effect PURE ~> RWI = lift_pure_rwi | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | b: Prims.bool -> f: (_: Prims.unit -> RW.RWI Prims.int) -> g: (_: Prims.unit -> RW.RWI Prims.int)
-> RW.RWI Prims.int | RW.RWI | [] | [] | [
"FStar.ST.st_pre",
"RW.st_bpost",
"Prims.int",
"Prims.bool",
"Prims.unit",
"RW.RO"
] | [] | false | true | false | false | false | let test_rrr
#pre
#post
(b: bool)
(f: (unit -> RWI int RO pre post))
(g: (unit -> RWI int RO pre post))
: RWI int RO pre post =
| if b then f () else g () | false |
RW.fst | RW.test_abs0' | val test_abs0' (n: int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) | val test_abs0' (n: int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) | let test_abs0' (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
let r = labs0 n in
let r : nat = r in // need this! an ascription won't work!
r | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 3,
"end_line": 246,
"start_col": 0,
"start_line": 243
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h
let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1
// how is subtyping handled? can I subtype on a?
// note that post is contravariant in a
let subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)
(i2:idx) (pre' : st_pre) (post' : st_bpost a)
(f : m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True))
= fun () -> f ()
unfold
let ite (p q r : Type0) = (p ==> q) /\ (~p ==> r)
let if_then_else
(a : Type) (i1:idx)
(pre1:st_pre)
(post1 : st_bpost a)
(i2 : idx)
(pre2 : st_pre)
(post2 : st_bpost a)
(f : m a i1 pre1 post1) (g : m a i2 pre2 post2)
(p : bool)
: Type
= m a (join i1 i2)
(fun h0 -> ite p (pre1 h0) (pre2 h0))
(fun h0 x h1 -> ite p (post1 h0 x h1) (post2 h0 x h1))
reifiable
reflectable
effect {
RWI (a:Type) (i:idx) (_:st_pre) (_:st_bpost a)
with {repr = m;
return = return;
bind = bind;
subcomp = subcomp;
if_then_else = if_then_else}
}
unfold
let sp #a (wp : pure_wp a) : pure_post a =
fun x -> ~ (wp (fun y -> ~(x == y)))
let lift_pure_rwi
(a:Type)
(wp : pure_wp a)
(f :unit -> PURE a wp)
// with the index-polymorphic bind above, this has to be in RO,
// or unification will usually not find the index here
: m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\ h1 == h0)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun () -> f ()
sub_effect PURE ~> RWI = lift_pure_rwi
let test_rrr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_rrw #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_rwr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_rww #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wrr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_wrw #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wwr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_www #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
let rec map #a #b
(f : a -> RWI b RO (fun _ -> True) (fun _ _ _ -> True))
(xs : list a)
: RWI (list b) RO (fun _ -> True) (fun _ _ _ -> True)
= match xs with
| [] -> []
| x::xs -> (f x)::(map f xs)
let app #a #b #i #pre #post (f : a -> RWI b i pre post) (x : a) : RWI b i pre post = f x
// can't resolve an index, providing it explicitly with #i makes it explode too
// update: actually, putting a dollar sign on f makes it work... why? I can see
// why it helps to find the index but why doesn't it explode too?
(*
* AR: Could not resolve #i in the recursive call
*)
let rec appn #a #i
(n:nat)
(f : a -> RWI a i (fun _ -> True) (fun _ _ _ -> True))
(x : a)
: RWI a i (fun _ -> True) (fun _ _ _ -> True)
= match n with
| 0 -> x
| _ -> begin
appn #_ #i (n-1) f (f x)
end
let labs0 (n:int) : RWI int RO (fun _ -> True) (fun h0 x h1 -> x >= 0 /\ h1 == h0) =
if n < 0
then -n
else n
let labs (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
if n < 0
then -n
else n
let rwi_assert (p:Type0) : RWI unit RO (fun _ -> p) (fun h0 () h1 -> h0 == h1) =
// assert p // fails
RWI?.reflect (fun () -> assert p)
let rwi_assume (p:Type0) : RWI unit RO (fun _ -> True) (fun h0 () h1 -> h0 == h1 /\ p) =
RWI?.reflect (fun () -> assume p)
let test_abs0 (n:int) : RWI int RO (fun _ -> True) (fun h0 r h1 -> r >= 0) =
let r = labs0 n in
();
();
r | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | n: Prims.int -> RW.RWI Prims.nat | RW.RWI | [] | [] | [
"Prims.int",
"Prims.nat",
"RW.labs0",
"RW.RO",
"FStar.Monotonic.Heap.heap",
"Prims.l_True"
] | [] | false | true | false | false | false | let test_abs0' (n: int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
| let r = labs0 n in
let r:nat = r in
r | false |
LowStar.Buffer.fst | LowStar.Buffer.lbuffer | val lbuffer : a: Type0 -> len: Prims.nat -> Type0 | let lbuffer (a:Type0) (len:nat) = lmbuffer a (trivial_preorder a) (trivial_preorder a) len | {
"file_name": "ulib/LowStar.Buffer.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 97,
"end_line": 54,
"start_col": 7,
"start_line": 54
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module LowStar.Buffer
include LowStar.Monotonic.Buffer
module P = FStar.Preorder
module G = FStar.Ghost
module U32 = FStar.UInt32
module Seq = FStar.Seq
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
(*
* Wrapper over LowStar.Monotonic.Buffer, with trivial preorders
* -- functions that take explicit preorder as arguments (e.g. sub etc.)
* -- these include allocation functions also
*)
let trivial_preorder (a:Type0) :srel a = fun _ _ -> True
type buffer (a:Type0) = mbuffer a (trivial_preorder a) (trivial_preorder a)
unfold let null (#a:Type0) :buffer a = mnull #a #(trivial_preorder a) #(trivial_preorder a)
unfold let gsub (#a:Type0) = mgsub #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a)
unfold let gsub_inj (#a:Type0) = mgsub_inj #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a) (trivial_preorder a)
[@@unifier_hint_injective]
inline_for_extraction
type pointer (a:Type0) = b:buffer a{length b == 1}
inline_for_extraction
type pointer_or_null (a:Type0) = b:buffer a{if g_is_null b then True else length b == 1}
inline_for_extraction let sub (#a:Type0) = msub #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a)
inline_for_extraction let offset (#a:Type0) = moffset #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Preorder.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LowStar.Buffer.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.Preorder",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type0 -> len: Prims.nat -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"LowStar.Monotonic.Buffer.lmbuffer",
"LowStar.Buffer.trivial_preorder"
] | [] | false | false | false | true | true | let lbuffer (a: Type0) (len: nat) =
| lmbuffer a (trivial_preorder a) (trivial_preorder a) len | false |
|
RW.fst | RW.get_indexed | val get_indexed: #i: idx -> Prims.unit
-> RWI H.heap i (fun _ -> True) (fun h0 x h1 -> x == h0 /\ h1 == h0) | val get_indexed: #i: idx -> Prims.unit
-> RWI H.heap i (fun _ -> True) (fun h0 x h1 -> x == h0 /\ h1 == h0) | let get_indexed (#i:idx) () : RWI H.heap i (fun _ -> True) (fun h0 x h1 -> x == h0 /\ h1 == h0) =
RWI?.reflect (fun () -> ST.get ()) | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 36,
"end_line": 254,
"start_col": 0,
"start_line": 253
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h
let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1
// how is subtyping handled? can I subtype on a?
// note that post is contravariant in a
let subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)
(i2:idx) (pre' : st_pre) (post' : st_bpost a)
(f : m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True))
= fun () -> f ()
unfold
let ite (p q r : Type0) = (p ==> q) /\ (~p ==> r)
let if_then_else
(a : Type) (i1:idx)
(pre1:st_pre)
(post1 : st_bpost a)
(i2 : idx)
(pre2 : st_pre)
(post2 : st_bpost a)
(f : m a i1 pre1 post1) (g : m a i2 pre2 post2)
(p : bool)
: Type
= m a (join i1 i2)
(fun h0 -> ite p (pre1 h0) (pre2 h0))
(fun h0 x h1 -> ite p (post1 h0 x h1) (post2 h0 x h1))
reifiable
reflectable
effect {
RWI (a:Type) (i:idx) (_:st_pre) (_:st_bpost a)
with {repr = m;
return = return;
bind = bind;
subcomp = subcomp;
if_then_else = if_then_else}
}
unfold
let sp #a (wp : pure_wp a) : pure_post a =
fun x -> ~ (wp (fun y -> ~(x == y)))
let lift_pure_rwi
(a:Type)
(wp : pure_wp a)
(f :unit -> PURE a wp)
// with the index-polymorphic bind above, this has to be in RO,
// or unification will usually not find the index here
: m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\ h1 == h0)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun () -> f ()
sub_effect PURE ~> RWI = lift_pure_rwi
let test_rrr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_rrw #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_rwr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_rww #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wrr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_wrw #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wwr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_www #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
let rec map #a #b
(f : a -> RWI b RO (fun _ -> True) (fun _ _ _ -> True))
(xs : list a)
: RWI (list b) RO (fun _ -> True) (fun _ _ _ -> True)
= match xs with
| [] -> []
| x::xs -> (f x)::(map f xs)
let app #a #b #i #pre #post (f : a -> RWI b i pre post) (x : a) : RWI b i pre post = f x
// can't resolve an index, providing it explicitly with #i makes it explode too
// update: actually, putting a dollar sign on f makes it work... why? I can see
// why it helps to find the index but why doesn't it explode too?
(*
* AR: Could not resolve #i in the recursive call
*)
let rec appn #a #i
(n:nat)
(f : a -> RWI a i (fun _ -> True) (fun _ _ _ -> True))
(x : a)
: RWI a i (fun _ -> True) (fun _ _ _ -> True)
= match n with
| 0 -> x
| _ -> begin
appn #_ #i (n-1) f (f x)
end
let labs0 (n:int) : RWI int RO (fun _ -> True) (fun h0 x h1 -> x >= 0 /\ h1 == h0) =
if n < 0
then -n
else n
let labs (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
if n < 0
then -n
else n
let rwi_assert (p:Type0) : RWI unit RO (fun _ -> p) (fun h0 () h1 -> h0 == h1) =
// assert p // fails
RWI?.reflect (fun () -> assert p)
let rwi_assume (p:Type0) : RWI unit RO (fun _ -> True) (fun h0 () h1 -> h0 == h1 /\ p) =
RWI?.reflect (fun () -> assume p)
let test_abs0 (n:int) : RWI int RO (fun _ -> True) (fun h0 r h1 -> r >= 0) =
let r = labs0 n in
();
();
r
let test_abs0' (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
let r = labs0 n in
let r : nat = r in // need this! an ascription won't work!
r
let test_abs (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
let r = labs n in
r | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit -> RW.RWI FStar.Monotonic.Heap.heap | RW.RWI | [] | [] | [
"RW.idx",
"Prims.unit",
"FStar.ST.get",
"FStar.Monotonic.Heap.heap",
"Prims.l_True",
"Prims.l_and",
"Prims.eq2"
] | [] | false | true | false | false | false | let get_indexed (#i: idx) () : RWI H.heap i (fun _ -> True) (fun h0 x h1 -> x == h0 /\ h1 == h0) =
| RWI?.reflect (fun () -> ST.get ()) | false |
RW.fst | RW.labs | val labs (n: int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) | val labs (n: int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) | let labs (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
if n < 0
then -n
else n | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 8,
"end_line": 228,
"start_col": 0,
"start_line": 225
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h
let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1
// how is subtyping handled? can I subtype on a?
// note that post is contravariant in a
let subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)
(i2:idx) (pre' : st_pre) (post' : st_bpost a)
(f : m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True))
= fun () -> f ()
unfold
let ite (p q r : Type0) = (p ==> q) /\ (~p ==> r)
let if_then_else
(a : Type) (i1:idx)
(pre1:st_pre)
(post1 : st_bpost a)
(i2 : idx)
(pre2 : st_pre)
(post2 : st_bpost a)
(f : m a i1 pre1 post1) (g : m a i2 pre2 post2)
(p : bool)
: Type
= m a (join i1 i2)
(fun h0 -> ite p (pre1 h0) (pre2 h0))
(fun h0 x h1 -> ite p (post1 h0 x h1) (post2 h0 x h1))
reifiable
reflectable
effect {
RWI (a:Type) (i:idx) (_:st_pre) (_:st_bpost a)
with {repr = m;
return = return;
bind = bind;
subcomp = subcomp;
if_then_else = if_then_else}
}
unfold
let sp #a (wp : pure_wp a) : pure_post a =
fun x -> ~ (wp (fun y -> ~(x == y)))
let lift_pure_rwi
(a:Type)
(wp : pure_wp a)
(f :unit -> PURE a wp)
// with the index-polymorphic bind above, this has to be in RO,
// or unification will usually not find the index here
: m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\ h1 == h0)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun () -> f ()
sub_effect PURE ~> RWI = lift_pure_rwi
let test_rrr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_rrw #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_rwr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_rww #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wrr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_wrw #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wwr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_www #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
let rec map #a #b
(f : a -> RWI b RO (fun _ -> True) (fun _ _ _ -> True))
(xs : list a)
: RWI (list b) RO (fun _ -> True) (fun _ _ _ -> True)
= match xs with
| [] -> []
| x::xs -> (f x)::(map f xs)
let app #a #b #i #pre #post (f : a -> RWI b i pre post) (x : a) : RWI b i pre post = f x
// can't resolve an index, providing it explicitly with #i makes it explode too
// update: actually, putting a dollar sign on f makes it work... why? I can see
// why it helps to find the index but why doesn't it explode too?
(*
* AR: Could not resolve #i in the recursive call
*)
let rec appn #a #i
(n:nat)
(f : a -> RWI a i (fun _ -> True) (fun _ _ _ -> True))
(x : a)
: RWI a i (fun _ -> True) (fun _ _ _ -> True)
= match n with
| 0 -> x
| _ -> begin
appn #_ #i (n-1) f (f x)
end
let labs0 (n:int) : RWI int RO (fun _ -> True) (fun h0 x h1 -> x >= 0 /\ h1 == h0) =
if n < 0
then -n
else n | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | n: Prims.int -> RW.RWI Prims.nat | RW.RWI | [] | [] | [
"Prims.int",
"Prims.op_LessThan",
"Prims.op_Minus",
"Prims.bool",
"Prims.nat",
"RW.RO",
"FStar.Monotonic.Heap.heap",
"Prims.l_True"
] | [] | false | true | false | false | false | let labs (n: int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
| if n < 0 then - n else n | false |
RW.fst | RW.map | val map (#a #b: _) (f: (a -> RWI b RO (fun _ -> True) (fun _ _ _ -> True))) (xs: list a)
: RWI (list b) RO (fun _ -> True) (fun _ _ _ -> True) | val map (#a #b: _) (f: (a -> RWI b RO (fun _ -> True) (fun _ _ _ -> True))) (xs: list a)
: RWI (list b) RO (fun _ -> True) (fun _ _ _ -> True) | let rec map #a #b
(f : a -> RWI b RO (fun _ -> True) (fun _ _ _ -> True))
(xs : list a)
: RWI (list b) RO (fun _ -> True) (fun _ _ _ -> True)
= match xs with
| [] -> []
| x::xs -> (f x)::(map f xs) | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 31,
"end_line": 198,
"start_col": 0,
"start_line": 192
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h
let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1
// how is subtyping handled? can I subtype on a?
// note that post is contravariant in a
let subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)
(i2:idx) (pre' : st_pre) (post' : st_bpost a)
(f : m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True))
= fun () -> f ()
unfold
let ite (p q r : Type0) = (p ==> q) /\ (~p ==> r)
let if_then_else
(a : Type) (i1:idx)
(pre1:st_pre)
(post1 : st_bpost a)
(i2 : idx)
(pre2 : st_pre)
(post2 : st_bpost a)
(f : m a i1 pre1 post1) (g : m a i2 pre2 post2)
(p : bool)
: Type
= m a (join i1 i2)
(fun h0 -> ite p (pre1 h0) (pre2 h0))
(fun h0 x h1 -> ite p (post1 h0 x h1) (post2 h0 x h1))
reifiable
reflectable
effect {
RWI (a:Type) (i:idx) (_:st_pre) (_:st_bpost a)
with {repr = m;
return = return;
bind = bind;
subcomp = subcomp;
if_then_else = if_then_else}
}
unfold
let sp #a (wp : pure_wp a) : pure_post a =
fun x -> ~ (wp (fun y -> ~(x == y)))
let lift_pure_rwi
(a:Type)
(wp : pure_wp a)
(f :unit -> PURE a wp)
// with the index-polymorphic bind above, this has to be in RO,
// or unification will usually not find the index here
: m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\ h1 == h0)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun () -> f ()
sub_effect PURE ~> RWI = lift_pure_rwi
let test_rrr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_rrw #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_rwr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_rww #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wrr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_wrw #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wwr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_www #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | f: (_: a -> RW.RWI b) -> xs: Prims.list a -> RW.RWI (Prims.list b) | RW.RWI | [] | [] | [
"RW.RO",
"FStar.Monotonic.Heap.heap",
"Prims.l_True",
"Prims.list",
"Prims.Nil",
"Prims.Cons",
"RW.map"
] | [
"recursion"
] | false | true | false | false | false | let rec map #a #b (f: (a -> RWI b RO (fun _ -> True) (fun _ _ _ -> True))) (xs: list a)
: RWI (list b) RO (fun _ -> True) (fun _ _ _ -> True) =
| match xs with
| [] -> []
| x :: xs -> (f x) :: (map f xs) | false |
LowStar.Buffer.fst | LowStar.Buffer.alloca | val alloca : init: a -> len: FStar.UInt32.t
-> FStar.HyperStack.ST.StackInline
(b:
LowStar.Monotonic.Buffer.mbuffer a
(LowStar.Buffer.trivial_preorder a)
(LowStar.Buffer.trivial_preorder a)
{ LowStar.Monotonic.Buffer.length b == FStar.UInt32.v len /\
Prims.op_Negation (LowStar.Monotonic.Buffer.g_is_null b) }) | let alloca (#a:Type0) = malloca #a #(trivial_preorder a) | {
"file_name": "ulib/LowStar.Buffer.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 78,
"end_line": 60,
"start_col": 22,
"start_line": 60
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module LowStar.Buffer
include LowStar.Monotonic.Buffer
module P = FStar.Preorder
module G = FStar.Ghost
module U32 = FStar.UInt32
module Seq = FStar.Seq
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
(*
* Wrapper over LowStar.Monotonic.Buffer, with trivial preorders
* -- functions that take explicit preorder as arguments (e.g. sub etc.)
* -- these include allocation functions also
*)
let trivial_preorder (a:Type0) :srel a = fun _ _ -> True
type buffer (a:Type0) = mbuffer a (trivial_preorder a) (trivial_preorder a)
unfold let null (#a:Type0) :buffer a = mnull #a #(trivial_preorder a) #(trivial_preorder a)
unfold let gsub (#a:Type0) = mgsub #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a)
unfold let gsub_inj (#a:Type0) = mgsub_inj #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a) (trivial_preorder a)
[@@unifier_hint_injective]
inline_for_extraction
type pointer (a:Type0) = b:buffer a{length b == 1}
inline_for_extraction
type pointer_or_null (a:Type0) = b:buffer a{if g_is_null b then True else length b == 1}
inline_for_extraction let sub (#a:Type0) = msub #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a)
inline_for_extraction let offset (#a:Type0) = moffset #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a)
unfold let lbuffer (a:Type0) (len:nat) = lmbuffer a (trivial_preorder a) (trivial_preorder a) len
inline_for_extraction let gcmalloc (#a:Type0) = mgcmalloc #a #(trivial_preorder a)
inline_for_extraction let malloc (#a:Type0) = mmalloc #a #(trivial_preorder a) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Preorder.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LowStar.Buffer.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.Preorder",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | init: a -> len: FStar.UInt32.t
-> FStar.HyperStack.ST.StackInline
(b:
LowStar.Monotonic.Buffer.mbuffer a
(LowStar.Buffer.trivial_preorder a)
(LowStar.Buffer.trivial_preorder a)
{ LowStar.Monotonic.Buffer.length b == FStar.UInt32.v len /\
Prims.op_Negation (LowStar.Monotonic.Buffer.g_is_null b) }) | FStar.HyperStack.ST.StackInline | [] | [] | [
"LowStar.Monotonic.Buffer.malloca",
"LowStar.Buffer.trivial_preorder",
"FStar.UInt32.t",
"LowStar.Monotonic.Buffer.mbuffer",
"Prims.l_and",
"Prims.eq2",
"Prims.nat",
"LowStar.Monotonic.Buffer.length",
"FStar.UInt32.v",
"Prims.b2t",
"Prims.op_Negation",
"LowStar.Monotonic.Buffer.g_is_null",
"FStar.Monotonic.HyperStack.mem",
"Prims.op_GreaterThan",
"LowStar.Monotonic.Buffer.live",
"LowStar.Monotonic.Buffer.unused_in",
"FStar.Set.equal",
"FStar.Monotonic.HyperHeap.rid",
"FStar.Map.domain",
"FStar.Monotonic.Heap.heap",
"FStar.Monotonic.HyperStack.get_hmap",
"FStar.Monotonic.HyperStack.get_tip",
"LowStar.Monotonic.Buffer.modifies",
"LowStar.Monotonic.Buffer.loc_none",
"FStar.Seq.Base.seq",
"LowStar.Monotonic.Buffer.as_seq",
"FStar.Seq.Base.create",
"LowStar.Monotonic.Buffer.frameOf"
] | [] | false | true | false | false | false | let alloca (#a: Type0) =
| malloca #a #(trivial_preorder a) | false |
|
LowStar.Buffer.fst | LowStar.Buffer.gcmalloc | val gcmalloc : r: FStar.Monotonic.HyperHeap.rid -> init: a -> len: FStar.UInt32.t
-> FStar.HyperStack.ST.ST
(b:
(b:
LowStar.Monotonic.Buffer.mbuffer a
(LowStar.Buffer.trivial_preorder a)
(LowStar.Buffer.trivial_preorder a)
{ LowStar.Monotonic.Buffer.length b == FStar.UInt32.v len /\
Prims.op_Negation (LowStar.Monotonic.Buffer.g_is_null b) })
{LowStar.Monotonic.Buffer.frameOf b == r /\ LowStar.Monotonic.Buffer.recallable b}) | let gcmalloc (#a:Type0) = mgcmalloc #a #(trivial_preorder a) | {
"file_name": "ulib/LowStar.Buffer.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 82,
"end_line": 56,
"start_col": 22,
"start_line": 56
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module LowStar.Buffer
include LowStar.Monotonic.Buffer
module P = FStar.Preorder
module G = FStar.Ghost
module U32 = FStar.UInt32
module Seq = FStar.Seq
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
(*
* Wrapper over LowStar.Monotonic.Buffer, with trivial preorders
* -- functions that take explicit preorder as arguments (e.g. sub etc.)
* -- these include allocation functions also
*)
let trivial_preorder (a:Type0) :srel a = fun _ _ -> True
type buffer (a:Type0) = mbuffer a (trivial_preorder a) (trivial_preorder a)
unfold let null (#a:Type0) :buffer a = mnull #a #(trivial_preorder a) #(trivial_preorder a)
unfold let gsub (#a:Type0) = mgsub #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a)
unfold let gsub_inj (#a:Type0) = mgsub_inj #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a) (trivial_preorder a)
[@@unifier_hint_injective]
inline_for_extraction
type pointer (a:Type0) = b:buffer a{length b == 1}
inline_for_extraction
type pointer_or_null (a:Type0) = b:buffer a{if g_is_null b then True else length b == 1}
inline_for_extraction let sub (#a:Type0) = msub #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a)
inline_for_extraction let offset (#a:Type0) = moffset #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a)
unfold let lbuffer (a:Type0) (len:nat) = lmbuffer a (trivial_preorder a) (trivial_preorder a) len | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Preorder.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LowStar.Buffer.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.Preorder",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | r: FStar.Monotonic.HyperHeap.rid -> init: a -> len: FStar.UInt32.t
-> FStar.HyperStack.ST.ST
(b:
(b:
LowStar.Monotonic.Buffer.mbuffer a
(LowStar.Buffer.trivial_preorder a)
(LowStar.Buffer.trivial_preorder a)
{ LowStar.Monotonic.Buffer.length b == FStar.UInt32.v len /\
Prims.op_Negation (LowStar.Monotonic.Buffer.g_is_null b) })
{LowStar.Monotonic.Buffer.frameOf b == r /\ LowStar.Monotonic.Buffer.recallable b}) | FStar.HyperStack.ST.ST | [] | [] | [
"LowStar.Monotonic.Buffer.mgcmalloc",
"LowStar.Buffer.trivial_preorder",
"FStar.Monotonic.HyperHeap.rid",
"FStar.UInt32.t",
"LowStar.Monotonic.Buffer.mbuffer",
"Prims.l_and",
"Prims.eq2",
"Prims.nat",
"LowStar.Monotonic.Buffer.length",
"FStar.UInt32.v",
"Prims.b2t",
"Prims.op_Negation",
"LowStar.Monotonic.Buffer.g_is_null",
"LowStar.Monotonic.Buffer.frameOf",
"LowStar.Monotonic.Buffer.recallable",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.is_eternal_region",
"Prims.op_GreaterThan",
"LowStar.Monotonic.Buffer.live",
"LowStar.Monotonic.Buffer.unused_in",
"FStar.Set.equal",
"FStar.Map.domain",
"FStar.Monotonic.Heap.heap",
"FStar.Monotonic.HyperStack.get_hmap",
"FStar.Monotonic.HyperStack.get_tip",
"LowStar.Monotonic.Buffer.modifies",
"LowStar.Monotonic.Buffer.loc_none",
"FStar.Seq.Base.seq",
"LowStar.Monotonic.Buffer.as_seq",
"FStar.Seq.Base.create"
] | [] | false | true | false | false | false | let gcmalloc (#a: Type0) =
| mgcmalloc #a #(trivial_preorder a) | false |
|
RW.fst | RW.appn | val appn (#a #i: _) (n: nat) (f: (a -> RWI a i (fun _ -> True) (fun _ _ _ -> True))) (x: a)
: RWI a i (fun _ -> True) (fun _ _ _ -> True) | val appn (#a #i: _) (n: nat) (f: (a -> RWI a i (fun _ -> True) (fun _ _ _ -> True))) (x: a)
: RWI a i (fun _ -> True) (fun _ _ _ -> True) | let rec appn #a #i
(n:nat)
(f : a -> RWI a i (fun _ -> True) (fun _ _ _ -> True))
(x : a)
: RWI a i (fun _ -> True) (fun _ _ _ -> True)
= match n with
| 0 -> x
| _ -> begin
appn #_ #i (n-1) f (f x)
end | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 5,
"end_line": 218,
"start_col": 0,
"start_line": 209
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h
let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1
// how is subtyping handled? can I subtype on a?
// note that post is contravariant in a
let subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)
(i2:idx) (pre' : st_pre) (post' : st_bpost a)
(f : m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True))
= fun () -> f ()
unfold
let ite (p q r : Type0) = (p ==> q) /\ (~p ==> r)
let if_then_else
(a : Type) (i1:idx)
(pre1:st_pre)
(post1 : st_bpost a)
(i2 : idx)
(pre2 : st_pre)
(post2 : st_bpost a)
(f : m a i1 pre1 post1) (g : m a i2 pre2 post2)
(p : bool)
: Type
= m a (join i1 i2)
(fun h0 -> ite p (pre1 h0) (pre2 h0))
(fun h0 x h1 -> ite p (post1 h0 x h1) (post2 h0 x h1))
reifiable
reflectable
effect {
RWI (a:Type) (i:idx) (_:st_pre) (_:st_bpost a)
with {repr = m;
return = return;
bind = bind;
subcomp = subcomp;
if_then_else = if_then_else}
}
unfold
let sp #a (wp : pure_wp a) : pure_post a =
fun x -> ~ (wp (fun y -> ~(x == y)))
let lift_pure_rwi
(a:Type)
(wp : pure_wp a)
(f :unit -> PURE a wp)
// with the index-polymorphic bind above, this has to be in RO,
// or unification will usually not find the index here
: m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\ h1 == h0)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun () -> f ()
sub_effect PURE ~> RWI = lift_pure_rwi
let test_rrr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_rrw #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_rwr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_rww #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wrr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_wrw #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wwr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_www #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
let rec map #a #b
(f : a -> RWI b RO (fun _ -> True) (fun _ _ _ -> True))
(xs : list a)
: RWI (list b) RO (fun _ -> True) (fun _ _ _ -> True)
= match xs with
| [] -> []
| x::xs -> (f x)::(map f xs)
let app #a #b #i #pre #post (f : a -> RWI b i pre post) (x : a) : RWI b i pre post = f x
// can't resolve an index, providing it explicitly with #i makes it explode too
// update: actually, putting a dollar sign on f makes it work... why? I can see
// why it helps to find the index but why doesn't it explode too?
(*
* AR: Could not resolve #i in the recursive call | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | n: Prims.nat -> f: (_: a -> RW.RWI a) -> x: a -> RW.RWI a | RW.RWI | [] | [] | [
"RW.idx",
"Prims.nat",
"FStar.Monotonic.Heap.heap",
"Prims.l_True",
"Prims.int",
"RW.appn",
"Prims.op_Subtraction"
] | [
"recursion"
] | false | true | false | false | false | let rec appn #a #i (n: nat) (f: (a -> RWI a i (fun _ -> True) (fun _ _ _ -> True))) (x: a)
: RWI a i (fun _ -> True) (fun _ _ _ -> True) =
| match n with
| 0 -> x
| _ -> appn #_ #i (n - 1) f (f x) | false |
LowStar.Buffer.fst | LowStar.Buffer.trivial_preorder | val trivial_preorder (a: Type0) : srel a | val trivial_preorder (a: Type0) : srel a | let trivial_preorder (a:Type0) :srel a = fun _ _ -> True | {
"file_name": "ulib/LowStar.Buffer.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 56,
"end_line": 33,
"start_col": 0,
"start_line": 33
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module LowStar.Buffer
include LowStar.Monotonic.Buffer
module P = FStar.Preorder
module G = FStar.Ghost
module U32 = FStar.UInt32
module Seq = FStar.Seq
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
(*
* Wrapper over LowStar.Monotonic.Buffer, with trivial preorders
* -- functions that take explicit preorder as arguments (e.g. sub etc.)
* -- these include allocation functions also | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Preorder.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LowStar.Buffer.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.Preorder",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type0 -> LowStar.Monotonic.Buffer.srel a | Prims.Tot | [
"total"
] | [] | [
"FStar.Seq.Base.seq",
"Prims.l_True",
"Prims.logical",
"LowStar.Monotonic.Buffer.srel"
] | [] | false | false | false | true | false | let trivial_preorder (a: Type0) : srel a =
| fun _ _ -> True | false |
RW.fst | RW.test_abs | val test_abs (n: int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) | val test_abs (n: int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) | let test_abs (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
let r = labs n in
r | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 3,
"end_line": 250,
"start_col": 0,
"start_line": 248
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h
let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1
// how is subtyping handled? can I subtype on a?
// note that post is contravariant in a
let subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)
(i2:idx) (pre' : st_pre) (post' : st_bpost a)
(f : m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True))
= fun () -> f ()
unfold
let ite (p q r : Type0) = (p ==> q) /\ (~p ==> r)
let if_then_else
(a : Type) (i1:idx)
(pre1:st_pre)
(post1 : st_bpost a)
(i2 : idx)
(pre2 : st_pre)
(post2 : st_bpost a)
(f : m a i1 pre1 post1) (g : m a i2 pre2 post2)
(p : bool)
: Type
= m a (join i1 i2)
(fun h0 -> ite p (pre1 h0) (pre2 h0))
(fun h0 x h1 -> ite p (post1 h0 x h1) (post2 h0 x h1))
reifiable
reflectable
effect {
RWI (a:Type) (i:idx) (_:st_pre) (_:st_bpost a)
with {repr = m;
return = return;
bind = bind;
subcomp = subcomp;
if_then_else = if_then_else}
}
unfold
let sp #a (wp : pure_wp a) : pure_post a =
fun x -> ~ (wp (fun y -> ~(x == y)))
let lift_pure_rwi
(a:Type)
(wp : pure_wp a)
(f :unit -> PURE a wp)
// with the index-polymorphic bind above, this has to be in RO,
// or unification will usually not find the index here
: m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\ h1 == h0)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun () -> f ()
sub_effect PURE ~> RWI = lift_pure_rwi
let test_rrr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_rrw #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_rwr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_rww #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wrr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_wrw #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wwr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_www #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
let rec map #a #b
(f : a -> RWI b RO (fun _ -> True) (fun _ _ _ -> True))
(xs : list a)
: RWI (list b) RO (fun _ -> True) (fun _ _ _ -> True)
= match xs with
| [] -> []
| x::xs -> (f x)::(map f xs)
let app #a #b #i #pre #post (f : a -> RWI b i pre post) (x : a) : RWI b i pre post = f x
// can't resolve an index, providing it explicitly with #i makes it explode too
// update: actually, putting a dollar sign on f makes it work... why? I can see
// why it helps to find the index but why doesn't it explode too?
(*
* AR: Could not resolve #i in the recursive call
*)
let rec appn #a #i
(n:nat)
(f : a -> RWI a i (fun _ -> True) (fun _ _ _ -> True))
(x : a)
: RWI a i (fun _ -> True) (fun _ _ _ -> True)
= match n with
| 0 -> x
| _ -> begin
appn #_ #i (n-1) f (f x)
end
let labs0 (n:int) : RWI int RO (fun _ -> True) (fun h0 x h1 -> x >= 0 /\ h1 == h0) =
if n < 0
then -n
else n
let labs (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
if n < 0
then -n
else n
let rwi_assert (p:Type0) : RWI unit RO (fun _ -> p) (fun h0 () h1 -> h0 == h1) =
// assert p // fails
RWI?.reflect (fun () -> assert p)
let rwi_assume (p:Type0) : RWI unit RO (fun _ -> True) (fun h0 () h1 -> h0 == h1 /\ p) =
RWI?.reflect (fun () -> assume p)
let test_abs0 (n:int) : RWI int RO (fun _ -> True) (fun h0 r h1 -> r >= 0) =
let r = labs0 n in
();
();
r
let test_abs0' (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
let r = labs0 n in
let r : nat = r in // need this! an ascription won't work!
r | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | n: Prims.int -> RW.RWI Prims.nat | RW.RWI | [] | [] | [
"Prims.int",
"Prims.nat",
"RW.labs",
"RW.RO",
"FStar.Monotonic.Heap.heap",
"Prims.l_True"
] | [] | false | true | false | false | false | let test_abs (n: int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
| let r = labs n in
r | false |
RW.fst | RW.test_state_eq_rww | val test_state_eq_rww
(f: (unit -> RWI int RO (fun _ -> True) (fun _ _ _ -> True)))
(g: (unit -> RWI int RW (fun _ -> True) (fun _ _ _ -> True)))
: RWI int RW (fun _ -> True) (fun _ _ _ -> True) | val test_state_eq_rww
(f: (unit -> RWI int RO (fun _ -> True) (fun _ _ _ -> True)))
(g: (unit -> RWI int RW (fun _ -> True) (fun _ _ _ -> True)))
: RWI int RW (fun _ -> True) (fun _ _ _ -> True) | let test_state_eq_rww
(f : unit -> RWI int RO (fun _ -> True) (fun _ _ _ -> True))
(g : unit -> RWI int RW (fun _ -> True) (fun _ _ _ -> True))
: RWI int RW (fun _ -> True) (fun _ _ _ -> True)
=
let h0 = get () in
let x = f () in
let h1 = get () in
let y = g () in
let h2 = get () in
assert (h0 == h1);
x + y | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 7,
"end_line": 300,
"start_col": 0,
"start_line": 289
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h
let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1
// how is subtyping handled? can I subtype on a?
// note that post is contravariant in a
let subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)
(i2:idx) (pre' : st_pre) (post' : st_bpost a)
(f : m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True))
= fun () -> f ()
unfold
let ite (p q r : Type0) = (p ==> q) /\ (~p ==> r)
let if_then_else
(a : Type) (i1:idx)
(pre1:st_pre)
(post1 : st_bpost a)
(i2 : idx)
(pre2 : st_pre)
(post2 : st_bpost a)
(f : m a i1 pre1 post1) (g : m a i2 pre2 post2)
(p : bool)
: Type
= m a (join i1 i2)
(fun h0 -> ite p (pre1 h0) (pre2 h0))
(fun h0 x h1 -> ite p (post1 h0 x h1) (post2 h0 x h1))
reifiable
reflectable
effect {
RWI (a:Type) (i:idx) (_:st_pre) (_:st_bpost a)
with {repr = m;
return = return;
bind = bind;
subcomp = subcomp;
if_then_else = if_then_else}
}
unfold
let sp #a (wp : pure_wp a) : pure_post a =
fun x -> ~ (wp (fun y -> ~(x == y)))
let lift_pure_rwi
(a:Type)
(wp : pure_wp a)
(f :unit -> PURE a wp)
// with the index-polymorphic bind above, this has to be in RO,
// or unification will usually not find the index here
: m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\ h1 == h0)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun () -> f ()
sub_effect PURE ~> RWI = lift_pure_rwi
let test_rrr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_rrw #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_rwr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_rww #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wrr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_wrw #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wwr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_www #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
let rec map #a #b
(f : a -> RWI b RO (fun _ -> True) (fun _ _ _ -> True))
(xs : list a)
: RWI (list b) RO (fun _ -> True) (fun _ _ _ -> True)
= match xs with
| [] -> []
| x::xs -> (f x)::(map f xs)
let app #a #b #i #pre #post (f : a -> RWI b i pre post) (x : a) : RWI b i pre post = f x
// can't resolve an index, providing it explicitly with #i makes it explode too
// update: actually, putting a dollar sign on f makes it work... why? I can see
// why it helps to find the index but why doesn't it explode too?
(*
* AR: Could not resolve #i in the recursive call
*)
let rec appn #a #i
(n:nat)
(f : a -> RWI a i (fun _ -> True) (fun _ _ _ -> True))
(x : a)
: RWI a i (fun _ -> True) (fun _ _ _ -> True)
= match n with
| 0 -> x
| _ -> begin
appn #_ #i (n-1) f (f x)
end
let labs0 (n:int) : RWI int RO (fun _ -> True) (fun h0 x h1 -> x >= 0 /\ h1 == h0) =
if n < 0
then -n
else n
let labs (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
if n < 0
then -n
else n
let rwi_assert (p:Type0) : RWI unit RO (fun _ -> p) (fun h0 () h1 -> h0 == h1) =
// assert p // fails
RWI?.reflect (fun () -> assert p)
let rwi_assume (p:Type0) : RWI unit RO (fun _ -> True) (fun h0 () h1 -> h0 == h1 /\ p) =
RWI?.reflect (fun () -> assume p)
let test_abs0 (n:int) : RWI int RO (fun _ -> True) (fun h0 r h1 -> r >= 0) =
let r = labs0 n in
();
();
r
let test_abs0' (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
let r = labs0 n in
let r : nat = r in // need this! an ascription won't work!
r
let test_abs (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
let r = labs n in
r
// just a test
let get_indexed (#i:idx) () : RWI H.heap i (fun _ -> True) (fun h0 x h1 -> x == h0 /\ h1 == h0) =
RWI?.reflect (fun () -> ST.get ())
let get_r () : RWI H.heap RO (fun _ -> True) (fun h0 x h1 -> x == h0 /\ h1 == h0) =
RWI?.reflect (fun () -> ST.get ())
//let get #i = get_indexed #i
let get = get_r
let test_state_eq_rrr
(f g : unit -> RWI int RO (fun _ -> True) (fun _ _ _ -> True))
: RWI int RO (fun _ -> True) (fun _ _ _ -> True)
=
let h0 = get () in
let x = f () in
let h1 = get () in
let y = g () in
let h2 = get () in
assert (h0 == h1);
assert (h1 == h2);
x + y
let test_state_eq_rrw
(f : unit -> RWI int RO (fun _ -> True) (fun _ _ _ -> True))
(g : unit -> RWI int RO (fun _ -> True) (fun _ _ _ -> True))
: RWI int RW (fun _ -> True) (fun _ _ _ -> True)
=
let h0 = get () in
let x = f () in
let h1 = get () in
let y = g () in
let h2 = get () in
assert (h0 == h1);
assert (h1 == h2);
x + y | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | f: (_: Prims.unit -> RW.RWI Prims.int) -> g: (_: Prims.unit -> RW.RWI Prims.int) -> RW.RWI Prims.int | RW.RWI | [] | [] | [
"Prims.unit",
"Prims.int",
"RW.RO",
"FStar.Monotonic.Heap.heap",
"Prims.l_True",
"RW.RW",
"Prims.op_Addition",
"Prims._assert",
"Prims.eq2",
"RW.get"
] | [] | false | true | false | false | false | let test_state_eq_rww
(f: (unit -> RWI int RO (fun _ -> True) (fun _ _ _ -> True)))
(g: (unit -> RWI int RW (fun _ -> True) (fun _ _ _ -> True)))
: RWI int RW (fun _ -> True) (fun _ _ _ -> True) =
| let h0 = get () in
let x = f () in
let h1 = get () in
let y = g () in
let h2 = get () in
assert (h0 == h1);
x + y | false |
Pulse.Typing.Combinators.fsti | Pulse.Typing.Combinators.list_as_vprop | val list_as_vprop (vps: list term) : term | val list_as_vprop (vps: list term) : term | let rec list_as_vprop (vps:list term)
: term
= match vps with
| [] -> tm_emp
| [hd] -> hd
| hd::tl -> tm_star hd (list_as_vprop tl) | {
"file_name": "lib/steel/pulse/Pulse.Typing.Combinators.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 45,
"end_line": 113,
"start_col": 0,
"start_line": 108
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Typing.Combinators
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Typing
let st_comp_with_pre (st:st_comp) (pre:term) : st_comp = { st with pre }
let nvar_as_binder (x:nvar) (t:term) : binder =
mk_binder_ppname t (fst x)
val vprop_equiv_typing (#g:_) (#t0 #t1:term) (v:vprop_equiv g t0 t1)
: GTot ((tot_typing g t0 tm_vprop -> tot_typing g t1 tm_vprop) &
(tot_typing g t1 tm_vprop -> tot_typing g t0 tm_vprop))
val mk_bind (g:env)
(pre:term)
(e1:st_term)
(e2:st_term)
(c1:comp_st)
(c2:comp_st)
(px:nvar { ~ (Set.mem (snd px) (dom g)) })
(d_e1:st_typing g e1 c1)
(d_c1res:tot_typing g (comp_res c1) (tm_type (comp_u c1)))
(d_e2:st_typing (push_binding g (snd px) (fst px) (comp_res c1)) (open_st_term_nv e2 px) c2)
(res_typing:universe_of g (comp_res c2) (comp_u c2))
(post_typing:tot_typing (push_binding g (snd px) (fst px) (comp_res c2))
(open_term_nv (comp_post c2) px)
tm_vprop)
(bias_towards_continuation:bool)
: T.TacH (t:st_term &
c:comp_st { st_comp_of_comp c == st_comp_with_pre (st_comp_of_comp c2) pre /\
(bias_towards_continuation ==> effect_annot_of_comp c == effect_annot_of_comp c2) } &
st_typing g t c)
(requires fun _ ->
let _, x = px in
comp_pre c1 == pre /\
None? (lookup g x) /\
(~(x `Set.mem` freevars_st e2)) /\
open_term (comp_post c1) x == comp_pre c2 /\
(~ (x `Set.mem` freevars (comp_post c2))))
(ensures fun _ _ -> True)
val bind_res_and_post_typing (g:env) (s2:comp_st) (x:var { fresh_wrt x g (freevars (comp_post s2)) })
(post_hint:post_hint_opt g { comp_post_matches_hint s2 post_hint })
: T.Tac (universe_of g (comp_res s2) (comp_u s2) &
tot_typing (push_binding g x ppname_default (comp_res s2)) (open_term_nv (comp_post s2) (v_as_nv x)) tm_vprop)
val add_frame (#g:env) (#t:st_term) (#c:comp_st) (t_typing:st_typing g t c)
(#frame:vprop)
(frame_typing:tot_typing g frame tm_vprop)
: t':st_term &
c':comp_st { c' == add_frame c frame } &
st_typing g t' c'
let frame_for_req_in_ctxt (g:env) (ctxt:term) (req:term)
= (frame:term &
tot_typing g frame tm_vprop &
vprop_equiv g (tm_star req frame) ctxt)
let frame_of #g #ctxt #req (f:frame_for_req_in_ctxt g ctxt req) =
let (| frame, _, _ |) = f in frame
val apply_frame (#g:env)
(#t:st_term)
(#ctxt:term)
(ctxt_typing: tot_typing g ctxt tm_vprop)
(#c:comp { stateful_comp c })
(t_typing: st_typing g t c)
(frame_t:frame_for_req_in_ctxt g ctxt (comp_pre c))
: Tot (c':comp_st { comp_pre c' == ctxt /\
comp_res c' == comp_res c /\
comp_u c' == comp_u c /\
comp_post c' == tm_star (comp_post c) (frame_of frame_t) } &
st_typing g t c')
type st_typing_in_ctxt (g:env) (ctxt:vprop) (post_hint:post_hint_opt g) =
t:st_term &
c:comp_st { comp_pre c == ctxt /\ comp_post_matches_hint c post_hint } &
st_typing g t c
let rec vprop_as_list (vp:term)
: list term
= match vp.t with
| Tm_Emp -> []
| Tm_Star vp0 vp1 -> vprop_as_list vp0 @ vprop_as_list vp1
| _ -> [vp] | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Typing.Combinators.fsti"
} | [
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | vps: Prims.list Pulse.Syntax.Base.term -> Pulse.Syntax.Base.term | Prims.Tot | [
"total"
] | [] | [
"Prims.list",
"Pulse.Syntax.Base.term",
"Pulse.Syntax.Base.tm_emp",
"Pulse.Syntax.Base.tm_star",
"Pulse.Typing.Combinators.list_as_vprop"
] | [
"recursion"
] | false | false | false | true | false | let rec list_as_vprop (vps: list term) : term =
| match vps with
| [] -> tm_emp
| [hd] -> hd
| hd :: tl -> tm_star hd (list_as_vprop tl) | false |
RW.fst | RW.test_state_eq_rrw | val test_state_eq_rrw (f g: (unit -> RWI int RO (fun _ -> True) (fun _ _ _ -> True)))
: RWI int RW (fun _ -> True) (fun _ _ _ -> True) | val test_state_eq_rrw (f g: (unit -> RWI int RO (fun _ -> True) (fun _ _ _ -> True)))
: RWI int RW (fun _ -> True) (fun _ _ _ -> True) | let test_state_eq_rrw
(f : unit -> RWI int RO (fun _ -> True) (fun _ _ _ -> True))
(g : unit -> RWI int RO (fun _ -> True) (fun _ _ _ -> True))
: RWI int RW (fun _ -> True) (fun _ _ _ -> True)
=
let h0 = get () in
let x = f () in
let h1 = get () in
let y = g () in
let h2 = get () in
assert (h0 == h1);
assert (h1 == h2);
x + y | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 7,
"end_line": 287,
"start_col": 0,
"start_line": 275
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h
let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1
// how is subtyping handled? can I subtype on a?
// note that post is contravariant in a
let subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)
(i2:idx) (pre' : st_pre) (post' : st_bpost a)
(f : m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True))
= fun () -> f ()
unfold
let ite (p q r : Type0) = (p ==> q) /\ (~p ==> r)
let if_then_else
(a : Type) (i1:idx)
(pre1:st_pre)
(post1 : st_bpost a)
(i2 : idx)
(pre2 : st_pre)
(post2 : st_bpost a)
(f : m a i1 pre1 post1) (g : m a i2 pre2 post2)
(p : bool)
: Type
= m a (join i1 i2)
(fun h0 -> ite p (pre1 h0) (pre2 h0))
(fun h0 x h1 -> ite p (post1 h0 x h1) (post2 h0 x h1))
reifiable
reflectable
effect {
RWI (a:Type) (i:idx) (_:st_pre) (_:st_bpost a)
with {repr = m;
return = return;
bind = bind;
subcomp = subcomp;
if_then_else = if_then_else}
}
unfold
let sp #a (wp : pure_wp a) : pure_post a =
fun x -> ~ (wp (fun y -> ~(x == y)))
let lift_pure_rwi
(a:Type)
(wp : pure_wp a)
(f :unit -> PURE a wp)
// with the index-polymorphic bind above, this has to be in RO,
// or unification will usually not find the index here
: m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\ h1 == h0)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun () -> f ()
sub_effect PURE ~> RWI = lift_pure_rwi
let test_rrr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_rrw #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_rwr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_rww #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wrr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_wrw #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wwr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_www #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
let rec map #a #b
(f : a -> RWI b RO (fun _ -> True) (fun _ _ _ -> True))
(xs : list a)
: RWI (list b) RO (fun _ -> True) (fun _ _ _ -> True)
= match xs with
| [] -> []
| x::xs -> (f x)::(map f xs)
let app #a #b #i #pre #post (f : a -> RWI b i pre post) (x : a) : RWI b i pre post = f x
// can't resolve an index, providing it explicitly with #i makes it explode too
// update: actually, putting a dollar sign on f makes it work... why? I can see
// why it helps to find the index but why doesn't it explode too?
(*
* AR: Could not resolve #i in the recursive call
*)
let rec appn #a #i
(n:nat)
(f : a -> RWI a i (fun _ -> True) (fun _ _ _ -> True))
(x : a)
: RWI a i (fun _ -> True) (fun _ _ _ -> True)
= match n with
| 0 -> x
| _ -> begin
appn #_ #i (n-1) f (f x)
end
let labs0 (n:int) : RWI int RO (fun _ -> True) (fun h0 x h1 -> x >= 0 /\ h1 == h0) =
if n < 0
then -n
else n
let labs (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
if n < 0
then -n
else n
let rwi_assert (p:Type0) : RWI unit RO (fun _ -> p) (fun h0 () h1 -> h0 == h1) =
// assert p // fails
RWI?.reflect (fun () -> assert p)
let rwi_assume (p:Type0) : RWI unit RO (fun _ -> True) (fun h0 () h1 -> h0 == h1 /\ p) =
RWI?.reflect (fun () -> assume p)
let test_abs0 (n:int) : RWI int RO (fun _ -> True) (fun h0 r h1 -> r >= 0) =
let r = labs0 n in
();
();
r
let test_abs0' (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
let r = labs0 n in
let r : nat = r in // need this! an ascription won't work!
r
let test_abs (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
let r = labs n in
r
// just a test
let get_indexed (#i:idx) () : RWI H.heap i (fun _ -> True) (fun h0 x h1 -> x == h0 /\ h1 == h0) =
RWI?.reflect (fun () -> ST.get ())
let get_r () : RWI H.heap RO (fun _ -> True) (fun h0 x h1 -> x == h0 /\ h1 == h0) =
RWI?.reflect (fun () -> ST.get ())
//let get #i = get_indexed #i
let get = get_r
let test_state_eq_rrr
(f g : unit -> RWI int RO (fun _ -> True) (fun _ _ _ -> True))
: RWI int RO (fun _ -> True) (fun _ _ _ -> True)
=
let h0 = get () in
let x = f () in
let h1 = get () in
let y = g () in
let h2 = get () in
assert (h0 == h1);
assert (h1 == h2);
x + y | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | f: (_: Prims.unit -> RW.RWI Prims.int) -> g: (_: Prims.unit -> RW.RWI Prims.int) -> RW.RWI Prims.int | RW.RWI | [] | [] | [
"Prims.unit",
"Prims.int",
"RW.RO",
"FStar.Monotonic.Heap.heap",
"Prims.l_True",
"Prims.op_Addition",
"Prims._assert",
"Prims.eq2",
"RW.get",
"RW.RW"
] | [] | false | true | false | false | false | let test_state_eq_rrw (f g: (unit -> RWI int RO (fun _ -> True) (fun _ _ _ -> True)))
: RWI int RW (fun _ -> True) (fun _ _ _ -> True) =
| let h0 = get () in
let x = f () in
let h1 = get () in
let y = g () in
let h2 = get () in
assert (h0 == h1);
assert (h1 == h2);
x + y | false |
LowStar.Buffer.fst | LowStar.Buffer.alloca_of_list | val alloca_of_list : init: Prims.list a
-> FStar.HyperStack.ST.StackInline
(b:
LowStar.Monotonic.Buffer.mbuffer a
(LowStar.Buffer.trivial_preorder a)
(LowStar.Buffer.trivial_preorder a)
{ LowStar.Monotonic.Buffer.length b ==
FStar.Pervasives.normalize_term (FStar.List.Tot.Base.length init) /\
Prims.op_Negation (LowStar.Monotonic.Buffer.g_is_null b) }) | let alloca_of_list (#a:Type0) = malloca_of_list #a #(trivial_preorder a) | {
"file_name": "ulib/LowStar.Buffer.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 94,
"end_line": 62,
"start_col": 22,
"start_line": 62
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module LowStar.Buffer
include LowStar.Monotonic.Buffer
module P = FStar.Preorder
module G = FStar.Ghost
module U32 = FStar.UInt32
module Seq = FStar.Seq
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
(*
* Wrapper over LowStar.Monotonic.Buffer, with trivial preorders
* -- functions that take explicit preorder as arguments (e.g. sub etc.)
* -- these include allocation functions also
*)
let trivial_preorder (a:Type0) :srel a = fun _ _ -> True
type buffer (a:Type0) = mbuffer a (trivial_preorder a) (trivial_preorder a)
unfold let null (#a:Type0) :buffer a = mnull #a #(trivial_preorder a) #(trivial_preorder a)
unfold let gsub (#a:Type0) = mgsub #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a)
unfold let gsub_inj (#a:Type0) = mgsub_inj #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a) (trivial_preorder a)
[@@unifier_hint_injective]
inline_for_extraction
type pointer (a:Type0) = b:buffer a{length b == 1}
inline_for_extraction
type pointer_or_null (a:Type0) = b:buffer a{if g_is_null b then True else length b == 1}
inline_for_extraction let sub (#a:Type0) = msub #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a)
inline_for_extraction let offset (#a:Type0) = moffset #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a)
unfold let lbuffer (a:Type0) (len:nat) = lmbuffer a (trivial_preorder a) (trivial_preorder a) len
inline_for_extraction let gcmalloc (#a:Type0) = mgcmalloc #a #(trivial_preorder a)
inline_for_extraction let malloc (#a:Type0) = mmalloc #a #(trivial_preorder a)
inline_for_extraction let alloca (#a:Type0) = malloca #a #(trivial_preorder a) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Preorder.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LowStar.Buffer.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.Preorder",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | init: Prims.list a
-> FStar.HyperStack.ST.StackInline
(b:
LowStar.Monotonic.Buffer.mbuffer a
(LowStar.Buffer.trivial_preorder a)
(LowStar.Buffer.trivial_preorder a)
{ LowStar.Monotonic.Buffer.length b ==
FStar.Pervasives.normalize_term (FStar.List.Tot.Base.length init) /\
Prims.op_Negation (LowStar.Monotonic.Buffer.g_is_null b) }) | FStar.HyperStack.ST.StackInline | [] | [] | [
"LowStar.Monotonic.Buffer.malloca_of_list",
"LowStar.Buffer.trivial_preorder",
"Prims.list",
"LowStar.Monotonic.Buffer.mbuffer",
"Prims.l_and",
"Prims.eq2",
"Prims.nat",
"LowStar.Monotonic.Buffer.length",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.length",
"Prims.b2t",
"Prims.op_Negation",
"LowStar.Monotonic.Buffer.g_is_null",
"FStar.Monotonic.HyperStack.mem",
"FStar.Pervasives.normalize",
"Prims.op_LessThan",
"Prims.op_LessThanOrEqual",
"FStar.UInt.max_int",
"LowStar.Monotonic.Buffer.live",
"LowStar.Monotonic.Buffer.unused_in",
"FStar.Set.equal",
"FStar.Monotonic.HyperHeap.rid",
"FStar.Map.domain",
"FStar.Monotonic.Heap.heap",
"FStar.Monotonic.HyperStack.get_hmap",
"FStar.Monotonic.HyperStack.get_tip",
"LowStar.Monotonic.Buffer.modifies",
"LowStar.Monotonic.Buffer.loc_none",
"FStar.Seq.Base.seq",
"LowStar.Monotonic.Buffer.as_seq",
"FStar.Seq.Base.seq_of_list",
"LowStar.Monotonic.Buffer.frameOf"
] | [] | false | true | false | false | false | let alloca_of_list (#a: Type0) =
| malloca_of_list #a #(trivial_preorder a) | false |
|
RW.fst | RW.test_state_eq_www | val test_state_eq_www (f g: (unit -> RWI int RW (fun _ -> True) (fun _ _ _ -> True)))
: RWI int RW (fun _ -> True) (fun _ _ _ -> True) | val test_state_eq_www (f g: (unit -> RWI int RW (fun _ -> True) (fun _ _ _ -> True)))
: RWI int RW (fun _ -> True) (fun _ _ _ -> True) | let test_state_eq_www
(f : unit -> RWI int RW (fun _ -> True) (fun _ _ _ -> True))
(g : unit -> RWI int RW (fun _ -> True) (fun _ _ _ -> True))
: RWI int RW (fun _ -> True) (fun _ _ _ -> True)
=
let h0 = get () in
let x = f () in
let h1 = get () in
let y = g () in
let h2 = get () in
//assert (h0 == h1);
//assert (h1 == h2);
x + y | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 7,
"end_line": 314,
"start_col": 0,
"start_line": 302
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h
let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1
// how is subtyping handled? can I subtype on a?
// note that post is contravariant in a
let subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)
(i2:idx) (pre' : st_pre) (post' : st_bpost a)
(f : m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True))
= fun () -> f ()
unfold
let ite (p q r : Type0) = (p ==> q) /\ (~p ==> r)
let if_then_else
(a : Type) (i1:idx)
(pre1:st_pre)
(post1 : st_bpost a)
(i2 : idx)
(pre2 : st_pre)
(post2 : st_bpost a)
(f : m a i1 pre1 post1) (g : m a i2 pre2 post2)
(p : bool)
: Type
= m a (join i1 i2)
(fun h0 -> ite p (pre1 h0) (pre2 h0))
(fun h0 x h1 -> ite p (post1 h0 x h1) (post2 h0 x h1))
reifiable
reflectable
effect {
RWI (a:Type) (i:idx) (_:st_pre) (_:st_bpost a)
with {repr = m;
return = return;
bind = bind;
subcomp = subcomp;
if_then_else = if_then_else}
}
unfold
let sp #a (wp : pure_wp a) : pure_post a =
fun x -> ~ (wp (fun y -> ~(x == y)))
let lift_pure_rwi
(a:Type)
(wp : pure_wp a)
(f :unit -> PURE a wp)
// with the index-polymorphic bind above, this has to be in RO,
// or unification will usually not find the index here
: m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\ h1 == h0)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun () -> f ()
sub_effect PURE ~> RWI = lift_pure_rwi
let test_rrr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_rrw #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_rwr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_rww #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wrr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_wrw #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wwr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_www #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
let rec map #a #b
(f : a -> RWI b RO (fun _ -> True) (fun _ _ _ -> True))
(xs : list a)
: RWI (list b) RO (fun _ -> True) (fun _ _ _ -> True)
= match xs with
| [] -> []
| x::xs -> (f x)::(map f xs)
let app #a #b #i #pre #post (f : a -> RWI b i pre post) (x : a) : RWI b i pre post = f x
// can't resolve an index, providing it explicitly with #i makes it explode too
// update: actually, putting a dollar sign on f makes it work... why? I can see
// why it helps to find the index but why doesn't it explode too?
(*
* AR: Could not resolve #i in the recursive call
*)
let rec appn #a #i
(n:nat)
(f : a -> RWI a i (fun _ -> True) (fun _ _ _ -> True))
(x : a)
: RWI a i (fun _ -> True) (fun _ _ _ -> True)
= match n with
| 0 -> x
| _ -> begin
appn #_ #i (n-1) f (f x)
end
let labs0 (n:int) : RWI int RO (fun _ -> True) (fun h0 x h1 -> x >= 0 /\ h1 == h0) =
if n < 0
then -n
else n
let labs (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
if n < 0
then -n
else n
let rwi_assert (p:Type0) : RWI unit RO (fun _ -> p) (fun h0 () h1 -> h0 == h1) =
// assert p // fails
RWI?.reflect (fun () -> assert p)
let rwi_assume (p:Type0) : RWI unit RO (fun _ -> True) (fun h0 () h1 -> h0 == h1 /\ p) =
RWI?.reflect (fun () -> assume p)
let test_abs0 (n:int) : RWI int RO (fun _ -> True) (fun h0 r h1 -> r >= 0) =
let r = labs0 n in
();
();
r
let test_abs0' (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
let r = labs0 n in
let r : nat = r in // need this! an ascription won't work!
r
let test_abs (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
let r = labs n in
r
// just a test
let get_indexed (#i:idx) () : RWI H.heap i (fun _ -> True) (fun h0 x h1 -> x == h0 /\ h1 == h0) =
RWI?.reflect (fun () -> ST.get ())
let get_r () : RWI H.heap RO (fun _ -> True) (fun h0 x h1 -> x == h0 /\ h1 == h0) =
RWI?.reflect (fun () -> ST.get ())
//let get #i = get_indexed #i
let get = get_r
let test_state_eq_rrr
(f g : unit -> RWI int RO (fun _ -> True) (fun _ _ _ -> True))
: RWI int RO (fun _ -> True) (fun _ _ _ -> True)
=
let h0 = get () in
let x = f () in
let h1 = get () in
let y = g () in
let h2 = get () in
assert (h0 == h1);
assert (h1 == h2);
x + y
let test_state_eq_rrw
(f : unit -> RWI int RO (fun _ -> True) (fun _ _ _ -> True))
(g : unit -> RWI int RO (fun _ -> True) (fun _ _ _ -> True))
: RWI int RW (fun _ -> True) (fun _ _ _ -> True)
=
let h0 = get () in
let x = f () in
let h1 = get () in
let y = g () in
let h2 = get () in
assert (h0 == h1);
assert (h1 == h2);
x + y
let test_state_eq_rww
(f : unit -> RWI int RO (fun _ -> True) (fun _ _ _ -> True))
(g : unit -> RWI int RW (fun _ -> True) (fun _ _ _ -> True))
: RWI int RW (fun _ -> True) (fun _ _ _ -> True)
=
let h0 = get () in
let x = f () in
let h1 = get () in
let y = g () in
let h2 = get () in
assert (h0 == h1);
x + y | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | f: (_: Prims.unit -> RW.RWI Prims.int) -> g: (_: Prims.unit -> RW.RWI Prims.int) -> RW.RWI Prims.int | RW.RWI | [] | [] | [
"Prims.unit",
"Prims.int",
"RW.RW",
"FStar.Monotonic.Heap.heap",
"Prims.l_True",
"Prims.op_Addition",
"RW.get"
] | [] | false | true | false | false | false | let test_state_eq_www (f g: (unit -> RWI int RW (fun _ -> True) (fun _ _ _ -> True)))
: RWI int RW (fun _ -> True) (fun _ _ _ -> True) =
| let h0 = get () in
let x = f () in
let h1 = get () in
let y = g () in
let h2 = get () in
x + y | false |
RW.fst | RW.rwi_assert | val rwi_assert (p: Type0) : RWI unit RO (fun _ -> p) (fun h0 () h1 -> h0 == h1) | val rwi_assert (p: Type0) : RWI unit RO (fun _ -> p) (fun h0 () h1 -> h0 == h1) | let rwi_assert (p:Type0) : RWI unit RO (fun _ -> p) (fun h0 () h1 -> h0 == h1) =
// assert p // fails
RWI?.reflect (fun () -> assert p) | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 35,
"end_line": 232,
"start_col": 0,
"start_line": 230
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h
let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1
// how is subtyping handled? can I subtype on a?
// note that post is contravariant in a
let subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)
(i2:idx) (pre' : st_pre) (post' : st_bpost a)
(f : m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True))
= fun () -> f ()
unfold
let ite (p q r : Type0) = (p ==> q) /\ (~p ==> r)
let if_then_else
(a : Type) (i1:idx)
(pre1:st_pre)
(post1 : st_bpost a)
(i2 : idx)
(pre2 : st_pre)
(post2 : st_bpost a)
(f : m a i1 pre1 post1) (g : m a i2 pre2 post2)
(p : bool)
: Type
= m a (join i1 i2)
(fun h0 -> ite p (pre1 h0) (pre2 h0))
(fun h0 x h1 -> ite p (post1 h0 x h1) (post2 h0 x h1))
reifiable
reflectable
effect {
RWI (a:Type) (i:idx) (_:st_pre) (_:st_bpost a)
with {repr = m;
return = return;
bind = bind;
subcomp = subcomp;
if_then_else = if_then_else}
}
unfold
let sp #a (wp : pure_wp a) : pure_post a =
fun x -> ~ (wp (fun y -> ~(x == y)))
let lift_pure_rwi
(a:Type)
(wp : pure_wp a)
(f :unit -> PURE a wp)
// with the index-polymorphic bind above, this has to be in RO,
// or unification will usually not find the index here
: m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\ h1 == h0)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun () -> f ()
sub_effect PURE ~> RWI = lift_pure_rwi
let test_rrr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_rrw #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_rwr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_rww #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wrr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_wrw #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wwr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_www #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
let rec map #a #b
(f : a -> RWI b RO (fun _ -> True) (fun _ _ _ -> True))
(xs : list a)
: RWI (list b) RO (fun _ -> True) (fun _ _ _ -> True)
= match xs with
| [] -> []
| x::xs -> (f x)::(map f xs)
let app #a #b #i #pre #post (f : a -> RWI b i pre post) (x : a) : RWI b i pre post = f x
// can't resolve an index, providing it explicitly with #i makes it explode too
// update: actually, putting a dollar sign on f makes it work... why? I can see
// why it helps to find the index but why doesn't it explode too?
(*
* AR: Could not resolve #i in the recursive call
*)
let rec appn #a #i
(n:nat)
(f : a -> RWI a i (fun _ -> True) (fun _ _ _ -> True))
(x : a)
: RWI a i (fun _ -> True) (fun _ _ _ -> True)
= match n with
| 0 -> x
| _ -> begin
appn #_ #i (n-1) f (f x)
end
let labs0 (n:int) : RWI int RO (fun _ -> True) (fun h0 x h1 -> x >= 0 /\ h1 == h0) =
if n < 0
then -n
else n
let labs (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
if n < 0
then -n
else n | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | p: Type0 -> RW.RWI Prims.unit | RW.RWI | [] | [] | [
"Prims.unit",
"Prims._assert",
"RW.RO",
"FStar.Monotonic.Heap.heap",
"Prims.eq2"
] | [] | false | true | false | false | false | let rwi_assert (p: Type0) : RWI unit RO (fun _ -> p) (fun h0 () h1 -> h0 == h1) =
| RWI?.reflect (fun () -> assert p) | false |
LowStar.Buffer.fst | LowStar.Buffer.gcmalloc_of_list | val gcmalloc_of_list : r: FStar.Monotonic.HyperHeap.rid -> init: Prims.list a
-> FStar.HyperStack.ST.ST
(b:
(b:
LowStar.Monotonic.Buffer.mbuffer a
(LowStar.Buffer.trivial_preorder a)
(LowStar.Buffer.trivial_preorder a)
{ LowStar.Monotonic.Buffer.length b ==
FStar.Pervasives.normalize_term (FStar.List.Tot.Base.length init) /\
Prims.op_Negation (LowStar.Monotonic.Buffer.g_is_null b) })
{LowStar.Monotonic.Buffer.frameOf b == r /\ LowStar.Monotonic.Buffer.recallable b}) | let gcmalloc_of_list (#a:Type0) = mgcmalloc_of_list #a #(trivial_preorder a) | {
"file_name": "ulib/LowStar.Buffer.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 98,
"end_line": 64,
"start_col": 22,
"start_line": 64
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module LowStar.Buffer
include LowStar.Monotonic.Buffer
module P = FStar.Preorder
module G = FStar.Ghost
module U32 = FStar.UInt32
module Seq = FStar.Seq
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
(*
* Wrapper over LowStar.Monotonic.Buffer, with trivial preorders
* -- functions that take explicit preorder as arguments (e.g. sub etc.)
* -- these include allocation functions also
*)
let trivial_preorder (a:Type0) :srel a = fun _ _ -> True
type buffer (a:Type0) = mbuffer a (trivial_preorder a) (trivial_preorder a)
unfold let null (#a:Type0) :buffer a = mnull #a #(trivial_preorder a) #(trivial_preorder a)
unfold let gsub (#a:Type0) = mgsub #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a)
unfold let gsub_inj (#a:Type0) = mgsub_inj #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a) (trivial_preorder a)
[@@unifier_hint_injective]
inline_for_extraction
type pointer (a:Type0) = b:buffer a{length b == 1}
inline_for_extraction
type pointer_or_null (a:Type0) = b:buffer a{if g_is_null b then True else length b == 1}
inline_for_extraction let sub (#a:Type0) = msub #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a)
inline_for_extraction let offset (#a:Type0) = moffset #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a)
unfold let lbuffer (a:Type0) (len:nat) = lmbuffer a (trivial_preorder a) (trivial_preorder a) len
inline_for_extraction let gcmalloc (#a:Type0) = mgcmalloc #a #(trivial_preorder a)
inline_for_extraction let malloc (#a:Type0) = mmalloc #a #(trivial_preorder a)
inline_for_extraction let alloca (#a:Type0) = malloca #a #(trivial_preorder a)
inline_for_extraction let alloca_of_list (#a:Type0) = malloca_of_list #a #(trivial_preorder a) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Preorder.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LowStar.Buffer.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.Preorder",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | r: FStar.Monotonic.HyperHeap.rid -> init: Prims.list a
-> FStar.HyperStack.ST.ST
(b:
(b:
LowStar.Monotonic.Buffer.mbuffer a
(LowStar.Buffer.trivial_preorder a)
(LowStar.Buffer.trivial_preorder a)
{ LowStar.Monotonic.Buffer.length b ==
FStar.Pervasives.normalize_term (FStar.List.Tot.Base.length init) /\
Prims.op_Negation (LowStar.Monotonic.Buffer.g_is_null b) })
{LowStar.Monotonic.Buffer.frameOf b == r /\ LowStar.Monotonic.Buffer.recallable b}) | FStar.HyperStack.ST.ST | [] | [] | [
"LowStar.Monotonic.Buffer.mgcmalloc_of_list",
"LowStar.Buffer.trivial_preorder",
"FStar.Monotonic.HyperHeap.rid",
"Prims.list",
"LowStar.Monotonic.Buffer.mbuffer",
"Prims.l_and",
"Prims.eq2",
"Prims.nat",
"LowStar.Monotonic.Buffer.length",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.length",
"Prims.b2t",
"Prims.op_Negation",
"LowStar.Monotonic.Buffer.g_is_null",
"LowStar.Monotonic.Buffer.frameOf",
"LowStar.Monotonic.Buffer.recallable",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.is_eternal_region",
"FStar.Pervasives.normalize",
"Prims.op_LessThanOrEqual",
"FStar.UInt.max_int",
"LowStar.Monotonic.Buffer.live",
"LowStar.Monotonic.Buffer.unused_in",
"FStar.Set.equal",
"FStar.Map.domain",
"FStar.Monotonic.Heap.heap",
"FStar.Monotonic.HyperStack.get_hmap",
"FStar.Monotonic.HyperStack.get_tip",
"LowStar.Monotonic.Buffer.modifies",
"LowStar.Monotonic.Buffer.loc_none",
"FStar.Seq.Base.seq",
"LowStar.Monotonic.Buffer.as_seq",
"FStar.Seq.Base.seq_of_list"
] | [] | false | true | false | false | false | let gcmalloc_of_list (#a: Type0) =
| mgcmalloc_of_list #a #(trivial_preorder a) | false |
|
RW.fst | RW.labs0 | val labs0 (n: int) : RWI int RO (fun _ -> True) (fun h0 x h1 -> x >= 0 /\ h1 == h0) | val labs0 (n: int) : RWI int RO (fun _ -> True) (fun h0 x h1 -> x >= 0 /\ h1 == h0) | let labs0 (n:int) : RWI int RO (fun _ -> True) (fun h0 x h1 -> x >= 0 /\ h1 == h0) =
if n < 0
then -n
else n | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 8,
"end_line": 223,
"start_col": 0,
"start_line": 220
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h
let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1
// how is subtyping handled? can I subtype on a?
// note that post is contravariant in a
let subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)
(i2:idx) (pre' : st_pre) (post' : st_bpost a)
(f : m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True))
= fun () -> f ()
unfold
let ite (p q r : Type0) = (p ==> q) /\ (~p ==> r)
let if_then_else
(a : Type) (i1:idx)
(pre1:st_pre)
(post1 : st_bpost a)
(i2 : idx)
(pre2 : st_pre)
(post2 : st_bpost a)
(f : m a i1 pre1 post1) (g : m a i2 pre2 post2)
(p : bool)
: Type
= m a (join i1 i2)
(fun h0 -> ite p (pre1 h0) (pre2 h0))
(fun h0 x h1 -> ite p (post1 h0 x h1) (post2 h0 x h1))
reifiable
reflectable
effect {
RWI (a:Type) (i:idx) (_:st_pre) (_:st_bpost a)
with {repr = m;
return = return;
bind = bind;
subcomp = subcomp;
if_then_else = if_then_else}
}
unfold
let sp #a (wp : pure_wp a) : pure_post a =
fun x -> ~ (wp (fun y -> ~(x == y)))
let lift_pure_rwi
(a:Type)
(wp : pure_wp a)
(f :unit -> PURE a wp)
// with the index-polymorphic bind above, this has to be in RO,
// or unification will usually not find the index here
: m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\ h1 == h0)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun () -> f ()
sub_effect PURE ~> RWI = lift_pure_rwi
let test_rrr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_rrw #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_rwr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_rww #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wrr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_wrw #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wwr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_www #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
let rec map #a #b
(f : a -> RWI b RO (fun _ -> True) (fun _ _ _ -> True))
(xs : list a)
: RWI (list b) RO (fun _ -> True) (fun _ _ _ -> True)
= match xs with
| [] -> []
| x::xs -> (f x)::(map f xs)
let app #a #b #i #pre #post (f : a -> RWI b i pre post) (x : a) : RWI b i pre post = f x
// can't resolve an index, providing it explicitly with #i makes it explode too
// update: actually, putting a dollar sign on f makes it work... why? I can see
// why it helps to find the index but why doesn't it explode too?
(*
* AR: Could not resolve #i in the recursive call
*)
let rec appn #a #i
(n:nat)
(f : a -> RWI a i (fun _ -> True) (fun _ _ _ -> True))
(x : a)
: RWI a i (fun _ -> True) (fun _ _ _ -> True)
= match n with
| 0 -> x
| _ -> begin
appn #_ #i (n-1) f (f x)
end | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | n: Prims.int -> RW.RWI Prims.int | RW.RWI | [] | [] | [
"Prims.int",
"Prims.op_LessThan",
"Prims.op_Minus",
"Prims.bool",
"RW.RO",
"FStar.Monotonic.Heap.heap",
"Prims.l_True",
"Prims.l_and",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"Prims.eq2"
] | [] | false | true | false | false | false | let labs0 (n: int) : RWI int RO (fun _ -> True) (fun h0 x h1 -> x >= 0 /\ h1 == h0) =
| if n < 0 then - n else n | false |
RW.fst | RW.test_state_eq_rrr | val test_state_eq_rrr (f g: (unit -> RWI int RO (fun _ -> True) (fun _ _ _ -> True)))
: RWI int RO (fun _ -> True) (fun _ _ _ -> True) | val test_state_eq_rrr (f g: (unit -> RWI int RO (fun _ -> True) (fun _ _ _ -> True)))
: RWI int RO (fun _ -> True) (fun _ _ _ -> True) | let test_state_eq_rrr
(f g : unit -> RWI int RO (fun _ -> True) (fun _ _ _ -> True))
: RWI int RO (fun _ -> True) (fun _ _ _ -> True)
=
let h0 = get () in
let x = f () in
let h1 = get () in
let y = g () in
let h2 = get () in
assert (h0 == h1);
assert (h1 == h2);
x + y | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 7,
"end_line": 273,
"start_col": 0,
"start_line": 262
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h
let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1
// how is subtyping handled? can I subtype on a?
// note that post is contravariant in a
let subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)
(i2:idx) (pre' : st_pre) (post' : st_bpost a)
(f : m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True))
= fun () -> f ()
unfold
let ite (p q r : Type0) = (p ==> q) /\ (~p ==> r)
let if_then_else
(a : Type) (i1:idx)
(pre1:st_pre)
(post1 : st_bpost a)
(i2 : idx)
(pre2 : st_pre)
(post2 : st_bpost a)
(f : m a i1 pre1 post1) (g : m a i2 pre2 post2)
(p : bool)
: Type
= m a (join i1 i2)
(fun h0 -> ite p (pre1 h0) (pre2 h0))
(fun h0 x h1 -> ite p (post1 h0 x h1) (post2 h0 x h1))
reifiable
reflectable
effect {
RWI (a:Type) (i:idx) (_:st_pre) (_:st_bpost a)
with {repr = m;
return = return;
bind = bind;
subcomp = subcomp;
if_then_else = if_then_else}
}
unfold
let sp #a (wp : pure_wp a) : pure_post a =
fun x -> ~ (wp (fun y -> ~(x == y)))
let lift_pure_rwi
(a:Type)
(wp : pure_wp a)
(f :unit -> PURE a wp)
// with the index-polymorphic bind above, this has to be in RO,
// or unification will usually not find the index here
: m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\ h1 == h0)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun () -> f ()
sub_effect PURE ~> RWI = lift_pure_rwi
let test_rrr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_rrw #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_rwr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_rww #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wrr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_wrw #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wwr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_www #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
let rec map #a #b
(f : a -> RWI b RO (fun _ -> True) (fun _ _ _ -> True))
(xs : list a)
: RWI (list b) RO (fun _ -> True) (fun _ _ _ -> True)
= match xs with
| [] -> []
| x::xs -> (f x)::(map f xs)
let app #a #b #i #pre #post (f : a -> RWI b i pre post) (x : a) : RWI b i pre post = f x
// can't resolve an index, providing it explicitly with #i makes it explode too
// update: actually, putting a dollar sign on f makes it work... why? I can see
// why it helps to find the index but why doesn't it explode too?
(*
* AR: Could not resolve #i in the recursive call
*)
let rec appn #a #i
(n:nat)
(f : a -> RWI a i (fun _ -> True) (fun _ _ _ -> True))
(x : a)
: RWI a i (fun _ -> True) (fun _ _ _ -> True)
= match n with
| 0 -> x
| _ -> begin
appn #_ #i (n-1) f (f x)
end
let labs0 (n:int) : RWI int RO (fun _ -> True) (fun h0 x h1 -> x >= 0 /\ h1 == h0) =
if n < 0
then -n
else n
let labs (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
if n < 0
then -n
else n
let rwi_assert (p:Type0) : RWI unit RO (fun _ -> p) (fun h0 () h1 -> h0 == h1) =
// assert p // fails
RWI?.reflect (fun () -> assert p)
let rwi_assume (p:Type0) : RWI unit RO (fun _ -> True) (fun h0 () h1 -> h0 == h1 /\ p) =
RWI?.reflect (fun () -> assume p)
let test_abs0 (n:int) : RWI int RO (fun _ -> True) (fun h0 r h1 -> r >= 0) =
let r = labs0 n in
();
();
r
let test_abs0' (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
let r = labs0 n in
let r : nat = r in // need this! an ascription won't work!
r
let test_abs (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
let r = labs n in
r
// just a test
let get_indexed (#i:idx) () : RWI H.heap i (fun _ -> True) (fun h0 x h1 -> x == h0 /\ h1 == h0) =
RWI?.reflect (fun () -> ST.get ())
let get_r () : RWI H.heap RO (fun _ -> True) (fun h0 x h1 -> x == h0 /\ h1 == h0) =
RWI?.reflect (fun () -> ST.get ())
//let get #i = get_indexed #i
let get = get_r | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | f: (_: Prims.unit -> RW.RWI Prims.int) -> g: (_: Prims.unit -> RW.RWI Prims.int) -> RW.RWI Prims.int | RW.RWI | [] | [] | [
"Prims.unit",
"Prims.int",
"RW.RO",
"FStar.Monotonic.Heap.heap",
"Prims.l_True",
"Prims.op_Addition",
"Prims._assert",
"Prims.eq2",
"RW.get"
] | [] | false | true | false | false | false | let test_state_eq_rrr (f g: (unit -> RWI int RO (fun _ -> True) (fun _ _ _ -> True)))
: RWI int RO (fun _ -> True) (fun _ _ _ -> True) =
| let h0 = get () in
let x = f () in
let h1 = get () in
let y = g () in
let h2 = get () in
assert (h0 == h1);
assert (h1 == h2);
x + y | false |
RW.fst | RW.test_abs0 | val test_abs0 (n: int) : RWI int RO (fun _ -> True) (fun h0 r h1 -> r >= 0) | val test_abs0 (n: int) : RWI int RO (fun _ -> True) (fun h0 r h1 -> r >= 0) | let test_abs0 (n:int) : RWI int RO (fun _ -> True) (fun h0 r h1 -> r >= 0) =
let r = labs0 n in
();
();
r | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 3,
"end_line": 241,
"start_col": 0,
"start_line": 237
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h
let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1
// how is subtyping handled? can I subtype on a?
// note that post is contravariant in a
let subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)
(i2:idx) (pre' : st_pre) (post' : st_bpost a)
(f : m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True))
= fun () -> f ()
unfold
let ite (p q r : Type0) = (p ==> q) /\ (~p ==> r)
let if_then_else
(a : Type) (i1:idx)
(pre1:st_pre)
(post1 : st_bpost a)
(i2 : idx)
(pre2 : st_pre)
(post2 : st_bpost a)
(f : m a i1 pre1 post1) (g : m a i2 pre2 post2)
(p : bool)
: Type
= m a (join i1 i2)
(fun h0 -> ite p (pre1 h0) (pre2 h0))
(fun h0 x h1 -> ite p (post1 h0 x h1) (post2 h0 x h1))
reifiable
reflectable
effect {
RWI (a:Type) (i:idx) (_:st_pre) (_:st_bpost a)
with {repr = m;
return = return;
bind = bind;
subcomp = subcomp;
if_then_else = if_then_else}
}
unfold
let sp #a (wp : pure_wp a) : pure_post a =
fun x -> ~ (wp (fun y -> ~(x == y)))
let lift_pure_rwi
(a:Type)
(wp : pure_wp a)
(f :unit -> PURE a wp)
// with the index-polymorphic bind above, this has to be in RO,
// or unification will usually not find the index here
: m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\ h1 == h0)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun () -> f ()
sub_effect PURE ~> RWI = lift_pure_rwi
let test_rrr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_rrw #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_rwr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_rww #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wrr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_wrw #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wwr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_www #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
let rec map #a #b
(f : a -> RWI b RO (fun _ -> True) (fun _ _ _ -> True))
(xs : list a)
: RWI (list b) RO (fun _ -> True) (fun _ _ _ -> True)
= match xs with
| [] -> []
| x::xs -> (f x)::(map f xs)
let app #a #b #i #pre #post (f : a -> RWI b i pre post) (x : a) : RWI b i pre post = f x
// can't resolve an index, providing it explicitly with #i makes it explode too
// update: actually, putting a dollar sign on f makes it work... why? I can see
// why it helps to find the index but why doesn't it explode too?
(*
* AR: Could not resolve #i in the recursive call
*)
let rec appn #a #i
(n:nat)
(f : a -> RWI a i (fun _ -> True) (fun _ _ _ -> True))
(x : a)
: RWI a i (fun _ -> True) (fun _ _ _ -> True)
= match n with
| 0 -> x
| _ -> begin
appn #_ #i (n-1) f (f x)
end
let labs0 (n:int) : RWI int RO (fun _ -> True) (fun h0 x h1 -> x >= 0 /\ h1 == h0) =
if n < 0
then -n
else n
let labs (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
if n < 0
then -n
else n
let rwi_assert (p:Type0) : RWI unit RO (fun _ -> p) (fun h0 () h1 -> h0 == h1) =
// assert p // fails
RWI?.reflect (fun () -> assert p)
let rwi_assume (p:Type0) : RWI unit RO (fun _ -> True) (fun h0 () h1 -> h0 == h1 /\ p) =
RWI?.reflect (fun () -> assume p) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | n: Prims.int -> RW.RWI Prims.int | RW.RWI | [] | [] | [
"Prims.int",
"Prims.unit",
"RW.labs0",
"RW.RO",
"FStar.Monotonic.Heap.heap",
"Prims.l_True",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual"
] | [] | false | true | false | false | false | let test_abs0 (n: int) : RWI int RO (fun _ -> True) (fun h0 r h1 -> r >= 0) =
| let r = labs0 n in
();
();
r | false |
RW.fst | RW.makero | val makero (#a #pre: _) (#post: _{is_ro_post post}) (f: (unit -> RWI a RW pre post))
: RWI a RO pre post | val makero (#a #pre: _) (#post: _{is_ro_post post}) (f: (unit -> RWI a RW pre post))
: RWI a RO pre post | let makero
#a #pre (#post : _ {is_ro_post post})
(f : unit -> RWI a RW pre post)
: RWI a RO pre post
= RWI?.reflect (fun () -> reify (f ()) ()) | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 44,
"end_line": 321,
"start_col": 0,
"start_line": 317
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions
unfold
let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0
let is_ro_post #a (post : H.heap -> st_post a) : Type =
forall h0 x h1. post h0 x h1 ==> h0 == h1
let st_bpost (a:Type) : Type =
H.heap -> a -> H.heap -> Type0
let ro_sanity_check #a (post : H.heap -> st_post a) =
assert (is_ro_post (ro_post post))
let real_post #a (i : idx) (post : st_bpost a)
: st_bpost a
= match i with
| RO -> ro_post post
| _ -> post
// GM: Note, postconditions are totally defined, their well-typing cannot
// depend on pre (see issue #57 and the `st_post'` type).
let m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =
unit -> ST a pre (real_post i post)
let return (a:Type) (x:a) : m a RO (fun _ -> True) (fun h0 y h1 -> y == x /\ h1 == h0) =
fun () -> x
unfold
let bind_pre #a (i1 i2 : idx)
(pre : st_pre)
(pre' : a -> st_pre)
(post : st_bpost a)
: st_pre
= let post = real_post i1 post in
fun h0 -> pre h0 /\ (forall x h1. post h0 x h1 ==> pre' x h1)
unfold
let bind_post #a #b (i1 i2 : idx)
(pre : st_pre)
(post : st_bpost a)
(post' : a -> st_bpost b)
: st_bpost b
= let post : st_bpost a = real_post i1 post in
let post' x : st_bpost b = real_post i2 (post' x) in
fun h0 y h2 -> pre h0 /\ (exists x h1. post h0 x h1 /\ post' x h1 y h2)
let bind (a b : Type)
(i:idx) (pre:st_pre) (post:st_bpost a)
(i':idx)
(pre':a -> st_pre) (post':a -> st_bpost b)
(c : m a i pre post)
(f : (x:a -> m b i' (pre' x) (post' x)))
: Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))
= fun () -> let x = c () in f x ()
// a test
let rwi_subtype (a b : Type) (inj : a -> b)
(i:idx)
(pre:_) (post:st_bpost a)
(c : m a i pre post)
: Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\ post h0 x0 h1)) =
bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))
let pre_leq (pre1 pre2 : st_pre) =
forall h. pre2 h ==> pre1 h
let post_leq #a (post1 post2 : H.heap -> st_post a) =
forall h0 x h1. post1 h0 x h1 ==> post2 h0 x h1
// how is subtyping handled? can I subtype on a?
// note that post is contravariant in a
let subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)
(i2:idx) (pre' : st_pre) (post' : st_bpost a)
(f : m a i1 pre post)
: Pure (m a i2 pre' post')
(requires (flows i1 i2 /\ pre_leq pre pre' /\ post_leq post post'))
(ensures (fun _ -> True))
= fun () -> f ()
unfold
let ite (p q r : Type0) = (p ==> q) /\ (~p ==> r)
let if_then_else
(a : Type) (i1:idx)
(pre1:st_pre)
(post1 : st_bpost a)
(i2 : idx)
(pre2 : st_pre)
(post2 : st_bpost a)
(f : m a i1 pre1 post1) (g : m a i2 pre2 post2)
(p : bool)
: Type
= m a (join i1 i2)
(fun h0 -> ite p (pre1 h0) (pre2 h0))
(fun h0 x h1 -> ite p (post1 h0 x h1) (post2 h0 x h1))
reifiable
reflectable
effect {
RWI (a:Type) (i:idx) (_:st_pre) (_:st_bpost a)
with {repr = m;
return = return;
bind = bind;
subcomp = subcomp;
if_then_else = if_then_else}
}
unfold
let sp #a (wp : pure_wp a) : pure_post a =
fun x -> ~ (wp (fun y -> ~(x == y)))
let lift_pure_rwi
(a:Type)
(wp : pure_wp a)
(f :unit -> PURE a wp)
// with the index-polymorphic bind above, this has to be in RO,
// or unification will usually not find the index here
: m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\ h1 == h0)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun () -> f ()
sub_effect PURE ~> RWI = lift_pure_rwi
let test_rrr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_rrw #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_rwr #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_rww #pre #post (b:bool) (f : unit -> RWI int RO pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wrr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RO pre post = if b then f () else g ()
let test_wrw #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RO pre post) : RWI int RW pre post = if b then f () else g ()
[@@expect_failure]
let test_wwr #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RO pre post = if b then f () else g ()
let test_www #pre #post (b:bool) (f : unit -> RWI int RW pre post) (g : unit -> RWI int RW pre post) : RWI int RW pre post = if b then f () else g ()
let rec map #a #b
(f : a -> RWI b RO (fun _ -> True) (fun _ _ _ -> True))
(xs : list a)
: RWI (list b) RO (fun _ -> True) (fun _ _ _ -> True)
= match xs with
| [] -> []
| x::xs -> (f x)::(map f xs)
let app #a #b #i #pre #post (f : a -> RWI b i pre post) (x : a) : RWI b i pre post = f x
// can't resolve an index, providing it explicitly with #i makes it explode too
// update: actually, putting a dollar sign on f makes it work... why? I can see
// why it helps to find the index but why doesn't it explode too?
(*
* AR: Could not resolve #i in the recursive call
*)
let rec appn #a #i
(n:nat)
(f : a -> RWI a i (fun _ -> True) (fun _ _ _ -> True))
(x : a)
: RWI a i (fun _ -> True) (fun _ _ _ -> True)
= match n with
| 0 -> x
| _ -> begin
appn #_ #i (n-1) f (f x)
end
let labs0 (n:int) : RWI int RO (fun _ -> True) (fun h0 x h1 -> x >= 0 /\ h1 == h0) =
if n < 0
then -n
else n
let labs (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
if n < 0
then -n
else n
let rwi_assert (p:Type0) : RWI unit RO (fun _ -> p) (fun h0 () h1 -> h0 == h1) =
// assert p // fails
RWI?.reflect (fun () -> assert p)
let rwi_assume (p:Type0) : RWI unit RO (fun _ -> True) (fun h0 () h1 -> h0 == h1 /\ p) =
RWI?.reflect (fun () -> assume p)
let test_abs0 (n:int) : RWI int RO (fun _ -> True) (fun h0 r h1 -> r >= 0) =
let r = labs0 n in
();
();
r
let test_abs0' (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
let r = labs0 n in
let r : nat = r in // need this! an ascription won't work!
r
let test_abs (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =
let r = labs n in
r
// just a test
let get_indexed (#i:idx) () : RWI H.heap i (fun _ -> True) (fun h0 x h1 -> x == h0 /\ h1 == h0) =
RWI?.reflect (fun () -> ST.get ())
let get_r () : RWI H.heap RO (fun _ -> True) (fun h0 x h1 -> x == h0 /\ h1 == h0) =
RWI?.reflect (fun () -> ST.get ())
//let get #i = get_indexed #i
let get = get_r
let test_state_eq_rrr
(f g : unit -> RWI int RO (fun _ -> True) (fun _ _ _ -> True))
: RWI int RO (fun _ -> True) (fun _ _ _ -> True)
=
let h0 = get () in
let x = f () in
let h1 = get () in
let y = g () in
let h2 = get () in
assert (h0 == h1);
assert (h1 == h2);
x + y
let test_state_eq_rrw
(f : unit -> RWI int RO (fun _ -> True) (fun _ _ _ -> True))
(g : unit -> RWI int RO (fun _ -> True) (fun _ _ _ -> True))
: RWI int RW (fun _ -> True) (fun _ _ _ -> True)
=
let h0 = get () in
let x = f () in
let h1 = get () in
let y = g () in
let h2 = get () in
assert (h0 == h1);
assert (h1 == h2);
x + y
let test_state_eq_rww
(f : unit -> RWI int RO (fun _ -> True) (fun _ _ _ -> True))
(g : unit -> RWI int RW (fun _ -> True) (fun _ _ _ -> True))
: RWI int RW (fun _ -> True) (fun _ _ _ -> True)
=
let h0 = get () in
let x = f () in
let h1 = get () in
let y = g () in
let h2 = get () in
assert (h0 == h1);
x + y
let test_state_eq_www
(f : unit -> RWI int RW (fun _ -> True) (fun _ _ _ -> True))
(g : unit -> RWI int RW (fun _ -> True) (fun _ _ _ -> True))
: RWI int RW (fun _ -> True) (fun _ _ _ -> True)
=
let h0 = get () in
let x = f () in
let h1 = get () in
let y = g () in
let h2 = get () in
//assert (h0 == h1);
//assert (h1 == h2);
x + y | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | f: (_: Prims.unit -> RW.RWI a) -> RW.RWI a | RW.RWI | [] | [] | [
"FStar.ST.st_pre",
"FStar.Monotonic.Heap.heap",
"FStar.ST.st_post",
"RW.is_ro_post",
"Prims.unit",
"RW.RW",
"RW.m",
"RW.RO"
] | [] | false | true | false | false | false | let makero #a #pre (#post: _{is_ro_post post}) (f: (unit -> RWI a RW pre post)) : RWI a RO pre post =
| RWI?.reflect (fun () -> reify (f ()) ()) | false |
Hacl.Impl.FFDHE.fst | Hacl.Impl.FFDHE.ffdhe_shared_secret_precomp | val ffdhe_shared_secret_precomp:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_check_pk:ffdhe_check_pk_st t a len
-> ffdhe_compute_exp:ffdhe_compute_exp_st t a len ke ->
ffdhe_shared_secret_precomp_st t a len ke | val ffdhe_shared_secret_precomp:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_check_pk:ffdhe_check_pk_st t a len
-> ffdhe_compute_exp:ffdhe_compute_exp_st t a len ke ->
ffdhe_shared_secret_precomp_st t a len ke | let ffdhe_shared_secret_precomp #t a len ke ffdhe_check_pk ffdhe_compute_exp p_r2_n sk pk ss =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let sk_n = create nLen (uint #t #SEC 0) in
let pk_n = create nLen (uint #t #SEC 0) in
let h0 = ST.get () in
BN.bn_from_bytes_be len sk sk_n;
BN.bn_from_bytes_be len pk pk_n;
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 sk);
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 pk);
S.ffdhe_p_lemma a;
let m = ffdhe_check_pk pk_n p_n in
if Hacl.Bignum.Base.unsafe_bool_of_limb m then
ffdhe_compute_exp p_r2_n sk_n pk_n ss;
pop_frame ();
m | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 3,
"end_line": 442,
"start_col": 0,
"start_line": 425
} | module Hacl.Impl.FFDHE
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.FFDHE.Constants
open Hacl.Bignum.Definitions
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module S = Spec.FFDHE
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Lemmas = Hacl.Spec.FFDHE.Lemmas
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module BE = Hacl.Bignum.Exponentiation
module SB = Hacl.Spec.Bignum
module SM = Hacl.Spec.Bignum.Montgomery
module SE = Hacl.Spec.Bignum.Exponentiation
module SD = Hacl.Spec.Bignum.Definitions
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let size_pos = x:size_t{v x > 0}
[@CInline]
let ffdhe_len (a:S.ffdhe_alg) : x:size_pos{v x = S.ffdhe_len a} =
allow_inversion S.ffdhe_alg;
match a with
| S.FFDHE2048 -> 256ul
| S.FFDHE3072 -> 384ul
| S.FFDHE4096 -> 512ul
| S.FFDHE6144 -> 768ul
| S.FFDHE8192 -> 1024ul
inline_for_extraction noextract
let get_ffdhe_p (a:S.ffdhe_alg) :x:glbuffer pub_uint8 (ffdhe_len a)
{witnessed x (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) /\ recallable x}
=
allow_inversion S.ffdhe_alg;
match a with
| S.FFDHE2048 -> ffdhe_p2048
| S.FFDHE3072 -> ffdhe_p3072
| S.FFDHE4096 -> ffdhe_p4096
| S.FFDHE6144 -> ffdhe_p6144
| S.FFDHE8192 -> ffdhe_p8192
inline_for_extraction noextract
val ffdhe_p_to_ps:
a:S.ffdhe_alg
-> p_s:lbuffer uint8 (ffdhe_len a) ->
Stack unit
(requires fun h -> live h p_s)
(ensures fun h0 _ h1 -> modifies (loc p_s) h0 h1 /\
BSeq.nat_from_intseq_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) ==
BSeq.nat_from_intseq_be (as_seq h1 p_s))
let ffdhe_p_to_ps a p_s =
let p = get_ffdhe_p a in
recall_contents p (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a));
let len = ffdhe_len a in
mapT len p_s secret p;
BSeq.nat_from_intseq_be_public_to_secret (v len) (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a))
inline_for_extraction noextract
let ffdhe_bn_from_g_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) =
g_n:lbignum t (blocks len (size (numbytes t))) ->
Stack unit
(requires fun h ->
live h g_n /\
v len = S.ffdhe_len a /\
as_seq h g_n == LSeq.create (v (blocks len (size (numbytes t)))) (uint #t 0))
(ensures fun h0 _ h1 -> modifies (loc g_n) h0 h1 /\
bn_v h1 g_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_g (S.get_ffdhe_params a)))
inline_for_extraction noextract
val ffdhe_bn_from_g: #t:limb_t -> a:S.ffdhe_alg -> len:size_pos -> ffdhe_bn_from_g_st t a len
let ffdhe_bn_from_g #t a len g_n =
recall_contents ffdhe_g2 S.ffdhe_g2;
[@inline_let] let nLen = blocks len (size (numbytes t)) in
push_frame ();
let g = create 1ul (u8 0) in
mapT 1ul g secret ffdhe_g2;
BSeq.nat_from_intseq_be_public_to_secret 1 S.ffdhe_g2;
let h0 = ST.get () in
update_sub_f h0 g_n 0ul 1ul
(fun h -> SB.bn_from_bytes_be 1 (as_seq h0 g))
(fun _ -> BN.bn_from_bytes_be 1ul g (sub g_n 0ul 1ul));
let h1 = ST.get () in
SD.bn_eval_update_sub #t 1 (SB.bn_from_bytes_be 1 (as_seq h0 g)) (v nLen);
assert (bn_v h1 g_n == SD.bn_v (SB.bn_from_bytes_be #t 1 (as_seq h0 g)));
SB.bn_from_bytes_be_lemma #t 1 (as_seq h0 g);
assert (bn_v h1 g_n == BSeq.nat_from_bytes_be (as_seq h0 g));
pop_frame ()
inline_for_extraction noextract
let ffdhe_precomp_inv (#t:limb_t) (#len:size_nat{0 < len /\ len + len <= max_size_t})
(a:S.ffdhe_alg) (p_r2_n:SD.lbignum t (len + len))
=
let p_n = LSeq.sub p_r2_n 0 len in
let r2_n = LSeq.sub p_r2_n len len in
SD.bn_v p_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) /\
0 < SD.bn_v p_n /\ SD.bn_v r2_n == pow2 (2 * bits t * len) % SD.bn_v p_n
inline_for_extraction noextract
let ffdhe_precomp_p_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen) ->
Stack unit
(requires fun h ->
live h p_r2_n /\
v len = S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen)
(ensures fun h0 _ h1 -> modifies (loc p_r2_n) h0 h1 /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h1 p_r2_n))
inline_for_extraction noextract
val ffdhe_precomp_p:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t ->
ffdhe_precomp_p_st t a len ke
let ffdhe_precomp_p #t a len ke p_r2_n =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let r2_n = sub p_r2_n nLen nLen in
let p_s = create len (u8 0) in
ffdhe_p_to_ps a p_s;
let h0 = ST.get () in
BN.bn_from_bytes_be len p_s p_n;
let h1 = ST.get () in
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 p_s);
assert (bn_v h1 p_n == BSeq.nat_from_bytes_be (as_seq h0 p_s));
S.ffdhe_p_lemma a;
Lemmas.ffdhe_p_bits_lemma a;
ke.BE.precompr2 (8ul *! len -! 1ul) p_n r2_n;
SM.bn_precomp_r2_mod_n_lemma (8 * v len - 1) (as_seq h1 p_n);
pop_frame ()
inline_for_extraction noextract
let new_ffdhe_precomp_p_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
r:HS.rid ->
ST (B.buffer (limb t))
(requires fun h ->
ST.is_eternal_region r /\
v len = S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen)
(ensures fun h0 res h1 ->
B.(modifies loc_none h0 h1) /\
not (B.g_is_null res) ==> (
B.len res == nLen +! nLen /\
B.(fresh_loc (loc_buffer res) h0 h1) /\
B.(loc_includes (loc_region_only false r) (loc_buffer res)) /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h1 (res <: lbignum t (nLen +! nLen)))))
inline_for_extraction noextract
val new_ffdhe_precomp_p:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_precomp_p:ffdhe_precomp_p_st t a len ke ->
new_ffdhe_precomp_p_st t a len ke
let new_ffdhe_precomp_p #t a len ke ffdhe_precomp_p r =
let h0 = ST.get () in
let nLen = blocks len (size (numbytes t)) in
assert (v (nLen +! nLen) > 0);
let res = LowStar.Monotonic.Buffer.mmalloc_partial r (uint #t #SEC 0) (nLen +! nLen) in
if B.is_null res then
res
else
let h1 = ST.get () in
B.(modifies_only_not_unused_in loc_none h0 h1);
assert (B.len res == nLen +! nLen);
let res: Lib.Buffer.buffer (limb t) = res in
assert (B.length res == v nLen + v nLen);
let res: lbignum t (nLen +! nLen) = res in
ffdhe_precomp_p res;
let h2 = ST.get () in
B.(modifies_only_not_unused_in loc_none h0 h2);
res
inline_for_extraction noextract
let ffdhe_compute_exp_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen)
-> sk_n:lbignum t nLen
-> b_n:lbignum t nLen
-> res:lbuffer uint8 len ->
Stack unit
(requires fun h ->
live h p_r2_n /\ live h sk_n /\ live h b_n /\ live h res /\
disjoint p_r2_n res /\ disjoint sk_n res /\ disjoint b_n res /\
disjoint p_r2_n b_n /\ disjoint p_r2_n sk_n /\
v len == S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h p_r2_n) /\
bn_v h b_n < bn_v h (gsub p_r2_n 0ul nLen) - 1 /\
1 < bn_v h sk_n)
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
(S.ffdhe_p_lemma a;
let res_n = Lib.NatMod.pow_mod #(bn_v h0 (gsub p_r2_n 0ul nLen)) (bn_v h0 b_n) (bn_v h0 sk_n) in
as_seq h1 res == BSeq.nat_to_bytes_be (v len) res_n))
#push-options "--z3rlimit 100"
inline_for_extraction noextract
val ffdhe_compute_exp:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t ->
ffdhe_compute_exp_st t a len ke
let ffdhe_compute_exp #t a len ke p_r2_n sk_n b_n res =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let r2_n = sub p_r2_n nLen nLen in
let res_n = create nLen (uint #t #SEC 0) in
let h1 = ST.get () in
S.ffdhe_p_lemma a;
assert_norm (pow2 4 = 16);
assert_norm (pow2 10 = 1024);
Math.Lemmas.pow2_plus 4 10;
Math.Lemmas.pow2_lt_compat 32 14;
SD.bn_eval_bound #t (as_seq h1 sk_n) (v nLen);
BE.mk_bn_mod_exp_precompr2 nLen ke.BE.exp_ct_precomp p_n r2_n b_n (size (bits t) *! nLen) sk_n res_n; //b_n ^ sk_n % p_n
let h2 = ST.get () in
BN.bn_to_bytes_be len res_n res;
SB.bn_to_bytes_be_lemma (v len) (as_seq h2 res_n);
pop_frame ()
#pop-options
inline_for_extraction noextract
let ffdhe_secret_to_public_precomp_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen)
-> sk:lbuffer uint8 len
-> pk:lbuffer uint8 len ->
Stack unit
(requires fun h ->
live h sk /\ live h pk /\ live h p_r2_n /\
disjoint sk pk /\ disjoint sk p_r2_n /\ disjoint pk p_r2_n /\
v len == S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen /\
1 < Lib.ByteSequence.nat_from_bytes_be (as_seq h sk) /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h p_r2_n))
(ensures fun h0 _ h1 -> modifies (loc pk) h0 h1 /\
as_seq h1 pk == S.ffdhe_secret_to_public a (as_seq h0 sk))
//TODO: pass sBits?
inline_for_extraction noextract
val ffdhe_secret_to_public_precomp:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_compute_exp:ffdhe_compute_exp_st t a len ke ->
ffdhe_secret_to_public_precomp_st t a len ke
let ffdhe_secret_to_public_precomp #t a len ke ffdhe_compute_exp p_r2_n sk pk =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let g_n = create nLen (uint #t #SEC 0) in
ffdhe_bn_from_g a len g_n;
let sk_n = create nLen (uint #t #SEC 0) in
let h0 = ST.get () in
BN.bn_from_bytes_be len sk sk_n;
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 sk);
S.ffdhe_g2_lemma ();
S.ffdhe_p_lemma a;
ffdhe_compute_exp p_r2_n sk_n g_n pk;
pop_frame ()
inline_for_extraction noextract
let ffdhe_secret_to_public_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
sk:lbuffer uint8 len
-> pk:lbuffer uint8 len ->
Stack unit
(requires fun h ->
live h sk /\ live h pk /\ disjoint sk pk /\
v len == S.ffdhe_len a /\
ke.BE.bn.BN.len == blocks len (size (numbytes t)) /\
1 < Lib.ByteSequence.nat_from_bytes_be (as_seq h sk))
(ensures fun h0 _ h1 -> modifies (loc pk) h0 h1 /\
as_seq h1 pk == S.ffdhe_secret_to_public a (as_seq h0 sk))
//TODO: pass sBits?
inline_for_extraction noextract
val ffdhe_secret_to_public:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_secret_to_public_precomp:ffdhe_secret_to_public_precomp_st t a len ke
-> ffdhe_precomp_p:ffdhe_precomp_p_st t a len ke ->
ffdhe_secret_to_public_st t a len ke
let ffdhe_secret_to_public #t a len ke ffdhe_secret_to_public_precomp ffdhe_precomp_p sk pk =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_r2_n = create (nLen +! nLen) (uint #t #SEC 0) in
ffdhe_precomp_p p_r2_n;
ffdhe_secret_to_public_precomp p_r2_n sk pk;
pop_frame ()
inline_for_extraction noextract
let ffdhe_check_pk_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) =
let nLen = blocks len (size (numbytes t)) in
pk_n:lbignum t nLen
-> p_n:lbignum t nLen ->
Stack (limb t)
(requires fun h ->
live h pk_n /\ live h p_n /\ disjoint pk_n p_n /\
v len = S.ffdhe_len a /\
bn_v h p_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)))
(ensures fun h0 m h1 -> modifies0 h0 h1 /\
v m == (if (1 < bn_v h0 pk_n && bn_v h0 pk_n < bn_v h0 p_n - 1) then v (ones t SEC) else 0))
inline_for_extraction noextract
val ffdhe_check_pk: #t:limb_t -> a:S.ffdhe_alg -> len:size_pos -> ffdhe_check_pk_st t a len
let ffdhe_check_pk #t a len pk_n p_n =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n1 = create nLen (uint #t #SEC 0) in
let h0 = ST.get () in
let c = BN.bn_sub1 nLen p_n (uint #t 1) p_n1 in
SB.bn_sub1_lemma (as_seq h0 p_n) (uint #t 1);
let h1 = ST.get () in
S.ffdhe_p_lemma a;
SD.bn_eval_bound (as_seq h1 p_n1) (v nLen);
assert (bn_v h1 p_n1 == bn_v h0 p_n - 1);
let m0 = BN.bn_gt_pow2_mask nLen pk_n 0ul in
SB.bn_gt_pow2_mask_lemma (as_seq h1 pk_n) 0;
assert_norm (pow2 0 = 1);
assert (if v m0 = 0 then 1 >= bn_v h1 pk_n else 1 < bn_v h1 pk_n);
let m1 = BN.bn_lt_mask nLen pk_n p_n1 in
SB.bn_lt_mask_lemma (as_seq h1 pk_n) (as_seq h1 p_n1);
assert (if v m1 = 0 then bn_v h1 pk_n >= bn_v h1 p_n1 else bn_v h1 pk_n < bn_v h1 p_n1);
let m = m0 &. m1 in
logand_lemma m0 m1;
pop_frame ();
m
inline_for_extraction noextract
let ffdhe_shared_secret_precomp_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen)
-> sk:lbuffer uint8 len
-> pk:lbuffer uint8 len
-> ss:lbuffer uint8 len ->
Stack (limb t)
(requires fun h ->
live h sk /\ live h pk /\ live h ss /\ live h p_r2_n /\
disjoint sk pk /\ disjoint sk ss /\ disjoint pk ss /\
disjoint p_r2_n ss /\ disjoint p_r2_n pk /\ disjoint p_r2_n sk /\
v len = S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen /\
1 < Lib.ByteSequence.nat_from_bytes_be (as_seq h sk) /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h p_r2_n))
(ensures fun h0 m h1 -> modifies (loc ss) h0 h1 /\
(let ss_s = S.ffdhe_shared_secret a (as_seq h0 sk) (as_seq h0 pk) in
if v m = v (ones t SEC) then Some? ss_s /\ as_seq h1 ss == Some?.v ss_s else None? ss_s))
inline_for_extraction noextract
val ffdhe_shared_secret_precomp:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_check_pk:ffdhe_check_pk_st t a len
-> ffdhe_compute_exp:ffdhe_compute_exp_st t a len ke ->
ffdhe_shared_secret_precomp_st t a len ke | {
"checked_file": "/",
"dependencies": [
"Spec.FFDHE.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.FFDHE.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.Exponentiation.fsti.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"Hacl.Impl.FFDHE.Constants.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Base.fst.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.FFDHE.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Exponentiation",
"short_module": "SE"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "SM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "SB"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.FFDHE.Lemmas",
"short_module": "Lemmas"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "Spec.FFDHE",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.FFDHE.Constants",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Spec.FFDHE.ffdhe_alg ->
len: Hacl.Impl.FFDHE.size_pos ->
ke: Hacl.Bignum.Exponentiation.exp t ->
ffdhe_check_pk: Hacl.Impl.FFDHE.ffdhe_check_pk_st t a len ->
ffdhe_compute_exp: Hacl.Impl.FFDHE.ffdhe_compute_exp_st t a len ke
-> Hacl.Impl.FFDHE.ffdhe_shared_secret_precomp_st t a len ke | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Definitions.limb_t",
"Spec.FFDHE.ffdhe_alg",
"Hacl.Impl.FFDHE.size_pos",
"Hacl.Bignum.Exponentiation.exp",
"Hacl.Impl.FFDHE.ffdhe_check_pk_st",
"Hacl.Impl.FFDHE.ffdhe_compute_exp_st",
"Hacl.Bignum.Definitions.lbignum",
"Lib.IntTypes.op_Plus_Bang",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Hacl.Bignum.Definitions.blocks",
"Lib.IntTypes.size",
"Lib.IntTypes.numbytes",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"Hacl.Bignum.Definitions.limb",
"Prims.unit",
"FStar.HyperStack.ST.pop_frame",
"Hacl.Spec.Bignum.Base.unsafe_bool_of_limb",
"Prims.bool",
"Spec.FFDHE.ffdhe_p_lemma",
"Hacl.Spec.Bignum.bn_from_bytes_be_lemma",
"Lib.IntTypes.v",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"Hacl.Bignum.bn_from_bytes_be",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.create",
"Lib.IntTypes.uint",
"Lib.IntTypes.SEC",
"Lib.Buffer.sub",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.int_t",
"Prims.eq2",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Prims.l_and",
"Prims.b2t",
"Prims.op_GreaterThan",
"Prims.op_LessThanOrEqual",
"Prims.op_Subtraction",
"Prims.pow2",
"Prims.op_Multiply",
"Lib.IntTypes.mk_int",
"Hacl.Spec.Bignum.Definitions.blocks",
"FStar.HyperStack.ST.push_frame"
] | [] | false | false | false | false | false | let ffdhe_shared_secret_precomp #t a len ke ffdhe_check_pk ffdhe_compute_exp p_r2_n sk pk ss =
| push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let sk_n = create nLen (uint #t #SEC 0) in
let pk_n = create nLen (uint #t #SEC 0) in
let h0 = ST.get () in
BN.bn_from_bytes_be len sk sk_n;
BN.bn_from_bytes_be len pk pk_n;
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 sk);
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 pk);
S.ffdhe_p_lemma a;
let m = ffdhe_check_pk pk_n p_n in
if Hacl.Bignum.Base.unsafe_bool_of_limb m then ffdhe_compute_exp p_r2_n sk_n pk_n ss;
pop_frame ();
m | false |
LowStar.Buffer.fst | LowStar.Buffer.assign_list_t | val assign_list_t : l: Prims.list a -> Type0 | let assign_list_t #a (l: list a) = (b: buffer a) -> HST.Stack unit
(requires (fun h0 ->
live h0 b /\
length b = L.length l))
(ensures (fun h0 _ h1 ->
live h1 b /\
(modifies (loc_buffer b) h0 h1) /\
as_seq h1 b == Seq.seq_of_list l)) | {
"file_name": "ulib/LowStar.Buffer.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 38,
"end_line": 76,
"start_col": 0,
"start_line": 69
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module LowStar.Buffer
include LowStar.Monotonic.Buffer
module P = FStar.Preorder
module G = FStar.Ghost
module U32 = FStar.UInt32
module Seq = FStar.Seq
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
(*
* Wrapper over LowStar.Monotonic.Buffer, with trivial preorders
* -- functions that take explicit preorder as arguments (e.g. sub etc.)
* -- these include allocation functions also
*)
let trivial_preorder (a:Type0) :srel a = fun _ _ -> True
type buffer (a:Type0) = mbuffer a (trivial_preorder a) (trivial_preorder a)
unfold let null (#a:Type0) :buffer a = mnull #a #(trivial_preorder a) #(trivial_preorder a)
unfold let gsub (#a:Type0) = mgsub #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a)
unfold let gsub_inj (#a:Type0) = mgsub_inj #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a) (trivial_preorder a)
[@@unifier_hint_injective]
inline_for_extraction
type pointer (a:Type0) = b:buffer a{length b == 1}
inline_for_extraction
type pointer_or_null (a:Type0) = b:buffer a{if g_is_null b then True else length b == 1}
inline_for_extraction let sub (#a:Type0) = msub #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a)
inline_for_extraction let offset (#a:Type0) = moffset #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a)
unfold let lbuffer (a:Type0) (len:nat) = lmbuffer a (trivial_preorder a) (trivial_preorder a) len
inline_for_extraction let gcmalloc (#a:Type0) = mgcmalloc #a #(trivial_preorder a)
inline_for_extraction let malloc (#a:Type0) = mmalloc #a #(trivial_preorder a)
inline_for_extraction let alloca (#a:Type0) = malloca #a #(trivial_preorder a)
inline_for_extraction let alloca_of_list (#a:Type0) = malloca_of_list #a #(trivial_preorder a)
inline_for_extraction let gcmalloc_of_list (#a:Type0) = mgcmalloc_of_list #a #(trivial_preorder a)
module L = FStar.List.Tot | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Preorder.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LowStar.Buffer.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.Preorder",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | l: Prims.list a -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Prims.list",
"LowStar.Buffer.buffer",
"Prims.unit",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_and",
"LowStar.Monotonic.Buffer.live",
"LowStar.Buffer.trivial_preorder",
"Prims.b2t",
"Prims.op_Equality",
"Prims.nat",
"LowStar.Monotonic.Buffer.length",
"FStar.List.Tot.Base.length",
"LowStar.Monotonic.Buffer.modifies",
"LowStar.Monotonic.Buffer.loc_buffer",
"Prims.eq2",
"FStar.Seq.Base.seq",
"LowStar.Monotonic.Buffer.as_seq",
"FStar.Seq.Base.seq_of_list"
] | [] | false | false | false | true | true | let assign_list_t #a (l: list a) =
| b: buffer a
-> HST.Stack unit
(requires (fun h0 -> live h0 b /\ length b = L.length l))
(ensures
(fun h0 _ h1 ->
live h1 b /\ (modifies (loc_buffer b) h0 h1) /\ as_seq h1 b == Seq.seq_of_list l)) | false |
|
LowStar.Buffer.fst | LowStar.Buffer.assign_list | val assign_list (#a: _) (l: list a) : assign_list_t l | val assign_list (#a: _) (l: list a) : assign_list_t l | let rec assign_list #a (l: list a): assign_list_t l
= fun b ->
Seq.lemma_seq_of_list_induction l;
match l with
| [] ->
let h = HST.get () in
assert (length b = 0);
assert (Seq.length (as_seq h b) = 0);
assert (Seq.equal (as_seq h b) (Seq.empty #a));
assert (Seq.seq_of_list [] `Seq.equal` Seq.empty #a)
| hd :: tl ->
let b_hd = sub b 0ul 1ul in
let b_tl = offset b 1ul in
let h = HST.get () in
upd b_hd 0ul hd;
let h0 = HST.get () in
assign_list tl b_tl;
let h1 = HST.get () in
assert (as_seq h1 b_hd == as_seq h0 b_hd);
assert (get h1 b_hd 0 == hd);
assert (as_seq h1 b_tl == Seq.seq_of_list tl);
assert (Seq.equal (as_seq h1 b) (Seq.append (as_seq h1 b_hd) (as_seq h1 b_tl)));
assert ((Seq.seq_of_list l) == (Seq.cons hd (Seq.seq_of_list tl))) | {
"file_name": "ulib/LowStar.Buffer.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 72,
"end_line": 100,
"start_col": 0,
"start_line": 78
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module LowStar.Buffer
include LowStar.Monotonic.Buffer
module P = FStar.Preorder
module G = FStar.Ghost
module U32 = FStar.UInt32
module Seq = FStar.Seq
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
(*
* Wrapper over LowStar.Monotonic.Buffer, with trivial preorders
* -- functions that take explicit preorder as arguments (e.g. sub etc.)
* -- these include allocation functions also
*)
let trivial_preorder (a:Type0) :srel a = fun _ _ -> True
type buffer (a:Type0) = mbuffer a (trivial_preorder a) (trivial_preorder a)
unfold let null (#a:Type0) :buffer a = mnull #a #(trivial_preorder a) #(trivial_preorder a)
unfold let gsub (#a:Type0) = mgsub #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a)
unfold let gsub_inj (#a:Type0) = mgsub_inj #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a) (trivial_preorder a)
[@@unifier_hint_injective]
inline_for_extraction
type pointer (a:Type0) = b:buffer a{length b == 1}
inline_for_extraction
type pointer_or_null (a:Type0) = b:buffer a{if g_is_null b then True else length b == 1}
inline_for_extraction let sub (#a:Type0) = msub #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a)
inline_for_extraction let offset (#a:Type0) = moffset #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a)
unfold let lbuffer (a:Type0) (len:nat) = lmbuffer a (trivial_preorder a) (trivial_preorder a) len
inline_for_extraction let gcmalloc (#a:Type0) = mgcmalloc #a #(trivial_preorder a)
inline_for_extraction let malloc (#a:Type0) = mmalloc #a #(trivial_preorder a)
inline_for_extraction let alloca (#a:Type0) = malloca #a #(trivial_preorder a)
inline_for_extraction let alloca_of_list (#a:Type0) = malloca_of_list #a #(trivial_preorder a)
inline_for_extraction let gcmalloc_of_list (#a:Type0) = mgcmalloc_of_list #a #(trivial_preorder a)
module L = FStar.List.Tot
unfold
let assign_list_t #a (l: list a) = (b: buffer a) -> HST.Stack unit
(requires (fun h0 ->
live h0 b /\
length b = L.length l))
(ensures (fun h0 _ h1 ->
live h1 b /\
(modifies (loc_buffer b) h0 h1) /\
as_seq h1 b == Seq.seq_of_list l)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Preorder.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LowStar.Buffer.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.Preorder",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "LowStar.Monotonic.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | l: Prims.list a -> LowStar.Buffer.assign_list_t l | Prims.Tot | [
"total"
] | [] | [
"Prims.list",
"LowStar.Buffer.buffer",
"Prims._assert",
"FStar.Seq.Base.equal",
"FStar.Seq.Base.seq_of_list",
"Prims.Nil",
"FStar.Seq.Base.empty",
"Prims.unit",
"LowStar.Monotonic.Buffer.as_seq",
"LowStar.Buffer.trivial_preorder",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"LowStar.Monotonic.Buffer.length",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Prims.eq2",
"FStar.Seq.Base.seq",
"FStar.Seq.Base.cons",
"FStar.Seq.Base.append",
"LowStar.Monotonic.Buffer.get",
"LowStar.Buffer.assign_list",
"LowStar.Monotonic.Buffer.upd",
"FStar.UInt32.__uint_to_t",
"LowStar.Monotonic.Buffer.mbuffer",
"LowStar.Buffer.offset",
"LowStar.Buffer.sub",
"FStar.Ghost.hide",
"FStar.UInt32.t",
"FStar.Seq.Properties.lemma_seq_of_list_induction"
] | [
"recursion"
] | false | false | false | false | false | let rec assign_list #a (l: list a) : assign_list_t l =
| fun b ->
Seq.lemma_seq_of_list_induction l;
match l with
| [] ->
let h = HST.get () in
assert (length b = 0);
assert (Seq.length (as_seq h b) = 0);
assert (Seq.equal (as_seq h b) (Seq.empty #a));
assert ((Seq.seq_of_list []) `Seq.equal` (Seq.empty #a))
| hd :: tl ->
let b_hd = sub b 0ul 1ul in
let b_tl = offset b 1ul in
let h = HST.get () in
upd b_hd 0ul hd;
let h0 = HST.get () in
assign_list tl b_tl;
let h1 = HST.get () in
assert (as_seq h1 b_hd == as_seq h0 b_hd);
assert (get h1 b_hd 0 == hd);
assert (as_seq h1 b_tl == Seq.seq_of_list tl);
assert (Seq.equal (as_seq h1 b) (Seq.append (as_seq h1 b_hd) (as_seq h1 b_tl)));
assert ((Seq.seq_of_list l) == (Seq.cons hd (Seq.seq_of_list tl))) | false |
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_codegen_success_KeyExpansion256Stdcall | val va_codegen_success_KeyExpansion256Stdcall : va_dummy:unit -> Tot va_pbool | val va_codegen_success_KeyExpansion256Stdcall : va_dummy:unit -> Tot va_pbool | let va_codegen_success_KeyExpansion256Stdcall () =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg
10) Secret) (va_pbool_and (va_codegen_success_Store128_byte16_buffer (va_op_heaplet_mem_heaplet
1) (va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) Secret) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 14) (va_pbool_and
(va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_ttrue ()))))))))))) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 94,
"end_line": 616,
"start_col": 0,
"start_line": 602
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round
rcon) va_s0 round rcon dst key 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 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1
va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32)) :
(va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(va_QProc (va_code_KeyExpansionRoundEven256 round rcon) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem])
(va_wp_KeyExpansionRoundEven256 round rcon dst key) (va_wpProof_KeyExpansionRoundEven256 round
rcon dst key))
//--
//-- KeyExpansionRoundOdd256
val va_code_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundOdd256 round =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
()))))))))))))))
val va_codegen_success_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundOdd256 round =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundOdd256 (va_mods:va_mods_t) (round:nat8) (dst:buffer128) (key:(seq
nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) =
(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 114 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 115 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 116 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 117 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 118 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 120 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 121 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 123 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 124 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 125 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 127 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg23:Prims.int) = round + 1
in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg21:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg21 va_arg22 0 va_arg23)
(let (va_arg20:Prims.int) = round + 1 in let (va_arg19:Vale.Def.Types_s.quad32) = va_get_vec 1
va_old_s in let (va_arg18:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 129 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_round_key_256_rcon_odd va_arg18 va_arg19 0
va_arg20) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 130 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(())))))))))))))))))))
val va_lemma_KeyExpansionRoundOdd256 : va_b0:va_code -> va_s0:va_state -> round:nat8 ->
dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundOdd256 round) va_s0 /\ va_get_ok
va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0)
dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10
va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundOdd256 va_b0 va_s0 round dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundOdd256 va_mods round dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundOdd256 round) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 92 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 102 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 110 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 111 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 112 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32)
(va_x_v4:quad32) . let va_sM = va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem
va_x_mem va_s0)))))) in va_get_ok va_sM /\ Vale.PPC64LE.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15 (va_get_mem_layout va_sM) Secret /\
va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec 3 va_sM ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundOdd256 : round:nat8 -> dst:buffer128 -> key:(seq nat32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundOdd256 round dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundOdd256 round)
([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1;
va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundOdd256 round dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundOdd256 (va_code_KeyExpansionRoundOdd256 round)
va_s0 round dst key in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) : (va_quickCode
unit (va_code_KeyExpansionRoundOdd256 round)) =
(va_QProc (va_code_KeyExpansionRoundOdd256 round) ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_KeyExpansionRoundOdd256
round dst key) (va_wpProof_KeyExpansionRoundOdd256 round dst key))
//--
//-- KeyExpansionRoundUnrolledRecursive256
val va_code_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_code(decreases %[n])
[@ "opaque_to_smt"]
let rec va_code_KeyExpansionRoundUnrolledRecursive256 n =
(va_Block (va_CCons (if (1 < n && n <= 14) then va_Block (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_CCons (if (n `op_Modulus` 2 = 0)
then va_Block (va_CCons (va_code_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_CNil ())) else va_Block (va_CCons
(va_code_KeyExpansionRoundOdd256 (n - 1)) (va_CNil ()))) (va_CNil ()))) else va_Block (va_CNil
())) (va_CNil ())))
val va_codegen_success_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_pbool(decreases %[n])
[@ "opaque_to_smt"]
let rec va_codegen_success_KeyExpansionRoundUnrolledRecursive256 n =
(va_pbool_and (if (1 < n && n <= 14) then va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_pbool_and (if (n
`op_Modulus` 2 = 0) then va_pbool_and (va_codegen_success_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_ttrue ()) else va_pbool_and
(va_codegen_success_KeyExpansionRoundOdd256 (n - 1)) (va_ttrue ())) (va_ttrue ())) else
va_ttrue ()) (va_ttrue ()))
val va_lemma_KeyExpansionRoundUnrolledRecursive256 : va_b0:va_code -> va_s0:va_state -> key:(seq
nat32) -> dst:buffer128 -> n:int
-> Ghost (va_state & va_fuel)(decreases %[n])
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == (if (n `op_Modulus` 2 = 0) then va_get_vec 1 va_sM else
va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == (if ((n - 1) `op_Modulus` 2 = 0) then va_get_vec 1
va_sM else va_get_vec 3 va_sM) /\ (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read
dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j <= n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.AES256_helpers_BE.expand_key_256 key j) /\ 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_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let rec va_lemma_KeyExpansionRoundUnrolledRecursive256 va_b0 va_s0 key dst n =
va_reveal_opaque (`%va_code_KeyExpansionRoundUnrolledRecursive256)
(va_code_KeyExpansionRoundUnrolledRecursive256 n);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let va_b2 = va_tl va_b1 in
let va_c2 = va_hd va_b1 in
let (va_fc2, va_s2) =
(
if (1 < n && n <= 14) then
(
let va_b3 = va_get_block va_c2 in
let (va_s4, va_fc4) = va_lemma_KeyExpansionRoundUnrolledRecursive256 (va_hd va_b3) va_s0 key
dst (n - 1) in
let va_b4 = va_tl va_b3 in
let (old_mem:vale_heap) = va_get_mem_heaplet 1 va_s4 in
let va_b6 = va_tl va_b4 in
let va_c6 = va_hd va_b4 in
let (va_fc6, va_s6) =
(
if (n `op_Modulus` 2 = 0) then
(
let va_b7 = va_get_block va_c6 in
let (va_s8, va_fc8) = va_lemma_KeyExpansionRoundEven256 (va_hd va_b7) va_s4 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1)) dst key in
let va_b8 = va_tl va_b7 in
let (va_s6, va_f8) = va_lemma_empty_total va_s8 va_b8 in
let va_fc6 = va_lemma_merge_total va_b7 va_s4 va_fc8 va_s8 va_f8 va_s6 in
(va_fc6, va_s6)
)
else
(
let va_b9 = va_get_block va_c6 in
let (va_s10, va_fc10) = va_lemma_KeyExpansionRoundOdd256 (va_hd va_b9) va_s4 (n - 1) dst
key in
let va_b10 = va_tl va_b9 in
let (va_s6, va_f10) = va_lemma_empty_total va_s10 va_b10 in
let va_fc6 = va_lemma_merge_total va_b9 va_s4 va_fc10 va_s10 va_f10 va_s6 in
(va_fc6, va_s6)
)
) in
assert (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1
va_s6)))}0 <= j /\ j < n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_s6)) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j old_mem));
let (va_s2, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f4 = va_lemma_merge_total va_b4 va_s4 va_fc6 va_s6 va_f6 va_s2 in
let va_fc2 = va_lemma_merge_total va_b3 va_s0 va_fc4 va_s4 va_f4 va_s2 in
(va_fc2, va_s2)
)
else
(
let va_b12 = va_get_block va_c2 in
let (va_s2, va_fc2) = va_lemma_empty_total va_s0 va_b12 in
(va_fc2, va_s2)
)
) in
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_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)
/\ (forall (va_x_mem:vale_heap) (va_x_heap1:vale_heap) (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) . 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_upd_mem_heaplet 1
va_x_heap1 (va_upd_mem va_x_mem va_s0)))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == va_if (n `op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM)
(fun _ -> va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == va_if ((n - 1)
`op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM) (fun _ -> va_get_vec 3 va_sM) /\ (forall j .
{:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j
<= n ==> Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j
(va_get_mem_heaplet 1 va_sM)) == Vale.AES.AES256_helpers_BE.expand_key_256 key j) ==> va_k
va_sM (())))
val va_wpProof_KeyExpansionRoundUnrolledRecursive256 : key:(seq nat32) -> dst:buffer128 -> n:int ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundUnrolledRecursive256
n) ([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_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundUnrolledRecursive256
(va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 key dst n 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem 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_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int) :
(va_quickCode unit (va_code_KeyExpansionRoundUnrolledRecursive256 n)) =
(va_QProc (va_code_KeyExpansionRoundUnrolledRecursive256 n) ([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_mem_heaplet 1;
va_Mod_mem]) (va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n)
(va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n))
//--
//-- KeyExpansion256Stdcall
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansion256Stdcall () =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_CCons
(va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret) (va_CCons (va_code_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg
10) Secret) (va_CCons (va_code_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) Secret) (va_CCons
(va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 14) (va_CCons (va_code_Vxor (va_op_vec_opr_vec
1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_CNil ())))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_pbool | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.PPC64LE.Decls.va_pbool_and",
"Vale.PPC64LE.InsBasic.va_codegen_success_LoadImm64",
"Vale.PPC64LE.Decls.va_op_reg_opr_reg",
"Vale.PPC64LE.InsVector.va_codegen_success_Load128_byte16_buffer",
"Vale.PPC64LE.Decls.va_op_heaplet_mem_heaplet",
"Vale.PPC64LE.Decls.va_op_vec_opr_vec",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.PPC64LE.InsVector.va_codegen_success_Load128_byte16_buffer_index",
"Vale.PPC64LE.InsVector.va_codegen_success_Store128_byte16_buffer",
"Vale.PPC64LE.InsVector.va_codegen_success_Store128_byte16_buffer_index",
"Vale.AES.PPC64LE.AES256.va_codegen_success_KeyExpansionRoundUnrolledRecursive256",
"Vale.PPC64LE.InsVector.va_codegen_success_Vxor",
"Vale.PPC64LE.Decls.va_ttrue",
"Vale.PPC64LE.Decls.va_pbool"
] | [] | false | false | false | true | false | let va_codegen_success_KeyExpansion256Stdcall () =
| (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 16)
(va_pbool_and (va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4)
Secret)
(va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 4)
(va_op_reg_opr_reg 10)
Secret)
(va_pbool_and (va_codegen_success_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3)
Secret)
(va_pbool_and (va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet
1)
(va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3)
(va_op_reg_opr_reg 10)
Secret)
(va_pbool_and (va_codegen_success_KeyExpansionRoundUnrolledRecursive256 14)
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4))
(va_ttrue ()))))))))))) | false |
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_code_KeyExpansion256Stdcall | val va_code_KeyExpansion256Stdcall : va_dummy:unit -> Tot va_code | val va_code_KeyExpansion256Stdcall : va_dummy:unit -> Tot va_code | let va_code_KeyExpansion256Stdcall () =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_CCons
(va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret) (va_CCons (va_code_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg
10) Secret) (va_CCons (va_code_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) Secret) (va_CCons
(va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 14) (va_CCons (va_code_Vxor (va_op_vec_opr_vec
1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_CNil ())))))))))))) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 72,
"end_line": 599,
"start_col": 0,
"start_line": 586
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round
rcon) va_s0 round rcon dst key 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 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1
va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32)) :
(va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(va_QProc (va_code_KeyExpansionRoundEven256 round rcon) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem])
(va_wp_KeyExpansionRoundEven256 round rcon dst key) (va_wpProof_KeyExpansionRoundEven256 round
rcon dst key))
//--
//-- KeyExpansionRoundOdd256
val va_code_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundOdd256 round =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
()))))))))))))))
val va_codegen_success_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundOdd256 round =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundOdd256 (va_mods:va_mods_t) (round:nat8) (dst:buffer128) (key:(seq
nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) =
(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 114 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 115 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 116 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 117 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 118 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 120 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 121 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 123 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 124 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 125 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 127 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg23:Prims.int) = round + 1
in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg21:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg21 va_arg22 0 va_arg23)
(let (va_arg20:Prims.int) = round + 1 in let (va_arg19:Vale.Def.Types_s.quad32) = va_get_vec 1
va_old_s in let (va_arg18:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 129 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_round_key_256_rcon_odd va_arg18 va_arg19 0
va_arg20) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 130 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(())))))))))))))))))))
val va_lemma_KeyExpansionRoundOdd256 : va_b0:va_code -> va_s0:va_state -> round:nat8 ->
dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundOdd256 round) va_s0 /\ va_get_ok
va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0)
dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10
va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundOdd256 va_b0 va_s0 round dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundOdd256 va_mods round dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundOdd256 round) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 92 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 102 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 110 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 111 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 112 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32)
(va_x_v4:quad32) . let va_sM = va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem
va_x_mem va_s0)))))) in va_get_ok va_sM /\ Vale.PPC64LE.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15 (va_get_mem_layout va_sM) Secret /\
va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec 3 va_sM ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundOdd256 : round:nat8 -> dst:buffer128 -> key:(seq nat32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundOdd256 round dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundOdd256 round)
([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1;
va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundOdd256 round dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundOdd256 (va_code_KeyExpansionRoundOdd256 round)
va_s0 round dst key in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) : (va_quickCode
unit (va_code_KeyExpansionRoundOdd256 round)) =
(va_QProc (va_code_KeyExpansionRoundOdd256 round) ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_KeyExpansionRoundOdd256
round dst key) (va_wpProof_KeyExpansionRoundOdd256 round dst key))
//--
//-- KeyExpansionRoundUnrolledRecursive256
val va_code_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_code(decreases %[n])
[@ "opaque_to_smt"]
let rec va_code_KeyExpansionRoundUnrolledRecursive256 n =
(va_Block (va_CCons (if (1 < n && n <= 14) then va_Block (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_CCons (if (n `op_Modulus` 2 = 0)
then va_Block (va_CCons (va_code_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_CNil ())) else va_Block (va_CCons
(va_code_KeyExpansionRoundOdd256 (n - 1)) (va_CNil ()))) (va_CNil ()))) else va_Block (va_CNil
())) (va_CNil ())))
val va_codegen_success_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_pbool(decreases %[n])
[@ "opaque_to_smt"]
let rec va_codegen_success_KeyExpansionRoundUnrolledRecursive256 n =
(va_pbool_and (if (1 < n && n <= 14) then va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_pbool_and (if (n
`op_Modulus` 2 = 0) then va_pbool_and (va_codegen_success_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_ttrue ()) else va_pbool_and
(va_codegen_success_KeyExpansionRoundOdd256 (n - 1)) (va_ttrue ())) (va_ttrue ())) else
va_ttrue ()) (va_ttrue ()))
val va_lemma_KeyExpansionRoundUnrolledRecursive256 : va_b0:va_code -> va_s0:va_state -> key:(seq
nat32) -> dst:buffer128 -> n:int
-> Ghost (va_state & va_fuel)(decreases %[n])
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == (if (n `op_Modulus` 2 = 0) then va_get_vec 1 va_sM else
va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == (if ((n - 1) `op_Modulus` 2 = 0) then va_get_vec 1
va_sM else va_get_vec 3 va_sM) /\ (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read
dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j <= n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.AES256_helpers_BE.expand_key_256 key j) /\ 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_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let rec va_lemma_KeyExpansionRoundUnrolledRecursive256 va_b0 va_s0 key dst n =
va_reveal_opaque (`%va_code_KeyExpansionRoundUnrolledRecursive256)
(va_code_KeyExpansionRoundUnrolledRecursive256 n);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let va_b2 = va_tl va_b1 in
let va_c2 = va_hd va_b1 in
let (va_fc2, va_s2) =
(
if (1 < n && n <= 14) then
(
let va_b3 = va_get_block va_c2 in
let (va_s4, va_fc4) = va_lemma_KeyExpansionRoundUnrolledRecursive256 (va_hd va_b3) va_s0 key
dst (n - 1) in
let va_b4 = va_tl va_b3 in
let (old_mem:vale_heap) = va_get_mem_heaplet 1 va_s4 in
let va_b6 = va_tl va_b4 in
let va_c6 = va_hd va_b4 in
let (va_fc6, va_s6) =
(
if (n `op_Modulus` 2 = 0) then
(
let va_b7 = va_get_block va_c6 in
let (va_s8, va_fc8) = va_lemma_KeyExpansionRoundEven256 (va_hd va_b7) va_s4 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1)) dst key in
let va_b8 = va_tl va_b7 in
let (va_s6, va_f8) = va_lemma_empty_total va_s8 va_b8 in
let va_fc6 = va_lemma_merge_total va_b7 va_s4 va_fc8 va_s8 va_f8 va_s6 in
(va_fc6, va_s6)
)
else
(
let va_b9 = va_get_block va_c6 in
let (va_s10, va_fc10) = va_lemma_KeyExpansionRoundOdd256 (va_hd va_b9) va_s4 (n - 1) dst
key in
let va_b10 = va_tl va_b9 in
let (va_s6, va_f10) = va_lemma_empty_total va_s10 va_b10 in
let va_fc6 = va_lemma_merge_total va_b9 va_s4 va_fc10 va_s10 va_f10 va_s6 in
(va_fc6, va_s6)
)
) in
assert (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1
va_s6)))}0 <= j /\ j < n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_s6)) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j old_mem));
let (va_s2, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f4 = va_lemma_merge_total va_b4 va_s4 va_fc6 va_s6 va_f6 va_s2 in
let va_fc2 = va_lemma_merge_total va_b3 va_s0 va_fc4 va_s4 va_f4 va_s2 in
(va_fc2, va_s2)
)
else
(
let va_b12 = va_get_block va_c2 in
let (va_s2, va_fc2) = va_lemma_empty_total va_s0 va_b12 in
(va_fc2, va_s2)
)
) in
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_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)
/\ (forall (va_x_mem:vale_heap) (va_x_heap1:vale_heap) (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) . 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_upd_mem_heaplet 1
va_x_heap1 (va_upd_mem va_x_mem va_s0)))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == va_if (n `op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM)
(fun _ -> va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == va_if ((n - 1)
`op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM) (fun _ -> va_get_vec 3 va_sM) /\ (forall j .
{:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j
<= n ==> Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j
(va_get_mem_heaplet 1 va_sM)) == Vale.AES.AES256_helpers_BE.expand_key_256 key j) ==> va_k
va_sM (())))
val va_wpProof_KeyExpansionRoundUnrolledRecursive256 : key:(seq nat32) -> dst:buffer128 -> n:int ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundUnrolledRecursive256
n) ([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_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundUnrolledRecursive256
(va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 key dst n 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem 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_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int) :
(va_quickCode unit (va_code_KeyExpansionRoundUnrolledRecursive256 n)) =
(va_QProc (va_code_KeyExpansionRoundUnrolledRecursive256 n) ([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_mem_heaplet 1;
va_Mod_mem]) (va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n)
(va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n))
//--
//-- KeyExpansion256Stdcall | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_code | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.PPC64LE.Decls.va_Block",
"Vale.PPC64LE.Decls.va_CCons",
"Vale.PPC64LE.InsBasic.va_code_LoadImm64",
"Vale.PPC64LE.Decls.va_op_reg_opr_reg",
"Vale.PPC64LE.InsVector.va_code_Load128_byte16_buffer",
"Vale.PPC64LE.Decls.va_op_heaplet_mem_heaplet",
"Vale.PPC64LE.Decls.va_op_vec_opr_vec",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.PPC64LE.InsVector.va_code_Load128_byte16_buffer_index",
"Vale.PPC64LE.InsVector.va_code_Store128_byte16_buffer",
"Vale.PPC64LE.InsVector.va_code_Store128_byte16_buffer_index",
"Vale.AES.PPC64LE.AES256.va_code_KeyExpansionRoundUnrolledRecursive256",
"Vale.PPC64LE.InsVector.va_code_Vxor",
"Vale.PPC64LE.Decls.va_CNil",
"Vale.PPC64LE.Decls.va_code"
] | [] | false | false | false | true | false | let va_code_KeyExpansion256Stdcall () =
| (va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 16)
(va_CCons (va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4)
Secret)
(va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 4)
(va_op_reg_opr_reg 10)
Secret)
(va_CCons (va_code_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3)
Secret)
(va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3)
(va_op_reg_opr_reg 10)
Secret)
(va_CCons (va_code_KeyExpansionRoundUnrolledRecursive256 14)
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1))
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2))
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3))
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4))
(va_CNil ())))))))))))) | false |
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_code_AES256EncryptBlock | val va_code_AES256EncryptBlock : va_dummy:unit -> Tot va_code | val va_code_AES256EncryptBlock : va_dummy:unit -> Tot va_code | let va_code_AES256EncryptBlock () =
(va_Block (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10)
0) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons
(va_code_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_CCons
(va_code_AES256EncryptRound 1) (va_CCons (va_code_AES256EncryptRound 2) (va_CCons
(va_code_AES256EncryptRound 3) (va_CCons (va_code_AES256EncryptRound 4) (va_CCons
(va_code_AES256EncryptRound 5) (va_CCons (va_code_AES256EncryptRound 6) (va_CCons
(va_code_AES256EncryptRound 7) (va_CCons (va_code_AES256EncryptRound 8) (va_CCons
(va_code_AES256EncryptRound 9) (va_CCons (va_code_AES256EncryptRound 10) (va_CCons
(va_code_AES256EncryptRound 11) (va_CCons (va_code_AES256EncryptRound 12) (va_CCons
(va_code_AES256EncryptRound 13) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16
`op_Multiply` 14)) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons
(va_code_Vcipherlast (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2))
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2))
(va_CNil ()))))))))))))))))))))))) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 38,
"end_line": 840,
"start_col": 0,
"start_line": 824
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round
rcon) va_s0 round rcon dst key 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 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1
va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32)) :
(va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(va_QProc (va_code_KeyExpansionRoundEven256 round rcon) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem])
(va_wp_KeyExpansionRoundEven256 round rcon dst key) (va_wpProof_KeyExpansionRoundEven256 round
rcon dst key))
//--
//-- KeyExpansionRoundOdd256
val va_code_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundOdd256 round =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
()))))))))))))))
val va_codegen_success_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundOdd256 round =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundOdd256 (va_mods:va_mods_t) (round:nat8) (dst:buffer128) (key:(seq
nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) =
(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 114 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 115 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 116 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 117 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 118 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 120 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 121 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 123 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 124 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 125 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 127 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg23:Prims.int) = round + 1
in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg21:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg21 va_arg22 0 va_arg23)
(let (va_arg20:Prims.int) = round + 1 in let (va_arg19:Vale.Def.Types_s.quad32) = va_get_vec 1
va_old_s in let (va_arg18:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 129 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_round_key_256_rcon_odd va_arg18 va_arg19 0
va_arg20) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 130 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(())))))))))))))))))))
val va_lemma_KeyExpansionRoundOdd256 : va_b0:va_code -> va_s0:va_state -> round:nat8 ->
dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundOdd256 round) va_s0 /\ va_get_ok
va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0)
dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10
va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundOdd256 va_b0 va_s0 round dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundOdd256 va_mods round dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundOdd256 round) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 92 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 102 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 110 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 111 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 112 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32)
(va_x_v4:quad32) . let va_sM = va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem
va_x_mem va_s0)))))) in va_get_ok va_sM /\ Vale.PPC64LE.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15 (va_get_mem_layout va_sM) Secret /\
va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec 3 va_sM ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundOdd256 : round:nat8 -> dst:buffer128 -> key:(seq nat32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundOdd256 round dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundOdd256 round)
([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1;
va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundOdd256 round dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundOdd256 (va_code_KeyExpansionRoundOdd256 round)
va_s0 round dst key in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) : (va_quickCode
unit (va_code_KeyExpansionRoundOdd256 round)) =
(va_QProc (va_code_KeyExpansionRoundOdd256 round) ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_KeyExpansionRoundOdd256
round dst key) (va_wpProof_KeyExpansionRoundOdd256 round dst key))
//--
//-- KeyExpansionRoundUnrolledRecursive256
val va_code_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_code(decreases %[n])
[@ "opaque_to_smt"]
let rec va_code_KeyExpansionRoundUnrolledRecursive256 n =
(va_Block (va_CCons (if (1 < n && n <= 14) then va_Block (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_CCons (if (n `op_Modulus` 2 = 0)
then va_Block (va_CCons (va_code_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_CNil ())) else va_Block (va_CCons
(va_code_KeyExpansionRoundOdd256 (n - 1)) (va_CNil ()))) (va_CNil ()))) else va_Block (va_CNil
())) (va_CNil ())))
val va_codegen_success_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_pbool(decreases %[n])
[@ "opaque_to_smt"]
let rec va_codegen_success_KeyExpansionRoundUnrolledRecursive256 n =
(va_pbool_and (if (1 < n && n <= 14) then va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_pbool_and (if (n
`op_Modulus` 2 = 0) then va_pbool_and (va_codegen_success_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_ttrue ()) else va_pbool_and
(va_codegen_success_KeyExpansionRoundOdd256 (n - 1)) (va_ttrue ())) (va_ttrue ())) else
va_ttrue ()) (va_ttrue ()))
val va_lemma_KeyExpansionRoundUnrolledRecursive256 : va_b0:va_code -> va_s0:va_state -> key:(seq
nat32) -> dst:buffer128 -> n:int
-> Ghost (va_state & va_fuel)(decreases %[n])
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == (if (n `op_Modulus` 2 = 0) then va_get_vec 1 va_sM else
va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == (if ((n - 1) `op_Modulus` 2 = 0) then va_get_vec 1
va_sM else va_get_vec 3 va_sM) /\ (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read
dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j <= n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.AES256_helpers_BE.expand_key_256 key j) /\ 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_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let rec va_lemma_KeyExpansionRoundUnrolledRecursive256 va_b0 va_s0 key dst n =
va_reveal_opaque (`%va_code_KeyExpansionRoundUnrolledRecursive256)
(va_code_KeyExpansionRoundUnrolledRecursive256 n);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let va_b2 = va_tl va_b1 in
let va_c2 = va_hd va_b1 in
let (va_fc2, va_s2) =
(
if (1 < n && n <= 14) then
(
let va_b3 = va_get_block va_c2 in
let (va_s4, va_fc4) = va_lemma_KeyExpansionRoundUnrolledRecursive256 (va_hd va_b3) va_s0 key
dst (n - 1) in
let va_b4 = va_tl va_b3 in
let (old_mem:vale_heap) = va_get_mem_heaplet 1 va_s4 in
let va_b6 = va_tl va_b4 in
let va_c6 = va_hd va_b4 in
let (va_fc6, va_s6) =
(
if (n `op_Modulus` 2 = 0) then
(
let va_b7 = va_get_block va_c6 in
let (va_s8, va_fc8) = va_lemma_KeyExpansionRoundEven256 (va_hd va_b7) va_s4 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1)) dst key in
let va_b8 = va_tl va_b7 in
let (va_s6, va_f8) = va_lemma_empty_total va_s8 va_b8 in
let va_fc6 = va_lemma_merge_total va_b7 va_s4 va_fc8 va_s8 va_f8 va_s6 in
(va_fc6, va_s6)
)
else
(
let va_b9 = va_get_block va_c6 in
let (va_s10, va_fc10) = va_lemma_KeyExpansionRoundOdd256 (va_hd va_b9) va_s4 (n - 1) dst
key in
let va_b10 = va_tl va_b9 in
let (va_s6, va_f10) = va_lemma_empty_total va_s10 va_b10 in
let va_fc6 = va_lemma_merge_total va_b9 va_s4 va_fc10 va_s10 va_f10 va_s6 in
(va_fc6, va_s6)
)
) in
assert (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1
va_s6)))}0 <= j /\ j < n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_s6)) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j old_mem));
let (va_s2, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f4 = va_lemma_merge_total va_b4 va_s4 va_fc6 va_s6 va_f6 va_s2 in
let va_fc2 = va_lemma_merge_total va_b3 va_s0 va_fc4 va_s4 va_f4 va_s2 in
(va_fc2, va_s2)
)
else
(
let va_b12 = va_get_block va_c2 in
let (va_s2, va_fc2) = va_lemma_empty_total va_s0 va_b12 in
(va_fc2, va_s2)
)
) in
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_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)
/\ (forall (va_x_mem:vale_heap) (va_x_heap1:vale_heap) (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) . 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_upd_mem_heaplet 1
va_x_heap1 (va_upd_mem va_x_mem va_s0)))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == va_if (n `op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM)
(fun _ -> va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == va_if ((n - 1)
`op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM) (fun _ -> va_get_vec 3 va_sM) /\ (forall j .
{:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j
<= n ==> Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j
(va_get_mem_heaplet 1 va_sM)) == Vale.AES.AES256_helpers_BE.expand_key_256 key j) ==> va_k
va_sM (())))
val va_wpProof_KeyExpansionRoundUnrolledRecursive256 : key:(seq nat32) -> dst:buffer128 -> n:int ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundUnrolledRecursive256
n) ([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_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundUnrolledRecursive256
(va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 key dst n 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem 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_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int) :
(va_quickCode unit (va_code_KeyExpansionRoundUnrolledRecursive256 n)) =
(va_QProc (va_code_KeyExpansionRoundUnrolledRecursive256 n) ([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_mem_heaplet 1;
va_Mod_mem]) (va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n)
(va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n))
//--
//-- KeyExpansion256Stdcall
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansion256Stdcall () =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_CCons
(va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret) (va_CCons (va_code_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg
10) Secret) (va_CCons (va_code_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) Secret) (va_CCons
(va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 14) (va_CCons (va_code_Vxor (va_op_vec_opr_vec
1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_CNil ()))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansion256Stdcall () =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg
10) Secret) (va_pbool_and (va_codegen_success_Store128_byte16_buffer (va_op_heaplet_mem_heaplet
1) (va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) Secret) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 14) (va_pbool_and
(va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_ttrue ())))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansion256Stdcall (va_mods:va_mods_t) (input_key_b:buffer128)
(output_key_expansion_b:buffer128) : (va_quickCode unit (va_code_KeyExpansion256Stdcall ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = Vale.AES.AES256_helpers_BE.make_AES256_key
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 0
(va_get_mem_heaplet 0 va_s))) (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet 0 va_s))) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 193 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 194 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret input_key_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 195 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret input_key_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 197 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) Secret output_key_expansion_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 198 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret output_key_expansion_b 1) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 200 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 201 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_KeyExpansionRoundUnrolledRecursive256 key output_key_expansion_b 14) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 202 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_expand_key_256 key 15) (va_QLemma va_range1
"***** PRECONDITION NOT MET AT line 203 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
true (fun _ -> va_reveal_eq (`%key_to_round_keys_word) key_to_round_keys_word
key_to_round_keys_word) (fun _ -> va_reveal_opaque (`%key_to_round_keys_word)
key_to_round_keys_word) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 206 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 207 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 208 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 209 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_QEmpty
(()))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansion256Stdcall va_b0 va_s0 input_key_b output_key_expansion_b =
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_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansion256Stdcall va_mods input_key_b output_key_expansion_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansion256Stdcall ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 174 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ (let (key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) =
Vale.AES.AES256_helpers_BE.make_AES256_key (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 0 (va_get_mem_heaplet 0 va_s0)))
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 1
(va_get_mem_heaplet 0 va_s0))) in label va_range1
"***** POSTCONDITION NOT MET AT line 186 column 71 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_sM) (va_get_reg 4 va_sM)
input_key_b 2 (va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 187 column 83 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM)
output_key_expansion_b 15 (va_get_mem_layout va_sM) Secret)) /\ (let (key:(FStar.Seq.Base.seq
Vale.Def.Types_s.nat32)) = Vale.AES.AES256_helpers_BE.make_AES256_key
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 0
(va_get_mem_heaplet 0 va_s0))) (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet 0 va_s0))) in label
va_range1
"***** POSTCONDITION NOT MET AT line 189 column 70 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer128 output_key_expansion_b (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 191 column 133 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(forall (j:nat) . {:pattern(reverse_bytes_quad32 (buffer128_read output_key_expansion_b j
(va_get_mem_heaplet 1 va_sM)))}j <= 14 ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read output_key_expansion_b j (va_get_mem_heaplet 1 va_sM)) ==
FStar.Seq.Base.index #Vale.Def.Types_s.quad32 (Vale.AES.AES_BE_s.key_to_round_keys_word AES_256
key) j))) 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_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_KeyExpansion256Stdcall input_key_b output_key_expansion_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansion256Stdcall (va_code_KeyExpansion256Stdcall ()) va_s0
input_key_b output_key_expansion_b 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem 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_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- AES256EncryptRound
val va_code_AES256EncryptRound : n:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_AES256EncryptRound n =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n)) (va_CCons
(va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_CNil ())))))
val va_codegen_success_AES256EncryptRound : n:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_AES256EncryptRound n =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n))
(va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_Vcipher (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2))
(va_ttrue ()))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_AES256EncryptRound (va_mods:va_mods_t) (n:nat8) (init:quad32) (round_keys:(seq
quad32)) (keys_buffer:buffer128) : (va_quickCode unit (va_code_AES256EncryptRound n)) =
(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 235 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 236 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret keys_buffer n) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 237 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipher (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_QEmpty
(()))))))
val va_lemma_AES256EncryptRound : va_b0:va_code -> va_s0:va_state -> n:nat8 -> init:quad32 ->
round_keys:(seq quad32) -> keys_buffer:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AES256EncryptRound n) va_s0 /\ va_get_ok va_s0 /\ (1
<= n /\ n < 14 /\ 14 <= FStar.Seq.Base.length #quad32 round_keys) /\ va_get_vec 0 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init round_keys (n - 1) /\ va_get_reg 4 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 keys_buffer (va_get_mem_heaplet 0
va_s0) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0)
keys_buffer 15 (va_get_mem_layout va_s0) Secret /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read keys_buffer n (va_get_mem_heaplet 0 va_s0)) ==
FStar.Seq.Base.index #quad32 round_keys n))
(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 0 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init round_keys n /\ va_state_eq va_sM
(va_update_vec 2 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_AES256EncryptRound va_b0 va_s0 n init round_keys keys_buffer =
let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in
let va_qc = va_qcode_AES256EncryptRound va_mods n init round_keys keys_buffer in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_AES256EncryptRound n) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 216 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 233 column 51 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 0 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init round_keys n)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_AES256EncryptRound (n:nat8) (init:quad32) (round_keys:(seq quad32))
(keys_buffer:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (1 <= n /\ n < 14 /\ 14 <= FStar.Seq.Base.length #quad32 round_keys) /\
va_get_vec 0 va_s0 == Vale.AES.AES_BE_s.eval_rounds_def init round_keys (n - 1) /\ va_get_reg 4
va_s0 == Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 keys_buffer
(va_get_mem_heaplet 0 va_s0) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0
va_s0) (va_get_reg 4 va_s0) keys_buffer 15 (va_get_mem_layout va_s0) Secret /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read keys_buffer n
(va_get_mem_heaplet 0 va_s0)) == FStar.Seq.Base.index #quad32 round_keys n /\ (forall
(va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) . let va_sM = va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)) in va_get_ok va_sM /\ va_get_vec 0 va_sM
== Vale.AES.AES_BE_s.eval_rounds_def init round_keys n ==> va_k va_sM (())))
val va_wpProof_AES256EncryptRound : n:nat8 -> init:quad32 -> round_keys:(seq quad32) ->
keys_buffer:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AES256EncryptRound n init round_keys keys_buffer va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AES256EncryptRound n) ([va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_AES256EncryptRound n init round_keys keys_buffer va_s0 va_k =
let (va_sM, va_f0) = va_lemma_AES256EncryptRound (va_code_AES256EncryptRound n) va_s0 n init
round_keys keys_buffer in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 2 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 2; 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_AES256EncryptRound (n:nat8) (init:quad32) (round_keys:(seq quad32))
(keys_buffer:buffer128) : (va_quickCode unit (va_code_AES256EncryptRound n)) =
(va_QProc (va_code_AES256EncryptRound n) ([va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10])
(va_wp_AES256EncryptRound n init round_keys keys_buffer) (va_wpProof_AES256EncryptRound n init
round_keys keys_buffer))
//--
//-- AES256EncryptBlock | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_code | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.PPC64LE.Decls.va_Block",
"Vale.PPC64LE.Decls.va_CCons",
"Vale.PPC64LE.Decls.va_CNil",
"Vale.PPC64LE.InsBasic.va_code_LoadImm64",
"Vale.PPC64LE.Decls.va_op_reg_opr_reg",
"Vale.PPC64LE.InsVector.va_code_Load128_byte16_buffer_index",
"Vale.PPC64LE.Decls.va_op_heaplet_mem_heaplet",
"Vale.PPC64LE.Decls.va_op_vec_opr_vec",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.PPC64LE.InsVector.va_code_Vxor",
"Vale.AES.PPC64LE.AES256.va_code_AES256EncryptRound",
"Prims.op_Multiply",
"Vale.PPC64LE.InsVector.va_code_Vcipherlast",
"Vale.PPC64LE.Decls.va_code"
] | [] | false | false | false | true | false | let va_code_AES256EncryptBlock () =
| (va_Block (va_CCons (va_Block (va_CNil ()))
(va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 0)
(va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4)
(va_op_reg_opr_reg 10)
Secret)
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 2))
(va_CCons (va_code_AES256EncryptRound 1)
(va_CCons (va_code_AES256EncryptRound 2)
(va_CCons (va_code_AES256EncryptRound 3)
(va_CCons (va_code_AES256EncryptRound 4)
(va_CCons (va_code_AES256EncryptRound 5)
(va_CCons (va_code_AES256EncryptRound 6)
(va_CCons (va_code_AES256EncryptRound 7)
(va_CCons (va_code_AES256EncryptRound 8)
(va_CCons (va_code_AES256EncryptRound 9)
(va_CCons (va_code_AES256EncryptRound 10)
(va_CCons (va_code_AES256EncryptRound 11
)
(va_CCons (va_code_AES256EncryptRound
12)
(va_CCons (va_code_AES256EncryptRound
13)
(va_CCons (va_code_LoadImm64
(va_op_reg_opr_reg 10
)
(16 `op_Multiply` 14
))
(va_CCons (va_code_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet
0)
(va_op_vec_opr_vec
2)
(va_op_reg_opr_reg
4)
(va_op_reg_opr_reg
10)
Secret)
(va_CCons (va_code_Vcipherlast
(va_op_vec_opr_vec
0)
(va_op_vec_opr_vec
0)
(va_op_vec_opr_vec
2))
(va_CCons (va_code_Vxor
(va_op_vec_opr_vec
2)
(va_op_vec_opr_vec
2)
(va_op_vec_opr_vec
2))
(va_CNil ())
))))))))))))))))
)))))) | false |
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_codegen_success_AES256EncryptBlock | val va_codegen_success_AES256EncryptBlock : va_dummy:unit -> Tot va_pbool | val va_codegen_success_AES256EncryptBlock : va_dummy:unit -> Tot va_pbool | let va_codegen_success_AES256EncryptBlock () =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 0) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2))
(va_pbool_and (va_codegen_success_AES256EncryptRound 1) (va_pbool_and
(va_codegen_success_AES256EncryptRound 2) (va_pbool_and (va_codegen_success_AES256EncryptRound
3) (va_pbool_and (va_codegen_success_AES256EncryptRound 4) (va_pbool_and
(va_codegen_success_AES256EncryptRound 5) (va_pbool_and (va_codegen_success_AES256EncryptRound
6) (va_pbool_and (va_codegen_success_AES256EncryptRound 7) (va_pbool_and
(va_codegen_success_AES256EncryptRound 8) (va_pbool_and (va_codegen_success_AES256EncryptRound
9) (va_pbool_and (va_codegen_success_AES256EncryptRound 10) (va_pbool_and
(va_codegen_success_AES256EncryptRound 11) (va_pbool_and (va_codegen_success_AES256EncryptRound
12) (va_pbool_and (va_codegen_success_AES256EncryptRound 13) (va_pbool_and
(va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` 14)) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_Vcipherlast (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec
2)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)) (va_ttrue ()))))))))))))))))))))) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 60,
"end_line": 862,
"start_col": 0,
"start_line": 843
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round
rcon) va_s0 round rcon dst key 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 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1
va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32)) :
(va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(va_QProc (va_code_KeyExpansionRoundEven256 round rcon) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem])
(va_wp_KeyExpansionRoundEven256 round rcon dst key) (va_wpProof_KeyExpansionRoundEven256 round
rcon dst key))
//--
//-- KeyExpansionRoundOdd256
val va_code_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundOdd256 round =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
()))))))))))))))
val va_codegen_success_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundOdd256 round =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundOdd256 (va_mods:va_mods_t) (round:nat8) (dst:buffer128) (key:(seq
nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) =
(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 114 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 115 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 116 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 117 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 118 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 120 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 121 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 123 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 124 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 125 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 127 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg23:Prims.int) = round + 1
in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg21:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg21 va_arg22 0 va_arg23)
(let (va_arg20:Prims.int) = round + 1 in let (va_arg19:Vale.Def.Types_s.quad32) = va_get_vec 1
va_old_s in let (va_arg18:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 129 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_round_key_256_rcon_odd va_arg18 va_arg19 0
va_arg20) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 130 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(())))))))))))))))))))
val va_lemma_KeyExpansionRoundOdd256 : va_b0:va_code -> va_s0:va_state -> round:nat8 ->
dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundOdd256 round) va_s0 /\ va_get_ok
va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0)
dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10
va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundOdd256 va_b0 va_s0 round dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundOdd256 va_mods round dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundOdd256 round) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 92 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 102 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 110 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 111 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 112 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32)
(va_x_v4:quad32) . let va_sM = va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem
va_x_mem va_s0)))))) in va_get_ok va_sM /\ Vale.PPC64LE.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15 (va_get_mem_layout va_sM) Secret /\
va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec 3 va_sM ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundOdd256 : round:nat8 -> dst:buffer128 -> key:(seq nat32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundOdd256 round dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundOdd256 round)
([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1;
va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundOdd256 round dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundOdd256 (va_code_KeyExpansionRoundOdd256 round)
va_s0 round dst key in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) : (va_quickCode
unit (va_code_KeyExpansionRoundOdd256 round)) =
(va_QProc (va_code_KeyExpansionRoundOdd256 round) ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_KeyExpansionRoundOdd256
round dst key) (va_wpProof_KeyExpansionRoundOdd256 round dst key))
//--
//-- KeyExpansionRoundUnrolledRecursive256
val va_code_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_code(decreases %[n])
[@ "opaque_to_smt"]
let rec va_code_KeyExpansionRoundUnrolledRecursive256 n =
(va_Block (va_CCons (if (1 < n && n <= 14) then va_Block (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_CCons (if (n `op_Modulus` 2 = 0)
then va_Block (va_CCons (va_code_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_CNil ())) else va_Block (va_CCons
(va_code_KeyExpansionRoundOdd256 (n - 1)) (va_CNil ()))) (va_CNil ()))) else va_Block (va_CNil
())) (va_CNil ())))
val va_codegen_success_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_pbool(decreases %[n])
[@ "opaque_to_smt"]
let rec va_codegen_success_KeyExpansionRoundUnrolledRecursive256 n =
(va_pbool_and (if (1 < n && n <= 14) then va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_pbool_and (if (n
`op_Modulus` 2 = 0) then va_pbool_and (va_codegen_success_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_ttrue ()) else va_pbool_and
(va_codegen_success_KeyExpansionRoundOdd256 (n - 1)) (va_ttrue ())) (va_ttrue ())) else
va_ttrue ()) (va_ttrue ()))
val va_lemma_KeyExpansionRoundUnrolledRecursive256 : va_b0:va_code -> va_s0:va_state -> key:(seq
nat32) -> dst:buffer128 -> n:int
-> Ghost (va_state & va_fuel)(decreases %[n])
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == (if (n `op_Modulus` 2 = 0) then va_get_vec 1 va_sM else
va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == (if ((n - 1) `op_Modulus` 2 = 0) then va_get_vec 1
va_sM else va_get_vec 3 va_sM) /\ (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read
dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j <= n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.AES256_helpers_BE.expand_key_256 key j) /\ 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_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let rec va_lemma_KeyExpansionRoundUnrolledRecursive256 va_b0 va_s0 key dst n =
va_reveal_opaque (`%va_code_KeyExpansionRoundUnrolledRecursive256)
(va_code_KeyExpansionRoundUnrolledRecursive256 n);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let va_b2 = va_tl va_b1 in
let va_c2 = va_hd va_b1 in
let (va_fc2, va_s2) =
(
if (1 < n && n <= 14) then
(
let va_b3 = va_get_block va_c2 in
let (va_s4, va_fc4) = va_lemma_KeyExpansionRoundUnrolledRecursive256 (va_hd va_b3) va_s0 key
dst (n - 1) in
let va_b4 = va_tl va_b3 in
let (old_mem:vale_heap) = va_get_mem_heaplet 1 va_s4 in
let va_b6 = va_tl va_b4 in
let va_c6 = va_hd va_b4 in
let (va_fc6, va_s6) =
(
if (n `op_Modulus` 2 = 0) then
(
let va_b7 = va_get_block va_c6 in
let (va_s8, va_fc8) = va_lemma_KeyExpansionRoundEven256 (va_hd va_b7) va_s4 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1)) dst key in
let va_b8 = va_tl va_b7 in
let (va_s6, va_f8) = va_lemma_empty_total va_s8 va_b8 in
let va_fc6 = va_lemma_merge_total va_b7 va_s4 va_fc8 va_s8 va_f8 va_s6 in
(va_fc6, va_s6)
)
else
(
let va_b9 = va_get_block va_c6 in
let (va_s10, va_fc10) = va_lemma_KeyExpansionRoundOdd256 (va_hd va_b9) va_s4 (n - 1) dst
key in
let va_b10 = va_tl va_b9 in
let (va_s6, va_f10) = va_lemma_empty_total va_s10 va_b10 in
let va_fc6 = va_lemma_merge_total va_b9 va_s4 va_fc10 va_s10 va_f10 va_s6 in
(va_fc6, va_s6)
)
) in
assert (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1
va_s6)))}0 <= j /\ j < n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_s6)) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j old_mem));
let (va_s2, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f4 = va_lemma_merge_total va_b4 va_s4 va_fc6 va_s6 va_f6 va_s2 in
let va_fc2 = va_lemma_merge_total va_b3 va_s0 va_fc4 va_s4 va_f4 va_s2 in
(va_fc2, va_s2)
)
else
(
let va_b12 = va_get_block va_c2 in
let (va_s2, va_fc2) = va_lemma_empty_total va_s0 va_b12 in
(va_fc2, va_s2)
)
) in
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_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)
/\ (forall (va_x_mem:vale_heap) (va_x_heap1:vale_heap) (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) . 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_upd_mem_heaplet 1
va_x_heap1 (va_upd_mem va_x_mem va_s0)))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == va_if (n `op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM)
(fun _ -> va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == va_if ((n - 1)
`op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM) (fun _ -> va_get_vec 3 va_sM) /\ (forall j .
{:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j
<= n ==> Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j
(va_get_mem_heaplet 1 va_sM)) == Vale.AES.AES256_helpers_BE.expand_key_256 key j) ==> va_k
va_sM (())))
val va_wpProof_KeyExpansionRoundUnrolledRecursive256 : key:(seq nat32) -> dst:buffer128 -> n:int ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundUnrolledRecursive256
n) ([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_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundUnrolledRecursive256
(va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 key dst n 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem 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_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int) :
(va_quickCode unit (va_code_KeyExpansionRoundUnrolledRecursive256 n)) =
(va_QProc (va_code_KeyExpansionRoundUnrolledRecursive256 n) ([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_mem_heaplet 1;
va_Mod_mem]) (va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n)
(va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n))
//--
//-- KeyExpansion256Stdcall
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansion256Stdcall () =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_CCons
(va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret) (va_CCons (va_code_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg
10) Secret) (va_CCons (va_code_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) Secret) (va_CCons
(va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 14) (va_CCons (va_code_Vxor (va_op_vec_opr_vec
1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_CNil ()))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansion256Stdcall () =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg
10) Secret) (va_pbool_and (va_codegen_success_Store128_byte16_buffer (va_op_heaplet_mem_heaplet
1) (va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) Secret) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 14) (va_pbool_and
(va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_ttrue ())))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansion256Stdcall (va_mods:va_mods_t) (input_key_b:buffer128)
(output_key_expansion_b:buffer128) : (va_quickCode unit (va_code_KeyExpansion256Stdcall ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = Vale.AES.AES256_helpers_BE.make_AES256_key
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 0
(va_get_mem_heaplet 0 va_s))) (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet 0 va_s))) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 193 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 194 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret input_key_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 195 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret input_key_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 197 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) Secret output_key_expansion_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 198 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret output_key_expansion_b 1) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 200 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 201 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_KeyExpansionRoundUnrolledRecursive256 key output_key_expansion_b 14) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 202 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_expand_key_256 key 15) (va_QLemma va_range1
"***** PRECONDITION NOT MET AT line 203 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
true (fun _ -> va_reveal_eq (`%key_to_round_keys_word) key_to_round_keys_word
key_to_round_keys_word) (fun _ -> va_reveal_opaque (`%key_to_round_keys_word)
key_to_round_keys_word) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 206 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 207 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 208 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 209 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_QEmpty
(()))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansion256Stdcall va_b0 va_s0 input_key_b output_key_expansion_b =
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_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansion256Stdcall va_mods input_key_b output_key_expansion_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansion256Stdcall ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 174 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ (let (key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) =
Vale.AES.AES256_helpers_BE.make_AES256_key (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 0 (va_get_mem_heaplet 0 va_s0)))
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 1
(va_get_mem_heaplet 0 va_s0))) in label va_range1
"***** POSTCONDITION NOT MET AT line 186 column 71 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_sM) (va_get_reg 4 va_sM)
input_key_b 2 (va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 187 column 83 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM)
output_key_expansion_b 15 (va_get_mem_layout va_sM) Secret)) /\ (let (key:(FStar.Seq.Base.seq
Vale.Def.Types_s.nat32)) = Vale.AES.AES256_helpers_BE.make_AES256_key
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 0
(va_get_mem_heaplet 0 va_s0))) (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet 0 va_s0))) in label
va_range1
"***** POSTCONDITION NOT MET AT line 189 column 70 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer128 output_key_expansion_b (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 191 column 133 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(forall (j:nat) . {:pattern(reverse_bytes_quad32 (buffer128_read output_key_expansion_b j
(va_get_mem_heaplet 1 va_sM)))}j <= 14 ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read output_key_expansion_b j (va_get_mem_heaplet 1 va_sM)) ==
FStar.Seq.Base.index #Vale.Def.Types_s.quad32 (Vale.AES.AES_BE_s.key_to_round_keys_word AES_256
key) j))) 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_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_KeyExpansion256Stdcall input_key_b output_key_expansion_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansion256Stdcall (va_code_KeyExpansion256Stdcall ()) va_s0
input_key_b output_key_expansion_b 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem 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_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- AES256EncryptRound
val va_code_AES256EncryptRound : n:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_AES256EncryptRound n =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n)) (va_CCons
(va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_CNil ())))))
val va_codegen_success_AES256EncryptRound : n:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_AES256EncryptRound n =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n))
(va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_Vcipher (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2))
(va_ttrue ()))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_AES256EncryptRound (va_mods:va_mods_t) (n:nat8) (init:quad32) (round_keys:(seq
quad32)) (keys_buffer:buffer128) : (va_quickCode unit (va_code_AES256EncryptRound n)) =
(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 235 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 236 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret keys_buffer n) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 237 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipher (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_QEmpty
(()))))))
val va_lemma_AES256EncryptRound : va_b0:va_code -> va_s0:va_state -> n:nat8 -> init:quad32 ->
round_keys:(seq quad32) -> keys_buffer:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AES256EncryptRound n) va_s0 /\ va_get_ok va_s0 /\ (1
<= n /\ n < 14 /\ 14 <= FStar.Seq.Base.length #quad32 round_keys) /\ va_get_vec 0 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init round_keys (n - 1) /\ va_get_reg 4 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 keys_buffer (va_get_mem_heaplet 0
va_s0) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0)
keys_buffer 15 (va_get_mem_layout va_s0) Secret /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read keys_buffer n (va_get_mem_heaplet 0 va_s0)) ==
FStar.Seq.Base.index #quad32 round_keys n))
(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 0 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init round_keys n /\ va_state_eq va_sM
(va_update_vec 2 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_AES256EncryptRound va_b0 va_s0 n init round_keys keys_buffer =
let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in
let va_qc = va_qcode_AES256EncryptRound va_mods n init round_keys keys_buffer in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_AES256EncryptRound n) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 216 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 233 column 51 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 0 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init round_keys n)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_AES256EncryptRound (n:nat8) (init:quad32) (round_keys:(seq quad32))
(keys_buffer:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (1 <= n /\ n < 14 /\ 14 <= FStar.Seq.Base.length #quad32 round_keys) /\
va_get_vec 0 va_s0 == Vale.AES.AES_BE_s.eval_rounds_def init round_keys (n - 1) /\ va_get_reg 4
va_s0 == Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 keys_buffer
(va_get_mem_heaplet 0 va_s0) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0
va_s0) (va_get_reg 4 va_s0) keys_buffer 15 (va_get_mem_layout va_s0) Secret /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read keys_buffer n
(va_get_mem_heaplet 0 va_s0)) == FStar.Seq.Base.index #quad32 round_keys n /\ (forall
(va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) . let va_sM = va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)) in va_get_ok va_sM /\ va_get_vec 0 va_sM
== Vale.AES.AES_BE_s.eval_rounds_def init round_keys n ==> va_k va_sM (())))
val va_wpProof_AES256EncryptRound : n:nat8 -> init:quad32 -> round_keys:(seq quad32) ->
keys_buffer:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AES256EncryptRound n init round_keys keys_buffer va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AES256EncryptRound n) ([va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_AES256EncryptRound n init round_keys keys_buffer va_s0 va_k =
let (va_sM, va_f0) = va_lemma_AES256EncryptRound (va_code_AES256EncryptRound n) va_s0 n init
round_keys keys_buffer in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 2 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 2; 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_AES256EncryptRound (n:nat8) (init:quad32) (round_keys:(seq quad32))
(keys_buffer:buffer128) : (va_quickCode unit (va_code_AES256EncryptRound n)) =
(va_QProc (va_code_AES256EncryptRound n) ([va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10])
(va_wp_AES256EncryptRound n init round_keys keys_buffer) (va_wpProof_AES256EncryptRound n init
round_keys keys_buffer))
//--
//-- AES256EncryptBlock
[@ "opaque_to_smt" va_qattr]
let va_code_AES256EncryptBlock () =
(va_Block (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10)
0) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons
(va_code_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_CCons
(va_code_AES256EncryptRound 1) (va_CCons (va_code_AES256EncryptRound 2) (va_CCons
(va_code_AES256EncryptRound 3) (va_CCons (va_code_AES256EncryptRound 4) (va_CCons
(va_code_AES256EncryptRound 5) (va_CCons (va_code_AES256EncryptRound 6) (va_CCons
(va_code_AES256EncryptRound 7) (va_CCons (va_code_AES256EncryptRound 8) (va_CCons
(va_code_AES256EncryptRound 9) (va_CCons (va_code_AES256EncryptRound 10) (va_CCons
(va_code_AES256EncryptRound 11) (va_CCons (va_code_AES256EncryptRound 12) (va_CCons
(va_code_AES256EncryptRound 13) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16
`op_Multiply` 14)) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons
(va_code_Vcipherlast (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2))
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2))
(va_CNil ()))))))))))))))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_pbool | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.PPC64LE.Decls.va_pbool_and",
"Vale.PPC64LE.InsBasic.va_codegen_success_LoadImm64",
"Vale.PPC64LE.Decls.va_op_reg_opr_reg",
"Vale.PPC64LE.InsVector.va_codegen_success_Load128_byte16_buffer_index",
"Vale.PPC64LE.Decls.va_op_heaplet_mem_heaplet",
"Vale.PPC64LE.Decls.va_op_vec_opr_vec",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.PPC64LE.InsVector.va_codegen_success_Vxor",
"Vale.AES.PPC64LE.AES256.va_codegen_success_AES256EncryptRound",
"Prims.op_Multiply",
"Vale.PPC64LE.InsVector.va_codegen_success_Vcipherlast",
"Vale.PPC64LE.Decls.va_ttrue",
"Vale.PPC64LE.Decls.va_pbool"
] | [] | false | false | false | true | false | let va_codegen_success_AES256EncryptBlock () =
| (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 0)
(va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4)
(va_op_reg_opr_reg 10)
Secret)
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 2))
(va_pbool_and (va_codegen_success_AES256EncryptRound 1)
(va_pbool_and (va_codegen_success_AES256EncryptRound 2)
(va_pbool_and (va_codegen_success_AES256EncryptRound 3)
(va_pbool_and (va_codegen_success_AES256EncryptRound 4)
(va_pbool_and (va_codegen_success_AES256EncryptRound 5)
(va_pbool_and (va_codegen_success_AES256EncryptRound 6)
(va_pbool_and (va_codegen_success_AES256EncryptRound 7)
(va_pbool_and (va_codegen_success_AES256EncryptRound 8)
(va_pbool_and (va_codegen_success_AES256EncryptRound 9)
(va_pbool_and (va_codegen_success_AES256EncryptRound
10)
(va_pbool_and (va_codegen_success_AES256EncryptRound
11)
(va_pbool_and (va_codegen_success_AES256EncryptRound
12)
(va_pbool_and (va_codegen_success_AES256EncryptRound
13)
(va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10)
(16 `op_Multiply` 14))
(va_pbool_and (va_codegen_success_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet
0)
(va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4)
(va_op_reg_opr_reg 10)
Secret)
(va_pbool_and (va_codegen_success_Vcipherlast
(va_op_vec_opr_vec 0
)
(va_op_vec_opr_vec 0
)
(va_op_vec_opr_vec 2
))
(va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec
2)
(va_op_vec_opr_vec
2)
(va_op_vec_opr_vec
2))
(va_ttrue ()))))))))
))))))))))))) | false |
Pulse.Checker.WithLocalArray.fst | Pulse.Checker.WithLocalArray.head_range | val head_range (t: st_term{Tm_WithLocalArray? t.term}) : range | val head_range (t: st_term{Tm_WithLocalArray? t.term}) : range | let head_range (t:st_term {Tm_WithLocalArray? t.term}) : range =
let Tm_WithLocalArray { initializer } = t.term in
initializer.range | {
"file_name": "lib/steel/pulse/Pulse.Checker.WithLocalArray.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 19,
"end_line": 76,
"start_col": 0,
"start_line": 74
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Checker.WithLocalArray
open Pulse.Syntax
open Pulse.Typing
open Pulse.Checker.Pure
open Pulse.Checker.Base
module T = FStar.Tactics.V2
module P = Pulse.Syntax.Printer
module RU = Pulse.Reflection.Util
let extend_post_hint
(g:env)
(p:post_hint_for_env g)
(init_t:term)
(x:var { ~ (Set.mem x (dom g)) })
: T.Tac (q:post_hint_for_env (push_binding g x ppname_default (mk_array init_t)) {
q.post == comp_withlocal_array_body_post p.post init_t (null_var x) /\
q.ret_ty == p.ret_ty /\
q.u == p.u /\
q.effect_annot == p.effect_annot
})
= let arr = null_var x in
let conjunct = (tm_exists_sl u0 (as_binder (mk_seq u0 init_t)) (mk_array_pts_to init_t arr (null_bvar 0))) in
let g' = push_binding g x ppname_default (mk_array init_t) in
let c_typing = Pulse.Checker.Pure.core_check_term g' conjunct T.E_Total tm_vprop in
let res = Pulse.Checker.Base.extend_post_hint g p x (mk_array init_t) _ c_typing in
res
let with_local_array_pre_typing (#g:env) (#pre:term)
(pre_typing:tot_typing g pre tm_vprop)
(init_t:term)
(init:term)
(len:term)
(init_typing:tot_typing g init init_t)
(len_typing:tot_typing g len tm_szt)
(x:var { ~ (Set.mem x (dom g)) })
: tot_typing (push_binding g x ppname_default (mk_array init_t))
(comp_withlocal_array_body_pre pre init_t (null_var x) init len)
tm_vprop
= admit()
let is_annotated_type_array (t:term) : option term =
match is_pure_app t with
| Some (head, None, a) ->
(match is_fvar head with
| Some (l, _) ->
if l = RU.array_lid
then Some a
else None
| _ -> None
)
| _ -> None | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Checker.Pure.fsti.checked",
"Pulse.Checker.Base.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.WithLocalArray.fst"
} | [
{
"abbrev": true,
"full_module": "Pulse.Reflection.Util",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 4,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: Pulse.Syntax.Base.st_term{Tm_WithLocalArray? (Mkst_term?.term t)} -> Pulse.Syntax.Base.range | Prims.Tot | [
"total"
] | [] | [
"Pulse.Syntax.Base.st_term",
"Prims.b2t",
"Pulse.Syntax.Base.uu___is_Tm_WithLocalArray",
"Pulse.Syntax.Base.__proj__Mkst_term__item__term",
"Pulse.Syntax.Base.binder",
"Pulse.Syntax.Base.term",
"Pulse.Syntax.Base.__proj__Mkterm__item__range",
"Pulse.Syntax.Base.range",
"Pulse.Syntax.Base.st_term'"
] | [] | false | false | false | false | false | let head_range (t: st_term{Tm_WithLocalArray? t.term}) : range =
| let Tm_WithLocalArray { initializer = initializer } = t.term in
initializer.range | false |
Pulse.Checker.WithLocalArray.fst | Pulse.Checker.WithLocalArray.is_annotated_type_array | val is_annotated_type_array (t: term) : option term | val is_annotated_type_array (t: term) : option term | let is_annotated_type_array (t:term) : option term =
match is_pure_app t with
| Some (head, None, a) ->
(match is_fvar head with
| Some (l, _) ->
if l = RU.array_lid
then Some a
else None
| _ -> None
)
| _ -> None | {
"file_name": "lib/steel/pulse/Pulse.Checker.WithLocalArray.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 13,
"end_line": 71,
"start_col": 0,
"start_line": 60
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Checker.WithLocalArray
open Pulse.Syntax
open Pulse.Typing
open Pulse.Checker.Pure
open Pulse.Checker.Base
module T = FStar.Tactics.V2
module P = Pulse.Syntax.Printer
module RU = Pulse.Reflection.Util
let extend_post_hint
(g:env)
(p:post_hint_for_env g)
(init_t:term)
(x:var { ~ (Set.mem x (dom g)) })
: T.Tac (q:post_hint_for_env (push_binding g x ppname_default (mk_array init_t)) {
q.post == comp_withlocal_array_body_post p.post init_t (null_var x) /\
q.ret_ty == p.ret_ty /\
q.u == p.u /\
q.effect_annot == p.effect_annot
})
= let arr = null_var x in
let conjunct = (tm_exists_sl u0 (as_binder (mk_seq u0 init_t)) (mk_array_pts_to init_t arr (null_bvar 0))) in
let g' = push_binding g x ppname_default (mk_array init_t) in
let c_typing = Pulse.Checker.Pure.core_check_term g' conjunct T.E_Total tm_vprop in
let res = Pulse.Checker.Base.extend_post_hint g p x (mk_array init_t) _ c_typing in
res
let with_local_array_pre_typing (#g:env) (#pre:term)
(pre_typing:tot_typing g pre tm_vprop)
(init_t:term)
(init:term)
(len:term)
(init_typing:tot_typing g init init_t)
(len_typing:tot_typing g len tm_szt)
(x:var { ~ (Set.mem x (dom g)) })
: tot_typing (push_binding g x ppname_default (mk_array init_t))
(comp_withlocal_array_body_pre pre init_t (null_var x) init len)
tm_vprop
= admit() | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Checker.Pure.fsti.checked",
"Pulse.Checker.Base.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.WithLocalArray.fst"
} | [
{
"abbrev": true,
"full_module": "Pulse.Reflection.Util",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: Pulse.Syntax.Base.term -> FStar.Pervasives.Native.option Pulse.Syntax.Base.term | Prims.Tot | [
"total"
] | [] | [
"Pulse.Syntax.Base.term",
"Pulse.Syntax.Pure.is_pure_app",
"Pulse.Syntax.Pure.is_fvar",
"FStar.Stubs.Reflection.Types.name",
"Prims.list",
"Pulse.Syntax.Base.universe",
"Prims.op_Equality",
"Prims.string",
"Pulse.Reflection.Util.array_lid",
"FStar.Pervasives.Native.Some",
"Prims.bool",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.tuple3",
"Pulse.Syntax.Base.qualifier"
] | [] | false | false | false | true | false | let is_annotated_type_array (t: term) : option term =
| match is_pure_app t with
| Some (head, None, a) ->
(match is_fvar head with
| Some (l, _) -> if l = RU.array_lid then Some a else None
| _ -> None)
| _ -> None | false |
FStar.Mul.fst | FStar.Mul.op_Star | val op_Star : _: Prims.int -> _: Prims.int -> Prims.int | let op_Star = Prims.op_Multiply | {
"file_name": "ulib/FStar.Mul.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 38,
"end_line": 19,
"start_col": 7,
"start_line": 19
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Mul
//If we're not doing anything with tuples, | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Mul.fst"
} | [
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.int -> _: Prims.int -> Prims.int | Prims.Tot | [
"total"
] | [] | [
"Prims.op_Multiply"
] | [] | false | false | false | true | false | let op_Star =
| Prims.op_Multiply | false |
|
Hacl.Impl.Chacha20.Vec.fst | Hacl.Impl.Chacha20.Vec.chacha20_update | val chacha20_update:
#w:lanes
-> ctx:state w
-> len:size_t{v len / (w * 64) <= max_size_t}
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
eq_or_disjoint text out /\ disjoint text ctx /\ disjoint out ctx))
(ensures (fun h0 _ h1 -> modifies (loc ctx |+| loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_update (as_seq h0 ctx) (as_seq h0 text))) | val chacha20_update:
#w:lanes
-> ctx:state w
-> len:size_t{v len / (w * 64) <= max_size_t}
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
eq_or_disjoint text out /\ disjoint text ctx /\ disjoint out ctx))
(ensures (fun h0 _ h1 -> modifies (loc ctx |+| loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_update (as_seq h0 ctx) (as_seq h0 text))) | let chacha20_update #w ctx len out text =
assert_norm (range (v len / v (size w *! 64ul)) U32);
let blocks = len /. (size w *! 64ul) in
let rem = len %. (size w *! 64ul) in
let h0 = ST.get() in
map_blocks h0 len (size w *! 64ul) text out
(fun h -> Spec.chacha20_encrypt_block (as_seq h0 ctx))
(fun h -> Spec.chacha20_encrypt_last (as_seq h0 ctx))
(fun i -> chacha20_encrypt_block ctx (sub out (i *! (size w *! 64ul)) (size w *! 64ul)) i (sub text (i *! (size w *! 64ul)) (size w *! 64ul)))
(fun i -> chacha20_encrypt_last ctx rem (sub out (i *! (size w *! 64ul)) rem) i (sub text (i *! (size w *! 64ul)) rem)) | {
"file_name": "code/chacha20/Hacl.Impl.Chacha20.Vec.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 123,
"end_line": 196,
"start_col": 0,
"start_line": 187
} | module Hacl.Impl.Chacha20.Vec
module ST = FStar.HyperStack.ST
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.IntVector
open Hacl.Impl.Chacha20.Core32xN
module Spec = Hacl.Spec.Chacha20.Vec
module Chacha20Equiv = Hacl.Spec.Chacha20.Equiv
module Loop = Lib.LoopCombinators
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 200 --record_options"
//#set-options "--debug Hacl.Impl.Chacha20.Vec --debug_level ExtractNorm"
noextract
val rounds:
#w:lanes
-> st:state w ->
Stack unit
(requires (fun h -> live h st))
(ensures (fun h0 _ h1 -> modifies (loc st) h0 h1 /\
as_seq h1 st == Spec.rounds (as_seq h0 st)))
[@ Meta.Attribute.inline_ ]
let rounds #w st =
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st
noextract
val chacha20_core:
#w:lanes
-> k:state w
-> ctx0:state w
-> ctr:size_t{w * v ctr <= max_size_t} ->
Stack unit
(requires (fun h -> live h ctx0 /\ live h k /\ disjoint ctx0 k))
(ensures (fun h0 _ h1 -> modifies (loc k) h0 h1 /\
as_seq h1 k == Spec.chacha20_core (v ctr) (as_seq h0 ctx0)))
[@ Meta.Attribute.specialize ]
let chacha20_core #w k ctx ctr =
copy_state k ctx;
let ctr_u32 = u32 w *! size_to_uint32 ctr in
let cv = vec_load ctr_u32 w in
k.(12ul) <- k.(12ul) +| cv;
rounds k;
sum_state k ctx;
k.(12ul) <- k.(12ul) +| cv
val chacha20_constants:
b:glbuffer size_t 4ul{recallable b /\ witnessed b Spec.Chacha20.chacha20_constants}
let chacha20_constants =
[@ inline_let]
let l = [Spec.c0;Spec.c1;Spec.c2;Spec.c3] in
assert_norm(List.Tot.length l == 4);
createL_global l
inline_for_extraction noextract
val setup1:
ctx:lbuffer uint32 16ul
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (u32 0)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.setup1 (as_seq h0 k) (as_seq h0 n) (v ctr0)))
let setup1 ctx k n ctr =
let h0 = ST.get() in
recall_contents chacha20_constants Spec.chacha20_constants;
update_sub_f h0 ctx 0ul 4ul
(fun h -> Lib.Sequence.map secret Spec.chacha20_constants)
(fun _ -> mapT 4ul (sub ctx 0ul 4ul) secret chacha20_constants);
let h1 = ST.get() in
update_sub_f h1 ctx 4ul 8ul
(fun h -> Lib.ByteSequence.uints_from_bytes_le (as_seq h k))
(fun _ -> uints_from_bytes_le (sub ctx 4ul 8ul) k);
let h2 = ST.get() in
ctx.(12ul) <- size_to_uint32 ctr;
let h3 = ST.get() in
update_sub_f h3 ctx 13ul 3ul
(fun h -> Lib.ByteSequence.uints_from_bytes_le (as_seq h n))
(fun _ -> uints_from_bytes_le (sub ctx 13ul 3ul) n)
inline_for_extraction noextract
val chacha20_init:
#w:lanes
-> ctx:state w
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (vec_zero U32 w)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.chacha20_init (as_seq h0 k) (as_seq h0 n) (v ctr0)))
[@ Meta.Attribute.specialize ]
let chacha20_init #w ctx k n ctr =
push_frame();
let ctx1 = create 16ul (u32 0) in
setup1 ctx1 k n ctr;
let h0 = ST.get() in
mapT 16ul ctx (Spec.vec_load_i w) ctx1;
let ctr = vec_counter U32 w in
let c12 = ctx.(12ul) in
ctx.(12ul) <- c12 +| ctr;
pop_frame()
noextract
val chacha20_encrypt_block:
#w:lanes
-> ctx:state w
-> out:lbuffer uint8 (size w *! 64ul)
-> incr:size_t{w * v incr <= max_size_t}
-> text:lbuffer uint8 (size w *! 64ul) ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
disjoint out ctx /\ disjoint text ctx /\ eq_or_disjoint text out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_block (as_seq h0 ctx) (v incr) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_encrypt_block #w ctx out incr text =
push_frame();
let k = create 16ul (vec_zero U32 w) in
chacha20_core k ctx incr;
transpose k;
xor_block out k text;
pop_frame()
noextract
val chacha20_encrypt_last:
#w:lanes
-> ctx:state w
-> len:size_t{v len < w * 64}
-> out:lbuffer uint8 len
-> incr:size_t{w * v incr <= max_size_t}
-> text:lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
disjoint out ctx /\ disjoint text ctx))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_last (as_seq h0 ctx) (v incr) (v len) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_encrypt_last #w ctx len out incr text =
push_frame();
let plain = create (size w *! size 64) (u8 0) in
update_sub plain 0ul len text;
chacha20_encrypt_block ctx plain incr plain;
copy out (sub plain 0ul len);
pop_frame()
noextract
val chacha20_update:
#w:lanes
-> ctx:state w
-> len:size_t{v len / (w * 64) <= max_size_t}
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
eq_or_disjoint text out /\ disjoint text ctx /\ disjoint out ctx))
(ensures (fun h0 _ h1 -> modifies (loc ctx |+| loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_update (as_seq h0 ctx) (as_seq h0 text))) | {
"checked_file": "/",
"dependencies": [
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntVector.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"Hacl.Spec.Chacha20.Equiv.fst.checked",
"Hacl.Impl.Chacha20.Core32xN.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Chacha20.Vec.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loop"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Equiv",
"short_module": "Chacha20Equiv"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Vec",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20.Core32xN",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
ctx: Hacl.Impl.Chacha20.Core32xN.state w ->
len: Lib.IntTypes.size_t{Lib.IntTypes.v len / (w * 64) <= Lib.IntTypes.max_size_t} ->
out: Lib.Buffer.lbuffer Lib.IntTypes.uint8 len ->
text: Lib.Buffer.lbuffer Lib.IntTypes.uint8 len
-> FStar.HyperStack.ST.Stack Prims.unit | FStar.HyperStack.ST.Stack | [] | [] | [
"Hacl.Impl.Chacha20.Core32xN.lanes",
"Hacl.Impl.Chacha20.Core32xN.state",
"Lib.IntTypes.size_t",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Division",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"FStar.Mul.op_Star",
"Lib.IntTypes.max_size_t",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"Lib.Buffer.map_blocks",
"Lib.Buffer.MUT",
"Lib.IntTypes.op_Star_Bang",
"Lib.IntTypes.size",
"FStar.UInt32.__uint_to_t",
"FStar.Monotonic.HyperStack.mem",
"Hacl.Spec.Chacha20.Vec.chacha20_encrypt_block",
"Lib.Buffer.as_seq",
"Hacl.Impl.Chacha20.Core32xN.uint32xN",
"Prims.nat",
"Prims.op_LessThan",
"Lib.Sequence.lseq",
"Hacl.Spec.Chacha20.Vec.chacha20_encrypt_last",
"Prims.eq2",
"Prims.int",
"Lib.IntTypes.size_nat",
"Hacl.Impl.Chacha20.Vec.chacha20_encrypt_block",
"Prims.unit",
"Lib.Buffer.lbuffer_t",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.IntTypes.mul",
"Lib.IntTypes.mk_int",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.sub",
"Hacl.Impl.Chacha20.Vec.chacha20_encrypt_last",
"FStar.HyperStack.ST.get",
"Lib.IntTypes.op_Percent_Dot",
"Lib.IntTypes.op_Slash_Dot",
"FStar.Pervasives.assert_norm",
"Lib.IntTypes.range"
] | [] | false | true | false | false | false | let chacha20_update #w ctx len out text =
| assert_norm (range (v len / v (size w *! 64ul)) U32);
let blocks = len /. (size w *! 64ul) in
let rem = len %. (size w *! 64ul) in
let h0 = ST.get () in
map_blocks h0
len
(size w *! 64ul)
text
out
(fun h -> Spec.chacha20_encrypt_block (as_seq h0 ctx))
(fun h -> Spec.chacha20_encrypt_last (as_seq h0 ctx))
(fun i ->
chacha20_encrypt_block ctx
(sub out (i *! (size w *! 64ul)) (size w *! 64ul))
i
(sub text (i *! (size w *! 64ul)) (size w *! 64ul)))
(fun i ->
chacha20_encrypt_last ctx
rem
(sub out (i *! (size w *! 64ul)) rem)
i
(sub text (i *! (size w *! 64ul)) rem)) | false |
Vale.Wrapper.X64.Fadd.fsti | Vale.Wrapper.X64.Fadd.u1024 | val u1024 : Type0 | let u1024 = b:B.buffer UInt64.t{B.length b == 16} | {
"file_name": "vale/code/arch/x64/interop/Vale.Wrapper.X64.Fadd.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 49,
"end_line": 15,
"start_col": 0,
"start_line": 15
} | module Vale.Wrapper.X64.Fadd
open Vale.X64.CPU_Features_s
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open Vale.Curve25519.Fast_defs
open FStar.Mul
unfold
let u256 = b:B.buffer UInt64.t{B.length b == 4}
unfold
let u512 = b:B.buffer UInt64.t{B.length b == 8} | {
"checked_file": "/",
"dependencies": [
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Curve25519.Fast_defs.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Wrapper.X64.Fadd.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Curve25519.Fast_defs",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Wrapper.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Wrapper.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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"LowStar.Buffer.buffer",
"FStar.UInt64.t",
"Prims.eq2",
"Prims.int",
"LowStar.Monotonic.Buffer.length",
"LowStar.Buffer.trivial_preorder"
] | [] | false | false | false | true | true | let u1024 =
| b: B.buffer UInt64.t {B.length b == 16} | false |
|
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_code_KeyExpansionRoundOdd256 | val va_code_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_code | val va_code_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_code | let va_code_KeyExpansionRoundOdd256 round =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 20,
"end_line": 243,
"start_col": 0,
"start_line": 230
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round
rcon) va_s0 round rcon dst key 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 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1
va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32)) :
(va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(va_QProc (va_code_KeyExpansionRoundEven256 round rcon) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem])
(va_wp_KeyExpansionRoundEven256 round rcon dst key) (va_wpProof_KeyExpansionRoundEven256 round
rcon dst key))
//--
//-- KeyExpansionRoundOdd256
val va_code_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_code | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | round: Vale.PPC64LE.Memory.nat8 -> Vale.PPC64LE.Decls.va_code | Prims.Tot | [
"total"
] | [] | [
"Vale.PPC64LE.Memory.nat8",
"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.InsVector.va_code_Vsbox",
"Vale.PPC64LE.InsVector.va_code_Vspltw",
"Vale.PPC64LE.InsVector.va_code_Vsldoi",
"Vale.PPC64LE.InsVector.va_code_Vxor",
"Vale.PPC64LE.InsBasic.va_code_LoadImm64",
"Vale.PPC64LE.Decls.va_op_reg_opr_reg",
"Prims.op_Multiply",
"Prims.op_Addition",
"Vale.PPC64LE.InsVector.va_code_Store128_byte16_buffer_index",
"Vale.PPC64LE.Decls.va_op_heaplet_mem_heaplet",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.PPC64LE.Decls.va_CNil",
"Vale.PPC64LE.Decls.va_code"
] | [] | false | false | false | true | false | let va_code_KeyExpansionRoundOdd256 round =
| (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0)
(va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1))
(va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3)
(va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3)
12)
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4))
(va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3)
12)
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4))
(va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3)
12)
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4))
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2))
(va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10)
(16 `op_Multiply` (round + 1)))
(va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet
1)
(va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3)
(va_op_reg_opr_reg 10)
Secret)
(va_CNil ())))))))))))))) | false |
Vale.Wrapper.X64.Fadd.fsti | Vale.Wrapper.X64.Fadd.u256 | val u256 : Type0 | let u256 = b:B.buffer UInt64.t{B.length b == 4} | {
"file_name": "vale/code/arch/x64/interop/Vale.Wrapper.X64.Fadd.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 47,
"end_line": 11,
"start_col": 0,
"start_line": 11
} | module Vale.Wrapper.X64.Fadd
open Vale.X64.CPU_Features_s
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open Vale.Curve25519.Fast_defs
open FStar.Mul | {
"checked_file": "/",
"dependencies": [
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Curve25519.Fast_defs.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Wrapper.X64.Fadd.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Curve25519.Fast_defs",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Wrapper.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Wrapper.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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"LowStar.Buffer.buffer",
"FStar.UInt64.t",
"Prims.eq2",
"Prims.int",
"LowStar.Monotonic.Buffer.length",
"LowStar.Buffer.trivial_preorder"
] | [] | false | false | false | true | true | let u256 =
| b: B.buffer UInt64.t {B.length b == 4} | false |
|
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_code_KeyExpansionRoundEven256 | val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code | val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code | let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
()))))))))))))))))))) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 25,
"end_line": 39,
"start_col": 0,
"start_line": 22
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | round: Vale.PPC64LE.Memory.nat8 -> rcon: Vale.PPC64LE.Memory.nat8 -> Vale.PPC64LE.Decls.va_code | Prims.Tot | [
"total"
] | [] | [
"Vale.PPC64LE.Memory.nat8",
"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.InsVector.va_code_Vsbox",
"Vale.PPC64LE.InsBasic.va_code_LoadImmShl64",
"Vale.PPC64LE.Decls.va_op_reg_opr_reg",
"Vale.PPC64LE.InsVector.va_code_Mtvsrws",
"Vale.PPC64LE.InsVector.va_code_Vxor",
"Vale.PPC64LE.InsVector.va_code_RotWord",
"Vale.PPC64LE.InsVector.va_code_Vspltw",
"Vale.PPC64LE.InsVector.va_code_Vsldoi",
"Vale.PPC64LE.InsBasic.va_code_LoadImm64",
"Prims.op_Multiply",
"Prims.op_Addition",
"Vale.PPC64LE.InsVector.va_code_Store128_byte16_buffer_index",
"Vale.PPC64LE.Decls.va_op_heaplet_mem_heaplet",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.PPC64LE.Decls.va_CNil",
"Vale.PPC64LE.Decls.va_code"
] | [] | false | false | false | true | false | let va_code_KeyExpansionRoundEven256 round rcon =
| (va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0)
(va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 4) 8)
(va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon)
(va_CCons (va_code_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10))
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 5))
(va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 4))
(va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)
3)
(va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1)
12)
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4))
(va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1)
12)
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4))
(va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1)
12)
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 1
)
(va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4))
(va_CCons (va_code_Vxor (va_op_vec_opr_vec
1)
(va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2))
(va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg
10)
(16
`op_Multiply`
(round + 1)))
(va_CCons (va_code_Store128_byte16_buffer_index
(va_op_heaplet_mem_heaplet
1)
(va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3)
(va_op_reg_opr_reg 10)
Secret)
(va_CNil ())))))))))))))))))
)) | false |
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_codegen_success_KeyExpansionRoundEven256 | val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool | val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool | let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
())))))))))))))))))) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 24,
"end_line": 64,
"start_col": 0,
"start_line": 43
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | round: Vale.PPC64LE.Memory.nat8 -> rcon: Vale.PPC64LE.Memory.nat8 -> Vale.PPC64LE.Decls.va_pbool | Prims.Tot | [
"total"
] | [] | [
"Vale.PPC64LE.Memory.nat8",
"Vale.PPC64LE.Decls.va_pbool_and",
"Vale.PPC64LE.InsVector.va_codegen_success_Vspltisw",
"Vale.PPC64LE.Decls.va_op_vec_opr_vec",
"Vale.PPC64LE.InsVector.va_codegen_success_Vsbox",
"Vale.PPC64LE.InsBasic.va_codegen_success_LoadImmShl64",
"Vale.PPC64LE.Decls.va_op_reg_opr_reg",
"Vale.PPC64LE.InsVector.va_codegen_success_Mtvsrws",
"Vale.PPC64LE.InsVector.va_codegen_success_Vxor",
"Vale.PPC64LE.InsVector.va_codegen_success_RotWord",
"Vale.PPC64LE.InsVector.va_codegen_success_Vspltw",
"Vale.PPC64LE.InsVector.va_codegen_success_Vsldoi",
"Vale.PPC64LE.InsBasic.va_codegen_success_LoadImm64",
"Prims.op_Multiply",
"Prims.op_Addition",
"Vale.PPC64LE.InsVector.va_codegen_success_Store128_byte16_buffer_index",
"Vale.PPC64LE.Decls.va_op_heaplet_mem_heaplet",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.PPC64LE.Decls.va_ttrue",
"Vale.PPC64LE.Decls.va_pbool"
] | [] | false | false | false | true | false | let va_codegen_success_KeyExpansionRoundEven256 round rcon =
| (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0)
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8)
(va_pbool_and (va_codegen_success_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_pbool_and (va_codegen_success_LoadImmShl64 (va_op_reg_opr_reg 10) rcon)
(va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 5))
(va_pbool_and (va_codegen_success_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 4))
(va_pbool_and (va_codegen_success_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)
3)
(va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1)
12)
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4))
(va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4
)
(va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1)
12)
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec
1)
(va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4))
(va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec
4)
(va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1)
12)
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec
1)
(va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec
1)
(va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2))
(va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10)
(16 `op_Multiply` (round + 1)))
(va_pbool_and (va_codegen_success_Store128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 1
)
(va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3)
(va_op_reg_opr_reg 10)
Secret)
(va_ttrue ())))))))))))))))))) | false |
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_codegen_success_KeyExpansionRoundOdd256 | val va_codegen_success_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_pbool | val va_codegen_success_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_pbool | let va_codegen_success_KeyExpansionRoundOdd256 round =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 263,
"start_col": 0,
"start_line": 247
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round
rcon) va_s0 round rcon dst key 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 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1
va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32)) :
(va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(va_QProc (va_code_KeyExpansionRoundEven256 round rcon) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem])
(va_wp_KeyExpansionRoundEven256 round rcon dst key) (va_wpProof_KeyExpansionRoundEven256 round
rcon dst key))
//--
//-- KeyExpansionRoundOdd256
val va_code_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundOdd256 round =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
()))))))))))))))
val va_codegen_success_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_pbool | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | round: Vale.PPC64LE.Memory.nat8 -> Vale.PPC64LE.Decls.va_pbool | Prims.Tot | [
"total"
] | [] | [
"Vale.PPC64LE.Memory.nat8",
"Vale.PPC64LE.Decls.va_pbool_and",
"Vale.PPC64LE.InsVector.va_codegen_success_Vspltisw",
"Vale.PPC64LE.Decls.va_op_vec_opr_vec",
"Vale.PPC64LE.InsVector.va_codegen_success_Vsbox",
"Vale.PPC64LE.InsVector.va_codegen_success_Vspltw",
"Vale.PPC64LE.InsVector.va_codegen_success_Vsldoi",
"Vale.PPC64LE.InsVector.va_codegen_success_Vxor",
"Vale.PPC64LE.InsBasic.va_codegen_success_LoadImm64",
"Vale.PPC64LE.Decls.va_op_reg_opr_reg",
"Prims.op_Multiply",
"Prims.op_Addition",
"Vale.PPC64LE.InsVector.va_codegen_success_Store128_byte16_buffer_index",
"Vale.PPC64LE.Decls.va_op_heaplet_mem_heaplet",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.PPC64LE.Decls.va_ttrue",
"Vale.PPC64LE.Decls.va_pbool"
] | [] | false | false | false | true | false | let va_codegen_success_KeyExpansionRoundOdd256 round =
| (va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0)
(va_pbool_and (va_codegen_success_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1))
(va_pbool_and (va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3)
(va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3)
12)
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4))
(va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3)
12)
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4))
(va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3)
12)
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2))
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg
10)
(16 `op_Multiply` (round + 1)))
(va_pbool_and (va_codegen_success_Store128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3)
(va_op_reg_opr_reg 10)
Secret)
(va_ttrue ()))))))))))))) | false |
Vale.Wrapper.X64.Fadd.fsti | Vale.Wrapper.X64.Fadd.u512 | val u512 : Type0 | let u512 = b:B.buffer UInt64.t{B.length b == 8} | {
"file_name": "vale/code/arch/x64/interop/Vale.Wrapper.X64.Fadd.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 47,
"end_line": 13,
"start_col": 0,
"start_line": 13
} | module Vale.Wrapper.X64.Fadd
open Vale.X64.CPU_Features_s
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open Vale.Curve25519.Fast_defs
open FStar.Mul
unfold
let u256 = b:B.buffer UInt64.t{B.length b == 4} | {
"checked_file": "/",
"dependencies": [
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Curve25519.Fast_defs.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Wrapper.X64.Fadd.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Curve25519.Fast_defs",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Wrapper.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Wrapper.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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"LowStar.Buffer.buffer",
"FStar.UInt64.t",
"Prims.eq2",
"Prims.int",
"LowStar.Monotonic.Buffer.length",
"LowStar.Buffer.trivial_preorder"
] | [] | false | false | false | true | true | let u512 =
| b: B.buffer UInt64.t {B.length b == 8} | false |
|
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_wp_KeyExpansionRoundUnrolledRecursive256 | val va_wp_KeyExpansionRoundUnrolledRecursive256
(key: (seq nat32))
(dst: buffer128)
(n: int)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_KeyExpansionRoundUnrolledRecursive256
(key: (seq nat32))
(dst: buffer128)
(n: int)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)
/\ (forall (va_x_mem:vale_heap) (va_x_heap1:vale_heap) (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) . 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_upd_mem_heaplet 1
va_x_heap1 (va_upd_mem va_x_mem va_s0)))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == va_if (n `op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM)
(fun _ -> va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == va_if ((n - 1)
`op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM) (fun _ -> va_get_vec 3 va_sM) /\ (forall j .
{:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j
<= n ==> Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j
(va_get_mem_heaplet 1 va_sM)) == Vale.AES.AES256_helpers_BE.expand_key_256 key j) ==> va_k
va_sM (()))) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 16,
"end_line": 551,
"start_col": 0,
"start_line": 524
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round
rcon) va_s0 round rcon dst key 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 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1
va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32)) :
(va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(va_QProc (va_code_KeyExpansionRoundEven256 round rcon) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem])
(va_wp_KeyExpansionRoundEven256 round rcon dst key) (va_wpProof_KeyExpansionRoundEven256 round
rcon dst key))
//--
//-- KeyExpansionRoundOdd256
val va_code_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundOdd256 round =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
()))))))))))))))
val va_codegen_success_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundOdd256 round =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundOdd256 (va_mods:va_mods_t) (round:nat8) (dst:buffer128) (key:(seq
nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) =
(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 114 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 115 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 116 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 117 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 118 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 120 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 121 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 123 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 124 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 125 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 127 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg23:Prims.int) = round + 1
in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg21:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg21 va_arg22 0 va_arg23)
(let (va_arg20:Prims.int) = round + 1 in let (va_arg19:Vale.Def.Types_s.quad32) = va_get_vec 1
va_old_s in let (va_arg18:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 129 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_round_key_256_rcon_odd va_arg18 va_arg19 0
va_arg20) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 130 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(())))))))))))))))))))
val va_lemma_KeyExpansionRoundOdd256 : va_b0:va_code -> va_s0:va_state -> round:nat8 ->
dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundOdd256 round) va_s0 /\ va_get_ok
va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0)
dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10
va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundOdd256 va_b0 va_s0 round dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundOdd256 va_mods round dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundOdd256 round) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 92 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 102 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 110 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 111 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 112 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32)
(va_x_v4:quad32) . let va_sM = va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem
va_x_mem va_s0)))))) in va_get_ok va_sM /\ Vale.PPC64LE.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15 (va_get_mem_layout va_sM) Secret /\
va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec 3 va_sM ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundOdd256 : round:nat8 -> dst:buffer128 -> key:(seq nat32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundOdd256 round dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundOdd256 round)
([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1;
va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundOdd256 round dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundOdd256 (va_code_KeyExpansionRoundOdd256 round)
va_s0 round dst key in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) : (va_quickCode
unit (va_code_KeyExpansionRoundOdd256 round)) =
(va_QProc (va_code_KeyExpansionRoundOdd256 round) ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_KeyExpansionRoundOdd256
round dst key) (va_wpProof_KeyExpansionRoundOdd256 round dst key))
//--
//-- KeyExpansionRoundUnrolledRecursive256
val va_code_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_code(decreases %[n])
[@ "opaque_to_smt"]
let rec va_code_KeyExpansionRoundUnrolledRecursive256 n =
(va_Block (va_CCons (if (1 < n && n <= 14) then va_Block (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_CCons (if (n `op_Modulus` 2 = 0)
then va_Block (va_CCons (va_code_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_CNil ())) else va_Block (va_CCons
(va_code_KeyExpansionRoundOdd256 (n - 1)) (va_CNil ()))) (va_CNil ()))) else va_Block (va_CNil
())) (va_CNil ())))
val va_codegen_success_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_pbool(decreases %[n])
[@ "opaque_to_smt"]
let rec va_codegen_success_KeyExpansionRoundUnrolledRecursive256 n =
(va_pbool_and (if (1 < n && n <= 14) then va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_pbool_and (if (n
`op_Modulus` 2 = 0) then va_pbool_and (va_codegen_success_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_ttrue ()) else va_pbool_and
(va_codegen_success_KeyExpansionRoundOdd256 (n - 1)) (va_ttrue ())) (va_ttrue ())) else
va_ttrue ()) (va_ttrue ()))
val va_lemma_KeyExpansionRoundUnrolledRecursive256 : va_b0:va_code -> va_s0:va_state -> key:(seq
nat32) -> dst:buffer128 -> n:int
-> Ghost (va_state & va_fuel)(decreases %[n])
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == (if (n `op_Modulus` 2 = 0) then va_get_vec 1 va_sM else
va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == (if ((n - 1) `op_Modulus` 2 = 0) then va_get_vec 1
va_sM else va_get_vec 3 va_sM) /\ (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read
dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j <= n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.AES256_helpers_BE.expand_key_256 key j) /\ 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_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let rec va_lemma_KeyExpansionRoundUnrolledRecursive256 va_b0 va_s0 key dst n =
va_reveal_opaque (`%va_code_KeyExpansionRoundUnrolledRecursive256)
(va_code_KeyExpansionRoundUnrolledRecursive256 n);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let va_b2 = va_tl va_b1 in
let va_c2 = va_hd va_b1 in
let (va_fc2, va_s2) =
(
if (1 < n && n <= 14) then
(
let va_b3 = va_get_block va_c2 in
let (va_s4, va_fc4) = va_lemma_KeyExpansionRoundUnrolledRecursive256 (va_hd va_b3) va_s0 key
dst (n - 1) in
let va_b4 = va_tl va_b3 in
let (old_mem:vale_heap) = va_get_mem_heaplet 1 va_s4 in
let va_b6 = va_tl va_b4 in
let va_c6 = va_hd va_b4 in
let (va_fc6, va_s6) =
(
if (n `op_Modulus` 2 = 0) then
(
let va_b7 = va_get_block va_c6 in
let (va_s8, va_fc8) = va_lemma_KeyExpansionRoundEven256 (va_hd va_b7) va_s4 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1)) dst key in
let va_b8 = va_tl va_b7 in
let (va_s6, va_f8) = va_lemma_empty_total va_s8 va_b8 in
let va_fc6 = va_lemma_merge_total va_b7 va_s4 va_fc8 va_s8 va_f8 va_s6 in
(va_fc6, va_s6)
)
else
(
let va_b9 = va_get_block va_c6 in
let (va_s10, va_fc10) = va_lemma_KeyExpansionRoundOdd256 (va_hd va_b9) va_s4 (n - 1) dst
key in
let va_b10 = va_tl va_b9 in
let (va_s6, va_f10) = va_lemma_empty_total va_s10 va_b10 in
let va_fc6 = va_lemma_merge_total va_b9 va_s4 va_fc10 va_s10 va_f10 va_s6 in
(va_fc6, va_s6)
)
) in
assert (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1
va_s6)))}0 <= j /\ j < n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_s6)) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j old_mem));
let (va_s2, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f4 = va_lemma_merge_total va_b4 va_s4 va_fc6 va_s6 va_f6 va_s2 in
let va_fc2 = va_lemma_merge_total va_b3 va_s0 va_fc4 va_s4 va_f4 va_s2 in
(va_fc2, va_s2)
)
else
(
let va_b12 = va_get_block va_c2 in
let (va_s2, va_fc2) = va_lemma_empty_total va_s0 va_b12 in
(va_fc2, va_s2)
)
) in
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) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
key: FStar.Seq.Base.seq Vale.PPC64LE.Memory.nat32 ->
dst: Vale.PPC64LE.Memory.buffer128 ->
n: Prims.int ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"FStar.Seq.Base.seq",
"Vale.PPC64LE.Memory.nat32",
"Vale.PPC64LE.Memory.buffer128",
"Prims.int",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Vale.PPC64LE.Decls.validDstAddrs128",
"Vale.PPC64LE.Decls.va_get_mem_heaplet",
"Vale.PPC64LE.Decls.va_get_reg",
"Vale.PPC64LE.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Secret",
"Prims.op_LessThan",
"Prims.op_LessThanOrEqual",
"Vale.AES.AES_BE_s.is_aes_key_word",
"Vale.AES.AES_common_s.AES_256",
"Prims.eq2",
"Vale.Def.Types_s.quad32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.AES.AES256_helpers_BE.expand_key_256",
"Vale.Def.Types_s.reverse_bytes_quad32",
"Vale.PPC64LE.Decls.buffer128_read",
"Vale.PPC64LE.Memory.buffer_addr",
"Vale.PPC64LE.Memory.vuint128",
"Prims.l_Forall",
"Vale.PPC64LE.InsBasic.vale_heap",
"Vale.PPC64LE.Memory.nat64",
"Vale.PPC64LE.Memory.quad32",
"Prims.l_imp",
"Vale.PPC64LE.Decls.modifies_buffer128",
"Vale.PPC64LE.Decls.va_if",
"Vale.PPC64LE.Machine_s.quad32",
"Prims.op_Equality",
"Prims.op_Modulus",
"Prims.l_not",
"Prims.op_Subtraction",
"Prims.op_GreaterThanOrEqual",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.Decls.va_upd_vec",
"Vale.PPC64LE.Decls.va_upd_reg",
"Vale.PPC64LE.Decls.va_upd_mem_heaplet",
"Vale.PPC64LE.Decls.va_upd_mem"
] | [] | false | false | false | true | true | let va_wp_KeyExpansionRoundUnrolledRecursive256
(key: (seq nat32))
(dst: buffer128)
(n: int)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_get_ok va_s0 /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0)
(va_get_reg 3 va_s0)
dst
15
(va_get_mem_layout va_s0)
Secret /\ (0 < n /\ n <= 14) /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\
va_get_vec 1 va_s0 == Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\
va_get_vec 3 va_s0 == Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\
va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst
0
(va_get_mem_heaplet 1 va_s0)) /\
va_get_vec 3 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst
1
(va_get_mem_heaplet 1 va_s0)) /\
va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0) /\
(forall (va_x_mem: vale_heap)
(va_x_heap1: vale_heap)
(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).
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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0)))))))
)
in
va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM)
(va_get_reg 3 va_sM)
dst
15
(va_get_mem_layout va_sM)
Secret /\
Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst
n
(va_get_mem_heaplet 1 va_sM)) ==
va_if (n `op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM) (fun _ -> va_get_vec 3 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst
(n - 1)
(va_get_mem_heaplet 1 va_sM)) ==
va_if ((n - 1) `op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM) (fun _ -> va_get_vec 3 va_sM) /\
(forall j.
{:pattern (reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1 va_sM)))}
0 <= j /\ j <= n ==>
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst
j
(va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.AES256_helpers_BE.expand_key_256 key j) ==>
va_k va_sM (()))) | false |
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_wpProof_KeyExpansionRoundOdd256 | val va_wpProof_KeyExpansionRoundOdd256 : round:nat8 -> dst:buffer128 -> key:(seq nat32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundOdd256 round dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundOdd256 round)
([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1;
va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) | val va_wpProof_KeyExpansionRoundOdd256 : round:nat8 -> dst:buffer128 -> key:(seq nat32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundOdd256 round dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundOdd256 round)
([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1;
va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) | let va_wpProof_KeyExpansionRoundOdd256 round dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundOdd256 (va_code_KeyExpansionRoundOdd256 round)
va_s0 round dst key in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 22,
"end_line": 401,
"start_col": 0,
"start_line": 391
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round
rcon) va_s0 round rcon dst key 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 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1
va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32)) :
(va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(va_QProc (va_code_KeyExpansionRoundEven256 round rcon) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem])
(va_wp_KeyExpansionRoundEven256 round rcon dst key) (va_wpProof_KeyExpansionRoundEven256 round
rcon dst key))
//--
//-- KeyExpansionRoundOdd256
val va_code_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundOdd256 round =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
()))))))))))))))
val va_codegen_success_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundOdd256 round =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundOdd256 (va_mods:va_mods_t) (round:nat8) (dst:buffer128) (key:(seq
nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) =
(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 114 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 115 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 116 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 117 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 118 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 120 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 121 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 123 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 124 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 125 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 127 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg23:Prims.int) = round + 1
in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg21:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg21 va_arg22 0 va_arg23)
(let (va_arg20:Prims.int) = round + 1 in let (va_arg19:Vale.Def.Types_s.quad32) = va_get_vec 1
va_old_s in let (va_arg18:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 129 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_round_key_256_rcon_odd va_arg18 va_arg19 0
va_arg20) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 130 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(())))))))))))))))))))
val va_lemma_KeyExpansionRoundOdd256 : va_b0:va_code -> va_s0:va_state -> round:nat8 ->
dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundOdd256 round) va_s0 /\ va_get_ok
va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0)
dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10
va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundOdd256 va_b0 va_s0 round dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundOdd256 va_mods round dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundOdd256 round) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 92 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 102 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 110 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 111 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 112 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32)
(va_x_v4:quad32) . let va_sM = va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem
va_x_mem va_s0)))))) in va_get_ok va_sM /\ Vale.PPC64LE.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15 (va_get_mem_layout va_sM) Secret /\
va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec 3 va_sM ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundOdd256 : round:nat8 -> dst:buffer128 -> key:(seq nat32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundOdd256 round dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundOdd256 round)
([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1;
va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
round: Vale.PPC64LE.Memory.nat8 ->
dst: Vale.PPC64LE.Memory.buffer128 ->
key: FStar.Seq.Base.seq Vale.PPC64LE.Memory.nat32 ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Prims.Ghost ((Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) * Prims.unit) | Prims.Ghost | [] | [] | [
"Vale.PPC64LE.Memory.nat8",
"Vale.PPC64LE.Memory.buffer128",
"FStar.Seq.Base.seq",
"Vale.PPC64LE.Memory.nat32",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Vale.PPC64LE.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple3",
"Vale.PPC64LE.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Vale.PPC64LE.QuickCode.va_Mod_mem_heaplet",
"Vale.PPC64LE.QuickCode.va_Mod_mem",
"Prims.Nil",
"Prims._assert",
"Vale.PPC64LE.Decls.va_state_eq",
"Vale.PPC64LE.Decls.va_update_vec",
"Vale.PPC64LE.Decls.va_update_reg",
"Vale.PPC64LE.Decls.va_update_mem_heaplet",
"Vale.PPC64LE.Decls.va_update_ok",
"Vale.PPC64LE.Decls.va_update_mem",
"Vale.PPC64LE.Decls.va_lemma_upd_update",
"FStar.Pervasives.Native.tuple3",
"FStar.Pervasives.Native.tuple2",
"Vale.PPC64LE.Machine_s.state",
"Vale.AES.PPC64LE.AES256.va_lemma_KeyExpansionRoundOdd256",
"Vale.AES.PPC64LE.AES256.va_code_KeyExpansionRoundOdd256"
] | [] | false | false | false | false | false | let va_wpProof_KeyExpansionRoundOdd256 round dst key va_s0 va_k =
| let va_sM, va_f0 =
va_lemma_KeyExpansionRoundOdd256 (va_code_KeyExpansionRoundOdd256 round) va_s0 round dst key
in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM
(va_update_vec 4
va_sM
(va_update_vec 3
va_sM
(va_update_vec 2
va_sM
(va_update_vec 0
va_sM
(va_update_reg 10
va_sM
(va_update_mem_heaplet 1
va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))));
va_lemma_norm_mods ([
va_Mod_vec 4;
va_Mod_vec 3;
va_Mod_vec 2;
va_Mod_vec 0;
va_Mod_reg 10;
va_Mod_mem_heaplet 1;
va_Mod_mem
])
va_sM
va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | false |
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_quick_KeyExpansionRoundEven256 | val va_quick_KeyExpansionRoundEven256 (round rcon: nat8) (dst: buffer128) (key: (seq nat32))
: (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) | val va_quick_KeyExpansionRoundEven256 (round rcon: nat8) (dst: buffer128) (key: (seq nat32))
: (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) | let va_quick_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32)) :
(va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(va_QProc (va_code_KeyExpansionRoundEven256 round rcon) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem])
(va_wp_KeyExpansionRoundEven256 round rcon dst key) (va_wpProof_KeyExpansionRoundEven256 round
rcon dst key)) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 18,
"end_line": 224,
"start_col": 0,
"start_line": 219
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round
rcon) va_s0 round rcon dst key 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 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1
va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
round: Vale.PPC64LE.Memory.nat8 ->
rcon: Vale.PPC64LE.Memory.nat8 ->
dst: Vale.PPC64LE.Memory.buffer128 ->
key: FStar.Seq.Base.seq Vale.PPC64LE.Memory.nat32
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.AES.PPC64LE.AES256.va_code_KeyExpansionRoundEven256 round rcon) | Prims.Tot | [
"total"
] | [] | [
"Vale.PPC64LE.Memory.nat8",
"Vale.PPC64LE.Memory.buffer128",
"FStar.Seq.Base.seq",
"Vale.PPC64LE.Memory.nat32",
"Vale.PPC64LE.QuickCode.va_QProc",
"Prims.unit",
"Vale.AES.PPC64LE.AES256.va_code_KeyExpansionRoundEven256",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Vale.PPC64LE.QuickCode.va_Mod_mem_heaplet",
"Vale.PPC64LE.QuickCode.va_Mod_mem",
"Prims.Nil",
"Vale.AES.PPC64LE.AES256.va_wp_KeyExpansionRoundEven256",
"Vale.AES.PPC64LE.AES256.va_wpProof_KeyExpansionRoundEven256",
"Vale.PPC64LE.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_KeyExpansionRoundEven256 (round rcon: nat8) (dst: buffer128) (key: (seq nat32))
: (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
| (va_QProc (va_code_KeyExpansionRoundEven256 round rcon)
([
va_Mod_vec 5;
va_Mod_vec 4;
va_Mod_vec 2;
va_Mod_vec 1;
va_Mod_vec 0;
va_Mod_reg 10;
va_Mod_mem_heaplet 1;
va_Mod_mem
])
(va_wp_KeyExpansionRoundEven256 round rcon dst key)
(va_wpProof_KeyExpansionRoundEven256 round rcon dst key)) | false |
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_wp_KeyExpansionRoundEven256 | val va_wp_KeyExpansionRoundEven256
(round rcon: nat8)
(dst: buffer128)
(key: (seq nat32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_KeyExpansionRoundEven256
(round rcon: nat8)
(dst: buffer128)
(key: (seq nat32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 78,
"end_line": 195,
"start_col": 0,
"start_line": 178
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
round: Vale.PPC64LE.Memory.nat8 ->
rcon: Vale.PPC64LE.Memory.nat8 ->
dst: Vale.PPC64LE.Memory.buffer128 ->
key: FStar.Seq.Base.seq Vale.PPC64LE.Memory.nat32 ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.PPC64LE.Memory.nat8",
"Vale.PPC64LE.Memory.buffer128",
"FStar.Seq.Base.seq",
"Vale.PPC64LE.Memory.nat32",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Vale.PPC64LE.Decls.validDstAddrs128",
"Vale.PPC64LE.Decls.va_get_mem_heaplet",
"Vale.PPC64LE.Decls.va_get_reg",
"Vale.PPC64LE.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Secret",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"Prims.eq2",
"Prims.int",
"Prims.op_Modulus",
"Prims.op_Addition",
"Prims.nat",
"Prims.l_or",
"Vale.Def.Words_s.pow2_8",
"Vale.Def.Words_s.pow2_32",
"Vale.AES.AES_common_s.aes_rcon",
"Prims.op_Subtraction",
"Prims.op_Division",
"Vale.AES.AES_BE_s.is_aes_key_word",
"Vale.AES.AES_common_s.AES_256",
"Vale.Def.Types_s.quad32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.AES.AES256_helpers_BE.expand_key_256",
"Prims.l_Forall",
"Vale.PPC64LE.InsBasic.vale_heap",
"Vale.PPC64LE.Memory.nat64",
"Vale.PPC64LE.Memory.quad32",
"Prims.l_imp",
"Vale.Def.Types_s.reverse_bytes_quad32",
"Vale.PPC64LE.Decls.buffer128_read",
"Vale.PPC64LE.Decls.modifies_buffer_specific128",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.Decls.va_upd_vec",
"Vale.PPC64LE.Decls.va_upd_reg",
"Vale.PPC64LE.Decls.va_upd_mem_heaplet",
"Vale.PPC64LE.Decls.va_upd_mem"
] | [] | false | false | false | true | true | let va_wp_KeyExpansionRoundEven256
(round rcon: nat8)
(dst: buffer128)
(key: (seq nat32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_get_ok va_s0 /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0)
(va_get_reg 3 va_s0)
dst
15
(va_get_mem_layout va_s0)
Secret /\ (1 <= round /\ round < 14) /\ (round + 1) `op_Modulus` 2 == 0 /\
rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\
va_get_vec 1 va_s0 == Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\
va_get_vec 3 va_s0 == Vale.AES.AES256_helpers_BE.expand_key_256 key round /\
(forall (va_x_mem: vale_heap)
(va_x_heap1: vale_heap)
(va_x_r10: nat64)
(va_x_v0: quad32)
(va_x_v1: quad32)
(va_x_v2: quad32)
(va_x_v4: quad32)
(va_x_v5: quad32).
let va_sM =
va_upd_vec 5
va_x_v5
(va_upd_vec 4
va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0)))))))
in
va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM)
(va_get_reg 3 va_sM)
dst
15
(va_get_mem_layout va_sM)
Secret /\
va_get_vec 1 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst
(round + 1)
(va_get_mem_heaplet 1 va_sM)) /\
va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst
(va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM)
(round + 1)
(round + 1) ==>
va_k va_sM (()))) | false |
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_code_AES256EncryptBlock_6way | val va_code_AES256EncryptBlock_6way : va_dummy:unit -> Tot va_code | val va_code_AES256EncryptBlock_6way : va_dummy:unit -> Tot va_code | let va_code_AES256EncryptBlock_6way () =
(va_Block (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block
(va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_Block (va_CNil ())) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 0) (va_CCons
(va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 6)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons (va_code_Vxor (va_op_vec_opr_vec
0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 5)
(va_op_vec_opr_vec 5) (va_op_vec_opr_vec 6)) (va_CCons (va_code_AES256EncryptRound_6way 1)
(va_CCons (va_code_AES256EncryptRound_6way 2) (va_CCons (va_code_AES256EncryptRound_6way 3)
(va_CCons (va_code_AES256EncryptRound_6way 4) (va_CCons (va_code_AES256EncryptRound_6way 5)
(va_CCons (va_code_AES256EncryptRound_6way 6) (va_CCons (va_code_AES256EncryptRound_6way 7)
(va_CCons (va_code_AES256EncryptRound_6way 8) (va_CCons (va_code_AES256EncryptRound_6way 9)
(va_CCons (va_code_AES256EncryptRound_6way 10) (va_CCons (va_code_AES256EncryptRound_6way 11)
(va_CCons (va_code_AES256EncryptRound_6way 12) (va_CCons (va_code_AES256EncryptRound_6way 13)
(va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` 14)) (va_CCons
(va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 6)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons (va_code_Vcipherlast
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6)) (va_CCons
(va_code_Vcipherlast (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 6))
(va_CCons (va_code_Vcipherlast (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec
6)) (va_CCons (va_code_Vcipherlast (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 6)) (va_CCons (va_code_Vcipherlast (va_op_vec_opr_vec 4) (va_op_vec_opr_vec
4) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vcipherlast (va_op_vec_opr_vec 5)
(va_op_vec_opr_vec 5) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 6)
(va_op_vec_opr_vec 6) (va_op_vec_opr_vec 6)) (va_CNil ())))))))))))))))))))))))))))))))))))))) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 98,
"end_line": 1159,
"start_col": 0,
"start_line": 1131
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round
rcon) va_s0 round rcon dst key 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 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1
va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32)) :
(va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(va_QProc (va_code_KeyExpansionRoundEven256 round rcon) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem])
(va_wp_KeyExpansionRoundEven256 round rcon dst key) (va_wpProof_KeyExpansionRoundEven256 round
rcon dst key))
//--
//-- KeyExpansionRoundOdd256
val va_code_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundOdd256 round =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
()))))))))))))))
val va_codegen_success_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundOdd256 round =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundOdd256 (va_mods:va_mods_t) (round:nat8) (dst:buffer128) (key:(seq
nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) =
(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 114 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 115 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 116 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 117 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 118 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 120 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 121 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 123 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 124 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 125 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 127 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg23:Prims.int) = round + 1
in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg21:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg21 va_arg22 0 va_arg23)
(let (va_arg20:Prims.int) = round + 1 in let (va_arg19:Vale.Def.Types_s.quad32) = va_get_vec 1
va_old_s in let (va_arg18:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 129 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_round_key_256_rcon_odd va_arg18 va_arg19 0
va_arg20) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 130 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(())))))))))))))))))))
val va_lemma_KeyExpansionRoundOdd256 : va_b0:va_code -> va_s0:va_state -> round:nat8 ->
dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundOdd256 round) va_s0 /\ va_get_ok
va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0)
dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10
va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundOdd256 va_b0 va_s0 round dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundOdd256 va_mods round dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundOdd256 round) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 92 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 102 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 110 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 111 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 112 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32)
(va_x_v4:quad32) . let va_sM = va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem
va_x_mem va_s0)))))) in va_get_ok va_sM /\ Vale.PPC64LE.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15 (va_get_mem_layout va_sM) Secret /\
va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec 3 va_sM ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundOdd256 : round:nat8 -> dst:buffer128 -> key:(seq nat32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundOdd256 round dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundOdd256 round)
([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1;
va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundOdd256 round dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundOdd256 (va_code_KeyExpansionRoundOdd256 round)
va_s0 round dst key in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) : (va_quickCode
unit (va_code_KeyExpansionRoundOdd256 round)) =
(va_QProc (va_code_KeyExpansionRoundOdd256 round) ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_KeyExpansionRoundOdd256
round dst key) (va_wpProof_KeyExpansionRoundOdd256 round dst key))
//--
//-- KeyExpansionRoundUnrolledRecursive256
val va_code_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_code(decreases %[n])
[@ "opaque_to_smt"]
let rec va_code_KeyExpansionRoundUnrolledRecursive256 n =
(va_Block (va_CCons (if (1 < n && n <= 14) then va_Block (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_CCons (if (n `op_Modulus` 2 = 0)
then va_Block (va_CCons (va_code_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_CNil ())) else va_Block (va_CCons
(va_code_KeyExpansionRoundOdd256 (n - 1)) (va_CNil ()))) (va_CNil ()))) else va_Block (va_CNil
())) (va_CNil ())))
val va_codegen_success_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_pbool(decreases %[n])
[@ "opaque_to_smt"]
let rec va_codegen_success_KeyExpansionRoundUnrolledRecursive256 n =
(va_pbool_and (if (1 < n && n <= 14) then va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_pbool_and (if (n
`op_Modulus` 2 = 0) then va_pbool_and (va_codegen_success_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_ttrue ()) else va_pbool_and
(va_codegen_success_KeyExpansionRoundOdd256 (n - 1)) (va_ttrue ())) (va_ttrue ())) else
va_ttrue ()) (va_ttrue ()))
val va_lemma_KeyExpansionRoundUnrolledRecursive256 : va_b0:va_code -> va_s0:va_state -> key:(seq
nat32) -> dst:buffer128 -> n:int
-> Ghost (va_state & va_fuel)(decreases %[n])
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == (if (n `op_Modulus` 2 = 0) then va_get_vec 1 va_sM else
va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == (if ((n - 1) `op_Modulus` 2 = 0) then va_get_vec 1
va_sM else va_get_vec 3 va_sM) /\ (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read
dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j <= n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.AES256_helpers_BE.expand_key_256 key j) /\ 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_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let rec va_lemma_KeyExpansionRoundUnrolledRecursive256 va_b0 va_s0 key dst n =
va_reveal_opaque (`%va_code_KeyExpansionRoundUnrolledRecursive256)
(va_code_KeyExpansionRoundUnrolledRecursive256 n);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let va_b2 = va_tl va_b1 in
let va_c2 = va_hd va_b1 in
let (va_fc2, va_s2) =
(
if (1 < n && n <= 14) then
(
let va_b3 = va_get_block va_c2 in
let (va_s4, va_fc4) = va_lemma_KeyExpansionRoundUnrolledRecursive256 (va_hd va_b3) va_s0 key
dst (n - 1) in
let va_b4 = va_tl va_b3 in
let (old_mem:vale_heap) = va_get_mem_heaplet 1 va_s4 in
let va_b6 = va_tl va_b4 in
let va_c6 = va_hd va_b4 in
let (va_fc6, va_s6) =
(
if (n `op_Modulus` 2 = 0) then
(
let va_b7 = va_get_block va_c6 in
let (va_s8, va_fc8) = va_lemma_KeyExpansionRoundEven256 (va_hd va_b7) va_s4 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1)) dst key in
let va_b8 = va_tl va_b7 in
let (va_s6, va_f8) = va_lemma_empty_total va_s8 va_b8 in
let va_fc6 = va_lemma_merge_total va_b7 va_s4 va_fc8 va_s8 va_f8 va_s6 in
(va_fc6, va_s6)
)
else
(
let va_b9 = va_get_block va_c6 in
let (va_s10, va_fc10) = va_lemma_KeyExpansionRoundOdd256 (va_hd va_b9) va_s4 (n - 1) dst
key in
let va_b10 = va_tl va_b9 in
let (va_s6, va_f10) = va_lemma_empty_total va_s10 va_b10 in
let va_fc6 = va_lemma_merge_total va_b9 va_s4 va_fc10 va_s10 va_f10 va_s6 in
(va_fc6, va_s6)
)
) in
assert (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1
va_s6)))}0 <= j /\ j < n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_s6)) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j old_mem));
let (va_s2, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f4 = va_lemma_merge_total va_b4 va_s4 va_fc6 va_s6 va_f6 va_s2 in
let va_fc2 = va_lemma_merge_total va_b3 va_s0 va_fc4 va_s4 va_f4 va_s2 in
(va_fc2, va_s2)
)
else
(
let va_b12 = va_get_block va_c2 in
let (va_s2, va_fc2) = va_lemma_empty_total va_s0 va_b12 in
(va_fc2, va_s2)
)
) in
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_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)
/\ (forall (va_x_mem:vale_heap) (va_x_heap1:vale_heap) (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) . 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_upd_mem_heaplet 1
va_x_heap1 (va_upd_mem va_x_mem va_s0)))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == va_if (n `op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM)
(fun _ -> va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == va_if ((n - 1)
`op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM) (fun _ -> va_get_vec 3 va_sM) /\ (forall j .
{:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j
<= n ==> Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j
(va_get_mem_heaplet 1 va_sM)) == Vale.AES.AES256_helpers_BE.expand_key_256 key j) ==> va_k
va_sM (())))
val va_wpProof_KeyExpansionRoundUnrolledRecursive256 : key:(seq nat32) -> dst:buffer128 -> n:int ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundUnrolledRecursive256
n) ([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_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundUnrolledRecursive256
(va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 key dst n 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem 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_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int) :
(va_quickCode unit (va_code_KeyExpansionRoundUnrolledRecursive256 n)) =
(va_QProc (va_code_KeyExpansionRoundUnrolledRecursive256 n) ([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_mem_heaplet 1;
va_Mod_mem]) (va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n)
(va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n))
//--
//-- KeyExpansion256Stdcall
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansion256Stdcall () =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_CCons
(va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret) (va_CCons (va_code_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg
10) Secret) (va_CCons (va_code_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) Secret) (va_CCons
(va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 14) (va_CCons (va_code_Vxor (va_op_vec_opr_vec
1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_CNil ()))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansion256Stdcall () =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg
10) Secret) (va_pbool_and (va_codegen_success_Store128_byte16_buffer (va_op_heaplet_mem_heaplet
1) (va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) Secret) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 14) (va_pbool_and
(va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_ttrue ())))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansion256Stdcall (va_mods:va_mods_t) (input_key_b:buffer128)
(output_key_expansion_b:buffer128) : (va_quickCode unit (va_code_KeyExpansion256Stdcall ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = Vale.AES.AES256_helpers_BE.make_AES256_key
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 0
(va_get_mem_heaplet 0 va_s))) (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet 0 va_s))) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 193 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 194 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret input_key_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 195 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret input_key_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 197 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) Secret output_key_expansion_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 198 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret output_key_expansion_b 1) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 200 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 201 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_KeyExpansionRoundUnrolledRecursive256 key output_key_expansion_b 14) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 202 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_expand_key_256 key 15) (va_QLemma va_range1
"***** PRECONDITION NOT MET AT line 203 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
true (fun _ -> va_reveal_eq (`%key_to_round_keys_word) key_to_round_keys_word
key_to_round_keys_word) (fun _ -> va_reveal_opaque (`%key_to_round_keys_word)
key_to_round_keys_word) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 206 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 207 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 208 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 209 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_QEmpty
(()))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansion256Stdcall va_b0 va_s0 input_key_b output_key_expansion_b =
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_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansion256Stdcall va_mods input_key_b output_key_expansion_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansion256Stdcall ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 174 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ (let (key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) =
Vale.AES.AES256_helpers_BE.make_AES256_key (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 0 (va_get_mem_heaplet 0 va_s0)))
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 1
(va_get_mem_heaplet 0 va_s0))) in label va_range1
"***** POSTCONDITION NOT MET AT line 186 column 71 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_sM) (va_get_reg 4 va_sM)
input_key_b 2 (va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 187 column 83 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM)
output_key_expansion_b 15 (va_get_mem_layout va_sM) Secret)) /\ (let (key:(FStar.Seq.Base.seq
Vale.Def.Types_s.nat32)) = Vale.AES.AES256_helpers_BE.make_AES256_key
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 0
(va_get_mem_heaplet 0 va_s0))) (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet 0 va_s0))) in label
va_range1
"***** POSTCONDITION NOT MET AT line 189 column 70 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer128 output_key_expansion_b (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 191 column 133 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(forall (j:nat) . {:pattern(reverse_bytes_quad32 (buffer128_read output_key_expansion_b j
(va_get_mem_heaplet 1 va_sM)))}j <= 14 ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read output_key_expansion_b j (va_get_mem_heaplet 1 va_sM)) ==
FStar.Seq.Base.index #Vale.Def.Types_s.quad32 (Vale.AES.AES_BE_s.key_to_round_keys_word AES_256
key) j))) 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_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_KeyExpansion256Stdcall input_key_b output_key_expansion_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansion256Stdcall (va_code_KeyExpansion256Stdcall ()) va_s0
input_key_b output_key_expansion_b 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem 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_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- AES256EncryptRound
val va_code_AES256EncryptRound : n:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_AES256EncryptRound n =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n)) (va_CCons
(va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_CNil ())))))
val va_codegen_success_AES256EncryptRound : n:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_AES256EncryptRound n =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n))
(va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_Vcipher (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2))
(va_ttrue ()))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_AES256EncryptRound (va_mods:va_mods_t) (n:nat8) (init:quad32) (round_keys:(seq
quad32)) (keys_buffer:buffer128) : (va_quickCode unit (va_code_AES256EncryptRound n)) =
(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 235 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 236 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret keys_buffer n) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 237 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipher (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_QEmpty
(()))))))
val va_lemma_AES256EncryptRound : va_b0:va_code -> va_s0:va_state -> n:nat8 -> init:quad32 ->
round_keys:(seq quad32) -> keys_buffer:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AES256EncryptRound n) va_s0 /\ va_get_ok va_s0 /\ (1
<= n /\ n < 14 /\ 14 <= FStar.Seq.Base.length #quad32 round_keys) /\ va_get_vec 0 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init round_keys (n - 1) /\ va_get_reg 4 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 keys_buffer (va_get_mem_heaplet 0
va_s0) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0)
keys_buffer 15 (va_get_mem_layout va_s0) Secret /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read keys_buffer n (va_get_mem_heaplet 0 va_s0)) ==
FStar.Seq.Base.index #quad32 round_keys n))
(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 0 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init round_keys n /\ va_state_eq va_sM
(va_update_vec 2 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_AES256EncryptRound va_b0 va_s0 n init round_keys keys_buffer =
let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in
let va_qc = va_qcode_AES256EncryptRound va_mods n init round_keys keys_buffer in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_AES256EncryptRound n) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 216 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 233 column 51 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 0 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init round_keys n)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_AES256EncryptRound (n:nat8) (init:quad32) (round_keys:(seq quad32))
(keys_buffer:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (1 <= n /\ n < 14 /\ 14 <= FStar.Seq.Base.length #quad32 round_keys) /\
va_get_vec 0 va_s0 == Vale.AES.AES_BE_s.eval_rounds_def init round_keys (n - 1) /\ va_get_reg 4
va_s0 == Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 keys_buffer
(va_get_mem_heaplet 0 va_s0) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0
va_s0) (va_get_reg 4 va_s0) keys_buffer 15 (va_get_mem_layout va_s0) Secret /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read keys_buffer n
(va_get_mem_heaplet 0 va_s0)) == FStar.Seq.Base.index #quad32 round_keys n /\ (forall
(va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) . let va_sM = va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)) in va_get_ok va_sM /\ va_get_vec 0 va_sM
== Vale.AES.AES_BE_s.eval_rounds_def init round_keys n ==> va_k va_sM (())))
val va_wpProof_AES256EncryptRound : n:nat8 -> init:quad32 -> round_keys:(seq quad32) ->
keys_buffer:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AES256EncryptRound n init round_keys keys_buffer va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AES256EncryptRound n) ([va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_AES256EncryptRound n init round_keys keys_buffer va_s0 va_k =
let (va_sM, va_f0) = va_lemma_AES256EncryptRound (va_code_AES256EncryptRound n) va_s0 n init
round_keys keys_buffer in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 2 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 2; 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_AES256EncryptRound (n:nat8) (init:quad32) (round_keys:(seq quad32))
(keys_buffer:buffer128) : (va_quickCode unit (va_code_AES256EncryptRound n)) =
(va_QProc (va_code_AES256EncryptRound n) ([va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10])
(va_wp_AES256EncryptRound n init round_keys keys_buffer) (va_wpProof_AES256EncryptRound n init
round_keys keys_buffer))
//--
//-- AES256EncryptBlock
[@ "opaque_to_smt" va_qattr]
let va_code_AES256EncryptBlock () =
(va_Block (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10)
0) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons
(va_code_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_CCons
(va_code_AES256EncryptRound 1) (va_CCons (va_code_AES256EncryptRound 2) (va_CCons
(va_code_AES256EncryptRound 3) (va_CCons (va_code_AES256EncryptRound 4) (va_CCons
(va_code_AES256EncryptRound 5) (va_CCons (va_code_AES256EncryptRound 6) (va_CCons
(va_code_AES256EncryptRound 7) (va_CCons (va_code_AES256EncryptRound 8) (va_CCons
(va_code_AES256EncryptRound 9) (va_CCons (va_code_AES256EncryptRound 10) (va_CCons
(va_code_AES256EncryptRound 11) (va_CCons (va_code_AES256EncryptRound 12) (va_CCons
(va_code_AES256EncryptRound 13) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16
`op_Multiply` 14)) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons
(va_code_Vcipherlast (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2))
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2))
(va_CNil ())))))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_AES256EncryptBlock () =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 0) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2))
(va_pbool_and (va_codegen_success_AES256EncryptRound 1) (va_pbool_and
(va_codegen_success_AES256EncryptRound 2) (va_pbool_and (va_codegen_success_AES256EncryptRound
3) (va_pbool_and (va_codegen_success_AES256EncryptRound 4) (va_pbool_and
(va_codegen_success_AES256EncryptRound 5) (va_pbool_and (va_codegen_success_AES256EncryptRound
6) (va_pbool_and (va_codegen_success_AES256EncryptRound 7) (va_pbool_and
(va_codegen_success_AES256EncryptRound 8) (va_pbool_and (va_codegen_success_AES256EncryptRound
9) (va_pbool_and (va_codegen_success_AES256EncryptRound 10) (va_pbool_and
(va_codegen_success_AES256EncryptRound 11) (va_pbool_and (va_codegen_success_AES256EncryptRound
12) (va_pbool_and (va_codegen_success_AES256EncryptRound 13) (va_pbool_and
(va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` 14)) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_Vcipherlast (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec
2)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)) (va_ttrue ())))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_AES256EncryptBlock (va_mods:va_mods_t) (input:quad32) (key:(seq nat32))
(round_keys:(seq quad32)) (keys_buffer:buffer128) : (va_quickCode unit
(va_code_AES256EncryptBlock ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_qAssertSquash
va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 262 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540)))
Vale.Def.Types_s.quad32 round_keys 0) (fun _ -> let (init:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.quad32_xor input (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0)
in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 264 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 265 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret keys_buffer 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 266 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 267 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 1 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 268 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 2 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 269 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 3 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 270 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 4 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 271 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 5 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 272 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 6 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 273 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 7 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 274 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 8 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 275 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 9 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 276 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 10 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 277 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 11 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 278 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 12 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 279 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 13 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 280 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` 14)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 281 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret keys_buffer 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 282 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipherlast (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 285 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 286 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.aes_encrypt_word_reveal ()) (va_QEmpty
(())))))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_AES256EncryptBlock va_b0 va_s0 input key round_keys keys_buffer =
let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in
let va_qc = va_qcode_AES256EncryptBlock va_mods input key round_keys keys_buffer in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_AES256EncryptBlock ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 240 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 260 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 0 va_sM == Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key input)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 2; 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_AES256EncryptBlock input key round_keys keys_buffer va_s0 va_k =
let (va_sM, va_f0) = va_lemma_AES256EncryptBlock (va_code_AES256EncryptBlock ()) va_s0 input key
round_keys keys_buffer in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 2 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 2; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- AES256EncryptRound_6way
val va_code_AES256EncryptRound_6way : n:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_AES256EncryptRound_6way n =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n)) (va_CCons
(va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 6)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 6)) (va_CNil ()))))))))))
val va_codegen_success_AES256EncryptRound_6way : n:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_AES256EncryptRound_6way n =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n))
(va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 6) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_Vcipher (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6))
(va_pbool_and (va_codegen_success_Vcipher (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 6)) (va_pbool_and (va_codegen_success_Vcipher (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 6)) (va_pbool_and (va_codegen_success_Vcipher
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 6)) (va_pbool_and
(va_codegen_success_Vcipher (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 6))
(va_pbool_and (va_codegen_success_Vcipher (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5)
(va_op_vec_opr_vec 6)) (va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_AES256EncryptRound_6way (va_mods:va_mods_t) (n:nat8) (init1:quad32) (init2:quad32)
(init3:quad32) (init4:quad32) (init5:quad32) (init6:quad32) (round_keys:(seq quad32))
(keys_buffer:buffer128) : (va_quickCode unit (va_code_AES256EncryptRound_6way n)) =
(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 323 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 324 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 6)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret keys_buffer n) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 325 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipher (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 326 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipher (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 6)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 327 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipher (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 6)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 328 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipher (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 6)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 329 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipher (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 6)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 330 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipher (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 6)) (va_QEmpty
(())))))))))))
val va_lemma_AES256EncryptRound_6way : va_b0:va_code -> va_s0:va_state -> n:nat8 -> init1:quad32 ->
init2:quad32 -> init3:quad32 -> init4:quad32 -> init5:quad32 -> init6:quad32 -> round_keys:(seq
quad32) -> keys_buffer:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AES256EncryptRound_6way n) va_s0 /\ va_get_ok va_s0 /\
(1 <= n /\ n < 14 /\ 14 <= FStar.Seq.Base.length #quad32 round_keys) /\ va_get_vec 0 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init1 round_keys (n - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init2 round_keys (n - 1) /\ va_get_vec 2 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init3 round_keys (n - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init4 round_keys (n - 1) /\ va_get_vec 4 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init5 round_keys (n - 1) /\ va_get_vec 5 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init6 round_keys (n - 1) /\ va_get_reg 4 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 keys_buffer (va_get_mem_heaplet 0
va_s0) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0)
keys_buffer 15 (va_get_mem_layout va_s0) Secret /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read keys_buffer n (va_get_mem_heaplet 0 va_s0)) ==
FStar.Seq.Base.index #quad32 round_keys n))
(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 0 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init1 round_keys n /\ va_get_vec 1
va_sM == Vale.AES.AES_BE_s.eval_rounds_def init2 round_keys n /\ va_get_vec 2 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init3 round_keys n /\ va_get_vec 3 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init4 round_keys n /\ va_get_vec 4 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init5 round_keys n /\ va_get_vec 5 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init6 round_keys n /\ 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)))))))))))
[@"opaque_to_smt"]
let va_lemma_AES256EncryptRound_6way va_b0 va_s0 n init1 init2 init3 init4 init5 init6 round_keys
keys_buffer =
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_AES256EncryptRound_6way va_mods n init1 init2 init3 init4 init5 init6
round_keys keys_buffer in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_AES256EncryptRound_6way n) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 289 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 316 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 0 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init1 round_keys n) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 317 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init2 round_keys n) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 318 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 2 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init3 round_keys n) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 319 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init4 round_keys n) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 320 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 4 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init5 round_keys n) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 321 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 5 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init6 round_keys n)) 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)
[@ va_qattr]
let va_wp_AES256EncryptRound_6way (n:nat8) (init1:quad32) (init2:quad32) (init3:quad32)
(init4:quad32) (init5:quad32) (init6:quad32) (round_keys:(seq quad32)) (keys_buffer:buffer128)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (1 <= n /\ n < 14 /\ 14 <= FStar.Seq.Base.length #quad32 round_keys) /\
va_get_vec 0 va_s0 == Vale.AES.AES_BE_s.eval_rounds_def init1 round_keys (n - 1) /\ va_get_vec
1 va_s0 == Vale.AES.AES_BE_s.eval_rounds_def init2 round_keys (n - 1) /\ va_get_vec 2 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init3 round_keys (n - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init4 round_keys (n - 1) /\ va_get_vec 4 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init5 round_keys (n - 1) /\ va_get_vec 5 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init6 round_keys (n - 1) /\ va_get_reg 4 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 keys_buffer (va_get_mem_heaplet 0
va_s0) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0)
keys_buffer 15 (va_get_mem_layout va_s0) Secret /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read keys_buffer n (va_get_mem_heaplet 0 va_s0)) ==
FStar.Seq.Base.index #quad32 round_keys n /\ (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)
(va_x_v6:quad32) . let va_sM = va_upd_vec 6 va_x_v6 (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 /\ va_get_vec 0 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init1 round_keys n /\ va_get_vec 1 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init2 round_keys n /\ va_get_vec 2 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init3 round_keys n /\ va_get_vec 3 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init4 round_keys n /\ va_get_vec 4 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init5 round_keys n /\ va_get_vec 5 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init6 round_keys n ==> va_k va_sM (())))
val va_wpProof_AES256EncryptRound_6way : n:nat8 -> init1:quad32 -> init2:quad32 -> init3:quad32 ->
init4:quad32 -> init5:quad32 -> init6:quad32 -> round_keys:(seq quad32) -> keys_buffer:buffer128
-> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AES256EncryptRound_6way n init1 init2 init3 init4 init5
init6 round_keys keys_buffer va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AES256EncryptRound_6way n)
([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_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_AES256EncryptRound_6way n init1 init2 init3 init4 init5 init6 round_keys keys_buffer
va_s0 va_k =
let (va_sM, va_f0) = va_lemma_AES256EncryptRound_6way (va_code_AES256EncryptRound_6way n) va_s0 n
init1 init2 init3 init4 init5 init6 round_keys keys_buffer 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)
[@ "opaque_to_smt" va_qattr]
let va_quick_AES256EncryptRound_6way (n:nat8) (init1:quad32) (init2:quad32) (init3:quad32)
(init4:quad32) (init5:quad32) (init6:quad32) (round_keys:(seq quad32)) (keys_buffer:buffer128) :
(va_quickCode unit (va_code_AES256EncryptRound_6way n)) =
(va_QProc (va_code_AES256EncryptRound_6way n) ([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_wp_AES256EncryptRound_6way n init1 init2 init3 init4 init5 init6 round_keys keys_buffer)
(va_wpProof_AES256EncryptRound_6way n init1 init2 init3 init4 init5 init6 round_keys
keys_buffer))
//--
//-- AES256EncryptBlock_6way | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_code | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.PPC64LE.Decls.va_Block",
"Vale.PPC64LE.Decls.va_CCons",
"Vale.PPC64LE.Decls.va_CNil",
"Vale.PPC64LE.InsBasic.va_code_LoadImm64",
"Vale.PPC64LE.Decls.va_op_reg_opr_reg",
"Vale.PPC64LE.InsVector.va_code_Load128_byte16_buffer_index",
"Vale.PPC64LE.Decls.va_op_heaplet_mem_heaplet",
"Vale.PPC64LE.Decls.va_op_vec_opr_vec",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.PPC64LE.InsVector.va_code_Vxor",
"Vale.AES.PPC64LE.AES256.va_code_AES256EncryptRound_6way",
"Prims.op_Multiply",
"Vale.PPC64LE.InsVector.va_code_Vcipherlast",
"Vale.PPC64LE.Decls.va_code"
] | [] | false | false | false | true | false | let va_code_AES256EncryptBlock_6way () =
| (va_Block (va_CCons (va_Block (va_CNil ()))
(va_CCons (va_Block (va_CNil ()))
(va_CCons (va_Block (va_CNil ()))
(va_CCons (va_Block (va_CNil ()))
(va_CCons (va_Block (va_CNil ()))
(va_CCons (va_Block (va_CNil ()))
(va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 0)
(va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet
0)
(va_op_vec_opr_vec 6)
(va_op_reg_opr_reg 4)
(va_op_reg_opr_reg 10)
Secret)
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 6))
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 6))
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 6))
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 6))
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 6))
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 5
)
(va_op_vec_opr_vec 5)
(va_op_vec_opr_vec 6))
(va_CCons (va_code_AES256EncryptRound_6way
1)
(va_CCons (va_code_AES256EncryptRound_6way
2)
(va_CCons (va_code_AES256EncryptRound_6way
3)
(va_CCons (va_code_AES256EncryptRound_6way
4)
(va_CCons (va_code_AES256EncryptRound_6way
5)
(va_CCons (va_code_AES256EncryptRound_6way
6)
(va_CCons (va_code_AES256EncryptRound_6way
7)
(va_CCons (va_code_AES256EncryptRound_6way
8)
(va_CCons
(va_code_AES256EncryptRound_6way
9
)
(va_CCons
(
va_code_AES256EncryptRound_6way
10
)
(
va_CCons
(
va_code_AES256EncryptRound_6way
11
)
(
va_CCons
(
va_code_AES256EncryptRound_6way
12
)
(
va_CCons
(
va_code_AES256EncryptRound_6way
13
)
(
va_CCons
(
va_code_LoadImm64
(
va_op_reg_opr_reg
10
)
(
16
`op_Multiply`
14
)
)
(
va_CCons
(
va_code_Load128_byte16_buffer_index
(
va_op_heaplet_mem_heaplet
0
)
(
va_op_vec_opr_vec
6
)
(
va_op_reg_opr_reg
4
)
(
va_op_reg_opr_reg
10
)
Secret
)
(
va_CCons
(
va_code_Vcipherlast
(
va_op_vec_opr_vec
0
)
(
va_op_vec_opr_vec
0
)
(
va_op_vec_opr_vec
6
)
)
(
va_CCons
(
va_code_Vcipherlast
(
va_op_vec_opr_vec
1
)
(
va_op_vec_opr_vec
1
)
(
va_op_vec_opr_vec
6
)
)
(
va_CCons
(
va_code_Vcipherlast
(
va_op_vec_opr_vec
2
)
(
va_op_vec_opr_vec
2
)
(
va_op_vec_opr_vec
6
)
)
(
va_CCons
(
va_code_Vcipherlast
(
va_op_vec_opr_vec
3
)
(
va_op_vec_opr_vec
3
)
(
va_op_vec_opr_vec
6
)
)
(
va_CCons
(
va_code_Vcipherlast
(
va_op_vec_opr_vec
4
)
(
va_op_vec_opr_vec
4
)
(
va_op_vec_opr_vec
6
)
)
(
va_CCons
(
va_code_Vcipherlast
(
va_op_vec_opr_vec
5
)
(
va_op_vec_opr_vec
5
)
(
va_op_vec_opr_vec
6
)
)
(
va_CCons
(
va_code_Vxor
(
va_op_vec_opr_vec
6
)
(
va_op_vec_opr_vec
6
)
(
va_op_vec_opr_vec
6
)
)
(
va_CNil
()
)
)
)
)
)
)
)
)
)
)
)
)
)
))
))))))))))))
))))))))))) | false |
Pulse.Checker.WithLocalArray.fst | Pulse.Checker.WithLocalArray.extend_post_hint | val extend_post_hint (g: env) (p: post_hint_for_env g) (init_t: term) (x: var{~(Set.mem x (dom g))})
: T.Tac
(q:
post_hint_for_env (push_binding g x ppname_default (mk_array init_t))
{ q.post == comp_withlocal_array_body_post p.post init_t (null_var x) /\
q.ret_ty == p.ret_ty /\ q.u == p.u /\ q.effect_annot == p.effect_annot }) | val extend_post_hint (g: env) (p: post_hint_for_env g) (init_t: term) (x: var{~(Set.mem x (dom g))})
: T.Tac
(q:
post_hint_for_env (push_binding g x ppname_default (mk_array init_t))
{ q.post == comp_withlocal_array_body_post p.post init_t (null_var x) /\
q.ret_ty == p.ret_ty /\ q.u == p.u /\ q.effect_annot == p.effect_annot }) | let extend_post_hint
(g:env)
(p:post_hint_for_env g)
(init_t:term)
(x:var { ~ (Set.mem x (dom g)) })
: T.Tac (q:post_hint_for_env (push_binding g x ppname_default (mk_array init_t)) {
q.post == comp_withlocal_array_body_post p.post init_t (null_var x) /\
q.ret_ty == p.ret_ty /\
q.u == p.u /\
q.effect_annot == p.effect_annot
})
= let arr = null_var x in
let conjunct = (tm_exists_sl u0 (as_binder (mk_seq u0 init_t)) (mk_array_pts_to init_t arr (null_bvar 0))) in
let g' = push_binding g x ppname_default (mk_array init_t) in
let c_typing = Pulse.Checker.Pure.core_check_term g' conjunct T.E_Total tm_vprop in
let res = Pulse.Checker.Base.extend_post_hint g p x (mk_array init_t) _ c_typing in
res | {
"file_name": "lib/steel/pulse/Pulse.Checker.WithLocalArray.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 5,
"end_line": 44,
"start_col": 0,
"start_line": 28
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Checker.WithLocalArray
open Pulse.Syntax
open Pulse.Typing
open Pulse.Checker.Pure
open Pulse.Checker.Base
module T = FStar.Tactics.V2
module P = Pulse.Syntax.Printer
module RU = Pulse.Reflection.Util | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Checker.Pure.fsti.checked",
"Pulse.Checker.Base.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.WithLocalArray.fst"
} | [
{
"abbrev": true,
"full_module": "Pulse.Reflection.Util",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
g: Pulse.Typing.Env.env ->
p: Pulse.Typing.post_hint_for_env g ->
init_t: Pulse.Syntax.Base.term ->
x: Pulse.Syntax.Base.var{~(FStar.Set.mem x (Pulse.Typing.Env.dom g))}
-> FStar.Tactics.Effect.Tac
(q:
Pulse.Typing.post_hint_for_env (Pulse.Typing.Env.push_binding g
x
Pulse.Syntax.Base.ppname_default
(Pulse.Typing.mk_array init_t))
{ Mkpost_hint_t?.post q ==
Pulse.Typing.comp_withlocal_array_body_post (Mkpost_hint_t?.post p)
init_t
(Pulse.Syntax.Pure.null_var x) /\ Mkpost_hint_t?.ret_ty q == Mkpost_hint_t?.ret_ty p /\
Mkpost_hint_t?.u q == Mkpost_hint_t?.u p /\
Mkpost_hint_t?.effect_annot q == Mkpost_hint_t?.effect_annot p }) | FStar.Tactics.Effect.Tac | [] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Typing.post_hint_for_env",
"Pulse.Syntax.Base.term",
"Pulse.Syntax.Base.var",
"Prims.l_not",
"Prims.b2t",
"FStar.Set.mem",
"Pulse.Typing.Env.dom",
"Pulse.Typing.Env.push_binding",
"Pulse.Syntax.Base.ppname_default",
"Pulse.Typing.mk_array",
"Prims.l_and",
"Prims.eq2",
"Pulse.Typing.__proj__Mkpost_hint_t__item__post",
"Pulse.Typing.comp_withlocal_array_body_post",
"Pulse.Syntax.Pure.null_var",
"Pulse.Typing.__proj__Mkpost_hint_t__item__ret_ty",
"Pulse.Syntax.Base.universe",
"Pulse.Typing.__proj__Mkpost_hint_t__item__u",
"Pulse.Syntax.Base.effect_annot",
"Pulse.Typing.__proj__Mkpost_hint_t__item__effect_annot",
"Pulse.Syntax.Base.tm_star",
"Pulse.Checker.Base.extend_post_hint",
"Pulse.Typing.typing",
"FStar.Stubs.TypeChecker.Core.E_Total",
"Pulse.Syntax.Base.tm_vprop",
"Pulse.Checker.Pure.core_check_term",
"FStar.Reflection.Typing.fstar_top_env",
"Pulse.Typing.Env.fstar_env",
"Pulse.Syntax.Base.tm_exists_sl",
"Pulse.Syntax.Pure.u0",
"Pulse.Syntax.Base.as_binder",
"Pulse.Typing.mk_seq",
"Pulse.Typing.mk_array_pts_to",
"Pulse.Syntax.Pure.null_bvar"
] | [] | false | true | false | false | false | let extend_post_hint (g: env) (p: post_hint_for_env g) (init_t: term) (x: var{~(Set.mem x (dom g))})
: T.Tac
(q:
post_hint_for_env (push_binding g x ppname_default (mk_array init_t))
{ q.post == comp_withlocal_array_body_post p.post init_t (null_var x) /\
q.ret_ty == p.ret_ty /\ q.u == p.u /\ q.effect_annot == p.effect_annot }) =
| let arr = null_var x in
let conjunct =
(tm_exists_sl u0 (as_binder (mk_seq u0 init_t)) (mk_array_pts_to init_t arr (null_bvar 0)))
in
let g' = push_binding g x ppname_default (mk_array init_t) in
let c_typing = Pulse.Checker.Pure.core_check_term g' conjunct T.E_Total tm_vprop in
let res = Pulse.Checker.Base.extend_post_hint g p x (mk_array init_t) _ c_typing in
res | false |
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_codegen_success_AES256EncryptBlock_6way | val va_codegen_success_AES256EncryptBlock_6way : va_dummy:unit -> Tot va_pbool | val va_codegen_success_AES256EncryptBlock_6way : va_dummy:unit -> Tot va_pbool | let va_codegen_success_AES256EncryptBlock_6way () =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 0) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 6) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 6)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 6)) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 6)) (va_pbool_and
(va_codegen_success_Vxor (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 6))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5)
(va_op_vec_opr_vec 6)) (va_pbool_and (va_codegen_success_AES256EncryptRound_6way 1)
(va_pbool_and (va_codegen_success_AES256EncryptRound_6way 2) (va_pbool_and
(va_codegen_success_AES256EncryptRound_6way 3) (va_pbool_and
(va_codegen_success_AES256EncryptRound_6way 4) (va_pbool_and
(va_codegen_success_AES256EncryptRound_6way 5) (va_pbool_and
(va_codegen_success_AES256EncryptRound_6way 6) (va_pbool_and
(va_codegen_success_AES256EncryptRound_6way 7) (va_pbool_and
(va_codegen_success_AES256EncryptRound_6way 8) (va_pbool_and
(va_codegen_success_AES256EncryptRound_6way 9) (va_pbool_and
(va_codegen_success_AES256EncryptRound_6way 10) (va_pbool_and
(va_codegen_success_AES256EncryptRound_6way 11) (va_pbool_and
(va_codegen_success_AES256EncryptRound_6way 12) (va_pbool_and
(va_codegen_success_AES256EncryptRound_6way 13) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` 14)) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 6) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_Vcipherlast (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec
6)) (va_pbool_and (va_codegen_success_Vcipherlast (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 6)) (va_pbool_and (va_codegen_success_Vcipherlast (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 6)) (va_pbool_and (va_codegen_success_Vcipherlast
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 6)) (va_pbool_and
(va_codegen_success_Vcipherlast (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec
6)) (va_pbool_and (va_codegen_success_Vcipherlast (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5)
(va_op_vec_opr_vec 6)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 6)
(va_op_vec_opr_vec 6) (va_op_vec_opr_vec 6)) (va_ttrue ()))))))))))))))))))))))))))))))) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 92,
"end_line": 1197,
"start_col": 0,
"start_line": 1162
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round
rcon) va_s0 round rcon dst key 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 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1
va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32)) :
(va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(va_QProc (va_code_KeyExpansionRoundEven256 round rcon) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem])
(va_wp_KeyExpansionRoundEven256 round rcon dst key) (va_wpProof_KeyExpansionRoundEven256 round
rcon dst key))
//--
//-- KeyExpansionRoundOdd256
val va_code_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundOdd256 round =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
()))))))))))))))
val va_codegen_success_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundOdd256 round =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundOdd256 (va_mods:va_mods_t) (round:nat8) (dst:buffer128) (key:(seq
nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) =
(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 114 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 115 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 116 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 117 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 118 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 120 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 121 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 123 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 124 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 125 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 127 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg23:Prims.int) = round + 1
in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg21:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg21 va_arg22 0 va_arg23)
(let (va_arg20:Prims.int) = round + 1 in let (va_arg19:Vale.Def.Types_s.quad32) = va_get_vec 1
va_old_s in let (va_arg18:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 129 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_round_key_256_rcon_odd va_arg18 va_arg19 0
va_arg20) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 130 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(())))))))))))))))))))
val va_lemma_KeyExpansionRoundOdd256 : va_b0:va_code -> va_s0:va_state -> round:nat8 ->
dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundOdd256 round) va_s0 /\ va_get_ok
va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0)
dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10
va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundOdd256 va_b0 va_s0 round dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundOdd256 va_mods round dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundOdd256 round) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 92 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 102 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 110 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 111 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 112 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32)
(va_x_v4:quad32) . let va_sM = va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem
va_x_mem va_s0)))))) in va_get_ok va_sM /\ Vale.PPC64LE.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15 (va_get_mem_layout va_sM) Secret /\
va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec 3 va_sM ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundOdd256 : round:nat8 -> dst:buffer128 -> key:(seq nat32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundOdd256 round dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundOdd256 round)
([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1;
va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundOdd256 round dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundOdd256 (va_code_KeyExpansionRoundOdd256 round)
va_s0 round dst key in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) : (va_quickCode
unit (va_code_KeyExpansionRoundOdd256 round)) =
(va_QProc (va_code_KeyExpansionRoundOdd256 round) ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_KeyExpansionRoundOdd256
round dst key) (va_wpProof_KeyExpansionRoundOdd256 round dst key))
//--
//-- KeyExpansionRoundUnrolledRecursive256
val va_code_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_code(decreases %[n])
[@ "opaque_to_smt"]
let rec va_code_KeyExpansionRoundUnrolledRecursive256 n =
(va_Block (va_CCons (if (1 < n && n <= 14) then va_Block (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_CCons (if (n `op_Modulus` 2 = 0)
then va_Block (va_CCons (va_code_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_CNil ())) else va_Block (va_CCons
(va_code_KeyExpansionRoundOdd256 (n - 1)) (va_CNil ()))) (va_CNil ()))) else va_Block (va_CNil
())) (va_CNil ())))
val va_codegen_success_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_pbool(decreases %[n])
[@ "opaque_to_smt"]
let rec va_codegen_success_KeyExpansionRoundUnrolledRecursive256 n =
(va_pbool_and (if (1 < n && n <= 14) then va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_pbool_and (if (n
`op_Modulus` 2 = 0) then va_pbool_and (va_codegen_success_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_ttrue ()) else va_pbool_and
(va_codegen_success_KeyExpansionRoundOdd256 (n - 1)) (va_ttrue ())) (va_ttrue ())) else
va_ttrue ()) (va_ttrue ()))
val va_lemma_KeyExpansionRoundUnrolledRecursive256 : va_b0:va_code -> va_s0:va_state -> key:(seq
nat32) -> dst:buffer128 -> n:int
-> Ghost (va_state & va_fuel)(decreases %[n])
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == (if (n `op_Modulus` 2 = 0) then va_get_vec 1 va_sM else
va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == (if ((n - 1) `op_Modulus` 2 = 0) then va_get_vec 1
va_sM else va_get_vec 3 va_sM) /\ (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read
dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j <= n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.AES256_helpers_BE.expand_key_256 key j) /\ 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_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let rec va_lemma_KeyExpansionRoundUnrolledRecursive256 va_b0 va_s0 key dst n =
va_reveal_opaque (`%va_code_KeyExpansionRoundUnrolledRecursive256)
(va_code_KeyExpansionRoundUnrolledRecursive256 n);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let va_b2 = va_tl va_b1 in
let va_c2 = va_hd va_b1 in
let (va_fc2, va_s2) =
(
if (1 < n && n <= 14) then
(
let va_b3 = va_get_block va_c2 in
let (va_s4, va_fc4) = va_lemma_KeyExpansionRoundUnrolledRecursive256 (va_hd va_b3) va_s0 key
dst (n - 1) in
let va_b4 = va_tl va_b3 in
let (old_mem:vale_heap) = va_get_mem_heaplet 1 va_s4 in
let va_b6 = va_tl va_b4 in
let va_c6 = va_hd va_b4 in
let (va_fc6, va_s6) =
(
if (n `op_Modulus` 2 = 0) then
(
let va_b7 = va_get_block va_c6 in
let (va_s8, va_fc8) = va_lemma_KeyExpansionRoundEven256 (va_hd va_b7) va_s4 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1)) dst key in
let va_b8 = va_tl va_b7 in
let (va_s6, va_f8) = va_lemma_empty_total va_s8 va_b8 in
let va_fc6 = va_lemma_merge_total va_b7 va_s4 va_fc8 va_s8 va_f8 va_s6 in
(va_fc6, va_s6)
)
else
(
let va_b9 = va_get_block va_c6 in
let (va_s10, va_fc10) = va_lemma_KeyExpansionRoundOdd256 (va_hd va_b9) va_s4 (n - 1) dst
key in
let va_b10 = va_tl va_b9 in
let (va_s6, va_f10) = va_lemma_empty_total va_s10 va_b10 in
let va_fc6 = va_lemma_merge_total va_b9 va_s4 va_fc10 va_s10 va_f10 va_s6 in
(va_fc6, va_s6)
)
) in
assert (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1
va_s6)))}0 <= j /\ j < n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_s6)) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j old_mem));
let (va_s2, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f4 = va_lemma_merge_total va_b4 va_s4 va_fc6 va_s6 va_f6 va_s2 in
let va_fc2 = va_lemma_merge_total va_b3 va_s0 va_fc4 va_s4 va_f4 va_s2 in
(va_fc2, va_s2)
)
else
(
let va_b12 = va_get_block va_c2 in
let (va_s2, va_fc2) = va_lemma_empty_total va_s0 va_b12 in
(va_fc2, va_s2)
)
) in
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_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)
/\ (forall (va_x_mem:vale_heap) (va_x_heap1:vale_heap) (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) . 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_upd_mem_heaplet 1
va_x_heap1 (va_upd_mem va_x_mem va_s0)))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == va_if (n `op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM)
(fun _ -> va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == va_if ((n - 1)
`op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM) (fun _ -> va_get_vec 3 va_sM) /\ (forall j .
{:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j
<= n ==> Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j
(va_get_mem_heaplet 1 va_sM)) == Vale.AES.AES256_helpers_BE.expand_key_256 key j) ==> va_k
va_sM (())))
val va_wpProof_KeyExpansionRoundUnrolledRecursive256 : key:(seq nat32) -> dst:buffer128 -> n:int ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundUnrolledRecursive256
n) ([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_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundUnrolledRecursive256
(va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 key dst n 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem 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_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int) :
(va_quickCode unit (va_code_KeyExpansionRoundUnrolledRecursive256 n)) =
(va_QProc (va_code_KeyExpansionRoundUnrolledRecursive256 n) ([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_mem_heaplet 1;
va_Mod_mem]) (va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n)
(va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n))
//--
//-- KeyExpansion256Stdcall
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansion256Stdcall () =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_CCons
(va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret) (va_CCons (va_code_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg
10) Secret) (va_CCons (va_code_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) Secret) (va_CCons
(va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 14) (va_CCons (va_code_Vxor (va_op_vec_opr_vec
1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_CNil ()))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansion256Stdcall () =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg
10) Secret) (va_pbool_and (va_codegen_success_Store128_byte16_buffer (va_op_heaplet_mem_heaplet
1) (va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) Secret) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 14) (va_pbool_and
(va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_ttrue ())))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansion256Stdcall (va_mods:va_mods_t) (input_key_b:buffer128)
(output_key_expansion_b:buffer128) : (va_quickCode unit (va_code_KeyExpansion256Stdcall ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = Vale.AES.AES256_helpers_BE.make_AES256_key
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 0
(va_get_mem_heaplet 0 va_s))) (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet 0 va_s))) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 193 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 194 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret input_key_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 195 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret input_key_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 197 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) Secret output_key_expansion_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 198 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret output_key_expansion_b 1) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 200 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 201 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_KeyExpansionRoundUnrolledRecursive256 key output_key_expansion_b 14) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 202 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_expand_key_256 key 15) (va_QLemma va_range1
"***** PRECONDITION NOT MET AT line 203 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
true (fun _ -> va_reveal_eq (`%key_to_round_keys_word) key_to_round_keys_word
key_to_round_keys_word) (fun _ -> va_reveal_opaque (`%key_to_round_keys_word)
key_to_round_keys_word) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 206 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 207 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 208 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 209 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_QEmpty
(()))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansion256Stdcall va_b0 va_s0 input_key_b output_key_expansion_b =
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_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansion256Stdcall va_mods input_key_b output_key_expansion_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansion256Stdcall ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 174 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ (let (key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) =
Vale.AES.AES256_helpers_BE.make_AES256_key (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 0 (va_get_mem_heaplet 0 va_s0)))
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 1
(va_get_mem_heaplet 0 va_s0))) in label va_range1
"***** POSTCONDITION NOT MET AT line 186 column 71 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_sM) (va_get_reg 4 va_sM)
input_key_b 2 (va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 187 column 83 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM)
output_key_expansion_b 15 (va_get_mem_layout va_sM) Secret)) /\ (let (key:(FStar.Seq.Base.seq
Vale.Def.Types_s.nat32)) = Vale.AES.AES256_helpers_BE.make_AES256_key
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 0
(va_get_mem_heaplet 0 va_s0))) (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet 0 va_s0))) in label
va_range1
"***** POSTCONDITION NOT MET AT line 189 column 70 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer128 output_key_expansion_b (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 191 column 133 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(forall (j:nat) . {:pattern(reverse_bytes_quad32 (buffer128_read output_key_expansion_b j
(va_get_mem_heaplet 1 va_sM)))}j <= 14 ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read output_key_expansion_b j (va_get_mem_heaplet 1 va_sM)) ==
FStar.Seq.Base.index #Vale.Def.Types_s.quad32 (Vale.AES.AES_BE_s.key_to_round_keys_word AES_256
key) j))) 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_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_KeyExpansion256Stdcall input_key_b output_key_expansion_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansion256Stdcall (va_code_KeyExpansion256Stdcall ()) va_s0
input_key_b output_key_expansion_b 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem 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_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- AES256EncryptRound
val va_code_AES256EncryptRound : n:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_AES256EncryptRound n =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n)) (va_CCons
(va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_CNil ())))))
val va_codegen_success_AES256EncryptRound : n:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_AES256EncryptRound n =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n))
(va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_Vcipher (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2))
(va_ttrue ()))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_AES256EncryptRound (va_mods:va_mods_t) (n:nat8) (init:quad32) (round_keys:(seq
quad32)) (keys_buffer:buffer128) : (va_quickCode unit (va_code_AES256EncryptRound n)) =
(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 235 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 236 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret keys_buffer n) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 237 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipher (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_QEmpty
(()))))))
val va_lemma_AES256EncryptRound : va_b0:va_code -> va_s0:va_state -> n:nat8 -> init:quad32 ->
round_keys:(seq quad32) -> keys_buffer:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AES256EncryptRound n) va_s0 /\ va_get_ok va_s0 /\ (1
<= n /\ n < 14 /\ 14 <= FStar.Seq.Base.length #quad32 round_keys) /\ va_get_vec 0 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init round_keys (n - 1) /\ va_get_reg 4 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 keys_buffer (va_get_mem_heaplet 0
va_s0) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0)
keys_buffer 15 (va_get_mem_layout va_s0) Secret /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read keys_buffer n (va_get_mem_heaplet 0 va_s0)) ==
FStar.Seq.Base.index #quad32 round_keys n))
(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 0 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init round_keys n /\ va_state_eq va_sM
(va_update_vec 2 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_AES256EncryptRound va_b0 va_s0 n init round_keys keys_buffer =
let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in
let va_qc = va_qcode_AES256EncryptRound va_mods n init round_keys keys_buffer in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_AES256EncryptRound n) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 216 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 233 column 51 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 0 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init round_keys n)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_AES256EncryptRound (n:nat8) (init:quad32) (round_keys:(seq quad32))
(keys_buffer:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (1 <= n /\ n < 14 /\ 14 <= FStar.Seq.Base.length #quad32 round_keys) /\
va_get_vec 0 va_s0 == Vale.AES.AES_BE_s.eval_rounds_def init round_keys (n - 1) /\ va_get_reg 4
va_s0 == Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 keys_buffer
(va_get_mem_heaplet 0 va_s0) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0
va_s0) (va_get_reg 4 va_s0) keys_buffer 15 (va_get_mem_layout va_s0) Secret /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read keys_buffer n
(va_get_mem_heaplet 0 va_s0)) == FStar.Seq.Base.index #quad32 round_keys n /\ (forall
(va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) . let va_sM = va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)) in va_get_ok va_sM /\ va_get_vec 0 va_sM
== Vale.AES.AES_BE_s.eval_rounds_def init round_keys n ==> va_k va_sM (())))
val va_wpProof_AES256EncryptRound : n:nat8 -> init:quad32 -> round_keys:(seq quad32) ->
keys_buffer:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AES256EncryptRound n init round_keys keys_buffer va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AES256EncryptRound n) ([va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_AES256EncryptRound n init round_keys keys_buffer va_s0 va_k =
let (va_sM, va_f0) = va_lemma_AES256EncryptRound (va_code_AES256EncryptRound n) va_s0 n init
round_keys keys_buffer in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 2 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 2; 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_AES256EncryptRound (n:nat8) (init:quad32) (round_keys:(seq quad32))
(keys_buffer:buffer128) : (va_quickCode unit (va_code_AES256EncryptRound n)) =
(va_QProc (va_code_AES256EncryptRound n) ([va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10])
(va_wp_AES256EncryptRound n init round_keys keys_buffer) (va_wpProof_AES256EncryptRound n init
round_keys keys_buffer))
//--
//-- AES256EncryptBlock
[@ "opaque_to_smt" va_qattr]
let va_code_AES256EncryptBlock () =
(va_Block (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10)
0) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons
(va_code_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_CCons
(va_code_AES256EncryptRound 1) (va_CCons (va_code_AES256EncryptRound 2) (va_CCons
(va_code_AES256EncryptRound 3) (va_CCons (va_code_AES256EncryptRound 4) (va_CCons
(va_code_AES256EncryptRound 5) (va_CCons (va_code_AES256EncryptRound 6) (va_CCons
(va_code_AES256EncryptRound 7) (va_CCons (va_code_AES256EncryptRound 8) (va_CCons
(va_code_AES256EncryptRound 9) (va_CCons (va_code_AES256EncryptRound 10) (va_CCons
(va_code_AES256EncryptRound 11) (va_CCons (va_code_AES256EncryptRound 12) (va_CCons
(va_code_AES256EncryptRound 13) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16
`op_Multiply` 14)) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons
(va_code_Vcipherlast (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2))
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2))
(va_CNil ())))))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_AES256EncryptBlock () =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 0) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2))
(va_pbool_and (va_codegen_success_AES256EncryptRound 1) (va_pbool_and
(va_codegen_success_AES256EncryptRound 2) (va_pbool_and (va_codegen_success_AES256EncryptRound
3) (va_pbool_and (va_codegen_success_AES256EncryptRound 4) (va_pbool_and
(va_codegen_success_AES256EncryptRound 5) (va_pbool_and (va_codegen_success_AES256EncryptRound
6) (va_pbool_and (va_codegen_success_AES256EncryptRound 7) (va_pbool_and
(va_codegen_success_AES256EncryptRound 8) (va_pbool_and (va_codegen_success_AES256EncryptRound
9) (va_pbool_and (va_codegen_success_AES256EncryptRound 10) (va_pbool_and
(va_codegen_success_AES256EncryptRound 11) (va_pbool_and (va_codegen_success_AES256EncryptRound
12) (va_pbool_and (va_codegen_success_AES256EncryptRound 13) (va_pbool_and
(va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` 14)) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_Vcipherlast (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec
2)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)) (va_ttrue ())))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_AES256EncryptBlock (va_mods:va_mods_t) (input:quad32) (key:(seq nat32))
(round_keys:(seq quad32)) (keys_buffer:buffer128) : (va_quickCode unit
(va_code_AES256EncryptBlock ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_qAssertSquash
va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 262 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540)))
Vale.Def.Types_s.quad32 round_keys 0) (fun _ -> let (init:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.quad32_xor input (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0)
in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 264 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 265 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret keys_buffer 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 266 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 267 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 1 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 268 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 2 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 269 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 3 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 270 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 4 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 271 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 5 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 272 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 6 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 273 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 7 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 274 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 8 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 275 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 9 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 276 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 10 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 277 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 11 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 278 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 12 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 279 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 13 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 280 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` 14)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 281 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret keys_buffer 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 282 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipherlast (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 285 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 286 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.aes_encrypt_word_reveal ()) (va_QEmpty
(())))))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_AES256EncryptBlock va_b0 va_s0 input key round_keys keys_buffer =
let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in
let va_qc = va_qcode_AES256EncryptBlock va_mods input key round_keys keys_buffer in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_AES256EncryptBlock ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 240 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 260 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 0 va_sM == Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key input)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 2; 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_AES256EncryptBlock input key round_keys keys_buffer va_s0 va_k =
let (va_sM, va_f0) = va_lemma_AES256EncryptBlock (va_code_AES256EncryptBlock ()) va_s0 input key
round_keys keys_buffer in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 2 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 2; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- AES256EncryptRound_6way
val va_code_AES256EncryptRound_6way : n:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_AES256EncryptRound_6way n =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n)) (va_CCons
(va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 6)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 6)) (va_CNil ()))))))))))
val va_codegen_success_AES256EncryptRound_6way : n:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_AES256EncryptRound_6way n =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n))
(va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 6) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_Vcipher (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6))
(va_pbool_and (va_codegen_success_Vcipher (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 6)) (va_pbool_and (va_codegen_success_Vcipher (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 6)) (va_pbool_and (va_codegen_success_Vcipher
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 6)) (va_pbool_and
(va_codegen_success_Vcipher (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 6))
(va_pbool_and (va_codegen_success_Vcipher (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5)
(va_op_vec_opr_vec 6)) (va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_AES256EncryptRound_6way (va_mods:va_mods_t) (n:nat8) (init1:quad32) (init2:quad32)
(init3:quad32) (init4:quad32) (init5:quad32) (init6:quad32) (round_keys:(seq quad32))
(keys_buffer:buffer128) : (va_quickCode unit (va_code_AES256EncryptRound_6way n)) =
(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 323 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 324 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 6)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret keys_buffer n) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 325 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipher (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 326 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipher (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 6)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 327 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipher (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 6)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 328 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipher (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 6)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 329 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipher (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 6)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 330 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipher (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 5) (va_op_vec_opr_vec 6)) (va_QEmpty
(())))))))))))
val va_lemma_AES256EncryptRound_6way : va_b0:va_code -> va_s0:va_state -> n:nat8 -> init1:quad32 ->
init2:quad32 -> init3:quad32 -> init4:quad32 -> init5:quad32 -> init6:quad32 -> round_keys:(seq
quad32) -> keys_buffer:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AES256EncryptRound_6way n) va_s0 /\ va_get_ok va_s0 /\
(1 <= n /\ n < 14 /\ 14 <= FStar.Seq.Base.length #quad32 round_keys) /\ va_get_vec 0 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init1 round_keys (n - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init2 round_keys (n - 1) /\ va_get_vec 2 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init3 round_keys (n - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init4 round_keys (n - 1) /\ va_get_vec 4 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init5 round_keys (n - 1) /\ va_get_vec 5 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init6 round_keys (n - 1) /\ va_get_reg 4 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 keys_buffer (va_get_mem_heaplet 0
va_s0) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0)
keys_buffer 15 (va_get_mem_layout va_s0) Secret /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read keys_buffer n (va_get_mem_heaplet 0 va_s0)) ==
FStar.Seq.Base.index #quad32 round_keys n))
(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 0 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init1 round_keys n /\ va_get_vec 1
va_sM == Vale.AES.AES_BE_s.eval_rounds_def init2 round_keys n /\ va_get_vec 2 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init3 round_keys n /\ va_get_vec 3 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init4 round_keys n /\ va_get_vec 4 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init5 round_keys n /\ va_get_vec 5 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init6 round_keys n /\ 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)))))))))))
[@"opaque_to_smt"]
let va_lemma_AES256EncryptRound_6way va_b0 va_s0 n init1 init2 init3 init4 init5 init6 round_keys
keys_buffer =
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_AES256EncryptRound_6way va_mods n init1 init2 init3 init4 init5 init6
round_keys keys_buffer in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_AES256EncryptRound_6way n) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 289 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 316 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 0 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init1 round_keys n) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 317 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init2 round_keys n) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 318 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 2 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init3 round_keys n) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 319 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init4 round_keys n) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 320 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 4 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init5 round_keys n) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 321 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 5 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init6 round_keys n)) 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)
[@ va_qattr]
let va_wp_AES256EncryptRound_6way (n:nat8) (init1:quad32) (init2:quad32) (init3:quad32)
(init4:quad32) (init5:quad32) (init6:quad32) (round_keys:(seq quad32)) (keys_buffer:buffer128)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (1 <= n /\ n < 14 /\ 14 <= FStar.Seq.Base.length #quad32 round_keys) /\
va_get_vec 0 va_s0 == Vale.AES.AES_BE_s.eval_rounds_def init1 round_keys (n - 1) /\ va_get_vec
1 va_s0 == Vale.AES.AES_BE_s.eval_rounds_def init2 round_keys (n - 1) /\ va_get_vec 2 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init3 round_keys (n - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init4 round_keys (n - 1) /\ va_get_vec 4 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init5 round_keys (n - 1) /\ va_get_vec 5 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init6 round_keys (n - 1) /\ va_get_reg 4 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 keys_buffer (va_get_mem_heaplet 0
va_s0) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0)
keys_buffer 15 (va_get_mem_layout va_s0) Secret /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read keys_buffer n (va_get_mem_heaplet 0 va_s0)) ==
FStar.Seq.Base.index #quad32 round_keys n /\ (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)
(va_x_v6:quad32) . let va_sM = va_upd_vec 6 va_x_v6 (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 /\ va_get_vec 0 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init1 round_keys n /\ va_get_vec 1 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init2 round_keys n /\ va_get_vec 2 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init3 round_keys n /\ va_get_vec 3 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init4 round_keys n /\ va_get_vec 4 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init5 round_keys n /\ va_get_vec 5 va_sM ==
Vale.AES.AES_BE_s.eval_rounds_def init6 round_keys n ==> va_k va_sM (())))
val va_wpProof_AES256EncryptRound_6way : n:nat8 -> init1:quad32 -> init2:quad32 -> init3:quad32 ->
init4:quad32 -> init5:quad32 -> init6:quad32 -> round_keys:(seq quad32) -> keys_buffer:buffer128
-> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AES256EncryptRound_6way n init1 init2 init3 init4 init5
init6 round_keys keys_buffer va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AES256EncryptRound_6way n)
([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_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_AES256EncryptRound_6way n init1 init2 init3 init4 init5 init6 round_keys keys_buffer
va_s0 va_k =
let (va_sM, va_f0) = va_lemma_AES256EncryptRound_6way (va_code_AES256EncryptRound_6way n) va_s0 n
init1 init2 init3 init4 init5 init6 round_keys keys_buffer 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)
[@ "opaque_to_smt" va_qattr]
let va_quick_AES256EncryptRound_6way (n:nat8) (init1:quad32) (init2:quad32) (init3:quad32)
(init4:quad32) (init5:quad32) (init6:quad32) (round_keys:(seq quad32)) (keys_buffer:buffer128) :
(va_quickCode unit (va_code_AES256EncryptRound_6way n)) =
(va_QProc (va_code_AES256EncryptRound_6way n) ([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_wp_AES256EncryptRound_6way n init1 init2 init3 init4 init5 init6 round_keys keys_buffer)
(va_wpProof_AES256EncryptRound_6way n init1 init2 init3 init4 init5 init6 round_keys
keys_buffer))
//--
//-- AES256EncryptBlock_6way
[@ "opaque_to_smt" va_qattr]
let va_code_AES256EncryptBlock_6way () =
(va_Block (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block
(va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_Block (va_CNil ())) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 0) (va_CCons
(va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 6)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons (va_code_Vxor (va_op_vec_opr_vec
0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 5)
(va_op_vec_opr_vec 5) (va_op_vec_opr_vec 6)) (va_CCons (va_code_AES256EncryptRound_6way 1)
(va_CCons (va_code_AES256EncryptRound_6way 2) (va_CCons (va_code_AES256EncryptRound_6way 3)
(va_CCons (va_code_AES256EncryptRound_6way 4) (va_CCons (va_code_AES256EncryptRound_6way 5)
(va_CCons (va_code_AES256EncryptRound_6way 6) (va_CCons (va_code_AES256EncryptRound_6way 7)
(va_CCons (va_code_AES256EncryptRound_6way 8) (va_CCons (va_code_AES256EncryptRound_6way 9)
(va_CCons (va_code_AES256EncryptRound_6way 10) (va_CCons (va_code_AES256EncryptRound_6way 11)
(va_CCons (va_code_AES256EncryptRound_6way 12) (va_CCons (va_code_AES256EncryptRound_6way 13)
(va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` 14)) (va_CCons
(va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 6)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons (va_code_Vcipherlast
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 6)) (va_CCons
(va_code_Vcipherlast (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 6))
(va_CCons (va_code_Vcipherlast (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec
6)) (va_CCons (va_code_Vcipherlast (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 6)) (va_CCons (va_code_Vcipherlast (va_op_vec_opr_vec 4) (va_op_vec_opr_vec
4) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vcipherlast (va_op_vec_opr_vec 5)
(va_op_vec_opr_vec 5) (va_op_vec_opr_vec 6)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 6)
(va_op_vec_opr_vec 6) (va_op_vec_opr_vec 6)) (va_CNil ())))))))))))))))))))))))))))))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_pbool | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.PPC64LE.Decls.va_pbool_and",
"Vale.PPC64LE.InsBasic.va_codegen_success_LoadImm64",
"Vale.PPC64LE.Decls.va_op_reg_opr_reg",
"Vale.PPC64LE.InsVector.va_codegen_success_Load128_byte16_buffer_index",
"Vale.PPC64LE.Decls.va_op_heaplet_mem_heaplet",
"Vale.PPC64LE.Decls.va_op_vec_opr_vec",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.PPC64LE.InsVector.va_codegen_success_Vxor",
"Vale.AES.PPC64LE.AES256.va_codegen_success_AES256EncryptRound_6way",
"Prims.op_Multiply",
"Vale.PPC64LE.InsVector.va_codegen_success_Vcipherlast",
"Vale.PPC64LE.Decls.va_ttrue",
"Vale.PPC64LE.Decls.va_pbool"
] | [] | false | false | false | true | false | let va_codegen_success_AES256EncryptBlock_6way () =
| (va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 0)
(va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 6)
(va_op_reg_opr_reg 4)
(va_op_reg_opr_reg 10)
Secret)
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 6))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 6))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 6))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 6))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 6))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 5)
(va_op_vec_opr_vec 5)
(va_op_vec_opr_vec 6))
(va_pbool_and (va_codegen_success_AES256EncryptRound_6way 1)
(va_pbool_and (va_codegen_success_AES256EncryptRound_6way 2)
(va_pbool_and (va_codegen_success_AES256EncryptRound_6way 3)
(va_pbool_and (va_codegen_success_AES256EncryptRound_6way
4)
(va_pbool_and (va_codegen_success_AES256EncryptRound_6way
5)
(va_pbool_and (va_codegen_success_AES256EncryptRound_6way
6)
(va_pbool_and (va_codegen_success_AES256EncryptRound_6way
7)
(va_pbool_and (va_codegen_success_AES256EncryptRound_6way
8)
(va_pbool_and (va_codegen_success_AES256EncryptRound_6way
9)
(va_pbool_and (va_codegen_success_AES256EncryptRound_6way
10)
(va_pbool_and (va_codegen_success_AES256EncryptRound_6way
11)
(va_pbool_and (va_codegen_success_AES256EncryptRound_6way
12)
(va_pbool_and (va_codegen_success_AES256EncryptRound_6way
13)
(va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg
10)
(16
`op_Multiply`
14))
(va_pbool_and
(va_codegen_success_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet
0
)
(va_op_vec_opr_vec
6
)
(va_op_reg_opr_reg
4
)
(va_op_reg_opr_reg
10
)
Secret
)
(va_pbool_and
(va_codegen_success_Vcipherlast
(
va_op_vec_opr_vec
0
)
(
va_op_vec_opr_vec
0
)
(
va_op_vec_opr_vec
6
)
)
(va_pbool_and
(
va_codegen_success_Vcipherlast
(
va_op_vec_opr_vec
1
)
(
va_op_vec_opr_vec
1
)
(
va_op_vec_opr_vec
6
)
)
(
va_pbool_and
(
va_codegen_success_Vcipherlast
(
va_op_vec_opr_vec
2
)
(
va_op_vec_opr_vec
2
)
(
va_op_vec_opr_vec
6
)
)
(
va_pbool_and
(
va_codegen_success_Vcipherlast
(
va_op_vec_opr_vec
3
)
(
va_op_vec_opr_vec
3
)
(
va_op_vec_opr_vec
6
)
)
(
va_pbool_and
(
va_codegen_success_Vcipherlast
(
va_op_vec_opr_vec
4
)
(
va_op_vec_opr_vec
4
)
(
va_op_vec_opr_vec
6
)
)
(
va_pbool_and
(
va_codegen_success_Vcipherlast
(
va_op_vec_opr_vec
5
)
(
va_op_vec_opr_vec
5
)
(
va_op_vec_opr_vec
6
)
)
(
va_pbool_and
(
va_codegen_success_Vxor
(
va_op_vec_opr_vec
6
)
(
va_op_vec_opr_vec
6
)
(
va_op_vec_opr_vec
6
)
)
(
va_ttrue
()
)
)
)
)
)
)
))
))))))))))))
))))))))))) | false |
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_quick_KeyExpansionRoundOdd256 | val va_quick_KeyExpansionRoundOdd256 (round: nat8) (dst: buffer128) (key: (seq nat32))
: (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) | val va_quick_KeyExpansionRoundOdd256 (round: nat8) (dst: buffer128) (key: (seq nat32))
: (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) | let va_quick_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) : (va_quickCode
unit (va_code_KeyExpansionRoundOdd256 round)) =
(va_QProc (va_code_KeyExpansionRoundOdd256 round) ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_KeyExpansionRoundOdd256
round dst key) (va_wpProof_KeyExpansionRoundOdd256 round dst key)) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 70,
"end_line": 408,
"start_col": 0,
"start_line": 404
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round
rcon) va_s0 round rcon dst key 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 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1
va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32)) :
(va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(va_QProc (va_code_KeyExpansionRoundEven256 round rcon) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem])
(va_wp_KeyExpansionRoundEven256 round rcon dst key) (va_wpProof_KeyExpansionRoundEven256 round
rcon dst key))
//--
//-- KeyExpansionRoundOdd256
val va_code_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundOdd256 round =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
()))))))))))))))
val va_codegen_success_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundOdd256 round =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundOdd256 (va_mods:va_mods_t) (round:nat8) (dst:buffer128) (key:(seq
nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) =
(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 114 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 115 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 116 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 117 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 118 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 120 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 121 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 123 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 124 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 125 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 127 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg23:Prims.int) = round + 1
in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg21:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg21 va_arg22 0 va_arg23)
(let (va_arg20:Prims.int) = round + 1 in let (va_arg19:Vale.Def.Types_s.quad32) = va_get_vec 1
va_old_s in let (va_arg18:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 129 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_round_key_256_rcon_odd va_arg18 va_arg19 0
va_arg20) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 130 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(())))))))))))))))))))
val va_lemma_KeyExpansionRoundOdd256 : va_b0:va_code -> va_s0:va_state -> round:nat8 ->
dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundOdd256 round) va_s0 /\ va_get_ok
va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0)
dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10
va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundOdd256 va_b0 va_s0 round dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundOdd256 va_mods round dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundOdd256 round) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 92 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 102 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 110 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 111 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 112 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32)
(va_x_v4:quad32) . let va_sM = va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem
va_x_mem va_s0)))))) in va_get_ok va_sM /\ Vale.PPC64LE.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15 (va_get_mem_layout va_sM) Secret /\
va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec 3 va_sM ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundOdd256 : round:nat8 -> dst:buffer128 -> key:(seq nat32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundOdd256 round dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundOdd256 round)
([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1;
va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundOdd256 round dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundOdd256 (va_code_KeyExpansionRoundOdd256 round)
va_s0 round dst key in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
round: Vale.PPC64LE.Memory.nat8 ->
dst: Vale.PPC64LE.Memory.buffer128 ->
key: FStar.Seq.Base.seq Vale.PPC64LE.Memory.nat32
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.AES.PPC64LE.AES256.va_code_KeyExpansionRoundOdd256 round) | Prims.Tot | [
"total"
] | [] | [
"Vale.PPC64LE.Memory.nat8",
"Vale.PPC64LE.Memory.buffer128",
"FStar.Seq.Base.seq",
"Vale.PPC64LE.Memory.nat32",
"Vale.PPC64LE.QuickCode.va_QProc",
"Prims.unit",
"Vale.AES.PPC64LE.AES256.va_code_KeyExpansionRoundOdd256",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Vale.PPC64LE.QuickCode.va_Mod_mem_heaplet",
"Vale.PPC64LE.QuickCode.va_Mod_mem",
"Prims.Nil",
"Vale.AES.PPC64LE.AES256.va_wp_KeyExpansionRoundOdd256",
"Vale.AES.PPC64LE.AES256.va_wpProof_KeyExpansionRoundOdd256",
"Vale.PPC64LE.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_KeyExpansionRoundOdd256 (round: nat8) (dst: buffer128) (key: (seq nat32))
: (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) =
| (va_QProc (va_code_KeyExpansionRoundOdd256 round)
([
va_Mod_vec 4;
va_Mod_vec 3;
va_Mod_vec 2;
va_Mod_vec 0;
va_Mod_reg 10;
va_Mod_mem_heaplet 1;
va_Mod_mem
])
(va_wp_KeyExpansionRoundOdd256 round dst key)
(va_wpProof_KeyExpansionRoundOdd256 round dst key)) | false |
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_codegen_success_KeyExpansionRoundUnrolledRecursive256 | val va_codegen_success_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_pbool(decreases %[n]) | val va_codegen_success_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_pbool(decreases %[n]) | let rec va_codegen_success_KeyExpansionRoundUnrolledRecursive256 n =
(va_pbool_and (if (1 < n && n <= 14) then va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_pbool_and (if (n
`op_Modulus` 2 = 0) then va_pbool_and (va_codegen_success_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_ttrue ()) else va_pbool_and
(va_codegen_success_KeyExpansionRoundOdd256 (n - 1)) (va_ttrue ())) (va_ttrue ())) else
va_ttrue ()) (va_ttrue ())) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 31,
"end_line": 430,
"start_col": 0,
"start_line": 424
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round
rcon) va_s0 round rcon dst key 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 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1
va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32)) :
(va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(va_QProc (va_code_KeyExpansionRoundEven256 round rcon) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem])
(va_wp_KeyExpansionRoundEven256 round rcon dst key) (va_wpProof_KeyExpansionRoundEven256 round
rcon dst key))
//--
//-- KeyExpansionRoundOdd256
val va_code_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundOdd256 round =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
()))))))))))))))
val va_codegen_success_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundOdd256 round =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundOdd256 (va_mods:va_mods_t) (round:nat8) (dst:buffer128) (key:(seq
nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) =
(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 114 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 115 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 116 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 117 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 118 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 120 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 121 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 123 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 124 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 125 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 127 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg23:Prims.int) = round + 1
in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg21:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg21 va_arg22 0 va_arg23)
(let (va_arg20:Prims.int) = round + 1 in let (va_arg19:Vale.Def.Types_s.quad32) = va_get_vec 1
va_old_s in let (va_arg18:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 129 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_round_key_256_rcon_odd va_arg18 va_arg19 0
va_arg20) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 130 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(())))))))))))))))))))
val va_lemma_KeyExpansionRoundOdd256 : va_b0:va_code -> va_s0:va_state -> round:nat8 ->
dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundOdd256 round) va_s0 /\ va_get_ok
va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0)
dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10
va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundOdd256 va_b0 va_s0 round dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundOdd256 va_mods round dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundOdd256 round) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 92 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 102 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 110 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 111 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 112 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32)
(va_x_v4:quad32) . let va_sM = va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem
va_x_mem va_s0)))))) in va_get_ok va_sM /\ Vale.PPC64LE.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15 (va_get_mem_layout va_sM) Secret /\
va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec 3 va_sM ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundOdd256 : round:nat8 -> dst:buffer128 -> key:(seq nat32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundOdd256 round dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundOdd256 round)
([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1;
va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundOdd256 round dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundOdd256 (va_code_KeyExpansionRoundOdd256 round)
va_s0 round dst key in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) : (va_quickCode
unit (va_code_KeyExpansionRoundOdd256 round)) =
(va_QProc (va_code_KeyExpansionRoundOdd256 round) ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_KeyExpansionRoundOdd256
round dst key) (va_wpProof_KeyExpansionRoundOdd256 round dst key))
//--
//-- KeyExpansionRoundUnrolledRecursive256
val va_code_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_code(decreases %[n])
[@ "opaque_to_smt"]
let rec va_code_KeyExpansionRoundUnrolledRecursive256 n =
(va_Block (va_CCons (if (1 < n && n <= 14) then va_Block (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_CCons (if (n `op_Modulus` 2 = 0)
then va_Block (va_CCons (va_code_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_CNil ())) else va_Block (va_CCons
(va_code_KeyExpansionRoundOdd256 (n - 1)) (va_CNil ()))) (va_CNil ()))) else va_Block (va_CNil
())) (va_CNil ())))
val va_codegen_success_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_pbool(decreases %[n]) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | n: Prims.int -> Prims.Tot Vale.PPC64LE.Decls.va_pbool | Prims.Tot | [
"total",
""
] | [] | [
"Prims.int",
"Vale.PPC64LE.Decls.va_pbool_and",
"Prims.op_AmpAmp",
"Prims.op_LessThan",
"Prims.op_LessThanOrEqual",
"Vale.AES.PPC64LE.AES256.va_codegen_success_KeyExpansionRoundUnrolledRecursive256",
"Prims.op_Subtraction",
"Prims.op_Equality",
"Prims.op_Modulus",
"Vale.AES.PPC64LE.AES256.va_codegen_success_KeyExpansionRoundEven256",
"Vale.AES.AES_common_s.aes_rcon",
"Prims.op_Division",
"Vale.PPC64LE.Decls.va_ttrue",
"Prims.bool",
"Vale.AES.PPC64LE.AES256.va_codegen_success_KeyExpansionRoundOdd256",
"Vale.PPC64LE.Decls.va_pbool"
] | [
"recursion"
] | false | false | false | true | false | let rec va_codegen_success_KeyExpansionRoundUnrolledRecursive256 n =
| (va_pbool_and (if (1 < n && n <= 14)
then
va_pbool_and (va_codegen_success_KeyExpansionRoundUnrolledRecursive256 (n - 1))
(va_pbool_and (if (n `op_Modulus` 2 = 0)
then
va_pbool_and (va_codegen_success_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1)))
(va_ttrue ())
else va_pbool_and (va_codegen_success_KeyExpansionRoundOdd256 (n - 1)) (va_ttrue ())
)
(va_ttrue ()))
else va_ttrue ())
(va_ttrue ())) | false |
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_wpProof_KeyExpansionRoundEven256 | val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) | val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) | let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round
rcon) va_s0 round rcon dst key 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 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1
va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 22,
"end_line": 216,
"start_col": 0,
"start_line": 206
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
round: Vale.PPC64LE.Memory.nat8 ->
rcon: Vale.PPC64LE.Memory.nat8 ->
dst: Vale.PPC64LE.Memory.buffer128 ->
key: FStar.Seq.Base.seq Vale.PPC64LE.Memory.nat32 ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Prims.Ghost ((Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) * Prims.unit) | Prims.Ghost | [] | [] | [
"Vale.PPC64LE.Memory.nat8",
"Vale.PPC64LE.Memory.buffer128",
"FStar.Seq.Base.seq",
"Vale.PPC64LE.Memory.nat32",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Vale.PPC64LE.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple3",
"Vale.PPC64LE.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Vale.PPC64LE.QuickCode.va_Mod_mem_heaplet",
"Vale.PPC64LE.QuickCode.va_Mod_mem",
"Prims.Nil",
"Prims._assert",
"Vale.PPC64LE.Decls.va_state_eq",
"Vale.PPC64LE.Decls.va_update_vec",
"Vale.PPC64LE.Decls.va_update_reg",
"Vale.PPC64LE.Decls.va_update_mem_heaplet",
"Vale.PPC64LE.Decls.va_update_ok",
"Vale.PPC64LE.Decls.va_update_mem",
"Vale.PPC64LE.Decls.va_lemma_upd_update",
"FStar.Pervasives.Native.tuple3",
"FStar.Pervasives.Native.tuple2",
"Vale.PPC64LE.Machine_s.state",
"Vale.AES.PPC64LE.AES256.va_lemma_KeyExpansionRoundEven256",
"Vale.AES.PPC64LE.AES256.va_code_KeyExpansionRoundEven256"
] | [] | false | false | false | false | false | let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
| let va_sM, va_f0 =
va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round rcon)
va_s0
round
rcon
dst
key
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 2
va_sM
(va_update_vec 1
va_sM
(va_update_vec 0
va_sM
(va_update_reg 10
va_sM
(va_update_mem_heaplet 1
va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([
va_Mod_vec 5;
va_Mod_vec 4;
va_Mod_vec 2;
va_Mod_vec 1;
va_Mod_vec 0;
va_Mod_reg 10;
va_Mod_mem_heaplet 1;
va_Mod_mem
])
va_sM
va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | false |
MerkleTree.Low.fst | MerkleTree.Low.mt_retract_to_ | val mt_retract_to_:
#hsz:hash_size_t ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
lv:uint32_t{lv < V.size_of hs} ->
i:index_t ->
s:index_t ->
j:index_t{i <= s && s <= j && v j < pow2 (U32.v (V.size_of hs) - v lv)}
-> HST.ST unit
(requires (fun h0 ->
RV.rv_inv h0 hs /\
mt_safe_elts h0 lv hs i j))
(ensures (fun h0 _ h1 ->
// memory safety
(modifies (loc_union
(RV.rv_loc_elems h0 hs lv (V.size_of hs))
(V.loc_vector_within hs lv (V.size_of hs)))
h0 h1) /\
RV.rv_inv h1 hs /\
mt_safe_elts h1 lv hs i s /\
// correctness
(mt_safe_elts_spec h0 lv hs i j;
S.equal (RV.as_seq h1 hs)
(MTH.mt_retract_to_
(RV.as_seq h0 hs) (U32.v lv)
(U32.v i) (U32.v s) (U32.v j)))
))
(decreases (U32.v merkle_tree_size_lg - U32.v lv)) | val mt_retract_to_:
#hsz:hash_size_t ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
lv:uint32_t{lv < V.size_of hs} ->
i:index_t ->
s:index_t ->
j:index_t{i <= s && s <= j && v j < pow2 (U32.v (V.size_of hs) - v lv)}
-> HST.ST unit
(requires (fun h0 ->
RV.rv_inv h0 hs /\
mt_safe_elts h0 lv hs i j))
(ensures (fun h0 _ h1 ->
// memory safety
(modifies (loc_union
(RV.rv_loc_elems h0 hs lv (V.size_of hs))
(V.loc_vector_within hs lv (V.size_of hs)))
h0 h1) /\
RV.rv_inv h1 hs /\
mt_safe_elts h1 lv hs i s /\
// correctness
(mt_safe_elts_spec h0 lv hs i j;
S.equal (RV.as_seq h1 hs)
(MTH.mt_retract_to_
(RV.as_seq h0 hs) (U32.v lv)
(U32.v i) (U32.v s) (U32.v j)))
))
(decreases (U32.v merkle_tree_size_lg - U32.v lv)) | let rec mt_retract_to_ #hsz hs lv i s j =
let hh0 = HST.get () in
// Base conditions
mt_safe_elts_rec hh0 lv hs i j;
V.loc_vector_within_included hs 0ul lv;
V.loc_vector_within_included hs lv (lv + 1ul);
V.loc_vector_within_included hs (lv + 1ul) (V.size_of hs);
V.loc_vector_within_disjoint hs lv (lv + 1ul) (lv + 1ul) (V.size_of hs);
if lv >= V.size_of hs then ()
else begin
// 1) Retract hashes at level `lv`.
let hvec = V.index hs lv in
let old_len = j - offset_of i in
let new_len = s - offset_of i in
let retracted = RV.shrink hvec new_len in
let hh1 = HST.get () in
// 1-0) Basic disjointness conditions for `RV.assign`
V.forall2_forall_left hh0 hs 0ul (V.size_of hs) lv
(fun b1 b2 -> HH.disjoint (Rgl?.region_of (hvreg hsz) b1)
(Rgl?.region_of (hvreg hsz) b2));
V.forall2_forall_right hh0 hs 0ul (V.size_of hs) lv
(fun b1 b2 -> HH.disjoint (Rgl?.region_of (hvreg hsz) b1)
(Rgl?.region_of (hvreg hsz) b2));
V.forall_preserved
hs 0ul lv
(fun b -> HH.disjoint (Rgl?.region_of (hvreg hsz) hvec)
(Rgl?.region_of (hvreg hsz) b))
(RV.loc_rvector hvec)
hh0 hh1;
V.forall_preserved
hs (lv + 1ul) (V.size_of hs)
(fun b -> HH.disjoint (Rgl?.region_of (hvreg hsz) hvec)
(Rgl?.region_of (hvreg hsz) b))
(RV.loc_rvector hvec)
hh0 hh1;
assert (Rgl?.region_of (hvreg hsz) hvec == Rgl?.region_of (hvreg hsz) retracted);
// 1-1) For the `modifies` postcondition.
assert (modifies (RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv)) hh0 hh1);
// 1-2) Preservation
RV.rv_loc_elems_preserved
hs (lv + 1ul) (V.size_of hs)
(RV.loc_rvector (V.get hh0 hs lv)) hh0 hh1;
// 1-3) For `mt_safe_elts`
assert (V.size_of retracted == new_len);
mt_safe_elts_preserved
(lv + 1ul) hs (i / 2ul) (j / 2ul)
(RV.loc_rvector (V.get hh0 hs lv)) hh0 hh1;
// 1-4) For the `rv_inv` postcondition
RV.rs_loc_elems_elem_disj
(hvreg hsz) (V.as_seq hh0 hs) (V.frameOf hs)
0 (U32.v (V.size_of hs)) 0 (U32.v lv) (U32.v lv);
RV.rs_loc_elems_parent_disj
(hvreg hsz) (V.as_seq hh0 hs) (V.frameOf hs)
0 (U32.v lv);
RV.rv_elems_inv_preserved
hs 0ul lv (RV.loc_rvector (V.get hh0 hs lv))
hh0 hh1;
assert (RV.rv_elems_inv hh1 hs 0ul lv);
RV.rs_loc_elems_elem_disj
(hvreg hsz) (V.as_seq hh0 hs) (V.frameOf hs)
0 (U32.v (V.size_of hs))
(U32.v lv + 1) (U32.v (V.size_of hs))
(U32.v lv);
RV.rs_loc_elems_parent_disj
(hvreg hsz) (V.as_seq hh0 hs) (V.frameOf hs)
(U32.v lv + 1) (U32.v (V.size_of hs));
RV.rv_elems_inv_preserved
hs (lv + 1ul) (V.size_of hs) (RV.loc_rvector (V.get hh0 hs lv))
hh0 hh1;
assert (RV.rv_elems_inv hh1 hs (lv + 1ul) (V.size_of hs));
assert (rv_itself_inv hh1 hs);
assert (elems_reg hh1 hs);
// 1-5) Correctness
assert (S.equal (RV.as_seq hh1 retracted)
(S.slice (RV.as_seq hh0 (V.get hh0 hs lv)) 0 (U32.v new_len)));
RV.assign hs lv retracted;
let hh2 = HST.get() in
// 2-1) For the `modifies` postcondition.
assert (modifies (V.loc_vector_within hs lv (lv + 1ul)) hh1 hh2);
assert (modifies (loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul))) hh0 hh2);
// 2-2) Preservation
V.loc_vector_within_disjoint hs lv (lv + 1ul) (lv + 1ul) (V.size_of hs);
RV.rv_loc_elems_preserved
hs (lv + 1ul) (V.size_of hs)
(V.loc_vector_within hs lv (lv + 1ul)) hh1 hh2;
// 2-3) For `mt_safe_elts`
assert (V.size_of (V.get hh2 hs lv) == s - offset_of i);
mt_safe_elts_preserved
(lv + 1ul) hs (i / 2ul) (j / 2ul)
(V.loc_vector_within hs lv (lv + 1ul)) hh1 hh2;
// 2-4) Correctness
RV.as_seq_sub_preserved hs 0ul lv (loc_rvector retracted) hh0 hh1;
RV.as_seq_sub_preserved hs (lv + 1ul) merkle_tree_size_lg (loc_rvector retracted) hh0 hh1;
assert (S.equal (RV.as_seq hh2 hs)
(S.append
(RV.as_seq_sub hh0 hs 0ul lv)
(S.cons (RV.as_seq hh1 retracted)
(RV.as_seq_sub hh0 hs (lv + 1ul) merkle_tree_size_lg))));
as_seq_sub_upd hh0 hs lv (RV.as_seq hh1 retracted);
if lv + 1ul < V.size_of hs then
begin
assert (mt_safe_elts hh2 (lv + 1ul) hs (i / 2ul) (j / 2ul));
mt_safe_elts_spec hh2 (lv + 1ul) hs (i / 2ul) (j / 2ul);
mt_retract_to_ hs (lv + 1ul) (i / 2ul) (s / 2ul) (j / 2ul);
// 3-0) Memory safety brought from the postcondition of the recursion
let hh3 = HST.get () in
assert (modifies
(loc_union
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
(loc_union
(RV.rv_loc_elems hh0 hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs))))
hh0 hh3);
mt_flush_to_modifies_rec_helper lv hs hh0;
V.loc_vector_within_disjoint hs lv (lv + 1ul) (lv + 1ul) (V.size_of hs);
V.loc_vector_within_included hs lv (lv + 1ul);
RV.rv_loc_elems_included hh2 hs (lv + 1ul) (V.size_of hs);
assert (loc_disjoint
(V.loc_vector_within hs lv (lv + 1ul))
(RV.rv_loc_elems hh2 hs (lv + 1ul) (V.size_of hs)));
V.get_preserved hs lv
(loc_union
(RV.rv_loc_elems hh2 hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)))
hh2 hh3;
assert (V.size_of (V.get hh3 hs lv) == s - offset_of i);
assert (RV.rv_inv hh3 hs);
mt_safe_elts_constr hh3 lv hs i s;
assert (mt_safe_elts hh3 lv hs i s);
// 3-1) Correctness
mt_safe_elts_spec hh2 (lv + 1ul) hs (i / 2ul) (j / 2ul);
assert (U32.v lv + 1 < S.length (RV.as_seq hh3 hs) ==>
S.equal (RV.as_seq hh3 hs)
(MTH.mt_retract_to_ (RV.as_seq hh2 hs) (U32.v lv + 1)
(U32.v i / 2) (U32.v s / 2) (U32.v j / 2)));
assert (RV.rv_inv hh0 hs);
assert (mt_safe_elts hh0 lv hs i j);
mt_safe_elts_spec hh0 lv hs i j;
assert (S.equal (RV.as_seq hh3 hs)
(MTH.mt_retract_to_ (RV.as_seq hh0 hs) (U32.v lv)
(U32.v i) (U32.v s) (U32.v j)))
end
else begin
let hh3 = HST.get() in
assert ((modifies (loc_union
(RV.rv_loc_elems hh0 hs lv (V.size_of hs))
(V.loc_vector_within hs lv (V.size_of hs)))
hh0 hh3));
assert (RV.rv_inv hh3 hs /\ mt_safe_elts hh3 lv hs i s);
mt_safe_elts_spec hh0 lv hs i j;
assert (S.equal (RV.as_seq hh3 hs)
(MTH.mt_retract_to_
(RV.as_seq hh0 hs) (U32.v lv)
(U32.v i) (U32.v s) (U32.v j)))
end
end | {
"file_name": "src/MerkleTree.Low.fst",
"git_rev": "7d7bdc20f2033171e279c176b26e84f9069d23c6",
"git_url": "https://github.com/hacl-star/merkle-tree.git",
"project_name": "merkle-tree"
} | {
"end_col": 5,
"end_line": 2741,
"start_col": 0,
"start_line": 2561
} | module MerkleTree.Low
open EverCrypt.Helpers
open FStar.All
open FStar.Integers
open FStar.Mul
open LowStar.Buffer
open LowStar.BufferOps
open LowStar.Vector
open LowStar.Regional
open LowStar.RVector
open LowStar.Regional.Instances
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module MHS = FStar.Monotonic.HyperStack
module HH = FStar.Monotonic.HyperHeap
module B = LowStar.Buffer
module CB = LowStar.ConstBuffer
module V = LowStar.Vector
module RV = LowStar.RVector
module RVI = LowStar.Regional.Instances
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module MTH = MerkleTree.New.High
module MTS = MerkleTree.Spec
open Lib.IntTypes
open MerkleTree.Low.Datastructures
open MerkleTree.Low.Hashfunctions
open MerkleTree.Low.VectorExtras
#set-options "--z3rlimit 10 --initial_fuel 0 --max_fuel 0 --initial_ifuel 0 --max_ifuel 0"
type const_pointer (a:Type0) = b:CB.const_buffer a{CB.length b == 1 /\ CB.qual_of b == CB.MUTABLE}
/// Low-level Merkle tree data structure
///
// NOTE: because of a lack of 64-bit LowStar.Buffer support, currently
// we cannot change below to some other types.
type index_t = uint32_t
let uint32_32_max = 4294967295ul
inline_for_extraction
let uint32_max = 4294967295UL
let uint64_max = 18446744073709551615UL
let offset_range_limit = uint32_max
type offset_t = uint64_t
inline_for_extraction noextract unfold let u32_64 = Int.Cast.uint32_to_uint64
inline_for_extraction noextract unfold let u64_32 = Int.Cast.uint64_to_uint32
private inline_for_extraction
let offsets_connect (x:offset_t) (y:offset_t): Tot bool = y >= x && (y - x) <= offset_range_limit
private inline_for_extraction
let split_offset (tree:offset_t) (index:offset_t{offsets_connect tree index}): Tot index_t =
[@inline_let] let diff = U64.sub_mod index tree in
assert (diff <= offset_range_limit);
Int.Cast.uint64_to_uint32 diff
private inline_for_extraction
let add64_fits (x:offset_t) (i:index_t): Tot bool = uint64_max - x >= (u32_64 i)
private inline_for_extraction
let join_offset (tree:offset_t) (i:index_t{add64_fits tree i}): Tot (r:offset_t{offsets_connect tree r}) =
U64.add tree (u32_64 i)
inline_for_extraction val merkle_tree_size_lg: uint32_t
let merkle_tree_size_lg = 32ul
// A Merkle tree `MT i j hs rhs_ok rhs` stores all necessary hashes to generate
// a Merkle path for each element from the index `i` to `j-1`.
// - Parameters
// `hs`: a 2-dim store for hashes, where `hs[0]` contains leaf hash values.
// `rhs_ok`: to check the rightmost hashes are up-to-date
// `rhs`: a store for "rightmost" hashes, manipulated only when required to
// calculate some merkle paths that need the rightmost hashes
// as a part of them.
// `mroot`: during the construction of `rhs` we can also calculate the Merkle
// root of the tree. If `rhs_ok` is true then it has the up-to-date
// root value.
noeq type merkle_tree =
| MT: hash_size:hash_size_t ->
offset:offset_t ->
i:index_t -> j:index_t{i <= j /\ add64_fits offset j} ->
hs:hash_vv hash_size {V.size_of hs = merkle_tree_size_lg} ->
rhs_ok:bool ->
rhs:hash_vec #hash_size {V.size_of rhs = merkle_tree_size_lg} ->
mroot:hash #hash_size ->
hash_spec:Ghost.erased (MTS.hash_fun_t #(U32.v hash_size)) ->
hash_fun:hash_fun_t #hash_size #hash_spec ->
merkle_tree
type mt_p = B.pointer merkle_tree
type const_mt_p = const_pointer merkle_tree
inline_for_extraction
let merkle_tree_conditions (#hsz:Ghost.erased hash_size_t) (offset:uint64_t) (i j:uint32_t) (hs:hash_vv hsz) (rhs_ok:bool) (rhs:hash_vec #hsz) (mroot:hash #hsz): Tot bool =
j >= i && add64_fits offset j &&
V.size_of hs = merkle_tree_size_lg &&
V.size_of rhs = merkle_tree_size_lg
// The maximum number of currently held elements in the tree is (2^32 - 1).
// cwinter: even when using 64-bit indices, we fail if the underlying 32-bit
// vector is full; this can be fixed if necessary.
private inline_for_extraction
val mt_not_full_nst: mtv:merkle_tree -> Tot bool
let mt_not_full_nst mtv = MT?.j mtv < uint32_32_max
val mt_not_full: HS.mem -> mt_p -> GTot bool
let mt_not_full h mt = mt_not_full_nst (B.get h mt 0)
/// (Memory) Safety
val offset_of: i:index_t -> Tot index_t
let offset_of i = if i % 2ul = 0ul then i else i - 1ul
// `mt_safe_elts` says that it is safe to access an element from `i` to `j - 1`
// at level `lv` in the Merkle tree, i.e., hs[lv][k] (i <= k < j) is a valid
// element.
inline_for_extraction noextract
val mt_safe_elts:
#hsz:hash_size_t ->
h:HS.mem -> lv:uint32_t{lv <= merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
i:index_t -> j:index_t{j >= i} ->
GTot Type0 (decreases (32 - U32.v lv))
let rec mt_safe_elts #hsz h lv hs i j =
if lv = merkle_tree_size_lg then true
else (let ofs = offset_of i in
V.size_of (V.get h hs lv) == j - ofs /\
mt_safe_elts #hsz h (lv + 1ul) hs (i / 2ul) (j / 2ul))
#push-options "--initial_fuel 1 --max_fuel 1"
val mt_safe_elts_constr:
#hsz:hash_size_t ->
h:HS.mem -> lv:uint32_t{lv < merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
i:index_t -> j:index_t{j >= i} ->
Lemma (requires (V.size_of (V.get h hs lv) == j - offset_of i /\
mt_safe_elts #hsz h (lv + 1ul) hs (i / 2ul) (j / 2ul)))
(ensures (mt_safe_elts #hsz h lv hs i j))
let mt_safe_elts_constr #_ h lv hs i j = ()
val mt_safe_elts_head:
#hsz:hash_size_t ->
h:HS.mem -> lv:uint32_t{lv < merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
i:index_t -> j:index_t{j >= i} ->
Lemma (requires (mt_safe_elts #hsz h lv hs i j))
(ensures (V.size_of (V.get h hs lv) == j - offset_of i))
let mt_safe_elts_head #_ h lv hs i j = ()
val mt_safe_elts_rec:
#hsz:hash_size_t ->
h:HS.mem -> lv:uint32_t{lv < merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
i:index_t -> j:index_t{j >= i} ->
Lemma (requires (mt_safe_elts #hsz h lv hs i j))
(ensures (mt_safe_elts #hsz h (lv + 1ul) hs (i / 2ul) (j / 2ul)))
let mt_safe_elts_rec #_ h lv hs i j = ()
val mt_safe_elts_init:
#hsz:hash_size_t ->
h:HS.mem -> lv:uint32_t{lv <= merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
Lemma (requires (V.forall_ h hs lv (V.size_of hs)
(fun hv -> V.size_of hv = 0ul)))
(ensures (mt_safe_elts #hsz h lv hs 0ul 0ul))
(decreases (32 - U32.v lv))
let rec mt_safe_elts_init #hsz h lv hs =
if lv = merkle_tree_size_lg then ()
else mt_safe_elts_init #hsz h (lv + 1ul) hs
#pop-options
val mt_safe_elts_preserved:
#hsz:hash_size_t ->
lv:uint32_t{lv <= merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
i:index_t -> j:index_t{j >= i} ->
p:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma (requires (V.live h0 hs /\
mt_safe_elts #hsz h0 lv hs i j /\
loc_disjoint p (V.loc_vector_within hs lv (V.size_of hs)) /\
modifies p h0 h1))
(ensures (mt_safe_elts #hsz h1 lv hs i j))
(decreases (32 - U32.v lv))
[SMTPat (V.live h0 hs);
SMTPat (mt_safe_elts #hsz h0 lv hs i j);
SMTPat (loc_disjoint p (RV.loc_rvector hs));
SMTPat (modifies p h0 h1)]
#push-options "--z3rlimit 100 --initial_fuel 2 --max_fuel 2"
let rec mt_safe_elts_preserved #hsz lv hs i j p h0 h1 =
if lv = merkle_tree_size_lg then ()
else (V.get_preserved hs lv p h0 h1;
mt_safe_elts_preserved #hsz (lv + 1ul) hs (i / 2ul) (j / 2ul) p h0 h1)
#pop-options
// `mt_safe` is the invariant of a Merkle tree through its lifetime.
// It includes liveness, regionality, disjointness (to each data structure),
// and valid element access (`mt_safe_elts`).
inline_for_extraction noextract
val mt_safe: HS.mem -> mt_p -> GTot Type0
let mt_safe h mt =
B.live h mt /\ B.freeable mt /\
(let mtv = B.get h mt 0 in
// Liveness & Accessibility
RV.rv_inv h (MT?.hs mtv) /\
RV.rv_inv h (MT?.rhs mtv) /\
Rgl?.r_inv (hreg (MT?.hash_size mtv)) h (MT?.mroot mtv) /\
mt_safe_elts h 0ul (MT?.hs mtv) (MT?.i mtv) (MT?.j mtv) /\
// Regionality
HH.extends (V.frameOf (MT?.hs mtv)) (B.frameOf mt) /\
HH.extends (V.frameOf (MT?.rhs mtv)) (B.frameOf mt) /\
HH.extends (B.frameOf (MT?.mroot mtv)) (B.frameOf mt) /\
HH.disjoint (V.frameOf (MT?.hs mtv)) (V.frameOf (MT?.rhs mtv)) /\
HH.disjoint (V.frameOf (MT?.hs mtv)) (B.frameOf (MT?.mroot mtv)) /\
HH.disjoint (V.frameOf (MT?.rhs mtv)) (B.frameOf (MT?.mroot mtv)))
// Since a Merkle tree satisfies regionality, it's ok to take all regions from
// a tree pointer as a location of the tree.
val mt_loc: mt_p -> GTot loc
let mt_loc mt = B.loc_all_regions_from false (B.frameOf mt)
val mt_safe_preserved:
mt:mt_p -> p:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma (requires (mt_safe h0 mt /\
loc_disjoint p (mt_loc mt) /\
modifies p h0 h1))
(ensures (B.get h0 mt 0 == B.get h1 mt 0 /\
mt_safe h1 mt))
let mt_safe_preserved mt p h0 h1 =
assert (loc_includes (mt_loc mt) (B.loc_buffer mt));
let mtv = B.get h0 mt 0 in
assert (loc_includes (mt_loc mt) (RV.loc_rvector (MT?.hs mtv)));
assert (loc_includes (mt_loc mt) (RV.loc_rvector (MT?.rhs mtv)));
assert (loc_includes (mt_loc mt) (V.loc_vector (MT?.hs mtv)));
assert (loc_includes (mt_loc mt)
(B.loc_all_regions_from false (B.frameOf (MT?.mroot mtv))));
RV.rv_inv_preserved (MT?.hs mtv) p h0 h1;
RV.rv_inv_preserved (MT?.rhs mtv) p h0 h1;
Rgl?.r_sep (hreg (MT?.hash_size mtv)) (MT?.mroot mtv) p h0 h1;
V.loc_vector_within_included (MT?.hs mtv) 0ul (V.size_of (MT?.hs mtv));
mt_safe_elts_preserved 0ul (MT?.hs mtv) (MT?.i mtv) (MT?.j mtv) p h0 h1
/// Lifting to a high-level Merkle tree structure
val mt_safe_elts_spec:
#hsz:hash_size_t ->
h:HS.mem ->
lv:uint32_t{lv <= merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
i:index_t ->
j:index_t{j >= i} ->
Lemma (requires (RV.rv_inv h hs /\
mt_safe_elts #hsz h lv hs i j))
(ensures (MTH.hs_wf_elts #(U32.v hsz)
(U32.v lv) (RV.as_seq h hs)
(U32.v i) (U32.v j)))
(decreases (32 - U32.v lv))
#push-options "--z3rlimit 100 --initial_fuel 2 --max_fuel 2"
let rec mt_safe_elts_spec #_ h lv hs i j =
if lv = merkle_tree_size_lg then ()
else mt_safe_elts_spec h (lv + 1ul) hs (i / 2ul) (j / 2ul)
#pop-options
val merkle_tree_lift:
h:HS.mem ->
mtv:merkle_tree{
RV.rv_inv h (MT?.hs mtv) /\
RV.rv_inv h (MT?.rhs mtv) /\
Rgl?.r_inv (hreg (MT?.hash_size mtv)) h (MT?.mroot mtv) /\
mt_safe_elts #(MT?.hash_size mtv) h 0ul (MT?.hs mtv) (MT?.i mtv) (MT?.j mtv)} ->
GTot (r:MTH.merkle_tree #(U32.v (MT?.hash_size mtv)) {MTH.mt_wf_elts #_ r})
let merkle_tree_lift h mtv =
mt_safe_elts_spec h 0ul (MT?.hs mtv) (MT?.i mtv) (MT?.j mtv);
MTH.MT #(U32.v (MT?.hash_size mtv))
(U32.v (MT?.i mtv))
(U32.v (MT?.j mtv))
(RV.as_seq h (MT?.hs mtv))
(MT?.rhs_ok mtv)
(RV.as_seq h (MT?.rhs mtv))
(Rgl?.r_repr (hreg (MT?.hash_size mtv)) h (MT?.mroot mtv))
(Ghost.reveal (MT?.hash_spec mtv))
val mt_lift:
h:HS.mem -> mt:mt_p{mt_safe h mt} ->
GTot (r:MTH.merkle_tree #(U32.v (MT?.hash_size (B.get h mt 0))) {MTH.mt_wf_elts #_ r})
let mt_lift h mt =
merkle_tree_lift h (B.get h mt 0)
val mt_preserved:
mt:mt_p -> p:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma (requires (mt_safe h0 mt /\
loc_disjoint p (mt_loc mt) /\
modifies p h0 h1))
(ensures (mt_safe_preserved mt p h0 h1;
mt_lift h0 mt == mt_lift h1 mt))
let mt_preserved mt p h0 h1 =
assert (loc_includes (B.loc_all_regions_from false (B.frameOf mt))
(B.loc_buffer mt));
B.modifies_buffer_elim mt p h0 h1;
assert (B.get h0 mt 0 == B.get h1 mt 0);
assert (loc_includes (B.loc_all_regions_from false (B.frameOf mt))
(RV.loc_rvector (MT?.hs (B.get h0 mt 0))));
assert (loc_includes (B.loc_all_regions_from false (B.frameOf mt))
(RV.loc_rvector (MT?.rhs (B.get h0 mt 0))));
assert (loc_includes (B.loc_all_regions_from false (B.frameOf mt))
(B.loc_buffer (MT?.mroot (B.get h0 mt 0))));
RV.as_seq_preserved (MT?.hs (B.get h0 mt 0)) p h0 h1;
RV.as_seq_preserved (MT?.rhs (B.get h0 mt 0)) p h0 h1;
B.modifies_buffer_elim (MT?.mroot (B.get h0 mt 0)) p h0 h1
/// Construction
// Note that the public function for creation is `mt_create` defined below,
// which builds a tree with an initial hash.
#push-options "--z3rlimit 100 --initial_fuel 1 --max_fuel 1 --initial_ifuel 1 --max_ifuel 1"
private
val create_empty_mt:
hash_size:hash_size_t ->
hash_spec:Ghost.erased (MTS.hash_fun_t #(U32.v hash_size)) ->
hash_fun:hash_fun_t #hash_size #hash_spec ->
r:HST.erid ->
HST.ST mt_p
(requires (fun _ -> true))
(ensures (fun h0 mt h1 ->
let dmt = B.get h1 mt 0 in
// memory safety
B.frameOf mt = r /\
modifies (mt_loc mt) h0 h1 /\
mt_safe h1 mt /\
mt_not_full h1 mt /\
// correctness
MT?.hash_size dmt = hash_size /\
MT?.offset dmt = 0UL /\
merkle_tree_lift h1 dmt == MTH.create_empty_mt #_ #(Ghost.reveal hash_spec) ()))
let create_empty_mt hsz hash_spec hash_fun r =
[@inline_let] let hrg = hreg hsz in
[@inline_let] let hvrg = hvreg hsz in
[@inline_let] let hvvrg = hvvreg hsz in
let hs_region = HST.new_region r in
let hs = RV.alloc_rid hvrg merkle_tree_size_lg hs_region in
let h0 = HST.get () in
mt_safe_elts_init #hsz h0 0ul hs;
let rhs_region = HST.new_region r in
let rhs = RV.alloc_rid hrg merkle_tree_size_lg rhs_region in
let h1 = HST.get () in
assert (RV.as_seq h1 rhs == S.create 32 (MTH.hash_init #(U32.v hsz)));
RV.rv_inv_preserved hs (V.loc_vector rhs) h0 h1;
RV.as_seq_preserved hs (V.loc_vector rhs) h0 h1;
V.loc_vector_within_included hs 0ul (V.size_of hs);
mt_safe_elts_preserved #hsz 0ul hs 0ul 0ul (V.loc_vector rhs) h0 h1;
let mroot_region = HST.new_region r in
let mroot = rg_alloc hrg mroot_region in
let h2 = HST.get () in
RV.as_seq_preserved hs loc_none h1 h2;
RV.as_seq_preserved rhs loc_none h1 h2;
mt_safe_elts_preserved #hsz 0ul hs 0ul 0ul loc_none h1 h2;
let mt = B.malloc r (MT hsz 0UL 0ul 0ul hs false rhs mroot hash_spec hash_fun) 1ul in
let h3 = HST.get () in
RV.as_seq_preserved hs loc_none h2 h3;
RV.as_seq_preserved rhs loc_none h2 h3;
Rgl?.r_sep hrg mroot loc_none h2 h3;
mt_safe_elts_preserved #hsz 0ul hs 0ul 0ul loc_none h2 h3;
mt
#pop-options
/// Destruction (free)
val mt_free: mt:mt_p ->
HST.ST unit
(requires (fun h0 -> mt_safe h0 mt))
(ensures (fun h0 _ h1 -> modifies (mt_loc mt) h0 h1))
#push-options "--z3rlimit 100"
let mt_free mt =
let mtv = !*mt in
RV.free (MT?.hs mtv);
RV.free (MT?.rhs mtv);
[@inline_let] let rg = hreg (MT?.hash_size mtv) in
rg_free rg (MT?.mroot mtv);
B.free mt
#pop-options
/// Insertion
private
val as_seq_sub_upd:
#a:Type0 -> #rst:Type -> #rg:regional rst a ->
h:HS.mem -> rv:rvector #a #rst rg ->
i:uint32_t{i < V.size_of rv} -> v:Rgl?.repr rg ->
Lemma (requires (RV.rv_inv h rv))
(ensures (S.equal (S.upd (RV.as_seq h rv) (U32.v i) v)
(S.append
(RV.as_seq_sub h rv 0ul i)
(S.cons v (RV.as_seq_sub h rv (i + 1ul) (V.size_of rv))))))
#push-options "--z3rlimit 20"
let as_seq_sub_upd #a #rst #rg h rv i v =
Seq.Properties.slice_upd (RV.as_seq h rv) 0 (U32.v i) (U32.v i) v;
Seq.Properties.slice_upd (RV.as_seq h rv) (U32.v i + 1) (U32.v (V.size_of rv)) (U32.v i) v;
RV.as_seq_seq_slice rg h (V.as_seq h rv)
0 (U32.v (V.size_of rv)) 0 (U32.v i);
assert (S.equal (S.slice (RV.as_seq h rv) 0 (U32.v i))
(RV.as_seq_sub h rv 0ul i));
RV.as_seq_seq_slice rg h (V.as_seq h rv)
0 (U32.v (V.size_of rv)) (U32.v i + 1) (U32.v (V.size_of rv));
assert (S.equal (S.slice (RV.as_seq h rv) (U32.v i + 1) (U32.v (V.size_of rv)))
(RV.as_seq_sub h rv (i + 1ul) (V.size_of rv)));
assert (S.index (S.upd (RV.as_seq h rv) (U32.v i) v) (U32.v i) == v)
#pop-options
// `hash_vv_insert_copy` inserts a hash element at a level `lv`, by copying
// and pushing its content to `hs[lv]`. For detailed insertion procedure, see
// `insert_` and `mt_insert`.
#push-options "--z3rlimit 100 --initial_fuel 1 --max_fuel 1"
private
inline_for_extraction
val hash_vv_insert_copy:
#hsz:hash_size_t ->
lv:uint32_t{lv < merkle_tree_size_lg} ->
i:Ghost.erased index_t ->
j:index_t{
Ghost.reveal i <= j &&
U32.v j < pow2 (32 - U32.v lv) - 1 &&
j < uint32_32_max} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
v:hash #hsz ->
HST.ST unit
(requires (fun h0 ->
RV.rv_inv h0 hs /\
Rgl?.r_inv (hreg hsz) h0 v /\
HH.disjoint (V.frameOf hs) (B.frameOf v) /\
mt_safe_elts #hsz h0 lv hs (Ghost.reveal i) j))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq h0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
h0 h1 /\
RV.rv_inv h1 hs /\
Rgl?.r_inv (hreg hsz) h1 v /\
V.size_of (V.get h1 hs lv) == j + 1ul - offset_of (Ghost.reveal i) /\
V.size_of (V.get h1 hs lv) == V.size_of (V.get h0 hs lv) + 1ul /\
mt_safe_elts #hsz h1 (lv + 1ul) hs (Ghost.reveal i / 2ul) (j / 2ul) /\
RV.rv_loc_elems h0 hs (lv + 1ul) (V.size_of hs) ==
RV.rv_loc_elems h1 hs (lv + 1ul) (V.size_of hs) /\
// correctness
(mt_safe_elts_spec #hsz h0 lv hs (Ghost.reveal i) j;
S.equal (RV.as_seq h1 hs)
(MTH.hashess_insert
(U32.v lv) (U32.v (Ghost.reveal i)) (U32.v j)
(RV.as_seq h0 hs) (Rgl?.r_repr (hreg hsz) h0 v))) /\
S.equal (S.index (RV.as_seq h1 hs) (U32.v lv))
(S.snoc (S.index (RV.as_seq h0 hs) (U32.v lv))
(Rgl?.r_repr (hreg hsz) h0 v))))
let hash_vv_insert_copy #hsz lv i j hs v =
let hh0 = HST.get () in
mt_safe_elts_rec hh0 lv hs (Ghost.reveal i) j;
/// 1) Insert an element at the level `lv`, where the new vector is not yet
/// connected to `hs`.
let ihv = RV.insert_copy (hcpy hsz) (V.index hs lv) v in
let hh1 = HST.get () in
// 1-0) Basic disjointness conditions
V.forall2_forall_left hh0 hs 0ul (V.size_of hs) lv
(fun b1 b2 -> HH.disjoint (Rgl?.region_of (hvreg hsz) b1)
(Rgl?.region_of (hvreg hsz) b2));
V.forall2_forall_right hh0 hs 0ul (V.size_of hs) lv
(fun b1 b2 -> HH.disjoint (Rgl?.region_of (hvreg hsz) b1)
(Rgl?.region_of (hvreg hsz) b2));
V.loc_vector_within_included hs lv (lv + 1ul);
V.loc_vector_within_included hs (lv + 1ul) (V.size_of hs);
V.loc_vector_within_disjoint hs lv (lv + 1ul) (lv + 1ul) (V.size_of hs);
// 1-1) For the `modifies` postcondition.
assert (modifies (RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv)) hh0 hh1);
// 1-2) Preservation
Rgl?.r_sep (hreg hsz) v (RV.loc_rvector (V.get hh0 hs lv)) hh0 hh1;
RV.rv_loc_elems_preserved
hs (lv + 1ul) (V.size_of hs)
(RV.loc_rvector (V.get hh0 hs lv)) hh0 hh1;
// 1-3) For `mt_safe_elts`
assert (V.size_of ihv == j + 1ul - offset_of (Ghost.reveal i)); // head updated
mt_safe_elts_preserved
(lv + 1ul) hs (Ghost.reveal i / 2ul) (j / 2ul)
(RV.loc_rvector (V.get hh0 hs lv)) hh0 hh1; // tail not yet
// 1-4) For the `rv_inv` postcondition
RV.rs_loc_elems_elem_disj
(hvreg hsz) (V.as_seq hh0 hs) (V.frameOf hs)
0 (U32.v (V.size_of hs)) 0 (U32.v lv) (U32.v lv);
RV.rs_loc_elems_parent_disj
(hvreg hsz) (V.as_seq hh0 hs) (V.frameOf hs)
0 (U32.v lv);
RV.rv_elems_inv_preserved
hs 0ul lv (RV.loc_rvector (V.get hh0 hs lv))
hh0 hh1;
assert (RV.rv_elems_inv hh1 hs 0ul lv);
RV.rs_loc_elems_elem_disj
(hvreg hsz) (V.as_seq hh0 hs) (V.frameOf hs)
0 (U32.v (V.size_of hs))
(U32.v lv + 1) (U32.v (V.size_of hs))
(U32.v lv);
RV.rs_loc_elems_parent_disj
(hvreg hsz) (V.as_seq hh0 hs) (V.frameOf hs)
(U32.v lv + 1) (U32.v (V.size_of hs));
RV.rv_elems_inv_preserved
hs (lv + 1ul) (V.size_of hs) (RV.loc_rvector (V.get hh0 hs lv))
hh0 hh1;
assert (RV.rv_elems_inv hh1 hs (lv + 1ul) (V.size_of hs));
// assert (rv_itself_inv hh1 hs);
// assert (elems_reg hh1 hs);
// 1-5) Correctness
assert (S.equal (RV.as_seq hh1 ihv)
(S.snoc (RV.as_seq hh0 (V.get hh0 hs lv)) (Rgl?.r_repr (hreg hsz) hh0 v)));
/// 2) Assign the updated vector to `hs` at the level `lv`.
RV.assign hs lv ihv;
let hh2 = HST.get () in
// 2-1) For the `modifies` postcondition.
assert (modifies (V.loc_vector_within hs lv (lv + 1ul)) hh1 hh2);
assert (modifies (loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul))) hh0 hh2);
// 2-2) Preservation
Rgl?.r_sep (hreg hsz) v (RV.loc_rvector hs) hh1 hh2;
RV.rv_loc_elems_preserved
hs (lv + 1ul) (V.size_of hs)
(V.loc_vector_within hs lv (lv + 1ul)) hh1 hh2;
// 2-3) For `mt_safe_elts`
assert (V.size_of (V.get hh2 hs lv) == j + 1ul - offset_of (Ghost.reveal i));
mt_safe_elts_preserved
(lv + 1ul) hs (Ghost.reveal i / 2ul) (j / 2ul)
(V.loc_vector_within hs lv (lv + 1ul)) hh1 hh2;
// 2-4) Correctness
RV.as_seq_sub_preserved hs 0ul lv (loc_rvector ihv) hh0 hh1;
RV.as_seq_sub_preserved hs (lv + 1ul) merkle_tree_size_lg (loc_rvector ihv) hh0 hh1;
assert (S.equal (RV.as_seq hh2 hs)
(S.append
(RV.as_seq_sub hh0 hs 0ul lv)
(S.cons (RV.as_seq hh1 ihv)
(RV.as_seq_sub hh0 hs (lv + 1ul) merkle_tree_size_lg))));
as_seq_sub_upd hh0 hs lv (RV.as_seq hh1 ihv)
#pop-options
private
val insert_index_helper_even:
lv:uint32_t{lv < merkle_tree_size_lg} ->
j:index_t{U32.v j < pow2 (32 - U32.v lv) - 1} ->
Lemma (requires (j % 2ul <> 1ul))
(ensures (U32.v j % 2 <> 1 /\ j / 2ul == (j + 1ul) / 2ul))
let insert_index_helper_even lv j = ()
#push-options "--z3rlimit 100 --initial_fuel 1 --max_fuel 1 --initial_ifuel 1 --max_ifuel 1"
private
val insert_index_helper_odd:
lv:uint32_t{lv < merkle_tree_size_lg} ->
i:index_t ->
j:index_t{i <= j && U32.v j < pow2 (32 - U32.v lv) - 1} ->
Lemma (requires (j % 2ul = 1ul /\
j < uint32_32_max))
(ensures (U32.v j % 2 = 1 /\
U32.v (j / 2ul) < pow2 (32 - U32.v (lv + 1ul)) - 1 /\
(j + 1ul) / 2ul == j / 2ul + 1ul /\
j - offset_of i > 0ul))
let insert_index_helper_odd lv i j = ()
#pop-options
private
val loc_union_assoc_4:
a:loc -> b:loc -> c:loc -> d:loc ->
Lemma (loc_union (loc_union a b) (loc_union c d) ==
loc_union (loc_union a c) (loc_union b d))
let loc_union_assoc_4 a b c d =
loc_union_assoc (loc_union a b) c d;
loc_union_assoc a b c;
loc_union_assoc a c b;
loc_union_assoc (loc_union a c) b d
private
val insert_modifies_rec_helper:
#hsz:hash_size_t ->
lv:uint32_t{lv < merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
aloc:loc ->
h:HS.mem ->
Lemma (loc_union
(loc_union
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq h hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
aloc)
(loc_union
(loc_union
(RV.rv_loc_elems h hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)))
aloc) ==
loc_union
(loc_union
(RV.rv_loc_elems h hs lv (V.size_of hs))
(V.loc_vector_within hs lv (V.size_of hs)))
aloc)
#push-options "--z3rlimit 100 --initial_fuel 2 --max_fuel 2"
let insert_modifies_rec_helper #hsz lv hs aloc h =
assert (V.loc_vector_within hs lv (V.size_of hs) ==
loc_union (V.loc_vector_within hs lv (lv + 1ul))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)));
RV.rs_loc_elems_rec_inverse (hvreg hsz) (V.as_seq h hs) (U32.v lv) (U32.v (V.size_of hs));
assert (RV.rv_loc_elems h hs lv (V.size_of hs) ==
loc_union (RV.rs_loc_elem (hvreg hsz) (V.as_seq h hs) (U32.v lv))
(RV.rv_loc_elems h hs (lv + 1ul) (V.size_of hs)));
// Applying some association rules...
loc_union_assoc
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq h hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul))) aloc
(loc_union
(loc_union
(RV.rv_loc_elems h hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)))
aloc);
loc_union_assoc
(loc_union
(RV.rv_loc_elems h hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs))) aloc aloc;
loc_union_assoc
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq h hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
(loc_union
(RV.rv_loc_elems h hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)))
aloc;
loc_union_assoc_4
(RV.rs_loc_elem (hvreg hsz) (V.as_seq h hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul))
(RV.rv_loc_elems h hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs))
#pop-options
private
val insert_modifies_union_loc_weakening:
l1:loc -> l2:loc -> l3:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma (requires (modifies l1 h0 h1))
(ensures (modifies (loc_union (loc_union l1 l2) l3) h0 h1))
let insert_modifies_union_loc_weakening l1 l2 l3 h0 h1 =
B.loc_includes_union_l l1 l2 l1;
B.loc_includes_union_l (loc_union l1 l2) l3 (loc_union l1 l2)
private
val insert_snoc_last_helper:
#a:Type -> s:S.seq a{S.length s > 0} -> v:a ->
Lemma (S.index (S.snoc s v) (S.length s - 1) == S.last s)
let insert_snoc_last_helper #a s v = ()
private
val rv_inv_rv_elems_reg:
#a:Type0 -> #rst:Type -> #rg:regional rst a ->
h:HS.mem -> rv:rvector rg ->
i:uint32_t -> j:uint32_t{i <= j && j <= V.size_of rv} ->
Lemma (requires (RV.rv_inv h rv))
(ensures (RV.rv_elems_reg h rv i j))
let rv_inv_rv_elems_reg #a #rst #rg h rv i j = ()
// `insert_` recursively inserts proper hashes to each level `lv` by
// accumulating a compressed hash. For example, if there are three leaf elements
// in the tree, `insert_` will change `hs` as follow:
// (`hij` is a compressed hash from `hi` to `hj`)
//
// BEFORE INSERTION AFTER INSERTION
// lv
// 0 h0 h1 h2 ====> h0 h1 h2 h3
// 1 h01 h01 h23
// 2 h03
//
private
val insert_:
#hsz:hash_size_t ->
#hash_spec:Ghost.erased (MTS.hash_fun_t #(U32.v hsz)) ->
lv:uint32_t{lv < merkle_tree_size_lg} ->
i:Ghost.erased index_t ->
j:index_t{
Ghost.reveal i <= j &&
U32.v j < pow2 (32 - U32.v lv) - 1 &&
j < uint32_32_max} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
acc:hash #hsz ->
hash_fun:hash_fun_t #hsz #hash_spec ->
HST.ST unit
(requires (fun h0 ->
RV.rv_inv h0 hs /\
Rgl?.r_inv (hreg hsz) h0 acc /\
HH.disjoint (V.frameOf hs) (B.frameOf acc) /\
mt_safe_elts h0 lv hs (Ghost.reveal i) j))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (loc_union
(loc_union
(RV.rv_loc_elems h0 hs lv (V.size_of hs))
(V.loc_vector_within hs lv (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf acc)))
h0 h1 /\
RV.rv_inv h1 hs /\
Rgl?.r_inv (hreg hsz) h1 acc /\
mt_safe_elts h1 lv hs (Ghost.reveal i) (j + 1ul) /\
// correctness
(mt_safe_elts_spec h0 lv hs (Ghost.reveal i) j;
S.equal (RV.as_seq h1 hs)
(MTH.insert_ #(U32.v hsz) #hash_spec (U32.v lv) (U32.v (Ghost.reveal i)) (U32.v j)
(RV.as_seq h0 hs) (Rgl?.r_repr (hreg hsz) h0 acc)))))
(decreases (U32.v j))
#push-options "--z3rlimit 800 --initial_fuel 1 --max_fuel 1 --initial_ifuel 1 --max_ifuel 1"
let rec insert_ #hsz #hash_spec lv i j hs acc hash_fun =
let hh0 = HST.get () in
hash_vv_insert_copy lv i j hs acc;
let hh1 = HST.get () in
// Base conditions
V.loc_vector_within_included hs lv (lv + 1ul);
V.loc_vector_within_included hs (lv + 1ul) (V.size_of hs);
V.loc_vector_within_disjoint hs lv (lv + 1ul) (lv + 1ul) (V.size_of hs);
assert (V.size_of (V.get hh1 hs lv) == j + 1ul - offset_of (Ghost.reveal i));
assert (mt_safe_elts hh1 (lv + 1ul) hs (Ghost.reveal i / 2ul) (j / 2ul));
if j % 2ul = 1ul
then (insert_index_helper_odd lv (Ghost.reveal i) j;
assert (S.length (S.index (RV.as_seq hh0 hs) (U32.v lv)) > 0);
let lvhs = V.index hs lv in
assert (U32.v (V.size_of lvhs) ==
S.length (S.index (RV.as_seq hh0 hs) (U32.v lv)) + 1);
assert (V.size_of lvhs > 1ul);
/// 3) Update the accumulator `acc`.
hash_vec_rv_inv_r_inv hh1 (V.get hh1 hs lv) (V.size_of (V.get hh1 hs lv) - 2ul);
assert (Rgl?.r_inv (hreg hsz) hh1 acc);
hash_fun (V.index lvhs (V.size_of lvhs - 2ul)) acc acc;
let hh2 = HST.get () in
// 3-1) For the `modifies` postcondition
assert (modifies (B.loc_all_regions_from false (B.frameOf acc)) hh1 hh2);
assert (modifies
(loc_union
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
(B.loc_all_regions_from false (B.frameOf acc)))
hh0 hh2);
// 3-2) Preservation
RV.rv_inv_preserved
hs (B.loc_region_only false (B.frameOf acc)) hh1 hh2;
RV.as_seq_preserved
hs (B.loc_region_only false (B.frameOf acc)) hh1 hh2;
RV.rv_loc_elems_preserved
hs (lv + 1ul) (V.size_of hs)
(B.loc_region_only false (B.frameOf acc)) hh1 hh2;
assert (RV.rv_inv hh2 hs);
assert (Rgl?.r_inv (hreg hsz) hh2 acc);
// 3-3) For `mt_safe_elts`
V.get_preserved hs lv
(B.loc_region_only false (B.frameOf acc)) hh1 hh2; // head preserved
mt_safe_elts_preserved
(lv + 1ul) hs (Ghost.reveal i / 2ul) (j / 2ul)
(B.loc_region_only false (B.frameOf acc)) hh1 hh2; // tail preserved
// 3-4) Correctness
insert_snoc_last_helper
(RV.as_seq hh0 (V.get hh0 hs lv))
(Rgl?.r_repr (hreg hsz) hh0 acc);
assert (S.equal (Rgl?.r_repr (hreg hsz) hh2 acc) // `nacc` in `MTH.insert_`
((Ghost.reveal hash_spec)
(S.last (S.index (RV.as_seq hh0 hs) (U32.v lv)))
(Rgl?.r_repr (hreg hsz) hh0 acc)));
/// 4) Recursion
insert_ (lv + 1ul)
(Ghost.hide (Ghost.reveal i / 2ul)) (j / 2ul)
hs acc hash_fun;
let hh3 = HST.get () in
// 4-0) Memory safety brought from the postcondition of the recursion
assert (RV.rv_inv hh3 hs);
assert (Rgl?.r_inv (hreg hsz) hh3 acc);
assert (modifies (loc_union
(loc_union
(RV.rv_loc_elems hh0 hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf acc)))
hh2 hh3);
assert (modifies
(loc_union
(loc_union
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
(B.loc_all_regions_from false (B.frameOf acc)))
(loc_union
(loc_union
(RV.rv_loc_elems hh0 hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf acc))))
hh0 hh3);
// 4-1) For `mt_safe_elts`
rv_inv_rv_elems_reg hh2 hs (lv + 1ul) (V.size_of hs);
RV.rv_loc_elems_included hh2 hs (lv + 1ul) (V.size_of hs);
assert (loc_disjoint
(V.loc_vector_within hs lv (lv + 1ul))
(RV.rv_loc_elems hh2 hs (lv + 1ul) (V.size_of hs)));
assert (loc_disjoint
(V.loc_vector_within hs lv (lv + 1ul))
(B.loc_all_regions_from false (B.frameOf acc)));
V.get_preserved hs lv
(loc_union
(loc_union
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs))
(RV.rv_loc_elems hh2 hs (lv + 1ul) (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf acc)))
hh2 hh3;
assert (V.size_of (V.get hh3 hs lv) ==
j + 1ul - offset_of (Ghost.reveal i)); // head preserved
assert (mt_safe_elts hh3 (lv + 1ul) hs
(Ghost.reveal i / 2ul) (j / 2ul + 1ul)); // tail by recursion
mt_safe_elts_constr hh3 lv hs (Ghost.reveal i) (j + 1ul);
assert (mt_safe_elts hh3 lv hs (Ghost.reveal i) (j + 1ul));
// 4-2) Correctness
mt_safe_elts_spec hh2 (lv + 1ul) hs (Ghost.reveal i / 2ul) (j / 2ul);
assert (S.equal (RV.as_seq hh3 hs)
(MTH.insert_ #(U32.v hsz) #(Ghost.reveal hash_spec) (U32.v lv + 1) (U32.v (Ghost.reveal i) / 2) (U32.v j / 2)
(RV.as_seq hh2 hs) (Rgl?.r_repr (hreg hsz) hh2 acc)));
mt_safe_elts_spec hh0 lv hs (Ghost.reveal i) j;
MTH.insert_rec #(U32.v hsz) #(Ghost.reveal hash_spec) (U32.v lv) (U32.v (Ghost.reveal i)) (U32.v j)
(RV.as_seq hh0 hs) (Rgl?.r_repr (hreg hsz) hh0 acc);
assert (S.equal (RV.as_seq hh3 hs)
(MTH.insert_ #(U32.v hsz) #(Ghost.reveal hash_spec) (U32.v lv) (U32.v (Ghost.reveal i)) (U32.v j)
(RV.as_seq hh0 hs) (Rgl?.r_repr (hreg hsz) hh0 acc))))
else (insert_index_helper_even lv j;
// memory safety
assert (mt_safe_elts hh1 (lv + 1ul) hs (Ghost.reveal i / 2ul) ((j + 1ul) / 2ul));
mt_safe_elts_constr hh1 lv hs (Ghost.reveal i) (j + 1ul);
assert (mt_safe_elts hh1 lv hs (Ghost.reveal i) (j + 1ul));
assert (modifies
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
hh0 hh1);
insert_modifies_union_loc_weakening
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
(B.loc_all_regions_from false (B.frameOf acc))
(loc_union
(loc_union
(RV.rv_loc_elems hh0 hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf acc)))
hh0 hh1;
// correctness
mt_safe_elts_spec hh0 lv hs (Ghost.reveal i) j;
MTH.insert_base #(U32.v hsz) #(Ghost.reveal hash_spec) (U32.v lv) (U32.v (Ghost.reveal i)) (U32.v j)
(RV.as_seq hh0 hs) (Rgl?.r_repr (hreg hsz) hh0 acc);
assert (S.equal (RV.as_seq hh1 hs)
(MTH.insert_ #(U32.v hsz) #(Ghost.reveal hash_spec) (U32.v lv) (U32.v (Ghost.reveal i)) (U32.v j)
(RV.as_seq hh0 hs) (Rgl?.r_repr (hreg hsz) hh0 acc))));
/// 5) Proving the postcondition after recursion
let hh4 = HST.get () in
// 5-1) For the `modifies` postcondition.
assert (modifies
(loc_union
(loc_union
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
(B.loc_all_regions_from false (B.frameOf acc)))
(loc_union
(loc_union
(RV.rv_loc_elems hh0 hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf acc))))
hh0 hh4);
insert_modifies_rec_helper
lv hs (B.loc_all_regions_from false (B.frameOf acc)) hh0;
// 5-2) For `mt_safe_elts`
assert (mt_safe_elts hh4 lv hs (Ghost.reveal i) (j + 1ul));
// 5-3) Preservation
assert (RV.rv_inv hh4 hs);
assert (Rgl?.r_inv (hreg hsz) hh4 acc);
// 5-4) Correctness
mt_safe_elts_spec hh0 lv hs (Ghost.reveal i) j;
assert (S.equal (RV.as_seq hh4 hs)
(MTH.insert_ #(U32.v hsz) #hash_spec (U32.v lv) (U32.v (Ghost.reveal i)) (U32.v j)
(RV.as_seq hh0 hs) (Rgl?.r_repr (hreg hsz) hh0 acc))) // QED
#pop-options
private inline_for_extraction
val mt_insert_pre_nst: mtv:merkle_tree -> v:hash #(MT?.hash_size mtv) -> Tot bool
let mt_insert_pre_nst mtv v = mt_not_full_nst mtv && add64_fits (MT?.offset mtv) ((MT?.j mtv) + 1ul)
val mt_insert_pre: #hsz:Ghost.erased hash_size_t -> mt:const_mt_p -> v:hash #hsz -> HST.ST bool
(requires (fun h0 -> mt_safe h0 (CB.cast mt) /\ (MT?.hash_size (B.get h0 (CB.cast mt) 0)) = Ghost.reveal hsz))
(ensures (fun _ _ _ -> True))
let mt_insert_pre #hsz mt v =
let mt = !*(CB.cast mt) in
assert (MT?.hash_size mt == (MT?.hash_size mt));
mt_insert_pre_nst mt v
// `mt_insert` inserts a hash to a Merkle tree. Note that this operation
// manipulates the content in `v`, since it uses `v` as an accumulator during
// insertion.
#push-options "--z3rlimit 100 --initial_fuel 1 --max_fuel 1 --initial_ifuel 1 --max_ifuel 1"
val mt_insert:
hsz:Ghost.erased hash_size_t ->
mt:mt_p -> v:hash #hsz ->
HST.ST unit
(requires (fun h0 ->
let dmt = B.get h0 mt 0 in
mt_safe h0 mt /\
Rgl?.r_inv (hreg hsz) h0 v /\
HH.disjoint (B.frameOf mt) (B.frameOf v) /\
MT?.hash_size dmt = Ghost.reveal hsz /\
mt_insert_pre_nst dmt v))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (loc_union
(mt_loc mt)
(B.loc_all_regions_from false (B.frameOf v)))
h0 h1 /\
mt_safe h1 mt /\
// correctness
MT?.hash_size (B.get h1 mt 0) = Ghost.reveal hsz /\
mt_lift h1 mt == MTH.mt_insert (mt_lift h0 mt) (Rgl?.r_repr (hreg hsz) h0 v)))
#pop-options
#push-options "--z3rlimit 40"
let mt_insert hsz mt v =
let hh0 = HST.get () in
let mtv = !*mt in
let hs = MT?.hs mtv in
let hsz = MT?.hash_size mtv in
insert_ #hsz #(Ghost.reveal (MT?.hash_spec mtv)) 0ul (Ghost.hide (MT?.i mtv)) (MT?.j mtv) hs v (MT?.hash_fun mtv);
let hh1 = HST.get () in
RV.rv_loc_elems_included hh0 (MT?.hs mtv) 0ul (V.size_of hs);
V.loc_vector_within_included hs 0ul (V.size_of hs);
RV.rv_inv_preserved
(MT?.rhs mtv)
(loc_union
(loc_union
(RV.rv_loc_elems hh0 hs 0ul (V.size_of hs))
(V.loc_vector_within hs 0ul (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf v)))
hh0 hh1;
RV.as_seq_preserved
(MT?.rhs mtv)
(loc_union
(loc_union
(RV.rv_loc_elems hh0 hs 0ul (V.size_of hs))
(V.loc_vector_within hs 0ul (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf v)))
hh0 hh1;
Rgl?.r_sep (hreg hsz) (MT?.mroot mtv)
(loc_union
(loc_union
(RV.rv_loc_elems hh0 hs 0ul (V.size_of hs))
(V.loc_vector_within hs 0ul (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf v)))
hh0 hh1;
mt *= MT (MT?.hash_size mtv)
(MT?.offset mtv)
(MT?.i mtv)
(MT?.j mtv + 1ul)
(MT?.hs mtv)
false // `rhs` is always deprecated right after an insertion.
(MT?.rhs mtv)
(MT?.mroot mtv)
(MT?.hash_spec mtv)
(MT?.hash_fun mtv);
let hh2 = HST.get () in
RV.rv_inv_preserved
(MT?.hs mtv) (B.loc_buffer mt) hh1 hh2;
RV.rv_inv_preserved
(MT?.rhs mtv) (B.loc_buffer mt) hh1 hh2;
RV.as_seq_preserved
(MT?.hs mtv) (B.loc_buffer mt) hh1 hh2;
RV.as_seq_preserved
(MT?.rhs mtv) (B.loc_buffer mt) hh1 hh2;
Rgl?.r_sep (hreg hsz) (MT?.mroot mtv) (B.loc_buffer mt) hh1 hh2;
mt_safe_elts_preserved
0ul (MT?.hs mtv) (MT?.i mtv) (MT?.j mtv + 1ul) (B.loc_buffer mt)
hh1 hh2
#pop-options
// `mt_create` initiates a Merkle tree with a given initial hash `init`.
// A valid Merkle tree should contain at least one element.
val mt_create_custom:
hsz:hash_size_t ->
hash_spec:Ghost.erased (MTS.hash_fun_t #(U32.v hsz)) ->
r:HST.erid -> init:hash #hsz -> hash_fun:hash_fun_t #hsz #hash_spec -> HST.ST mt_p
(requires (fun h0 ->
Rgl?.r_inv (hreg hsz) h0 init /\
HH.disjoint r (B.frameOf init)))
(ensures (fun h0 mt h1 ->
// memory safety
modifies (loc_union (mt_loc mt) (B.loc_all_regions_from false (B.frameOf init))) h0 h1 /\
mt_safe h1 mt /\
// correctness
MT?.hash_size (B.get h1 mt 0) = hsz /\
mt_lift h1 mt == MTH.mt_create (U32.v hsz) (Ghost.reveal hash_spec) (Rgl?.r_repr (hreg hsz) h0 init)))
#push-options "--z3rlimit 40"
let mt_create_custom hsz hash_spec r init hash_fun =
let hh0 = HST.get () in
let mt = create_empty_mt hsz hash_spec hash_fun r in
mt_insert hsz mt init;
let hh2 = HST.get () in
mt
#pop-options
/// Construction and Destruction of paths
// Since each element pointer in `path` is from the target Merkle tree and
// each element has different location in `MT?.hs` (thus different region id),
// we cannot use the regionality property for `path`s. Hence here we manually
// define invariants and representation.
noeq type path =
| Path: hash_size:hash_size_t ->
hashes:V.vector (hash #hash_size) ->
path
type path_p = B.pointer path
type const_path_p = const_pointer path
private
let phashes (h:HS.mem) (p:path_p)
: GTot (V.vector (hash #(Path?.hash_size (B.get h p 0))))
= Path?.hashes (B.get h p 0)
// Memory safety of a path as an invariant
inline_for_extraction noextract
val path_safe:
h:HS.mem -> mtr:HH.rid -> p:path_p -> GTot Type0
let path_safe h mtr p =
B.live h p /\ B.freeable p /\
V.live h (phashes h p) /\ V.freeable (phashes h p) /\
HST.is_eternal_region (V.frameOf (phashes h p)) /\
(let hsz = Path?.hash_size (B.get h p 0) in
V.forall_all h (phashes h p)
(fun hp -> Rgl?.r_inv (hreg hsz) h hp /\
HH.includes mtr (Rgl?.region_of (hreg hsz) hp)) /\
HH.extends (V.frameOf (phashes h p)) (B.frameOf p) /\
HH.disjoint mtr (B.frameOf p))
val path_loc: path_p -> GTot loc
let path_loc p = B.loc_all_regions_from false (B.frameOf p)
val lift_path_:
#hsz:hash_size_t ->
h:HS.mem ->
hs:S.seq (hash #hsz) ->
i:nat ->
j:nat{
i <= j /\ j <= S.length hs /\
V.forall_seq hs i j (fun hp -> Rgl?.r_inv (hreg hsz) h hp)} ->
GTot (hp:MTH.path #(U32.v hsz) {S.length hp = j - i}) (decreases j)
let rec lift_path_ #hsz h hs i j =
if i = j then S.empty
else (S.snoc (lift_path_ h hs i (j - 1))
(Rgl?.r_repr (hreg hsz) h (S.index hs (j - 1))))
// Representation of a path
val lift_path:
#hsz:hash_size_t ->
h:HS.mem -> mtr:HH.rid -> p:path_p {path_safe h mtr p /\ (Path?.hash_size (B.get h p 0)) = hsz} ->
GTot (hp:MTH.path #(U32.v hsz) {S.length hp = U32.v (V.size_of (phashes h p))})
let lift_path #hsz h mtr p =
lift_path_ h (V.as_seq h (phashes h p))
0 (S.length (V.as_seq h (phashes h p)))
val lift_path_index_:
#hsz:hash_size_t ->
h:HS.mem ->
hs:S.seq (hash #hsz) ->
i:nat -> j:nat{i <= j && j <= S.length hs} ->
k:nat{i <= k && k < j} ->
Lemma (requires (V.forall_seq hs i j (fun hp -> Rgl?.r_inv (hreg hsz) h hp)))
(ensures (Rgl?.r_repr (hreg hsz) h (S.index hs k) ==
S.index (lift_path_ h hs i j) (k - i)))
(decreases j)
[SMTPat (S.index (lift_path_ h hs i j) (k - i))]
#push-options "--initial_fuel 1 --max_fuel 1 --initial_ifuel 1 --max_ifuel 1"
let rec lift_path_index_ #hsz h hs i j k =
if i = j then ()
else if k = j - 1 then ()
else lift_path_index_ #hsz h hs i (j - 1) k
#pop-options
val lift_path_index:
h:HS.mem -> mtr:HH.rid ->
p:path_p -> i:uint32_t ->
Lemma (requires (path_safe h mtr p /\
i < V.size_of (phashes h p)))
(ensures (let hsz = Path?.hash_size (B.get h p 0) in
Rgl?.r_repr (hreg hsz) h (V.get h (phashes h p) i) ==
S.index (lift_path #(hsz) h mtr p) (U32.v i)))
let lift_path_index h mtr p i =
lift_path_index_ h (V.as_seq h (phashes h p))
0 (S.length (V.as_seq h (phashes h p))) (U32.v i)
val lift_path_eq:
#hsz:hash_size_t ->
h:HS.mem ->
hs1:S.seq (hash #hsz) -> hs2:S.seq (hash #hsz) ->
i:nat -> j:nat ->
Lemma (requires (i <= j /\ j <= S.length hs1 /\ j <= S.length hs2 /\
S.equal (S.slice hs1 i j) (S.slice hs2 i j) /\
V.forall_seq hs1 i j (fun hp -> Rgl?.r_inv (hreg hsz) h hp) /\
V.forall_seq hs2 i j (fun hp -> Rgl?.r_inv (hreg hsz) h hp)))
(ensures (S.equal (lift_path_ h hs1 i j) (lift_path_ h hs2 i j)))
let lift_path_eq #hsz h hs1 hs2 i j =
assert (forall (k:nat{i <= k && k < j}).
S.index (lift_path_ h hs1 i j) (k - i) ==
Rgl?.r_repr (hreg hsz) h (S.index hs1 k));
assert (forall (k:nat{i <= k && k < j}).
S.index (lift_path_ h hs2 i j) (k - i) ==
Rgl?.r_repr (hreg hsz) h (S.index hs2 k));
assert (forall (k:nat{k < j - i}).
S.index (lift_path_ h hs1 i j) k ==
Rgl?.r_repr (hreg hsz) h (S.index hs1 (k + i)));
assert (forall (k:nat{k < j - i}).
S.index (lift_path_ h hs2 i j) k ==
Rgl?.r_repr (hreg hsz) h (S.index hs2 (k + i)));
assert (forall (k:nat{k < j - i}).
S.index (S.slice hs1 i j) k == S.index (S.slice hs2 i j) k);
assert (forall (k:nat{i <= k && k < j}).
S.index (S.slice hs1 i j) (k - i) == S.index (S.slice hs2 i j) (k - i))
private
val path_safe_preserved_:
#hsz:hash_size_t ->
mtr:HH.rid -> hs:S.seq (hash #hsz) ->
i:nat -> j:nat{i <= j && j <= S.length hs} ->
dl:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma
(requires (V.forall_seq hs i j
(fun hp ->
Rgl?.r_inv (hreg hsz) h0 hp /\
HH.includes mtr (Rgl?.region_of (hreg hsz) hp)) /\
loc_disjoint dl (B.loc_all_regions_from false mtr) /\
modifies dl h0 h1))
(ensures (V.forall_seq hs i j
(fun hp ->
Rgl?.r_inv (hreg hsz) h1 hp /\
HH.includes mtr (Rgl?.region_of (hreg hsz) hp))))
(decreases j)
let rec path_safe_preserved_ #hsz mtr hs i j dl h0 h1 =
if i = j then ()
else (assert (loc_includes
(B.loc_all_regions_from false mtr)
(B.loc_all_regions_from false
(Rgl?.region_of (hreg hsz) (S.index hs (j - 1)))));
Rgl?.r_sep (hreg hsz) (S.index hs (j - 1)) dl h0 h1;
path_safe_preserved_ mtr hs i (j - 1) dl h0 h1)
val path_safe_preserved:
mtr:HH.rid -> p:path_p ->
dl:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma (requires (path_safe h0 mtr p /\
loc_disjoint dl (path_loc p) /\
loc_disjoint dl (B.loc_all_regions_from false mtr) /\
modifies dl h0 h1))
(ensures (path_safe h1 mtr p))
let path_safe_preserved mtr p dl h0 h1 =
assert (loc_includes (path_loc p) (B.loc_buffer p));
assert (loc_includes (path_loc p) (V.loc_vector (phashes h0 p)));
path_safe_preserved_
mtr (V.as_seq h0 (phashes h0 p))
0 (S.length (V.as_seq h0 (phashes h0 p))) dl h0 h1
val path_safe_init_preserved:
mtr:HH.rid -> p:path_p ->
dl:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma (requires (path_safe h0 mtr p /\
V.size_of (phashes h0 p) = 0ul /\
B.loc_disjoint dl (path_loc p) /\
modifies dl h0 h1))
(ensures (path_safe h1 mtr p /\
V.size_of (phashes h1 p) = 0ul))
let path_safe_init_preserved mtr p dl h0 h1 =
assert (loc_includes (path_loc p) (B.loc_buffer p));
assert (loc_includes (path_loc p) (V.loc_vector (phashes h0 p)))
val path_preserved_:
#hsz:hash_size_t ->
mtr:HH.rid ->
hs:S.seq (hash #hsz) ->
i:nat -> j:nat{i <= j && j <= S.length hs} ->
dl:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma (requires (V.forall_seq hs i j
(fun hp -> Rgl?.r_inv (hreg hsz) h0 hp /\
HH.includes mtr (Rgl?.region_of (hreg hsz) hp)) /\
loc_disjoint dl (B.loc_all_regions_from false mtr) /\
modifies dl h0 h1))
(ensures (path_safe_preserved_ mtr hs i j dl h0 h1;
S.equal (lift_path_ h0 hs i j)
(lift_path_ h1 hs i j)))
(decreases j)
#push-options "--initial_fuel 1 --max_fuel 1 --initial_ifuel 1 --max_ifuel 1"
let rec path_preserved_ #hsz mtr hs i j dl h0 h1 =
if i = j then ()
else (path_safe_preserved_ mtr hs i (j - 1) dl h0 h1;
path_preserved_ mtr hs i (j - 1) dl h0 h1;
assert (loc_includes
(B.loc_all_regions_from false mtr)
(B.loc_all_regions_from false
(Rgl?.region_of (hreg hsz) (S.index hs (j - 1)))));
Rgl?.r_sep (hreg hsz) (S.index hs (j - 1)) dl h0 h1)
#pop-options
val path_preserved:
mtr:HH.rid -> p:path_p ->
dl:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma (requires (path_safe h0 mtr p /\
loc_disjoint dl (path_loc p) /\
loc_disjoint dl (B.loc_all_regions_from false mtr) /\
modifies dl h0 h1))
(ensures (path_safe_preserved mtr p dl h0 h1;
let hsz0 = (Path?.hash_size (B.get h0 p 0)) in
let hsz1 = (Path?.hash_size (B.get h1 p 0)) in
let b:MTH.path = lift_path #hsz0 h0 mtr p in
let a:MTH.path = lift_path #hsz1 h1 mtr p in
hsz0 = hsz1 /\ S.equal b a))
let path_preserved mtr p dl h0 h1 =
assert (loc_includes (path_loc p) (B.loc_buffer p));
assert (loc_includes (path_loc p) (V.loc_vector (phashes h0 p)));
path_preserved_ mtr (V.as_seq h0 (phashes h0 p))
0 (S.length (V.as_seq h0 (phashes h0 p)))
dl h0 h1
val init_path:
hsz:hash_size_t ->
mtr:HH.rid -> r:HST.erid ->
HST.ST path_p
(requires (fun h0 -> HH.disjoint mtr r))
(ensures (fun h0 p h1 ->
// memory safety
path_safe h1 mtr p /\
// correctness
Path?.hash_size (B.get h1 p 0) = hsz /\
S.equal (lift_path #hsz h1 mtr p) S.empty))
let init_path hsz mtr r =
let nrid = HST.new_region r in
(B.malloc r (Path hsz (rg_alloc (hvreg hsz) nrid)) 1ul)
val clear_path:
mtr:HH.rid -> p:path_p ->
HST.ST unit
(requires (fun h0 -> path_safe h0 mtr p))
(ensures (fun h0 _ h1 ->
// memory safety
path_safe h1 mtr p /\
// correctness
V.size_of (phashes h1 p) = 0ul /\
S.equal (lift_path #(Path?.hash_size (B.get h1 p 0)) h1 mtr p) S.empty))
let clear_path mtr p =
let pv = !*p in
p *= Path (Path?.hash_size pv) (V.clear (Path?.hashes pv))
val free_path:
p:path_p ->
HST.ST unit
(requires (fun h0 ->
B.live h0 p /\ B.freeable p /\
V.live h0 (phashes h0 p) /\ V.freeable (phashes h0 p) /\
HH.extends (V.frameOf (phashes h0 p)) (B.frameOf p)))
(ensures (fun h0 _ h1 ->
modifies (path_loc p) h0 h1))
let free_path p =
let pv = !*p in
V.free (Path?.hashes pv);
B.free p
/// Getting the Merkle root and path
// Construct "rightmost hashes" for a given (incomplete) Merkle tree.
// This function calculates the Merkle root as well, which is the final
// accumulator value.
private
val construct_rhs:
#hsz:hash_size_t ->
#hash_spec:Ghost.erased (MTS.hash_fun_t #(U32.v hsz)) ->
lv:uint32_t{lv <= merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
rhs:hash_vec #hsz {V.size_of rhs = merkle_tree_size_lg} ->
i:index_t ->
j:index_t{i <= j && (U32.v j) < pow2 (32 - U32.v lv)} ->
acc:hash #hsz ->
actd:bool ->
hash_fun:hash_fun_t #hsz #(Ghost.reveal hash_spec) ->
HST.ST unit
(requires (fun h0 ->
RV.rv_inv h0 hs /\ RV.rv_inv h0 rhs /\
HH.disjoint (V.frameOf hs) (V.frameOf rhs) /\
Rgl?.r_inv (hreg hsz) h0 acc /\
HH.disjoint (B.frameOf acc) (V.frameOf hs) /\
HH.disjoint (B.frameOf acc) (V.frameOf rhs) /\
mt_safe_elts #hsz h0 lv hs i j))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (loc_union
(RV.loc_rvector rhs)
(B.loc_all_regions_from false (B.frameOf acc)))
h0 h1 /\
RV.rv_inv h1 rhs /\
Rgl?.r_inv (hreg hsz) h1 acc /\
// correctness
(mt_safe_elts_spec #hsz h0 lv hs i j;
MTH.construct_rhs #(U32.v hsz) #(Ghost.reveal hash_spec)
(U32.v lv)
(Rgl?.r_repr (hvvreg hsz) h0 hs)
(Rgl?.r_repr (hvreg hsz) h0 rhs)
(U32.v i) (U32.v j)
(Rgl?.r_repr (hreg hsz) h0 acc) actd ==
(Rgl?.r_repr (hvreg hsz) h1 rhs, Rgl?.r_repr (hreg hsz) h1 acc)
)))
(decreases (U32.v j))
#push-options "--z3rlimit 250 --initial_fuel 1 --max_fuel 1 --initial_ifuel 1 --max_ifuel 1"
let rec construct_rhs #hsz #hash_spec lv hs rhs i j acc actd hash_fun =
let hh0 = HST.get () in
if j = 0ul then begin
assert (RV.rv_inv hh0 hs);
assert (mt_safe_elts #hsz hh0 lv hs i j);
mt_safe_elts_spec #hsz hh0 lv hs 0ul 0ul;
assert (MTH.hs_wf_elts #(U32.v hsz)
(U32.v lv) (RV.as_seq hh0 hs)
(U32.v i) (U32.v j));
let hh1 = HST.get() in
assert (MTH.construct_rhs #(U32.v hsz) #(Ghost.reveal hash_spec)
(U32.v lv)
(Rgl?.r_repr (hvvreg hsz) hh0 hs)
(Rgl?.r_repr (hvreg hsz) hh0 rhs)
(U32.v i) (U32.v j)
(Rgl?.r_repr (hreg hsz) hh0 acc) actd ==
(Rgl?.r_repr (hvreg hsz) hh1 rhs, Rgl?.r_repr (hreg hsz) hh1 acc))
end
else
let ofs = offset_of i in
begin
(if j % 2ul = 0ul
then begin
Math.Lemmas.pow2_double_mult (32 - U32.v lv - 1);
mt_safe_elts_rec #hsz hh0 lv hs i j;
construct_rhs #hsz #hash_spec (lv + 1ul) hs rhs (i / 2ul) (j / 2ul) acc actd hash_fun;
let hh1 = HST.get () in
// correctness
mt_safe_elts_spec #hsz hh0 lv hs i j;
MTH.construct_rhs_even #(U32.v hsz) #hash_spec
(U32.v lv) (Rgl?.r_repr (hvvreg hsz) hh0 hs) (Rgl?.r_repr (hvreg hsz) hh0 rhs)
(U32.v i) (U32.v j) (Rgl?.r_repr (hreg hsz) hh0 acc) actd;
assert (MTH.construct_rhs #(U32.v hsz) #hash_spec
(U32.v lv)
(Rgl?.r_repr (hvvreg hsz) hh0 hs)
(Rgl?.r_repr (hvreg hsz) hh0 rhs)
(U32.v i) (U32.v j)
(Rgl?.r_repr (hreg hsz) hh0 acc)
actd ==
(Rgl?.r_repr (hvreg hsz) hh1 rhs, Rgl?.r_repr (hreg hsz) hh1 acc))
end
else begin
if actd
then begin
RV.assign_copy (hcpy hsz) rhs lv acc;
let hh1 = HST.get () in
// memory safety
Rgl?.r_sep (hreg hsz) acc
(B.loc_all_regions_from false (V.frameOf rhs)) hh0 hh1;
RV.rv_inv_preserved
hs (B.loc_all_regions_from false (V.frameOf rhs))
hh0 hh1;
RV.as_seq_preserved
hs (B.loc_all_regions_from false (V.frameOf rhs))
hh0 hh1;
RV.rv_inv_preserved
(V.get hh0 hs lv) (B.loc_all_regions_from false (V.frameOf rhs))
hh0 hh1;
V.loc_vector_within_included hs lv (V.size_of hs);
mt_safe_elts_preserved lv hs i j
(B.loc_all_regions_from false (V.frameOf rhs))
hh0 hh1;
mt_safe_elts_head hh1 lv hs i j;
hash_vv_rv_inv_r_inv hh1 hs lv (j - 1ul - ofs);
// correctness
assert (S.equal (RV.as_seq hh1 rhs)
(S.upd (RV.as_seq hh0 rhs) (U32.v lv)
(Rgl?.r_repr (hreg hsz) hh0 acc)));
hash_fun (V.index (V.index hs lv) (j - 1ul - ofs)) acc acc;
let hh2 = HST.get () in
// memory safety
mt_safe_elts_preserved lv hs i j
(B.loc_all_regions_from false (B.frameOf acc)) hh1 hh2;
RV.rv_inv_preserved
hs (B.loc_region_only false (B.frameOf acc)) hh1 hh2;
RV.rv_inv_preserved
rhs (B.loc_region_only false (B.frameOf acc)) hh1 hh2;
RV.as_seq_preserved
hs (B.loc_region_only false (B.frameOf acc)) hh1 hh2;
RV.as_seq_preserved
rhs (B.loc_region_only false (B.frameOf acc)) hh1 hh2;
// correctness
hash_vv_as_seq_get_index hh0 hs lv (j - 1ul - ofs);
assert (Rgl?.r_repr (hreg hsz) hh2 acc ==
(Ghost.reveal hash_spec) (S.index (S.index (RV.as_seq hh0 hs) (U32.v lv))
(U32.v j - 1 - U32.v ofs))
(Rgl?.r_repr (hreg hsz) hh0 acc))
end
else begin
mt_safe_elts_head hh0 lv hs i j;
hash_vv_rv_inv_r_inv hh0 hs lv (j - 1ul - ofs);
hash_vv_rv_inv_disjoint hh0 hs lv (j - 1ul - ofs) (B.frameOf acc);
Cpy?.copy (hcpy hsz) hsz (V.index (V.index hs lv) (j - 1ul - ofs)) acc;
let hh1 = HST.get () in
// memory safety
V.loc_vector_within_included hs lv (V.size_of hs);
mt_safe_elts_preserved lv hs i j
(B.loc_all_regions_from false (B.frameOf acc)) hh0 hh1;
RV.rv_inv_preserved
hs (B.loc_all_regions_from false (B.frameOf acc)) hh0 hh1;
RV.rv_inv_preserved
rhs (B.loc_all_regions_from false (B.frameOf acc)) hh0 hh1;
RV.as_seq_preserved
hs (B.loc_all_regions_from false (B.frameOf acc)) hh0 hh1;
RV.as_seq_preserved
rhs (B.loc_all_regions_from false (B.frameOf acc)) hh0 hh1;
// correctness
hash_vv_as_seq_get_index hh0 hs lv (j - 1ul - ofs);
assert (Rgl?.r_repr (hreg hsz) hh1 acc ==
S.index (S.index (RV.as_seq hh0 hs) (U32.v lv))
(U32.v j - 1 - U32.v ofs))
end;
let hh3 = HST.get () in
assert (S.equal (RV.as_seq hh3 hs) (RV.as_seq hh0 hs));
assert (S.equal (RV.as_seq hh3 rhs)
(if actd
then S.upd (RV.as_seq hh0 rhs) (U32.v lv)
(Rgl?.r_repr (hreg hsz) hh0 acc)
else RV.as_seq hh0 rhs));
assert (Rgl?.r_repr (hreg hsz) hh3 acc ==
(if actd
then (Ghost.reveal hash_spec) (S.index (S.index (RV.as_seq hh0 hs) (U32.v lv))
(U32.v j - 1 - U32.v ofs))
(Rgl?.r_repr (hreg hsz) hh0 acc)
else S.index (S.index (RV.as_seq hh0 hs) (U32.v lv))
(U32.v j - 1 - U32.v ofs)));
mt_safe_elts_rec hh3 lv hs i j;
construct_rhs #hsz #hash_spec (lv + 1ul) hs rhs (i / 2ul) (j / 2ul) acc true hash_fun;
let hh4 = HST.get () in
mt_safe_elts_spec hh3 (lv + 1ul) hs (i / 2ul) (j / 2ul);
assert (MTH.construct_rhs #(U32.v hsz) #hash_spec
(U32.v lv + 1)
(Rgl?.r_repr (hvvreg hsz) hh3 hs)
(Rgl?.r_repr (hvreg hsz) hh3 rhs)
(U32.v i / 2) (U32.v j / 2)
(Rgl?.r_repr (hreg hsz) hh3 acc) true ==
(Rgl?.r_repr (hvreg hsz) hh4 rhs, Rgl?.r_repr (hreg hsz) hh4 acc));
mt_safe_elts_spec hh0 lv hs i j;
MTH.construct_rhs_odd #(U32.v hsz) #hash_spec
(U32.v lv) (Rgl?.r_repr (hvvreg hsz) hh0 hs) (Rgl?.r_repr (hvreg hsz) hh0 rhs)
(U32.v i) (U32.v j) (Rgl?.r_repr (hreg hsz) hh0 acc) actd;
assert (MTH.construct_rhs #(U32.v hsz) #hash_spec
(U32.v lv)
(Rgl?.r_repr (hvvreg hsz) hh0 hs)
(Rgl?.r_repr (hvreg hsz) hh0 rhs)
(U32.v i) (U32.v j)
(Rgl?.r_repr (hreg hsz) hh0 acc) actd ==
(Rgl?.r_repr (hvreg hsz) hh4 rhs, Rgl?.r_repr (hreg hsz) hh4 acc))
end)
end
#pop-options
private inline_for_extraction
val mt_get_root_pre_nst: mtv:merkle_tree -> rt:hash #(MT?.hash_size mtv) -> Tot bool
let mt_get_root_pre_nst mtv rt = true
val mt_get_root_pre:
#hsz:Ghost.erased hash_size_t ->
mt:const_mt_p ->
rt:hash #hsz ->
HST.ST bool
(requires (fun h0 ->
let mt = CB.cast mt in
MT?.hash_size (B.get h0 mt 0) = Ghost.reveal hsz /\
mt_safe h0 mt /\ Rgl?.r_inv (hreg hsz) h0 rt /\
HH.disjoint (B.frameOf mt) (B.frameOf rt)))
(ensures (fun _ _ _ -> True))
let mt_get_root_pre #hsz mt rt =
let mt = CB.cast mt in
let mt = !*mt in
let hsz = MT?.hash_size mt in
assert (MT?.hash_size mt = hsz);
mt_get_root_pre_nst mt rt
// `mt_get_root` returns the Merkle root. If it's already calculated with
// up-to-date hashes, the root is returned immediately. Otherwise it calls
// `construct_rhs` to build rightmost hashes and to calculate the Merkle root
// as well.
val mt_get_root:
#hsz:Ghost.erased hash_size_t ->
mt:const_mt_p ->
rt:hash #hsz ->
HST.ST unit
(requires (fun h0 ->
let mt = CB.cast mt in
let dmt = B.get h0 mt 0 in
MT?.hash_size dmt = (Ghost.reveal hsz) /\
mt_get_root_pre_nst dmt rt /\
mt_safe h0 mt /\ Rgl?.r_inv (hreg hsz) h0 rt /\
HH.disjoint (B.frameOf mt) (B.frameOf rt)))
(ensures (fun h0 _ h1 ->
let mt = CB.cast mt in
// memory safety
modifies (loc_union
(mt_loc mt)
(B.loc_all_regions_from false (B.frameOf rt)))
h0 h1 /\
mt_safe h1 mt /\
(let mtv0 = B.get h0 mt 0 in
let mtv1 = B.get h1 mt 0 in
MT?.hash_size mtv0 = (Ghost.reveal hsz) /\
MT?.hash_size mtv1 = (Ghost.reveal hsz) /\
MT?.i mtv1 = MT?.i mtv0 /\ MT?.j mtv1 = MT?.j mtv0 /\
MT?.hs mtv1 == MT?.hs mtv0 /\ MT?.rhs mtv1 == MT?.rhs mtv0 /\
MT?.offset mtv1 == MT?.offset mtv0 /\
MT?.rhs_ok mtv1 = true /\
Rgl?.r_inv (hreg hsz) h1 rt /\
// correctness
MTH.mt_get_root (mt_lift h0 mt) (Rgl?.r_repr (hreg hsz) h0 rt) ==
(mt_lift h1 mt, Rgl?.r_repr (hreg hsz) h1 rt))))
#push-options "--z3rlimit 150 --initial_fuel 1 --max_fuel 1"
let mt_get_root #hsz mt rt =
let mt = CB.cast mt in
let hh0 = HST.get () in
let mtv = !*mt in
let prefix = MT?.offset mtv in
let i = MT?.i mtv in
let j = MT?.j mtv in
let hs = MT?.hs mtv in
let rhs = MT?.rhs mtv in
let mroot = MT?.mroot mtv in
let hash_size = MT?.hash_size mtv in
let hash_spec = MT?.hash_spec mtv in
let hash_fun = MT?.hash_fun mtv in
if MT?.rhs_ok mtv
then begin
Cpy?.copy (hcpy hash_size) hash_size mroot rt;
let hh1 = HST.get () in
mt_safe_preserved mt
(B.loc_all_regions_from false (Rgl?.region_of (hreg hsz) rt)) hh0 hh1;
mt_preserved mt
(B.loc_all_regions_from false (Rgl?.region_of (hreg hsz) rt)) hh0 hh1;
MTH.mt_get_root_rhs_ok_true
(mt_lift hh0 mt) (Rgl?.r_repr (hreg hsz) hh0 rt);
assert (MTH.mt_get_root (mt_lift hh0 mt) (Rgl?.r_repr (hreg hsz) hh0 rt) ==
(mt_lift hh1 mt, Rgl?.r_repr (hreg hsz) hh1 rt))
end
else begin
construct_rhs #hash_size #hash_spec 0ul hs rhs i j rt false hash_fun;
let hh1 = HST.get () in
// memory safety
assert (RV.rv_inv hh1 rhs);
assert (Rgl?.r_inv (hreg hsz) hh1 rt);
assert (B.live hh1 mt);
RV.rv_inv_preserved
hs (loc_union
(RV.loc_rvector rhs)
(B.loc_all_regions_from false (B.frameOf rt)))
hh0 hh1;
RV.as_seq_preserved
hs (loc_union
(RV.loc_rvector rhs)
(B.loc_all_regions_from false (B.frameOf rt)))
hh0 hh1;
V.loc_vector_within_included hs 0ul (V.size_of hs);
mt_safe_elts_preserved 0ul hs i j
(loc_union
(RV.loc_rvector rhs)
(B.loc_all_regions_from false (B.frameOf rt)))
hh0 hh1;
// correctness
mt_safe_elts_spec hh0 0ul hs i j;
assert (MTH.construct_rhs #(U32.v hash_size) #hash_spec 0
(Rgl?.r_repr (hvvreg hsz) hh0 hs)
(Rgl?.r_repr (hvreg hsz) hh0 rhs)
(U32.v i) (U32.v j)
(Rgl?.r_repr (hreg hsz) hh0 rt) false ==
(Rgl?.r_repr (hvreg hsz) hh1 rhs, Rgl?.r_repr (hreg hsz) hh1 rt));
Cpy?.copy (hcpy hash_size) hash_size rt mroot;
let hh2 = HST.get () in
// memory safety
RV.rv_inv_preserved
hs (B.loc_all_regions_from false (B.frameOf mroot))
hh1 hh2;
RV.rv_inv_preserved
rhs (B.loc_all_regions_from false (B.frameOf mroot))
hh1 hh2;
RV.as_seq_preserved
hs (B.loc_all_regions_from false (B.frameOf mroot))
hh1 hh2;
RV.as_seq_preserved
rhs (B.loc_all_regions_from false (B.frameOf mroot))
hh1 hh2;
B.modifies_buffer_elim
rt (B.loc_all_regions_from false (B.frameOf mroot))
hh1 hh2;
mt_safe_elts_preserved 0ul hs i j
(B.loc_all_regions_from false (B.frameOf mroot))
hh1 hh2;
// correctness
assert (Rgl?.r_repr (hreg hsz) hh2 mroot == Rgl?.r_repr (hreg hsz) hh1 rt);
mt *= MT hash_size prefix i j hs true rhs mroot hash_spec hash_fun;
let hh3 = HST.get () in
// memory safety
Rgl?.r_sep (hreg hsz) rt (B.loc_buffer mt) hh2 hh3;
RV.rv_inv_preserved hs (B.loc_buffer mt) hh2 hh3;
RV.rv_inv_preserved rhs (B.loc_buffer mt) hh2 hh3;
RV.as_seq_preserved hs (B.loc_buffer mt) hh2 hh3;
RV.as_seq_preserved rhs (B.loc_buffer mt) hh2 hh3;
Rgl?.r_sep (hreg hsz) mroot (B.loc_buffer mt) hh2 hh3;
mt_safe_elts_preserved 0ul hs i j
(B.loc_buffer mt) hh2 hh3;
assert (mt_safe hh3 mt);
// correctness
MTH.mt_get_root_rhs_ok_false
(mt_lift hh0 mt) (Rgl?.r_repr (hreg hsz) hh0 rt);
assert (MTH.mt_get_root (mt_lift hh0 mt) (Rgl?.r_repr (hreg hsz) hh0 rt) ==
(MTH.MT #(U32.v hash_size)
(U32.v i) (U32.v j)
(RV.as_seq hh0 hs)
true
(RV.as_seq hh1 rhs)
(Rgl?.r_repr (hreg hsz) hh1 rt)
hash_spec,
Rgl?.r_repr (hreg hsz) hh1 rt));
assert (MTH.mt_get_root (mt_lift hh0 mt) (Rgl?.r_repr (hreg hsz) hh0 rt) ==
(mt_lift hh3 mt, Rgl?.r_repr (hreg hsz) hh3 rt))
end
#pop-options
inline_for_extraction
val mt_path_insert:
#hsz:hash_size_t ->
mtr:HH.rid -> p:path_p -> hp:hash #hsz ->
HST.ST unit
(requires (fun h0 ->
path_safe h0 mtr p /\
not (V.is_full (phashes h0 p)) /\
Rgl?.r_inv (hreg hsz) h0 hp /\
HH.disjoint mtr (B.frameOf p) /\
HH.includes mtr (B.frameOf hp) /\
Path?.hash_size (B.get h0 p 0) = hsz))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (path_loc p) h0 h1 /\
path_safe h1 mtr p /\
// correctness
(let hsz0 = Path?.hash_size (B.get h0 p 0) in
let hsz1 = Path?.hash_size (B.get h1 p 0) in
(let before:(S.seq (MTH.hash #(U32.v hsz0))) = lift_path h0 mtr p in
let after:(S.seq (MTH.hash #(U32.v hsz1))) = lift_path h1 mtr p in
V.size_of (phashes h1 p) = V.size_of (phashes h0 p) + 1ul /\
hsz = hsz0 /\ hsz = hsz1 /\
(let hspec:(S.seq (MTH.hash #(U32.v hsz))) = (MTH.path_insert #(U32.v hsz) before (Rgl?.r_repr (hreg hsz) h0 hp)) in
S.equal hspec after)))))
#push-options "--z3rlimit 20 --initial_fuel 1 --max_fuel 1"
let mt_path_insert #hsz mtr p hp =
let pth = !*p in
let pv = Path?.hashes pth in
let hh0 = HST.get () in
let ipv = V.insert pv hp in
let hh1 = HST.get () in
path_safe_preserved_
mtr (V.as_seq hh0 pv) 0 (S.length (V.as_seq hh0 pv))
(B.loc_all_regions_from false (V.frameOf ipv)) hh0 hh1;
path_preserved_
mtr (V.as_seq hh0 pv) 0 (S.length (V.as_seq hh0 pv))
(B.loc_all_regions_from false (V.frameOf ipv)) hh0 hh1;
Rgl?.r_sep (hreg hsz) hp
(B.loc_all_regions_from false (V.frameOf ipv)) hh0 hh1;
p *= Path hsz ipv;
let hh2 = HST.get () in
path_safe_preserved_
mtr (V.as_seq hh1 ipv) 0 (S.length (V.as_seq hh1 ipv))
(B.loc_region_only false (B.frameOf p)) hh1 hh2;
path_preserved_
mtr (V.as_seq hh1 ipv) 0 (S.length (V.as_seq hh1 ipv))
(B.loc_region_only false (B.frameOf p)) hh1 hh2;
Rgl?.r_sep (hreg hsz) hp
(B.loc_region_only false (B.frameOf p)) hh1 hh2;
assert (S.equal (lift_path hh2 mtr p)
(lift_path_ hh1 (S.snoc (V.as_seq hh0 pv) hp)
0 (S.length (V.as_seq hh1 ipv))));
lift_path_eq hh1 (S.snoc (V.as_seq hh0 pv) hp) (V.as_seq hh0 pv)
0 (S.length (V.as_seq hh0 pv))
#pop-options
// For given a target index `k`, the number of elements (in the tree) `j`,
// and a boolean flag (to check the existence of rightmost hashes), we can
// calculate a required Merkle path length.
//
// `mt_path_length` is a postcondition of `mt_get_path`, and a precondition
// of `mt_verify`. For detailed description, see `mt_get_path` and `mt_verify`.
private
val mt_path_length_step:
k:index_t ->
j:index_t{k <= j} ->
actd:bool ->
Tot (sl:uint32_t{U32.v sl = MTH.mt_path_length_step (U32.v k) (U32.v j) actd})
let mt_path_length_step k j actd =
if j = 0ul then 0ul
else (if k % 2ul = 0ul
then (if j = k || (j = k + 1ul && not actd) then 0ul else 1ul)
else 1ul)
private inline_for_extraction
val mt_path_length:
lv:uint32_t{lv <= merkle_tree_size_lg} ->
k:index_t ->
j:index_t{k <= j && U32.v j < pow2 (32 - U32.v lv)} ->
actd:bool ->
Tot (l:uint32_t{
U32.v l = MTH.mt_path_length (U32.v k) (U32.v j) actd &&
l <= 32ul - lv})
(decreases (U32.v j))
#push-options "--z3rlimit 10 --initial_fuel 1 --max_fuel 1"
let rec mt_path_length lv k j actd =
if j = 0ul then 0ul
else (let nactd = actd || (j % 2ul = 1ul) in
mt_path_length_step k j actd +
mt_path_length (lv + 1ul) (k / 2ul) (j / 2ul) nactd)
#pop-options
val mt_get_path_length:
mtr:HH.rid ->
p:const_path_p ->
HST.ST uint32_t
(requires (fun h0 -> path_safe h0 mtr (CB.cast p)))
(ensures (fun h0 _ h1 -> True))
let mt_get_path_length mtr p =
let pd = !*(CB.cast p) in
V.size_of (Path?.hashes pd)
private inline_for_extraction
val mt_make_path_step:
#hsz:hash_size_t ->
lv:uint32_t{lv <= merkle_tree_size_lg} ->
mtr:HH.rid ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
rhs:hash_vec #hsz {V.size_of rhs = merkle_tree_size_lg} ->
i:index_t ->
j:index_t{j <> 0ul /\ i <= j /\ U32.v j < pow2 (32 - U32.v lv)} ->
k:index_t{i <= k && k <= j} ->
p:path_p ->
actd:bool ->
HST.ST unit
(requires (fun h0 ->
HH.includes mtr (V.frameOf hs) /\
HH.includes mtr (V.frameOf rhs) /\
RV.rv_inv h0 hs /\ RV.rv_inv h0 rhs /\
mt_safe_elts h0 lv hs i j /\
path_safe h0 mtr p /\
Path?.hash_size (B.get h0 p 0) = hsz /\
V.size_of (phashes h0 p) <= lv + 1ul))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (path_loc p) h0 h1 /\
path_safe h1 mtr p /\
V.size_of (phashes h1 p) == V.size_of (phashes h0 p) + mt_path_length_step k j actd /\
V.size_of (phashes h1 p) <= lv + 2ul /\
// correctness
(mt_safe_elts_spec h0 lv hs i j;
(let hsz0 = Path?.hash_size (B.get h0 p 0) in
let hsz1 = Path?.hash_size (B.get h1 p 0) in
let before:(S.seq (MTH.hash #(U32.v hsz0))) = lift_path h0 mtr p in
let after:(S.seq (MTH.hash #(U32.v hsz1))) = lift_path h1 mtr p in
hsz = hsz0 /\ hsz = hsz1 /\
S.equal after
(MTH.mt_make_path_step
(U32.v lv) (RV.as_seq h0 hs) (RV.as_seq h0 rhs)
(U32.v i) (U32.v j) (U32.v k) before actd)))))
#push-options "--z3rlimit 100 --initial_fuel 1 --max_fuel 1 --initial_ifuel 2 --max_ifuel 2"
let mt_make_path_step #hsz lv mtr hs rhs i j k p actd =
let pth = !*p in
let hh0 = HST.get () in
let ofs = offset_of i in
if k % 2ul = 1ul
then begin
hash_vv_rv_inv_includes hh0 hs lv (k - 1ul - ofs);
assert (HH.includes mtr
(B.frameOf (V.get hh0 (V.get hh0 hs lv) (k - 1ul - ofs))));
assert(Path?.hash_size pth = hsz);
mt_path_insert #hsz mtr p (V.index (V.index hs lv) (k - 1ul - ofs))
end
else begin
if k = j then ()
else if k + 1ul = j
then (if actd
then (assert (HH.includes mtr (B.frameOf (V.get hh0 rhs lv)));
mt_path_insert mtr p (V.index rhs lv)))
else (hash_vv_rv_inv_includes hh0 hs lv (k + 1ul - ofs);
assert (HH.includes mtr
(B.frameOf (V.get hh0 (V.get hh0 hs lv) (k + 1ul - ofs))));
mt_path_insert mtr p (V.index (V.index hs lv) (k + 1ul - ofs)))
end
#pop-options
private inline_for_extraction
val mt_get_path_step_pre_nst:
#hsz:Ghost.erased hash_size_t ->
mtr:HH.rid ->
p:path ->
i:uint32_t ->
Tot bool
let mt_get_path_step_pre_nst #hsz mtr p i =
i < V.size_of (Path?.hashes p)
val mt_get_path_step_pre:
#hsz:Ghost.erased hash_size_t ->
mtr:HH.rid ->
p:const_path_p ->
i:uint32_t ->
HST.ST bool
(requires (fun h0 ->
path_safe h0 mtr (CB.cast p) /\
(let pv = B.get h0 (CB.cast p) 0 in
Path?.hash_size pv = Ghost.reveal hsz /\
live h0 (Path?.hashes pv) /\
mt_get_path_step_pre_nst #hsz mtr pv i)))
(ensures (fun _ _ _ -> True))
let mt_get_path_step_pre #hsz mtr p i =
let p = CB.cast p in
mt_get_path_step_pre_nst #hsz mtr !*p i
val mt_get_path_step:
#hsz:Ghost.erased hash_size_t ->
mtr:HH.rid ->
p:const_path_p ->
i:uint32_t ->
HST.ST (hash #hsz)
(requires (fun h0 ->
path_safe h0 mtr (CB.cast p) /\
(let pv = B.get h0 (CB.cast p) 0 in
Path?.hash_size pv = Ghost.reveal hsz /\
live h0 (Path?.hashes pv) /\
i < V.size_of (Path?.hashes pv))))
(ensures (fun h0 r h1 -> True ))
let mt_get_path_step #hsz mtr p i =
let pd = !*(CB.cast p) in
V.index #(hash #(Path?.hash_size pd)) (Path?.hashes pd) i
private
val mt_get_path_:
#hsz:hash_size_t ->
lv:uint32_t{lv <= merkle_tree_size_lg} ->
mtr:HH.rid ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
rhs:hash_vec #hsz {V.size_of rhs = merkle_tree_size_lg} ->
i:index_t -> j:index_t{i <= j /\ U32.v j < pow2 (32 - U32.v lv)} ->
k:index_t{i <= k && k <= j} ->
p:path_p ->
actd:bool ->
HST.ST unit
(requires (fun h0 ->
HH.includes mtr (V.frameOf hs) /\
HH.includes mtr (V.frameOf rhs) /\
RV.rv_inv h0 hs /\ RV.rv_inv h0 rhs /\
mt_safe_elts h0 lv hs i j /\
path_safe h0 mtr p /\
Path?.hash_size (B.get h0 p 0) = hsz /\
V.size_of (phashes h0 p) <= lv + 1ul))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (path_loc p) h0 h1 /\
path_safe h1 mtr p /\
V.size_of (phashes h1 p) ==
V.size_of (phashes h0 p) + mt_path_length lv k j actd /\
// correctness
(mt_safe_elts_spec h0 lv hs i j;
(let hsz0 = Path?.hash_size (B.get h0 p 0) in
let hsz1 = Path?.hash_size (B.get h1 p 0) in
let before:(S.seq (MTH.hash #(U32.v hsz0))) = lift_path h0 mtr p in
let after:(S.seq (MTH.hash #(U32.v hsz1))) = lift_path h1 mtr p in
hsz = hsz0 /\ hsz = hsz1 /\
S.equal after
(MTH.mt_get_path_ (U32.v lv) (RV.as_seq h0 hs) (RV.as_seq h0 rhs)
(U32.v i) (U32.v j) (U32.v k) before actd)))))
(decreases (32 - U32.v lv))
#push-options "--z3rlimit 300 --initial_fuel 1 --max_fuel 1 --max_ifuel 2 --initial_ifuel 2"
let rec mt_get_path_ #hsz lv mtr hs rhs i j k p actd =
let hh0 = HST.get () in
mt_safe_elts_spec hh0 lv hs i j;
let ofs = offset_of i in
if j = 0ul then ()
else
(mt_make_path_step lv mtr hs rhs i j k p actd;
let hh1 = HST.get () in
mt_safe_elts_spec hh0 lv hs i j;
assert (S.equal (lift_path hh1 mtr p)
(MTH.mt_make_path_step
(U32.v lv) (RV.as_seq hh0 hs) (RV.as_seq hh0 rhs)
(U32.v i) (U32.v j) (U32.v k)
(lift_path hh0 mtr p) actd));
RV.rv_inv_preserved hs (path_loc p) hh0 hh1;
RV.rv_inv_preserved rhs (path_loc p) hh0 hh1;
RV.as_seq_preserved hs (path_loc p) hh0 hh1;
RV.as_seq_preserved rhs (path_loc p) hh0 hh1;
V.loc_vector_within_included hs lv (V.size_of hs);
mt_safe_elts_preserved lv hs i j (path_loc p) hh0 hh1;
assert (mt_safe_elts hh1 lv hs i j);
mt_safe_elts_rec hh1 lv hs i j;
mt_safe_elts_spec hh1 (lv + 1ul) hs (i / 2ul) (j / 2ul);
mt_get_path_ (lv + 1ul) mtr hs rhs (i / 2ul) (j / 2ul) (k / 2ul) p
(if j % 2ul = 0ul then actd else true);
let hh2 = HST.get () in
assert (S.equal (lift_path hh2 mtr p)
(MTH.mt_get_path_ (U32.v lv + 1)
(RV.as_seq hh1 hs) (RV.as_seq hh1 rhs)
(U32.v i / 2) (U32.v j / 2) (U32.v k / 2)
(lift_path hh1 mtr p)
(if U32.v j % 2 = 0 then actd else true)));
assert (S.equal (lift_path hh2 mtr p)
(MTH.mt_get_path_ (U32.v lv)
(RV.as_seq hh0 hs) (RV.as_seq hh0 rhs)
(U32.v i) (U32.v j) (U32.v k)
(lift_path hh0 mtr p) actd)))
#pop-options
private inline_for_extraction
val mt_get_path_pre_nst:
mtv:merkle_tree ->
idx:offset_t ->
p:path ->
root:(hash #(MT?.hash_size mtv)) ->
Tot bool
let mt_get_path_pre_nst mtv idx p root =
offsets_connect (MT?.offset mtv) idx &&
Path?.hash_size p = MT?.hash_size mtv &&
([@inline_let] let idx = split_offset (MT?.offset mtv) idx in
MT?.i mtv <= idx && idx < MT?.j mtv &&
V.size_of (Path?.hashes p) = 0ul)
val mt_get_path_pre:
#hsz:Ghost.erased hash_size_t ->
mt:const_mt_p ->
idx:offset_t ->
p:const_path_p ->
root:hash #hsz ->
HST.ST bool
(requires (fun h0 ->
let mt = CB.cast mt in
let p = CB.cast p in
let dmt = B.get h0 mt 0 in
let dp = B.get h0 p 0 in
MT?.hash_size dmt = (Ghost.reveal hsz) /\
Path?.hash_size dp = (Ghost.reveal hsz) /\
mt_safe h0 mt /\
path_safe h0 (B.frameOf mt) p /\
Rgl?.r_inv (hreg hsz) h0 root /\
HH.disjoint (B.frameOf root) (B.frameOf mt) /\
HH.disjoint (B.frameOf root) (B.frameOf p)))
(ensures (fun _ _ _ -> True))
let mt_get_path_pre #_ mt idx p root =
let mt = CB.cast mt in
let p = CB.cast p in
let mtv = !*mt in
mt_get_path_pre_nst mtv idx !*p root
val mt_get_path_loc_union_helper:
l1:loc -> l2:loc ->
Lemma (loc_union (loc_union l1 l2) l2 == loc_union l1 l2)
let mt_get_path_loc_union_helper l1 l2 = ()
// Construct a Merkle path for a given index `idx`, hashes `mt.hs`, and rightmost
// hashes `mt.rhs`. Note that this operation copies "pointers" into the Merkle tree
// to the output path.
#push-options "--z3rlimit 60"
val mt_get_path:
#hsz:Ghost.erased hash_size_t ->
mt:const_mt_p ->
idx:offset_t ->
p:path_p ->
root:hash #hsz ->
HST.ST index_t
(requires (fun h0 ->
let mt = CB.cast mt in
let dmt = B.get h0 mt 0 in
MT?.hash_size dmt = Ghost.reveal hsz /\
Path?.hash_size (B.get h0 p 0) = Ghost.reveal hsz /\
mt_get_path_pre_nst (B.get h0 mt 0) idx (B.get h0 p 0) root /\
mt_safe h0 mt /\
path_safe h0 (B.frameOf mt) p /\
Rgl?.r_inv (hreg hsz) h0 root /\
HH.disjoint (B.frameOf root) (B.frameOf mt) /\
HH.disjoint (B.frameOf root) (B.frameOf p)))
(ensures (fun h0 _ h1 ->
let mt = CB.cast mt in
let mtv0 = B.get h0 mt 0 in
let mtv1 = B.get h1 mt 0 in
let idx = split_offset (MT?.offset mtv0) idx in
MT?.hash_size mtv0 = Ghost.reveal hsz /\
MT?.hash_size mtv1 = Ghost.reveal hsz /\
Path?.hash_size (B.get h0 p 0) = Ghost.reveal hsz /\
Path?.hash_size (B.get h1 p 0) = Ghost.reveal hsz /\
// memory safety
modifies (loc_union
(loc_union
(mt_loc mt)
(B.loc_all_regions_from false (B.frameOf root)))
(path_loc p))
h0 h1 /\
mt_safe h1 mt /\
path_safe h1 (B.frameOf mt) p /\
Rgl?.r_inv (hreg hsz) h1 root /\
V.size_of (phashes h1 p) ==
1ul + mt_path_length 0ul idx (MT?.j mtv0) false /\
// correctness
(let sj, sp, srt =
MTH.mt_get_path
(mt_lift h0 mt) (U32.v idx) (Rgl?.r_repr (hreg hsz) h0 root) in
sj == U32.v (MT?.j mtv1) /\
S.equal sp (lift_path #hsz h1 (B.frameOf mt) p) /\
srt == Rgl?.r_repr (hreg hsz) h1 root)))
#pop-options
#push-options "--z3rlimit 300 --initial_fuel 1 --max_fuel 1"
let mt_get_path #hsz mt idx p root =
let ncmt = CB.cast mt in
let mtframe = B.frameOf ncmt in
let hh0 = HST.get () in
mt_get_root mt root;
let mtv = !*ncmt in
let hsz = MT?.hash_size mtv in
let hh1 = HST.get () in
path_safe_init_preserved mtframe p
(B.loc_union (mt_loc ncmt)
(B.loc_all_regions_from false (B.frameOf root)))
hh0 hh1;
assert (MTH.mt_get_root (mt_lift hh0 ncmt) (Rgl?.r_repr (hreg hsz) hh0 root) ==
(mt_lift hh1 ncmt, Rgl?.r_repr (hreg hsz) hh1 root));
assert (S.equal (lift_path #hsz hh1 mtframe p) S.empty);
let idx = split_offset (MT?.offset mtv) idx in
let i = MT?.i mtv in
let ofs = offset_of (MT?.i mtv) in
let j = MT?.j mtv in
let hs = MT?.hs mtv in
let rhs = MT?.rhs mtv in
assert (mt_safe_elts hh1 0ul hs i j);
assert (V.size_of (V.get hh1 hs 0ul) == j - ofs);
assert (idx < j);
hash_vv_rv_inv_includes hh1 hs 0ul (idx - ofs);
hash_vv_rv_inv_r_inv hh1 hs 0ul (idx - ofs);
hash_vv_as_seq_get_index hh1 hs 0ul (idx - ofs);
let ih = V.index (V.index hs 0ul) (idx - ofs) in
mt_path_insert #hsz mtframe p ih;
let hh2 = HST.get () in
assert (S.equal (lift_path hh2 mtframe p)
(MTH.path_insert
(lift_path hh1 mtframe p)
(S.index (S.index (RV.as_seq hh1 hs) 0) (U32.v idx - U32.v ofs))));
Rgl?.r_sep (hreg hsz) root (path_loc p) hh1 hh2;
mt_safe_preserved ncmt (path_loc p) hh1 hh2;
mt_preserved ncmt (path_loc p) hh1 hh2;
assert (V.size_of (phashes hh2 p) == 1ul);
mt_get_path_ 0ul mtframe hs rhs i j idx p false;
let hh3 = HST.get () in
// memory safety
mt_get_path_loc_union_helper
(loc_union (mt_loc ncmt)
(B.loc_all_regions_from false (B.frameOf root)))
(path_loc p);
Rgl?.r_sep (hreg hsz) root (path_loc p) hh2 hh3;
mt_safe_preserved ncmt (path_loc p) hh2 hh3;
mt_preserved ncmt (path_loc p) hh2 hh3;
assert (V.size_of (phashes hh3 p) ==
1ul + mt_path_length 0ul idx (MT?.j (B.get hh0 ncmt 0)) false);
assert (S.length (lift_path #hsz hh3 mtframe p) ==
S.length (lift_path #hsz hh2 mtframe p) +
MTH.mt_path_length (U32.v idx) (U32.v (MT?.j (B.get hh0 ncmt 0))) false);
assert (modifies (loc_union
(loc_union
(mt_loc ncmt)
(B.loc_all_regions_from false (B.frameOf root)))
(path_loc p))
hh0 hh3);
assert (mt_safe hh3 ncmt);
assert (path_safe hh3 mtframe p);
assert (Rgl?.r_inv (hreg hsz) hh3 root);
assert (V.size_of (phashes hh3 p) ==
1ul + mt_path_length 0ul idx (MT?.j (B.get hh0 ncmt 0)) false);
// correctness
mt_safe_elts_spec hh2 0ul hs i j;
assert (S.equal (lift_path hh3 mtframe p)
(MTH.mt_get_path_ 0 (RV.as_seq hh2 hs) (RV.as_seq hh2 rhs)
(U32.v i) (U32.v j) (U32.v idx)
(lift_path hh2 mtframe p) false));
assert (MTH.mt_get_path
(mt_lift hh0 ncmt) (U32.v idx) (Rgl?.r_repr (hreg hsz) hh0 root) ==
(U32.v (MT?.j (B.get hh3 ncmt 0)),
lift_path hh3 mtframe p,
Rgl?.r_repr (hreg hsz) hh3 root));
j
#pop-options
/// Flushing
private val
mt_flush_to_modifies_rec_helper:
#hsz:hash_size_t ->
lv:uint32_t{lv < merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
h:HS.mem ->
Lemma (loc_union
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq h hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
(loc_union
(RV.rv_loc_elems h hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs))) ==
loc_union
(RV.rv_loc_elems h hs lv (V.size_of hs))
(V.loc_vector_within hs lv (V.size_of hs)))
#push-options "--initial_fuel 2 --max_fuel 2"
let mt_flush_to_modifies_rec_helper #hsz lv hs h =
assert (V.loc_vector_within hs lv (V.size_of hs) ==
loc_union (V.loc_vector_within hs lv (lv + 1ul))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)));
RV.rs_loc_elems_rec_inverse (hvreg hsz) (V.as_seq h hs) (U32.v lv) (U32.v (V.size_of hs));
assert (RV.rv_loc_elems h hs lv (V.size_of hs) ==
loc_union (RV.rs_loc_elem (hvreg hsz) (V.as_seq h hs) (U32.v lv))
(RV.rv_loc_elems h hs (lv + 1ul) (V.size_of hs)));
loc_union_assoc_4
(RV.rs_loc_elem (hvreg hsz) (V.as_seq h hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul))
(RV.rv_loc_elems h hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs))
#pop-options
private
val mt_flush_to_:
hsz:hash_size_t ->
lv:uint32_t{lv < merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
pi:index_t ->
i:index_t{i >= pi} ->
j:Ghost.erased index_t{
Ghost.reveal j >= i &&
U32.v (Ghost.reveal j) < pow2 (32 - U32.v lv)} ->
HST.ST unit
(requires (fun h0 ->
RV.rv_inv h0 hs /\
mt_safe_elts h0 lv hs pi (Ghost.reveal j)))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (loc_union
(RV.rv_loc_elems h0 hs lv (V.size_of hs))
(V.loc_vector_within hs lv (V.size_of hs)))
h0 h1 /\
RV.rv_inv h1 hs /\
mt_safe_elts h1 lv hs i (Ghost.reveal j) /\
// correctness
(mt_safe_elts_spec h0 lv hs pi (Ghost.reveal j);
S.equal (RV.as_seq h1 hs)
(MTH.mt_flush_to_
(U32.v lv) (RV.as_seq h0 hs) (U32.v pi)
(U32.v i) (U32.v (Ghost.reveal j))))))
(decreases (U32.v i))
#restart-solver
#push-options "--z3rlimit 1500 --fuel 1 --ifuel 0"
let rec mt_flush_to_ hsz lv hs pi i j =
let hh0 = HST.get () in
// Base conditions
mt_safe_elts_rec hh0 lv hs pi (Ghost.reveal j);
V.loc_vector_within_included hs 0ul lv;
V.loc_vector_within_included hs lv (lv + 1ul);
V.loc_vector_within_included hs (lv + 1ul) (V.size_of hs);
V.loc_vector_within_disjoint hs lv (lv + 1ul) (lv + 1ul) (V.size_of hs);
let oi = offset_of i in
let opi = offset_of pi in
if oi = opi then mt_safe_elts_spec hh0 lv hs pi (Ghost.reveal j)
else begin
/// 1) Flush hashes at the level `lv`, where the new vector is
/// not yet connected to `hs`.
let ofs = oi - opi in
let hvec = V.index hs lv in
let flushed:(rvector (hreg hsz)) = rv_flush_inplace hvec ofs in
let hh1 = HST.get () in
// 1-0) Basic disjointness conditions for `RV.assign`
V.forall2_forall_left hh0 hs 0ul (V.size_of hs) lv
(fun b1 b2 -> HH.disjoint (Rgl?.region_of (hvreg hsz) b1)
(Rgl?.region_of (hvreg hsz) b2));
V.forall2_forall_right hh0 hs 0ul (V.size_of hs) lv
(fun b1 b2 -> HH.disjoint (Rgl?.region_of (hvreg hsz) b1)
(Rgl?.region_of (hvreg hsz) b2));
V.forall_preserved
hs 0ul lv
(fun b -> HH.disjoint (Rgl?.region_of (hvreg hsz) hvec)
(Rgl?.region_of (hvreg hsz) b))
(RV.loc_rvector hvec)
hh0 hh1;
V.forall_preserved
hs (lv + 1ul) (V.size_of hs)
(fun b -> HH.disjoint (Rgl?.region_of (hvreg hsz) hvec)
(Rgl?.region_of (hvreg hsz) b))
(RV.loc_rvector hvec)
hh0 hh1;
assert (Rgl?.region_of (hvreg hsz) hvec == Rgl?.region_of (hvreg hsz) flushed);
// 1-1) For the `modifies` postcondition.
assert (modifies (RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv)) hh0 hh1);
// 1-2) Preservation
RV.rv_loc_elems_preserved
hs (lv + 1ul) (V.size_of hs)
(RV.loc_rvector (V.get hh0 hs lv)) hh0 hh1;
// 1-3) For `mt_safe_elts`
assert (V.size_of flushed == Ghost.reveal j - offset_of i); // head updated
mt_safe_elts_preserved
(lv + 1ul) hs (pi / 2ul) (Ghost.reveal j / 2ul)
(RV.loc_rvector (V.get hh0 hs lv)) hh0 hh1; // tail not yet
// 1-4) For the `rv_inv` postcondition
RV.rs_loc_elems_elem_disj
(hvreg hsz) (V.as_seq hh0 hs) (V.frameOf hs)
0 (U32.v (V.size_of hs)) 0 (U32.v lv) (U32.v lv);
RV.rs_loc_elems_parent_disj
(hvreg hsz) (V.as_seq hh0 hs) (V.frameOf hs)
0 (U32.v lv);
RV.rv_elems_inv_preserved
hs 0ul lv (RV.loc_rvector (V.get hh0 hs lv))
hh0 hh1;
assert (RV.rv_elems_inv hh1 hs 0ul lv);
RV.rs_loc_elems_elem_disj
(hvreg hsz) (V.as_seq hh0 hs) (V.frameOf hs)
0 (U32.v (V.size_of hs))
(U32.v lv + 1) (U32.v (V.size_of hs))
(U32.v lv);
RV.rs_loc_elems_parent_disj
(hvreg hsz) (V.as_seq hh0 hs) (V.frameOf hs)
(U32.v lv + 1) (U32.v (V.size_of hs));
RV.rv_elems_inv_preserved
hs (lv + 1ul) (V.size_of hs) (RV.loc_rvector (V.get hh0 hs lv))
hh0 hh1;
assert (RV.rv_elems_inv hh1 hs (lv + 1ul) (V.size_of hs));
assert (rv_itself_inv hh1 hs);
assert (elems_reg hh1 hs);
// 1-5) Correctness
assert (S.equal (RV.as_seq hh1 flushed)
(S.slice (RV.as_seq hh0 (V.get hh0 hs lv)) (U32.v ofs)
(S.length (RV.as_seq hh0 (V.get hh0 hs lv)))));
/// 2) Assign the flushed vector to `hs` at the level `lv`.
RV.assign hs lv flushed;
let hh2 = HST.get () in
// 2-1) For the `modifies` postcondition.
assert (modifies (V.loc_vector_within hs lv (lv + 1ul)) hh1 hh2);
assert (modifies (loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul))) hh0 hh2);
// 2-2) Preservation
V.loc_vector_within_disjoint hs lv (lv + 1ul) (lv + 1ul) (V.size_of hs);
RV.rv_loc_elems_preserved
hs (lv + 1ul) (V.size_of hs)
(V.loc_vector_within hs lv (lv + 1ul)) hh1 hh2;
// 2-3) For `mt_safe_elts`
assert (V.size_of (V.get hh2 hs lv) ==
Ghost.reveal j - offset_of i);
mt_safe_elts_preserved
(lv + 1ul) hs (pi / 2ul) (Ghost.reveal j / 2ul)
(V.loc_vector_within hs lv (lv + 1ul)) hh1 hh2;
// 2-4) Correctness
RV.as_seq_sub_preserved hs 0ul lv (loc_rvector flushed) hh0 hh1;
RV.as_seq_sub_preserved hs (lv + 1ul) merkle_tree_size_lg (loc_rvector flushed) hh0 hh1;
assert (S.equal (RV.as_seq hh2 hs)
(S.append
(RV.as_seq_sub hh0 hs 0ul lv)
(S.cons (RV.as_seq hh1 flushed)
(RV.as_seq_sub hh0 hs (lv + 1ul) merkle_tree_size_lg))));
as_seq_sub_upd hh0 hs lv (RV.as_seq hh1 flushed);
// if `lv = 31` then `pi <= i <= j < 2` thus `oi = opi`,
// contradicting the branch.
assert (lv + 1ul < merkle_tree_size_lg);
assert (U32.v (Ghost.reveal j / 2ul) < pow2 (32 - U32.v (lv + 1ul)));
assert (RV.rv_inv hh2 hs);
assert (mt_safe_elts hh2 (lv + 1ul) hs (pi / 2ul) (Ghost.reveal j / 2ul));
/// 3) Recursion
mt_flush_to_ hsz (lv + 1ul) hs (pi / 2ul) (i / 2ul)
(Ghost.hide (Ghost.reveal j / 2ul));
let hh3 = HST.get () in
// 3-0) Memory safety brought from the postcondition of the recursion
assert (modifies
(loc_union
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
(loc_union
(RV.rv_loc_elems hh0 hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs))))
hh0 hh3);
mt_flush_to_modifies_rec_helper lv hs hh0;
V.loc_vector_within_disjoint hs lv (lv + 1ul) (lv + 1ul) (V.size_of hs);
V.loc_vector_within_included hs lv (lv + 1ul);
RV.rv_loc_elems_included hh2 hs (lv + 1ul) (V.size_of hs);
assert (loc_disjoint
(V.loc_vector_within hs lv (lv + 1ul))
(RV.rv_loc_elems hh2 hs (lv + 1ul) (V.size_of hs)));
V.get_preserved hs lv
(loc_union
(RV.rv_loc_elems hh2 hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)))
hh2 hh3;
assert (V.size_of (V.get hh3 hs lv) ==
Ghost.reveal j - offset_of i);
assert (RV.rv_inv hh3 hs);
mt_safe_elts_constr hh3 lv hs i (Ghost.reveal j);
assert (mt_safe_elts hh3 lv hs i (Ghost.reveal j));
// 3-1) Correctness
mt_safe_elts_spec hh2 (lv + 1ul) hs (pi / 2ul) (Ghost.reveal j / 2ul);
assert (S.equal (RV.as_seq hh3 hs)
(MTH.mt_flush_to_ (U32.v lv + 1) (RV.as_seq hh2 hs)
(U32.v pi / 2) (U32.v i / 2) (U32.v (Ghost.reveal j) / 2)));
mt_safe_elts_spec hh0 lv hs pi (Ghost.reveal j);
MTH.mt_flush_to_rec
(U32.v lv) (RV.as_seq hh0 hs)
(U32.v pi) (U32.v i) (U32.v (Ghost.reveal j));
assert (S.equal (RV.as_seq hh3 hs)
(MTH.mt_flush_to_ (U32.v lv) (RV.as_seq hh0 hs)
(U32.v pi) (U32.v i) (U32.v (Ghost.reveal j))))
end
#pop-options
// `mt_flush_to` flushes old hashes in the Merkle tree. It removes hash elements
// from `MT?.i` to **`offset_of (idx - 1)`**, but maintains the tree structure,
// i.e., the tree still holds some old internal hashes (compressed from old
// hashes) which are required to generate Merkle paths for remaining hashes.
//
// Note that `mt_flush_to` (and `mt_flush`) always remain at least one base hash
// elements. If there are `MT?.j` number of elements in the tree, because of the
// precondition `MT?.i <= idx < MT?.j` we still have `idx`-th element after
// flushing.
private inline_for_extraction
val mt_flush_to_pre_nst: mtv:merkle_tree -> idx:offset_t -> Tot bool
let mt_flush_to_pre_nst mtv idx =
offsets_connect (MT?.offset mtv) idx &&
([@inline_let] let idx = split_offset (MT?.offset mtv) idx in
idx >= MT?.i mtv &&
idx < MT?.j mtv)
val mt_flush_to_pre: mt:const_mt_p -> idx:offset_t -> HST.ST bool
(requires (fun h0 -> mt_safe h0 (CB.cast mt)))
(ensures (fun _ _ _ -> True))
let mt_flush_to_pre mt idx =
let mt = CB.cast mt in
let h0 = HST.get() in
let mtv = !*mt in
mt_flush_to_pre_nst mtv idx
#push-options "--z3rlimit 100 --initial_fuel 1 --max_fuel 1"
val mt_flush_to:
mt:mt_p ->
idx:offset_t ->
HST.ST unit
(requires (fun h0 -> mt_safe h0 mt /\ mt_flush_to_pre_nst (B.get h0 mt 0) idx))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (mt_loc mt) h0 h1 /\
mt_safe h1 mt /\
// correctness
(let mtv0 = B.get h0 mt 0 in
let mtv1 = B.get h1 mt 0 in
let off = MT?.offset mtv0 in
let idx = split_offset off idx in
MT?.hash_size mtv0 = MT?.hash_size mtv1 /\
MTH.mt_flush_to (mt_lift h0 mt) (U32.v idx) == mt_lift h1 mt)))
let mt_flush_to mt idx =
let hh0 = HST.get () in
let mtv = !*mt in
let offset = MT?.offset mtv in
let j = MT?.j mtv in
let hsz = MT?.hash_size mtv in
let idx = split_offset offset idx in
let hs = MT?.hs mtv in
mt_flush_to_ hsz 0ul hs (MT?.i mtv) idx (Ghost.hide (MT?.j mtv));
let hh1 = HST.get () in
RV.rv_loc_elems_included hh0 hs 0ul (V.size_of hs);
V.loc_vector_within_included hs 0ul (V.size_of hs);
RV.rv_inv_preserved
(MT?.rhs mtv)
(loc_union
(RV.rv_loc_elems hh0 hs 0ul (V.size_of hs))
(V.loc_vector_within hs 0ul (V.size_of hs)))
hh0 hh1;
RV.as_seq_preserved
(MT?.rhs mtv)
(loc_union
(RV.rv_loc_elems hh0 hs 0ul (V.size_of hs))
(V.loc_vector_within hs 0ul (V.size_of hs)))
hh0 hh1;
Rgl?.r_sep (hreg (MT?.hash_size mtv)) (MT?.mroot mtv)
(loc_union
(RV.rv_loc_elems hh0 hs 0ul (V.size_of hs))
(V.loc_vector_within hs 0ul (V.size_of hs)))
hh0 hh1;
mt *= MT (MT?.hash_size mtv)
(MT?.offset mtv) idx (MT?.j mtv)
hs
(MT?.rhs_ok mtv) (MT?.rhs mtv)
(MT?.mroot mtv)
(MT?.hash_spec mtv) (MT?.hash_fun mtv);
let hh2 = HST.get () in
RV.rv_inv_preserved (MT?.hs mtv) (B.loc_buffer mt) hh1 hh2;
RV.rv_inv_preserved (MT?.rhs mtv) (B.loc_buffer mt) hh1 hh2;
RV.as_seq_preserved (MT?.hs mtv) (B.loc_buffer mt) hh1 hh2;
RV.as_seq_preserved (MT?.rhs mtv) (B.loc_buffer mt) hh1 hh2;
Rgl?.r_sep (hreg (MT?.hash_size mtv)) (MT?.mroot mtv) (B.loc_buffer mt) hh1 hh2;
mt_safe_elts_preserved 0ul hs idx (MT?.j mtv) (B.loc_buffer mt) hh1 hh2
#pop-options
private inline_for_extraction
val mt_flush_pre_nst: mt:merkle_tree -> Tot bool
let mt_flush_pre_nst mt = MT?.j mt > MT?.i mt
val mt_flush_pre: mt:const_mt_p -> HST.ST bool (requires (fun h0 -> mt_safe h0 (CB.cast mt))) (ensures (fun _ _ _ -> True))
let mt_flush_pre mt = mt_flush_pre_nst !*(CB.cast mt)
val mt_flush:
mt:mt_p ->
HST.ST unit
(requires (fun h0 -> mt_safe h0 mt /\ mt_flush_pre_nst (B.get h0 mt 0)))
(ensures (fun h0 _ h1 ->
let mtv0 = B.get h0 mt 0 in
let mtv1 = B.get h1 mt 0 in
// memory safety
modifies (mt_loc mt) h0 h1 /\
mt_safe h1 mt /\
// correctness
MT?.hash_size mtv0 = MT?.hash_size mtv1 /\
MTH.mt_flush (mt_lift h0 mt) == mt_lift h1 mt))
#push-options "--z3rlimit 200 --initial_fuel 1 --max_fuel 1"
let mt_flush mt =
let mtv = !*mt in
let off = MT?.offset mtv in
let j = MT?.j mtv in
let j1 = j - 1ul in
assert (j1 < uint32_32_max);
assert (off < uint64_max);
assert (UInt.fits (U64.v off + U32.v j1) 64);
let jo = join_offset off j1 in
mt_flush_to mt jo
#pop-options
/// Retraction
private
val mt_retract_to_:
#hsz:hash_size_t ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
lv:uint32_t{lv < V.size_of hs} ->
i:index_t ->
s:index_t ->
j:index_t{i <= s && s <= j && v j < pow2 (U32.v (V.size_of hs) - v lv)}
-> HST.ST unit
(requires (fun h0 ->
RV.rv_inv h0 hs /\
mt_safe_elts h0 lv hs i j))
(ensures (fun h0 _ h1 ->
// memory safety
(modifies (loc_union
(RV.rv_loc_elems h0 hs lv (V.size_of hs))
(V.loc_vector_within hs lv (V.size_of hs)))
h0 h1) /\
RV.rv_inv h1 hs /\
mt_safe_elts h1 lv hs i s /\
// correctness
(mt_safe_elts_spec h0 lv hs i j;
S.equal (RV.as_seq h1 hs)
(MTH.mt_retract_to_
(RV.as_seq h0 hs) (U32.v lv)
(U32.v i) (U32.v s) (U32.v j)))
))
(decreases (U32.v merkle_tree_size_lg - U32.v lv))
#push-options "--z3rlimit 300 --initial_fuel 1 --max_fuel 1" | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MerkleTree.Spec.fst.checked",
"MerkleTree.New.High.fst.checked",
"MerkleTree.Low.VectorExtras.fst.checked",
"MerkleTree.Low.Hashfunctions.fst.checked",
"MerkleTree.Low.Datastructures.fst.checked",
"LowStar.Vector.fst.checked",
"LowStar.RVector.fst.checked",
"LowStar.Regional.Instances.fst.checked",
"LowStar.Regional.fst.checked",
"LowStar.ConstBuffer.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Properties.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.HyperStack.fsti.checked",
"FStar.Monotonic.HyperHeap.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Integers.fst.checked",
"FStar.Int.Cast.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.All.fst.checked",
"EverCrypt.Helpers.fsti.checked"
],
"interface_file": false,
"source_file": "MerkleTree.Low.fst"
} | [
{
"abbrev": false,
"full_module": "MerkleTree.Low.VectorExtras",
"short_module": null
},
{
"abbrev": false,
"full_module": "MerkleTree.Low.Hashfunctions",
"short_module": null
},
{
"abbrev": false,
"full_module": "MerkleTree.Low.Datastructures",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": true,
"full_module": "MerkleTree.Spec",
"short_module": "MTS"
},
{
"abbrev": true,
"full_module": "MerkleTree.New.High",
"short_module": "MTH"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Regional.Instances",
"short_module": "RVI"
},
{
"abbrev": true,
"full_module": "LowStar.RVector",
"short_module": "RV"
},
{
"abbrev": true,
"full_module": "LowStar.Vector",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "LowStar.ConstBuffer",
"short_module": "CB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.Monotonic.HyperHeap",
"short_module": "HH"
},
{
"abbrev": true,
"full_module": "FStar.Monotonic.HyperStack",
"short_module": "MHS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "LowStar.Regional.Instances",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.RVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Regional",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Vector",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "MerkleTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "MerkleTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 300,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
hs:
MerkleTree.Low.Datastructures.hash_vv hsz
{LowStar.Vector.size_of hs = MerkleTree.Low.merkle_tree_size_lg} ->
lv: LowStar.Vector.uint32_t{lv < LowStar.Vector.size_of hs} ->
i: MerkleTree.Low.index_t ->
s: MerkleTree.Low.index_t ->
j:
MerkleTree.Low.index_t
{ i <= s && s <= j &&
Lib.IntTypes.v j <
Prims.pow2 (FStar.UInt32.v (LowStar.Vector.size_of hs) - Lib.IntTypes.v lv) }
-> FStar.HyperStack.ST.ST Prims.unit | FStar.HyperStack.ST.ST | [
""
] | [] | [
"MerkleTree.Low.Datastructures.hash_size_t",
"MerkleTree.Low.Datastructures.hash_vv",
"Prims.b2t",
"Prims.op_Equality",
"LowStar.Vector.uint32_t",
"LowStar.Vector.size_of",
"MerkleTree.Low.Datastructures.hash_vec",
"MerkleTree.Low.merkle_tree_size_lg",
"FStar.Integers.op_Less",
"FStar.Integers.Unsigned",
"FStar.Integers.W32",
"MerkleTree.Low.index_t",
"Prims.op_AmpAmp",
"FStar.Integers.op_Less_Equals",
"FStar.Integers.Signed",
"FStar.Integers.Winfinite",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Prims.pow2",
"FStar.Integers.op_Subtraction",
"FStar.UInt32.v",
"FStar.Integers.op_Greater_Equals",
"Prims.unit",
"Prims.bool",
"FStar.Integers.op_Plus",
"FStar.UInt32.__uint_to_t",
"Prims._assert",
"FStar.Seq.Base.equal",
"LowStar.Regional.__proj__Rgl__item__repr",
"MerkleTree.Low.Datastructures.hvreg",
"LowStar.RVector.as_seq",
"MerkleTree.New.High.mt_retract_to_",
"MerkleTree.Low.mt_safe_elts_spec",
"MerkleTree.Low.mt_safe_elts",
"LowStar.RVector.rv_inv",
"Prims.l_imp",
"FStar.Seq.Base.length",
"FStar.Integers.op_Slash",
"MerkleTree.Low.mt_safe_elts_constr",
"Prims.eq2",
"FStar.UInt32.t",
"MerkleTree.Low.Datastructures.hash",
"LowStar.Vector.get",
"MerkleTree.Low.offset_of",
"LowStar.Vector.get_preserved",
"LowStar.Monotonic.Buffer.loc_union",
"LowStar.RVector.rv_loc_elems",
"LowStar.Vector.loc_vector_within",
"LowStar.Monotonic.Buffer.loc_disjoint",
"LowStar.RVector.rv_loc_elems_included",
"LowStar.Vector.loc_vector_within_included",
"LowStar.Vector.loc_vector_within_disjoint",
"MerkleTree.Low.mt_flush_to_modifies_rec_helper",
"LowStar.Monotonic.Buffer.modifies",
"LowStar.RVector.rs_loc_elem",
"LowStar.Vector.as_seq",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"MerkleTree.Low.mt_retract_to_",
"Prims.l_and",
"MerkleTree.Low.as_seq_sub_upd",
"MerkleTree.Low.Datastructures.hreg",
"FStar.Seq.Base.append",
"LowStar.RVector.as_seq_sub",
"FStar.Seq.Base.cons",
"LowStar.RVector.as_seq_sub_preserved",
"LowStar.RVector.loc_rvector",
"MerkleTree.Low.mt_safe_elts_preserved",
"LowStar.RVector.rv_loc_elems_preserved",
"LowStar.RVector.assign",
"FStar.Seq.Base.slice",
"LowStar.RVector.elems_reg",
"LowStar.RVector.rv_itself_inv",
"LowStar.RVector.rv_elems_inv",
"LowStar.RVector.rv_elems_inv_preserved",
"LowStar.RVector.rs_loc_elems_parent_disj",
"LowStar.Vector.frameOf",
"LowStar.RVector.rs_loc_elems_elem_disj",
"FStar.Monotonic.HyperHeap.rid",
"LowStar.Regional.__proj__Rgl__item__region_of",
"LowStar.Vector.forall_preserved",
"FStar.Monotonic.HyperHeap.disjoint",
"LowStar.Vector.forall2_forall_right",
"LowStar.Vector.forall2_forall_left",
"LowStar.RVector.rvector",
"LowStar.RVector.shrink",
"FStar.Integers.int_t",
"LowStar.Vector.index",
"MerkleTree.Low.mt_safe_elts_rec"
] | [
"recursion"
] | false | true | false | false | false | let rec mt_retract_to_ #hsz hs lv i s j =
| let hh0 = HST.get () in
mt_safe_elts_rec hh0 lv hs i j;
V.loc_vector_within_included hs 0ul lv;
V.loc_vector_within_included hs lv (lv + 1ul);
V.loc_vector_within_included hs (lv + 1ul) (V.size_of hs);
V.loc_vector_within_disjoint hs lv (lv + 1ul) (lv + 1ul) (V.size_of hs);
if lv >= V.size_of hs
then ()
else
let hvec = V.index hs lv in
let old_len = j - offset_of i in
let new_len = s - offset_of i in
let retracted = RV.shrink hvec new_len in
let hh1 = HST.get () in
V.forall2_forall_left hh0
hs
0ul
(V.size_of hs)
lv
(fun b1 b2 -> HH.disjoint (Rgl?.region_of (hvreg hsz) b1) (Rgl?.region_of (hvreg hsz) b2));
V.forall2_forall_right hh0
hs
0ul
(V.size_of hs)
lv
(fun b1 b2 -> HH.disjoint (Rgl?.region_of (hvreg hsz) b1) (Rgl?.region_of (hvreg hsz) b2));
V.forall_preserved hs
0ul
lv
(fun b -> HH.disjoint (Rgl?.region_of (hvreg hsz) hvec) (Rgl?.region_of (hvreg hsz) b))
(RV.loc_rvector hvec)
hh0
hh1;
V.forall_preserved hs
(lv + 1ul)
(V.size_of hs)
(fun b -> HH.disjoint (Rgl?.region_of (hvreg hsz) hvec) (Rgl?.region_of (hvreg hsz) b))
(RV.loc_rvector hvec)
hh0
hh1;
assert (Rgl?.region_of (hvreg hsz) hvec == Rgl?.region_of (hvreg hsz) retracted);
assert (modifies (RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv)) hh0 hh1);
RV.rv_loc_elems_preserved hs (lv + 1ul) (V.size_of hs) (RV.loc_rvector (V.get hh0 hs lv)) hh0 hh1;
assert (V.size_of retracted == new_len);
mt_safe_elts_preserved (lv + 1ul)
hs
(i / 2ul)
(j / 2ul)
(RV.loc_rvector (V.get hh0 hs lv))
hh0
hh1;
RV.rs_loc_elems_elem_disj (hvreg hsz)
(V.as_seq hh0 hs)
(V.frameOf hs)
0
(U32.v (V.size_of hs))
0
(U32.v lv)
(U32.v lv);
RV.rs_loc_elems_parent_disj (hvreg hsz) (V.as_seq hh0 hs) (V.frameOf hs) 0 (U32.v lv);
RV.rv_elems_inv_preserved hs 0ul lv (RV.loc_rvector (V.get hh0 hs lv)) hh0 hh1;
assert (RV.rv_elems_inv hh1 hs 0ul lv);
RV.rs_loc_elems_elem_disj (hvreg hsz)
(V.as_seq hh0 hs)
(V.frameOf hs)
0
(U32.v (V.size_of hs))
(U32.v lv + 1)
(U32.v (V.size_of hs))
(U32.v lv);
RV.rs_loc_elems_parent_disj (hvreg hsz)
(V.as_seq hh0 hs)
(V.frameOf hs)
(U32.v lv + 1)
(U32.v (V.size_of hs));
RV.rv_elems_inv_preserved hs (lv + 1ul) (V.size_of hs) (RV.loc_rvector (V.get hh0 hs lv)) hh0 hh1;
assert (RV.rv_elems_inv hh1 hs (lv + 1ul) (V.size_of hs));
assert (rv_itself_inv hh1 hs);
assert (elems_reg hh1 hs);
assert (S.equal (RV.as_seq hh1 retracted)
(S.slice (RV.as_seq hh0 (V.get hh0 hs lv)) 0 (U32.v new_len)));
RV.assign hs lv retracted;
let hh2 = HST.get () in
assert (modifies (V.loc_vector_within hs lv (lv + 1ul)) hh1 hh2);
assert (modifies (loc_union (RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
hh0
hh2);
V.loc_vector_within_disjoint hs lv (lv + 1ul) (lv + 1ul) (V.size_of hs);
RV.rv_loc_elems_preserved hs
(lv + 1ul)
(V.size_of hs)
(V.loc_vector_within hs lv (lv + 1ul))
hh1
hh2;
assert (V.size_of (V.get hh2 hs lv) == s - offset_of i);
mt_safe_elts_preserved (lv + 1ul)
hs
(i / 2ul)
(j / 2ul)
(V.loc_vector_within hs lv (lv + 1ul))
hh1
hh2;
RV.as_seq_sub_preserved hs 0ul lv (loc_rvector retracted) hh0 hh1;
RV.as_seq_sub_preserved hs (lv + 1ul) merkle_tree_size_lg (loc_rvector retracted) hh0 hh1;
assert (S.equal (RV.as_seq hh2 hs)
(S.append (RV.as_seq_sub hh0 hs 0ul lv)
(S.cons (RV.as_seq hh1 retracted) (RV.as_seq_sub hh0 hs (lv + 1ul) merkle_tree_size_lg))
));
as_seq_sub_upd hh0 hs lv (RV.as_seq hh1 retracted);
if lv + 1ul < V.size_of hs
then
(assert (mt_safe_elts hh2 (lv + 1ul) hs (i / 2ul) (j / 2ul));
mt_safe_elts_spec hh2 (lv + 1ul) hs (i / 2ul) (j / 2ul);
mt_retract_to_ hs (lv + 1ul) (i / 2ul) (s / 2ul) (j / 2ul);
let hh3 = HST.get () in
assert (modifies (loc_union (loc_union (RV.rs_loc_elem (hvreg hsz)
(V.as_seq hh0 hs)
(U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
(loc_union (RV.rv_loc_elems hh0 hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs))))
hh0
hh3);
mt_flush_to_modifies_rec_helper lv hs hh0;
V.loc_vector_within_disjoint hs lv (lv + 1ul) (lv + 1ul) (V.size_of hs);
V.loc_vector_within_included hs lv (lv + 1ul);
RV.rv_loc_elems_included hh2 hs (lv + 1ul) (V.size_of hs);
assert (loc_disjoint (V.loc_vector_within hs lv (lv + 1ul))
(RV.rv_loc_elems hh2 hs (lv + 1ul) (V.size_of hs)));
V.get_preserved hs
lv
(loc_union (RV.rv_loc_elems hh2 hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)))
hh2
hh3;
assert (V.size_of (V.get hh3 hs lv) == s - offset_of i);
assert (RV.rv_inv hh3 hs);
mt_safe_elts_constr hh3 lv hs i s;
assert (mt_safe_elts hh3 lv hs i s);
mt_safe_elts_spec hh2 (lv + 1ul) hs (i / 2ul) (j / 2ul);
assert (U32.v lv + 1 < S.length (RV.as_seq hh3 hs) ==>
S.equal (RV.as_seq hh3 hs)
(MTH.mt_retract_to_ (RV.as_seq hh2 hs)
(U32.v lv + 1)
(U32.v i / 2)
(U32.v s / 2)
(U32.v j / 2)));
assert (RV.rv_inv hh0 hs);
assert (mt_safe_elts hh0 lv hs i j);
mt_safe_elts_spec hh0 lv hs i j;
assert (S.equal (RV.as_seq hh3 hs)
(MTH.mt_retract_to_ (RV.as_seq hh0 hs) (U32.v lv) (U32.v i) (U32.v s) (U32.v j))))
else
let hh3 = HST.get () in
assert ((modifies (loc_union (RV.rv_loc_elems hh0 hs lv (V.size_of hs))
(V.loc_vector_within hs lv (V.size_of hs)))
hh0
hh3));
assert (RV.rv_inv hh3 hs /\ mt_safe_elts hh3 lv hs i s);
mt_safe_elts_spec hh0 lv hs i j;
assert (S.equal (RV.as_seq hh3 hs)
(MTH.mt_retract_to_ (RV.as_seq hh0 hs) (U32.v lv) (U32.v i) (U32.v s) (U32.v j))) | false |
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_wp_AES256EncryptRound | val va_wp_AES256EncryptRound
(n: nat8)
(init: quad32)
(round_keys: (seq quad32))
(keys_buffer: buffer128)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_AES256EncryptRound
(n: nat8)
(init: quad32)
(round_keys: (seq quad32))
(keys_buffer: buffer128)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_AES256EncryptRound (n:nat8) (init:quad32) (round_keys:(seq quad32))
(keys_buffer:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (1 <= n /\ n < 14 /\ 14 <= FStar.Seq.Base.length #quad32 round_keys) /\
va_get_vec 0 va_s0 == Vale.AES.AES_BE_s.eval_rounds_def init round_keys (n - 1) /\ va_get_reg 4
va_s0 == Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 keys_buffer
(va_get_mem_heaplet 0 va_s0) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0
va_s0) (va_get_reg 4 va_s0) keys_buffer 15 (va_get_mem_layout va_s0) Secret /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read keys_buffer n
(va_get_mem_heaplet 0 va_s0)) == FStar.Seq.Base.index #quad32 round_keys n /\ (forall
(va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) . let va_sM = va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)) in va_get_ok va_sM /\ va_get_vec 0 va_sM
== Vale.AES.AES_BE_s.eval_rounds_def init round_keys n ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 80,
"end_line": 793,
"start_col": 0,
"start_line": 782
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round
rcon) va_s0 round rcon dst key 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 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1
va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32)) :
(va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(va_QProc (va_code_KeyExpansionRoundEven256 round rcon) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem])
(va_wp_KeyExpansionRoundEven256 round rcon dst key) (va_wpProof_KeyExpansionRoundEven256 round
rcon dst key))
//--
//-- KeyExpansionRoundOdd256
val va_code_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundOdd256 round =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
()))))))))))))))
val va_codegen_success_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundOdd256 round =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundOdd256 (va_mods:va_mods_t) (round:nat8) (dst:buffer128) (key:(seq
nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) =
(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 114 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 115 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 116 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 117 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 118 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 120 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 121 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 123 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 124 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 125 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 127 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg23:Prims.int) = round + 1
in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg21:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg21 va_arg22 0 va_arg23)
(let (va_arg20:Prims.int) = round + 1 in let (va_arg19:Vale.Def.Types_s.quad32) = va_get_vec 1
va_old_s in let (va_arg18:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 129 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_round_key_256_rcon_odd va_arg18 va_arg19 0
va_arg20) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 130 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(())))))))))))))))))))
val va_lemma_KeyExpansionRoundOdd256 : va_b0:va_code -> va_s0:va_state -> round:nat8 ->
dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundOdd256 round) va_s0 /\ va_get_ok
va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0)
dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10
va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundOdd256 va_b0 va_s0 round dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundOdd256 va_mods round dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundOdd256 round) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 92 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 102 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 110 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 111 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 112 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32)
(va_x_v4:quad32) . let va_sM = va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem
va_x_mem va_s0)))))) in va_get_ok va_sM /\ Vale.PPC64LE.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15 (va_get_mem_layout va_sM) Secret /\
va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec 3 va_sM ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundOdd256 : round:nat8 -> dst:buffer128 -> key:(seq nat32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundOdd256 round dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundOdd256 round)
([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1;
va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundOdd256 round dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundOdd256 (va_code_KeyExpansionRoundOdd256 round)
va_s0 round dst key in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) : (va_quickCode
unit (va_code_KeyExpansionRoundOdd256 round)) =
(va_QProc (va_code_KeyExpansionRoundOdd256 round) ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_KeyExpansionRoundOdd256
round dst key) (va_wpProof_KeyExpansionRoundOdd256 round dst key))
//--
//-- KeyExpansionRoundUnrolledRecursive256
val va_code_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_code(decreases %[n])
[@ "opaque_to_smt"]
let rec va_code_KeyExpansionRoundUnrolledRecursive256 n =
(va_Block (va_CCons (if (1 < n && n <= 14) then va_Block (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_CCons (if (n `op_Modulus` 2 = 0)
then va_Block (va_CCons (va_code_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_CNil ())) else va_Block (va_CCons
(va_code_KeyExpansionRoundOdd256 (n - 1)) (va_CNil ()))) (va_CNil ()))) else va_Block (va_CNil
())) (va_CNil ())))
val va_codegen_success_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_pbool(decreases %[n])
[@ "opaque_to_smt"]
let rec va_codegen_success_KeyExpansionRoundUnrolledRecursive256 n =
(va_pbool_and (if (1 < n && n <= 14) then va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_pbool_and (if (n
`op_Modulus` 2 = 0) then va_pbool_and (va_codegen_success_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_ttrue ()) else va_pbool_and
(va_codegen_success_KeyExpansionRoundOdd256 (n - 1)) (va_ttrue ())) (va_ttrue ())) else
va_ttrue ()) (va_ttrue ()))
val va_lemma_KeyExpansionRoundUnrolledRecursive256 : va_b0:va_code -> va_s0:va_state -> key:(seq
nat32) -> dst:buffer128 -> n:int
-> Ghost (va_state & va_fuel)(decreases %[n])
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == (if (n `op_Modulus` 2 = 0) then va_get_vec 1 va_sM else
va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == (if ((n - 1) `op_Modulus` 2 = 0) then va_get_vec 1
va_sM else va_get_vec 3 va_sM) /\ (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read
dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j <= n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.AES256_helpers_BE.expand_key_256 key j) /\ 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_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let rec va_lemma_KeyExpansionRoundUnrolledRecursive256 va_b0 va_s0 key dst n =
va_reveal_opaque (`%va_code_KeyExpansionRoundUnrolledRecursive256)
(va_code_KeyExpansionRoundUnrolledRecursive256 n);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let va_b2 = va_tl va_b1 in
let va_c2 = va_hd va_b1 in
let (va_fc2, va_s2) =
(
if (1 < n && n <= 14) then
(
let va_b3 = va_get_block va_c2 in
let (va_s4, va_fc4) = va_lemma_KeyExpansionRoundUnrolledRecursive256 (va_hd va_b3) va_s0 key
dst (n - 1) in
let va_b4 = va_tl va_b3 in
let (old_mem:vale_heap) = va_get_mem_heaplet 1 va_s4 in
let va_b6 = va_tl va_b4 in
let va_c6 = va_hd va_b4 in
let (va_fc6, va_s6) =
(
if (n `op_Modulus` 2 = 0) then
(
let va_b7 = va_get_block va_c6 in
let (va_s8, va_fc8) = va_lemma_KeyExpansionRoundEven256 (va_hd va_b7) va_s4 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1)) dst key in
let va_b8 = va_tl va_b7 in
let (va_s6, va_f8) = va_lemma_empty_total va_s8 va_b8 in
let va_fc6 = va_lemma_merge_total va_b7 va_s4 va_fc8 va_s8 va_f8 va_s6 in
(va_fc6, va_s6)
)
else
(
let va_b9 = va_get_block va_c6 in
let (va_s10, va_fc10) = va_lemma_KeyExpansionRoundOdd256 (va_hd va_b9) va_s4 (n - 1) dst
key in
let va_b10 = va_tl va_b9 in
let (va_s6, va_f10) = va_lemma_empty_total va_s10 va_b10 in
let va_fc6 = va_lemma_merge_total va_b9 va_s4 va_fc10 va_s10 va_f10 va_s6 in
(va_fc6, va_s6)
)
) in
assert (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1
va_s6)))}0 <= j /\ j < n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_s6)) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j old_mem));
let (va_s2, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f4 = va_lemma_merge_total va_b4 va_s4 va_fc6 va_s6 va_f6 va_s2 in
let va_fc2 = va_lemma_merge_total va_b3 va_s0 va_fc4 va_s4 va_f4 va_s2 in
(va_fc2, va_s2)
)
else
(
let va_b12 = va_get_block va_c2 in
let (va_s2, va_fc2) = va_lemma_empty_total va_s0 va_b12 in
(va_fc2, va_s2)
)
) in
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_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)
/\ (forall (va_x_mem:vale_heap) (va_x_heap1:vale_heap) (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) . 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_upd_mem_heaplet 1
va_x_heap1 (va_upd_mem va_x_mem va_s0)))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == va_if (n `op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM)
(fun _ -> va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == va_if ((n - 1)
`op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM) (fun _ -> va_get_vec 3 va_sM) /\ (forall j .
{:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j
<= n ==> Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j
(va_get_mem_heaplet 1 va_sM)) == Vale.AES.AES256_helpers_BE.expand_key_256 key j) ==> va_k
va_sM (())))
val va_wpProof_KeyExpansionRoundUnrolledRecursive256 : key:(seq nat32) -> dst:buffer128 -> n:int ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundUnrolledRecursive256
n) ([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_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundUnrolledRecursive256
(va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 key dst n 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem 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_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int) :
(va_quickCode unit (va_code_KeyExpansionRoundUnrolledRecursive256 n)) =
(va_QProc (va_code_KeyExpansionRoundUnrolledRecursive256 n) ([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_mem_heaplet 1;
va_Mod_mem]) (va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n)
(va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n))
//--
//-- KeyExpansion256Stdcall
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansion256Stdcall () =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_CCons
(va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret) (va_CCons (va_code_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg
10) Secret) (va_CCons (va_code_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) Secret) (va_CCons
(va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 14) (va_CCons (va_code_Vxor (va_op_vec_opr_vec
1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_CNil ()))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansion256Stdcall () =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg
10) Secret) (va_pbool_and (va_codegen_success_Store128_byte16_buffer (va_op_heaplet_mem_heaplet
1) (va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) Secret) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 14) (va_pbool_and
(va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_ttrue ())))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansion256Stdcall (va_mods:va_mods_t) (input_key_b:buffer128)
(output_key_expansion_b:buffer128) : (va_quickCode unit (va_code_KeyExpansion256Stdcall ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = Vale.AES.AES256_helpers_BE.make_AES256_key
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 0
(va_get_mem_heaplet 0 va_s))) (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet 0 va_s))) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 193 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 194 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret input_key_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 195 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret input_key_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 197 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) Secret output_key_expansion_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 198 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret output_key_expansion_b 1) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 200 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 201 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_KeyExpansionRoundUnrolledRecursive256 key output_key_expansion_b 14) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 202 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_expand_key_256 key 15) (va_QLemma va_range1
"***** PRECONDITION NOT MET AT line 203 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
true (fun _ -> va_reveal_eq (`%key_to_round_keys_word) key_to_round_keys_word
key_to_round_keys_word) (fun _ -> va_reveal_opaque (`%key_to_round_keys_word)
key_to_round_keys_word) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 206 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 207 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 208 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 209 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_QEmpty
(()))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansion256Stdcall va_b0 va_s0 input_key_b output_key_expansion_b =
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_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansion256Stdcall va_mods input_key_b output_key_expansion_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansion256Stdcall ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 174 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ (let (key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) =
Vale.AES.AES256_helpers_BE.make_AES256_key (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 0 (va_get_mem_heaplet 0 va_s0)))
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 1
(va_get_mem_heaplet 0 va_s0))) in label va_range1
"***** POSTCONDITION NOT MET AT line 186 column 71 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_sM) (va_get_reg 4 va_sM)
input_key_b 2 (va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 187 column 83 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM)
output_key_expansion_b 15 (va_get_mem_layout va_sM) Secret)) /\ (let (key:(FStar.Seq.Base.seq
Vale.Def.Types_s.nat32)) = Vale.AES.AES256_helpers_BE.make_AES256_key
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 0
(va_get_mem_heaplet 0 va_s0))) (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet 0 va_s0))) in label
va_range1
"***** POSTCONDITION NOT MET AT line 189 column 70 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer128 output_key_expansion_b (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 191 column 133 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(forall (j:nat) . {:pattern(reverse_bytes_quad32 (buffer128_read output_key_expansion_b j
(va_get_mem_heaplet 1 va_sM)))}j <= 14 ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read output_key_expansion_b j (va_get_mem_heaplet 1 va_sM)) ==
FStar.Seq.Base.index #Vale.Def.Types_s.quad32 (Vale.AES.AES_BE_s.key_to_round_keys_word AES_256
key) j))) 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_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_KeyExpansion256Stdcall input_key_b output_key_expansion_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansion256Stdcall (va_code_KeyExpansion256Stdcall ()) va_s0
input_key_b output_key_expansion_b 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem 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_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- AES256EncryptRound
val va_code_AES256EncryptRound : n:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_AES256EncryptRound n =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n)) (va_CCons
(va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_CNil ())))))
val va_codegen_success_AES256EncryptRound : n:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_AES256EncryptRound n =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n))
(va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_Vcipher (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2))
(va_ttrue ()))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_AES256EncryptRound (va_mods:va_mods_t) (n:nat8) (init:quad32) (round_keys:(seq
quad32)) (keys_buffer:buffer128) : (va_quickCode unit (va_code_AES256EncryptRound n)) =
(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 235 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 236 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret keys_buffer n) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 237 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipher (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_QEmpty
(()))))))
val va_lemma_AES256EncryptRound : va_b0:va_code -> va_s0:va_state -> n:nat8 -> init:quad32 ->
round_keys:(seq quad32) -> keys_buffer:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AES256EncryptRound n) va_s0 /\ va_get_ok va_s0 /\ (1
<= n /\ n < 14 /\ 14 <= FStar.Seq.Base.length #quad32 round_keys) /\ va_get_vec 0 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init round_keys (n - 1) /\ va_get_reg 4 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 keys_buffer (va_get_mem_heaplet 0
va_s0) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0)
keys_buffer 15 (va_get_mem_layout va_s0) Secret /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read keys_buffer n (va_get_mem_heaplet 0 va_s0)) ==
FStar.Seq.Base.index #quad32 round_keys n))
(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 0 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init round_keys n /\ va_state_eq va_sM
(va_update_vec 2 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_AES256EncryptRound va_b0 va_s0 n init round_keys keys_buffer =
let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in
let va_qc = va_qcode_AES256EncryptRound va_mods n init round_keys keys_buffer in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_AES256EncryptRound n) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 216 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 233 column 51 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 0 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init round_keys n)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
n: Vale.PPC64LE.Memory.nat8 ->
init: Vale.PPC64LE.Memory.quad32 ->
round_keys: FStar.Seq.Base.seq Vale.PPC64LE.Memory.quad32 ->
keys_buffer: Vale.PPC64LE.Memory.buffer128 ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.PPC64LE.Memory.nat8",
"Vale.PPC64LE.Memory.quad32",
"FStar.Seq.Base.seq",
"Vale.PPC64LE.Memory.buffer128",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"FStar.Seq.Base.length",
"Prims.eq2",
"Vale.Def.Types_s.quad32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.AES.AES_BE_s.eval_rounds_def",
"Prims.op_Subtraction",
"Prims.int",
"Vale.PPC64LE.Decls.va_get_reg",
"Vale.PPC64LE.Memory.buffer_addr",
"Vale.PPC64LE.Memory.vuint128",
"Vale.PPC64LE.Decls.va_get_mem_heaplet",
"Vale.PPC64LE.Decls.validSrcAddrs128",
"Vale.PPC64LE.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.Def.Types_s.reverse_bytes_quad32",
"Vale.PPC64LE.Decls.buffer128_read",
"FStar.Seq.Base.index",
"Prims.l_Forall",
"Vale.PPC64LE.Memory.nat64",
"Prims.l_imp",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.Decls.va_upd_vec",
"Vale.PPC64LE.Decls.va_upd_reg"
] | [] | false | false | false | true | true | let va_wp_AES256EncryptRound
(n: nat8)
(init: quad32)
(round_keys: (seq quad32))
(keys_buffer: buffer128)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_get_ok va_s0 /\ (1 <= n /\ n < 14 /\ 14 <= FStar.Seq.Base.length #quad32 round_keys) /\
va_get_vec 0 va_s0 == Vale.AES.AES_BE_s.eval_rounds_def init round_keys (n - 1) /\
va_get_reg 4 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128
keys_buffer
(va_get_mem_heaplet 0 va_s0) /\
Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg 4 va_s0)
keys_buffer
15
(va_get_mem_layout va_s0)
Secret /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read keys_buffer
n
(va_get_mem_heaplet 0 va_s0)) ==
FStar.Seq.Base.index #quad32 round_keys n /\
(forall (va_x_r10: nat64) (va_x_v0: quad32) (va_x_v2: quad32).
let va_sM = va_upd_vec 2 va_x_v2 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)) in
va_get_ok va_sM /\ va_get_vec 0 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init round_keys n ==>
va_k va_sM (()))) | false |
Vale.Wrapper.X64.Fadd.fsti | Vale.Wrapper.X64.Fadd.as_nat | val as_nat (b: B.buffer UInt64.t {B.length b == 4}) (h: HS.mem) : GTot nat | val as_nat (b: B.buffer UInt64.t {B.length b == 4}) (h: HS.mem) : GTot nat | let as_nat (b:B.buffer UInt64.t{B.length b == 4}) (h:HS.mem) : GTot nat =
let s = B.as_seq h b in
let s0 = UInt64.v (Seq.index s 0) in
let s1 = UInt64.v (Seq.index s 1) in
let s2 = UInt64.v (Seq.index s 2) in
let s3 = UInt64.v (Seq.index s 3) in
pow2_four s0 s1 s2 s3 | {
"file_name": "vale/code/arch/x64/interop/Vale.Wrapper.X64.Fadd.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 23,
"end_line": 23,
"start_col": 0,
"start_line": 17
} | module Vale.Wrapper.X64.Fadd
open Vale.X64.CPU_Features_s
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open Vale.Curve25519.Fast_defs
open FStar.Mul
unfold
let u256 = b:B.buffer UInt64.t{B.length b == 4}
unfold
let u512 = b:B.buffer UInt64.t{B.length b == 8}
unfold
let u1024 = b:B.buffer UInt64.t{B.length b == 16} | {
"checked_file": "/",
"dependencies": [
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Curve25519.Fast_defs.fst.checked",
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.Wrapper.X64.Fadd.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Curve25519.Fast_defs",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Wrapper.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Wrapper.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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
b: LowStar.Buffer.buffer FStar.UInt64.t {LowStar.Monotonic.Buffer.length b == 4} ->
h: FStar.Monotonic.HyperStack.mem
-> Prims.GTot Prims.nat | Prims.GTot | [
"sometrivial"
] | [] | [
"LowStar.Buffer.buffer",
"FStar.UInt64.t",
"Prims.eq2",
"Prims.int",
"LowStar.Monotonic.Buffer.length",
"LowStar.Buffer.trivial_preorder",
"FStar.Monotonic.HyperStack.mem",
"Vale.Curve25519.Fast_defs.pow2_four",
"FStar.UInt.uint_t",
"FStar.UInt64.v",
"FStar.Seq.Base.index",
"FStar.Seq.Base.seq",
"LowStar.Monotonic.Buffer.as_seq",
"Prims.nat"
] | [] | false | false | false | false | false | let as_nat (b: B.buffer UInt64.t {B.length b == 4}) (h: HS.mem) : GTot nat =
| let s = B.as_seq h b in
let s0 = UInt64.v (Seq.index s 0) in
let s1 = UInt64.v (Seq.index s 1) in
let s2 = UInt64.v (Seq.index s 2) in
let s3 = UInt64.v (Seq.index s 3) in
pow2_four s0 s1 s2 s3 | false |
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_wp_KeyExpansionRoundOdd256 | val va_wp_KeyExpansionRoundOdd256
(round: nat8)
(dst: buffer128)
(key: (seq nat32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_KeyExpansionRoundOdd256
(round: nat8)
(dst: buffer128)
(key: (seq nat32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32)
(va_x_v4:quad32) . let va_sM = va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem
va_x_mem va_s0)))))) in va_get_ok va_sM /\ Vale.PPC64LE.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15 (va_get_mem_layout va_sM) Secret /\
va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec 3 va_sM ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 78,
"end_line": 380,
"start_col": 0,
"start_line": 364
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round
rcon) va_s0 round rcon dst key 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 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1
va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32)) :
(va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(va_QProc (va_code_KeyExpansionRoundEven256 round rcon) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem])
(va_wp_KeyExpansionRoundEven256 round rcon dst key) (va_wpProof_KeyExpansionRoundEven256 round
rcon dst key))
//--
//-- KeyExpansionRoundOdd256
val va_code_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundOdd256 round =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
()))))))))))))))
val va_codegen_success_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundOdd256 round =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundOdd256 (va_mods:va_mods_t) (round:nat8) (dst:buffer128) (key:(seq
nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) =
(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 114 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 115 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 116 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 117 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 118 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 120 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 121 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 123 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 124 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 125 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 127 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg23:Prims.int) = round + 1
in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg21:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg21 va_arg22 0 va_arg23)
(let (va_arg20:Prims.int) = round + 1 in let (va_arg19:Vale.Def.Types_s.quad32) = va_get_vec 1
va_old_s in let (va_arg18:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 129 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_round_key_256_rcon_odd va_arg18 va_arg19 0
va_arg20) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 130 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(())))))))))))))))))))
val va_lemma_KeyExpansionRoundOdd256 : va_b0:va_code -> va_s0:va_state -> round:nat8 ->
dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundOdd256 round) va_s0 /\ va_get_ok
va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0)
dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10
va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundOdd256 va_b0 va_s0 round dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundOdd256 va_mods round dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundOdd256 round) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 92 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 102 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 110 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 111 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 112 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
round: Vale.PPC64LE.Memory.nat8 ->
dst: Vale.PPC64LE.Memory.buffer128 ->
key: FStar.Seq.Base.seq Vale.PPC64LE.Memory.nat32 ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.PPC64LE.Memory.nat8",
"Vale.PPC64LE.Memory.buffer128",
"FStar.Seq.Base.seq",
"Vale.PPC64LE.Memory.nat32",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Vale.PPC64LE.Decls.validDstAddrs128",
"Vale.PPC64LE.Decls.va_get_mem_heaplet",
"Vale.PPC64LE.Decls.va_get_reg",
"Vale.PPC64LE.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Secret",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"Prims.l_not",
"Prims.eq2",
"Prims.int",
"Prims.op_Modulus",
"Prims.op_Addition",
"Vale.AES.AES_BE_s.is_aes_key_word",
"Vale.AES.AES_common_s.AES_256",
"Vale.Def.Types_s.quad32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.AES.AES256_helpers_BE.expand_key_256",
"Prims.op_Subtraction",
"Prims.l_Forall",
"Vale.PPC64LE.InsBasic.vale_heap",
"Vale.PPC64LE.Memory.nat64",
"Vale.PPC64LE.Memory.quad32",
"Prims.l_imp",
"Vale.Def.Types_s.reverse_bytes_quad32",
"Vale.PPC64LE.Decls.buffer128_read",
"Vale.PPC64LE.Decls.modifies_buffer_specific128",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.Decls.va_upd_vec",
"Vale.PPC64LE.Decls.va_upd_reg",
"Vale.PPC64LE.Decls.va_upd_mem_heaplet",
"Vale.PPC64LE.Decls.va_upd_mem"
] | [] | false | false | false | true | true | let va_wp_KeyExpansionRoundOdd256
(round: nat8)
(dst: buffer128)
(key: (seq nat32))
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_get_ok va_s0 /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0)
(va_get_reg 3 va_s0)
dst
15
(va_get_mem_layout va_s0)
Secret /\ (1 <= round /\ round < 14) /\ (round + 1) `op_Modulus` 2 =!= 0 /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\
va_get_vec 3 va_s0 == Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\
va_get_vec 1 va_s0 == Vale.AES.AES256_helpers_BE.expand_key_256 key round /\
(forall (va_x_mem: vale_heap)
(va_x_heap1: vale_heap)
(va_x_r10: nat64)
(va_x_v0: quad32)
(va_x_v2: quad32)
(va_x_v3: quad32)
(va_x_v4: quad32).
let va_sM =
va_upd_vec 4
va_x_v4
(va_upd_vec 3
va_x_v3
(va_upd_vec 2
va_x_v2
(va_upd_vec 0
va_x_v0
(va_upd_reg 10
va_x_r10
(va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))
in
va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM)
(va_get_reg 3 va_sM)
dst
15
(va_get_mem_layout va_sM)
Secret /\
va_get_vec 3 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst
(round + 1)
(va_get_mem_heaplet 1 va_sM)) /\
va_get_vec 3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst
(va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM)
(round + 1)
(round + 1) ==>
va_k va_sM (()))) | false |
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_wpProof_AES256EncryptBlock | val va_wpProof_AES256EncryptBlock : input:quad32 -> key:(seq nat32) -> round_keys:(seq quad32) ->
keys_buffer:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AES256EncryptBlock input key round_keys keys_buffer va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AES256EncryptBlock ()) ([va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g)))) | val va_wpProof_AES256EncryptBlock : input:quad32 -> key:(seq nat32) -> round_keys:(seq quad32) ->
keys_buffer:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AES256EncryptBlock input key round_keys keys_buffer va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AES256EncryptBlock ()) ([va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g)))) | let va_wpProof_AES256EncryptBlock input key round_keys keys_buffer va_s0 va_k =
let (va_sM, va_f0) = va_lemma_AES256EncryptBlock (va_code_AES256EncryptBlock ()) va_s0 input key
round_keys keys_buffer in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 2 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 2; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 22,
"end_line": 949,
"start_col": 0,
"start_line": 941
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round
rcon) va_s0 round rcon dst key 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 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1
va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32)) :
(va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(va_QProc (va_code_KeyExpansionRoundEven256 round rcon) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem])
(va_wp_KeyExpansionRoundEven256 round rcon dst key) (va_wpProof_KeyExpansionRoundEven256 round
rcon dst key))
//--
//-- KeyExpansionRoundOdd256
val va_code_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundOdd256 round =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
()))))))))))))))
val va_codegen_success_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundOdd256 round =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundOdd256 (va_mods:va_mods_t) (round:nat8) (dst:buffer128) (key:(seq
nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) =
(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 114 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 115 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 116 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 117 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 118 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 120 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 121 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 123 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 124 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 125 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 127 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg23:Prims.int) = round + 1
in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg21:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg21 va_arg22 0 va_arg23)
(let (va_arg20:Prims.int) = round + 1 in let (va_arg19:Vale.Def.Types_s.quad32) = va_get_vec 1
va_old_s in let (va_arg18:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 129 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_round_key_256_rcon_odd va_arg18 va_arg19 0
va_arg20) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 130 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(())))))))))))))))))))
val va_lemma_KeyExpansionRoundOdd256 : va_b0:va_code -> va_s0:va_state -> round:nat8 ->
dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundOdd256 round) va_s0 /\ va_get_ok
va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0)
dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10
va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundOdd256 va_b0 va_s0 round dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundOdd256 va_mods round dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundOdd256 round) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 92 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 102 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 110 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 111 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 112 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32)
(va_x_v4:quad32) . let va_sM = va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem
va_x_mem va_s0)))))) in va_get_ok va_sM /\ Vale.PPC64LE.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15 (va_get_mem_layout va_sM) Secret /\
va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec 3 va_sM ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundOdd256 : round:nat8 -> dst:buffer128 -> key:(seq nat32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundOdd256 round dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundOdd256 round)
([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1;
va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundOdd256 round dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundOdd256 (va_code_KeyExpansionRoundOdd256 round)
va_s0 round dst key in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) : (va_quickCode
unit (va_code_KeyExpansionRoundOdd256 round)) =
(va_QProc (va_code_KeyExpansionRoundOdd256 round) ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_KeyExpansionRoundOdd256
round dst key) (va_wpProof_KeyExpansionRoundOdd256 round dst key))
//--
//-- KeyExpansionRoundUnrolledRecursive256
val va_code_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_code(decreases %[n])
[@ "opaque_to_smt"]
let rec va_code_KeyExpansionRoundUnrolledRecursive256 n =
(va_Block (va_CCons (if (1 < n && n <= 14) then va_Block (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_CCons (if (n `op_Modulus` 2 = 0)
then va_Block (va_CCons (va_code_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_CNil ())) else va_Block (va_CCons
(va_code_KeyExpansionRoundOdd256 (n - 1)) (va_CNil ()))) (va_CNil ()))) else va_Block (va_CNil
())) (va_CNil ())))
val va_codegen_success_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_pbool(decreases %[n])
[@ "opaque_to_smt"]
let rec va_codegen_success_KeyExpansionRoundUnrolledRecursive256 n =
(va_pbool_and (if (1 < n && n <= 14) then va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_pbool_and (if (n
`op_Modulus` 2 = 0) then va_pbool_and (va_codegen_success_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_ttrue ()) else va_pbool_and
(va_codegen_success_KeyExpansionRoundOdd256 (n - 1)) (va_ttrue ())) (va_ttrue ())) else
va_ttrue ()) (va_ttrue ()))
val va_lemma_KeyExpansionRoundUnrolledRecursive256 : va_b0:va_code -> va_s0:va_state -> key:(seq
nat32) -> dst:buffer128 -> n:int
-> Ghost (va_state & va_fuel)(decreases %[n])
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == (if (n `op_Modulus` 2 = 0) then va_get_vec 1 va_sM else
va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == (if ((n - 1) `op_Modulus` 2 = 0) then va_get_vec 1
va_sM else va_get_vec 3 va_sM) /\ (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read
dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j <= n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.AES256_helpers_BE.expand_key_256 key j) /\ 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_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let rec va_lemma_KeyExpansionRoundUnrolledRecursive256 va_b0 va_s0 key dst n =
va_reveal_opaque (`%va_code_KeyExpansionRoundUnrolledRecursive256)
(va_code_KeyExpansionRoundUnrolledRecursive256 n);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let va_b2 = va_tl va_b1 in
let va_c2 = va_hd va_b1 in
let (va_fc2, va_s2) =
(
if (1 < n && n <= 14) then
(
let va_b3 = va_get_block va_c2 in
let (va_s4, va_fc4) = va_lemma_KeyExpansionRoundUnrolledRecursive256 (va_hd va_b3) va_s0 key
dst (n - 1) in
let va_b4 = va_tl va_b3 in
let (old_mem:vale_heap) = va_get_mem_heaplet 1 va_s4 in
let va_b6 = va_tl va_b4 in
let va_c6 = va_hd va_b4 in
let (va_fc6, va_s6) =
(
if (n `op_Modulus` 2 = 0) then
(
let va_b7 = va_get_block va_c6 in
let (va_s8, va_fc8) = va_lemma_KeyExpansionRoundEven256 (va_hd va_b7) va_s4 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1)) dst key in
let va_b8 = va_tl va_b7 in
let (va_s6, va_f8) = va_lemma_empty_total va_s8 va_b8 in
let va_fc6 = va_lemma_merge_total va_b7 va_s4 va_fc8 va_s8 va_f8 va_s6 in
(va_fc6, va_s6)
)
else
(
let va_b9 = va_get_block va_c6 in
let (va_s10, va_fc10) = va_lemma_KeyExpansionRoundOdd256 (va_hd va_b9) va_s4 (n - 1) dst
key in
let va_b10 = va_tl va_b9 in
let (va_s6, va_f10) = va_lemma_empty_total va_s10 va_b10 in
let va_fc6 = va_lemma_merge_total va_b9 va_s4 va_fc10 va_s10 va_f10 va_s6 in
(va_fc6, va_s6)
)
) in
assert (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1
va_s6)))}0 <= j /\ j < n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_s6)) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j old_mem));
let (va_s2, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f4 = va_lemma_merge_total va_b4 va_s4 va_fc6 va_s6 va_f6 va_s2 in
let va_fc2 = va_lemma_merge_total va_b3 va_s0 va_fc4 va_s4 va_f4 va_s2 in
(va_fc2, va_s2)
)
else
(
let va_b12 = va_get_block va_c2 in
let (va_s2, va_fc2) = va_lemma_empty_total va_s0 va_b12 in
(va_fc2, va_s2)
)
) in
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_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)
/\ (forall (va_x_mem:vale_heap) (va_x_heap1:vale_heap) (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) . 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_upd_mem_heaplet 1
va_x_heap1 (va_upd_mem va_x_mem va_s0)))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == va_if (n `op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM)
(fun _ -> va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == va_if ((n - 1)
`op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM) (fun _ -> va_get_vec 3 va_sM) /\ (forall j .
{:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j
<= n ==> Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j
(va_get_mem_heaplet 1 va_sM)) == Vale.AES.AES256_helpers_BE.expand_key_256 key j) ==> va_k
va_sM (())))
val va_wpProof_KeyExpansionRoundUnrolledRecursive256 : key:(seq nat32) -> dst:buffer128 -> n:int ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundUnrolledRecursive256
n) ([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_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundUnrolledRecursive256
(va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 key dst n 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem 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_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int) :
(va_quickCode unit (va_code_KeyExpansionRoundUnrolledRecursive256 n)) =
(va_QProc (va_code_KeyExpansionRoundUnrolledRecursive256 n) ([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_mem_heaplet 1;
va_Mod_mem]) (va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n)
(va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n))
//--
//-- KeyExpansion256Stdcall
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansion256Stdcall () =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_CCons
(va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret) (va_CCons (va_code_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg
10) Secret) (va_CCons (va_code_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) Secret) (va_CCons
(va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 14) (va_CCons (va_code_Vxor (va_op_vec_opr_vec
1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_CNil ()))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansion256Stdcall () =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg
10) Secret) (va_pbool_and (va_codegen_success_Store128_byte16_buffer (va_op_heaplet_mem_heaplet
1) (va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) Secret) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 14) (va_pbool_and
(va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_ttrue ())))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansion256Stdcall (va_mods:va_mods_t) (input_key_b:buffer128)
(output_key_expansion_b:buffer128) : (va_quickCode unit (va_code_KeyExpansion256Stdcall ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = Vale.AES.AES256_helpers_BE.make_AES256_key
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 0
(va_get_mem_heaplet 0 va_s))) (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet 0 va_s))) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 193 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 194 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret input_key_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 195 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret input_key_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 197 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) Secret output_key_expansion_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 198 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret output_key_expansion_b 1) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 200 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 201 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_KeyExpansionRoundUnrolledRecursive256 key output_key_expansion_b 14) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 202 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_expand_key_256 key 15) (va_QLemma va_range1
"***** PRECONDITION NOT MET AT line 203 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
true (fun _ -> va_reveal_eq (`%key_to_round_keys_word) key_to_round_keys_word
key_to_round_keys_word) (fun _ -> va_reveal_opaque (`%key_to_round_keys_word)
key_to_round_keys_word) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 206 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 207 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 208 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 209 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_QEmpty
(()))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansion256Stdcall va_b0 va_s0 input_key_b output_key_expansion_b =
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_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansion256Stdcall va_mods input_key_b output_key_expansion_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansion256Stdcall ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 174 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ (let (key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) =
Vale.AES.AES256_helpers_BE.make_AES256_key (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 0 (va_get_mem_heaplet 0 va_s0)))
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 1
(va_get_mem_heaplet 0 va_s0))) in label va_range1
"***** POSTCONDITION NOT MET AT line 186 column 71 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_sM) (va_get_reg 4 va_sM)
input_key_b 2 (va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 187 column 83 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM)
output_key_expansion_b 15 (va_get_mem_layout va_sM) Secret)) /\ (let (key:(FStar.Seq.Base.seq
Vale.Def.Types_s.nat32)) = Vale.AES.AES256_helpers_BE.make_AES256_key
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 0
(va_get_mem_heaplet 0 va_s0))) (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet 0 va_s0))) in label
va_range1
"***** POSTCONDITION NOT MET AT line 189 column 70 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer128 output_key_expansion_b (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 191 column 133 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(forall (j:nat) . {:pattern(reverse_bytes_quad32 (buffer128_read output_key_expansion_b j
(va_get_mem_heaplet 1 va_sM)))}j <= 14 ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read output_key_expansion_b j (va_get_mem_heaplet 1 va_sM)) ==
FStar.Seq.Base.index #Vale.Def.Types_s.quad32 (Vale.AES.AES_BE_s.key_to_round_keys_word AES_256
key) j))) 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_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_KeyExpansion256Stdcall input_key_b output_key_expansion_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansion256Stdcall (va_code_KeyExpansion256Stdcall ()) va_s0
input_key_b output_key_expansion_b 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem 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_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- AES256EncryptRound
val va_code_AES256EncryptRound : n:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_AES256EncryptRound n =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n)) (va_CCons
(va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_CNil ())))))
val va_codegen_success_AES256EncryptRound : n:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_AES256EncryptRound n =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n))
(va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_Vcipher (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2))
(va_ttrue ()))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_AES256EncryptRound (va_mods:va_mods_t) (n:nat8) (init:quad32) (round_keys:(seq
quad32)) (keys_buffer:buffer128) : (va_quickCode unit (va_code_AES256EncryptRound n)) =
(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 235 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 236 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret keys_buffer n) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 237 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipher (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_QEmpty
(()))))))
val va_lemma_AES256EncryptRound : va_b0:va_code -> va_s0:va_state -> n:nat8 -> init:quad32 ->
round_keys:(seq quad32) -> keys_buffer:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AES256EncryptRound n) va_s0 /\ va_get_ok va_s0 /\ (1
<= n /\ n < 14 /\ 14 <= FStar.Seq.Base.length #quad32 round_keys) /\ va_get_vec 0 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init round_keys (n - 1) /\ va_get_reg 4 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 keys_buffer (va_get_mem_heaplet 0
va_s0) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0)
keys_buffer 15 (va_get_mem_layout va_s0) Secret /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read keys_buffer n (va_get_mem_heaplet 0 va_s0)) ==
FStar.Seq.Base.index #quad32 round_keys n))
(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 0 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init round_keys n /\ va_state_eq va_sM
(va_update_vec 2 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_AES256EncryptRound va_b0 va_s0 n init round_keys keys_buffer =
let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in
let va_qc = va_qcode_AES256EncryptRound va_mods n init round_keys keys_buffer in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_AES256EncryptRound n) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 216 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 233 column 51 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 0 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init round_keys n)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_AES256EncryptRound (n:nat8) (init:quad32) (round_keys:(seq quad32))
(keys_buffer:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (1 <= n /\ n < 14 /\ 14 <= FStar.Seq.Base.length #quad32 round_keys) /\
va_get_vec 0 va_s0 == Vale.AES.AES_BE_s.eval_rounds_def init round_keys (n - 1) /\ va_get_reg 4
va_s0 == Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 keys_buffer
(va_get_mem_heaplet 0 va_s0) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0
va_s0) (va_get_reg 4 va_s0) keys_buffer 15 (va_get_mem_layout va_s0) Secret /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read keys_buffer n
(va_get_mem_heaplet 0 va_s0)) == FStar.Seq.Base.index #quad32 round_keys n /\ (forall
(va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) . let va_sM = va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)) in va_get_ok va_sM /\ va_get_vec 0 va_sM
== Vale.AES.AES_BE_s.eval_rounds_def init round_keys n ==> va_k va_sM (())))
val va_wpProof_AES256EncryptRound : n:nat8 -> init:quad32 -> round_keys:(seq quad32) ->
keys_buffer:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AES256EncryptRound n init round_keys keys_buffer va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AES256EncryptRound n) ([va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_AES256EncryptRound n init round_keys keys_buffer va_s0 va_k =
let (va_sM, va_f0) = va_lemma_AES256EncryptRound (va_code_AES256EncryptRound n) va_s0 n init
round_keys keys_buffer in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 2 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 2; 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_AES256EncryptRound (n:nat8) (init:quad32) (round_keys:(seq quad32))
(keys_buffer:buffer128) : (va_quickCode unit (va_code_AES256EncryptRound n)) =
(va_QProc (va_code_AES256EncryptRound n) ([va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10])
(va_wp_AES256EncryptRound n init round_keys keys_buffer) (va_wpProof_AES256EncryptRound n init
round_keys keys_buffer))
//--
//-- AES256EncryptBlock
[@ "opaque_to_smt" va_qattr]
let va_code_AES256EncryptBlock () =
(va_Block (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10)
0) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons
(va_code_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_CCons
(va_code_AES256EncryptRound 1) (va_CCons (va_code_AES256EncryptRound 2) (va_CCons
(va_code_AES256EncryptRound 3) (va_CCons (va_code_AES256EncryptRound 4) (va_CCons
(va_code_AES256EncryptRound 5) (va_CCons (va_code_AES256EncryptRound 6) (va_CCons
(va_code_AES256EncryptRound 7) (va_CCons (va_code_AES256EncryptRound 8) (va_CCons
(va_code_AES256EncryptRound 9) (va_CCons (va_code_AES256EncryptRound 10) (va_CCons
(va_code_AES256EncryptRound 11) (va_CCons (va_code_AES256EncryptRound 12) (va_CCons
(va_code_AES256EncryptRound 13) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16
`op_Multiply` 14)) (va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons
(va_code_Vcipherlast (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2))
(va_CCons (va_code_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2))
(va_CNil ())))))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_AES256EncryptBlock () =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 0) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2))
(va_pbool_and (va_codegen_success_AES256EncryptRound 1) (va_pbool_and
(va_codegen_success_AES256EncryptRound 2) (va_pbool_and (va_codegen_success_AES256EncryptRound
3) (va_pbool_and (va_codegen_success_AES256EncryptRound 4) (va_pbool_and
(va_codegen_success_AES256EncryptRound 5) (va_pbool_and (va_codegen_success_AES256EncryptRound
6) (va_pbool_and (va_codegen_success_AES256EncryptRound 7) (va_pbool_and
(va_codegen_success_AES256EncryptRound 8) (va_pbool_and (va_codegen_success_AES256EncryptRound
9) (va_pbool_and (va_codegen_success_AES256EncryptRound 10) (va_pbool_and
(va_codegen_success_AES256EncryptRound 11) (va_pbool_and (va_codegen_success_AES256EncryptRound
12) (va_pbool_and (va_codegen_success_AES256EncryptRound 13) (va_pbool_and
(va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` 14)) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_Vcipherlast (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec
2)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)) (va_ttrue ())))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_AES256EncryptBlock (va_mods:va_mods_t) (input:quad32) (key:(seq nat32))
(round_keys:(seq quad32)) (keys_buffer:buffer128) : (va_quickCode unit
(va_code_AES256EncryptBlock ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_qAssertSquash
va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 262 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540)))
Vale.Def.Types_s.quad32 round_keys 0) (fun _ -> let (init:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.quad32_xor input (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0)
in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 264 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 265 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret keys_buffer 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 266 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 267 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 1 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 268 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 2 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 269 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 3 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 270 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 4 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 271 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 5 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 272 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 6 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 273 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 7 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 274 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 8 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 275 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 9 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 276 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 10 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 277 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 11 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 278 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 12 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 279 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_AES256EncryptRound 13 init round_keys keys_buffer) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 280 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` 14)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 281 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret keys_buffer 14) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 282 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipherlast (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 285 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 286 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.aes_encrypt_word_reveal ()) (va_QEmpty
(())))))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_AES256EncryptBlock va_b0 va_s0 input key round_keys keys_buffer =
let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in
let va_qc = va_qcode_AES256EncryptBlock va_mods input key round_keys keys_buffer in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_AES256EncryptBlock ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 240 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 260 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 0 va_sM == Vale.AES.AES_BE_s.aes_encrypt_word AES_256 key input)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
input: Vale.PPC64LE.Memory.quad32 ->
key: FStar.Seq.Base.seq Vale.PPC64LE.Memory.nat32 ->
round_keys: FStar.Seq.Base.seq Vale.PPC64LE.Memory.quad32 ->
keys_buffer: Vale.PPC64LE.Memory.buffer128 ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Prims.Ghost ((Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) * Prims.unit) | Prims.Ghost | [] | [] | [
"Vale.PPC64LE.Memory.quad32",
"FStar.Seq.Base.seq",
"Vale.PPC64LE.Memory.nat32",
"Vale.PPC64LE.Memory.buffer128",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Vale.PPC64LE.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple3",
"Vale.PPC64LE.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Prims.Nil",
"Prims._assert",
"Vale.PPC64LE.Decls.va_state_eq",
"Vale.PPC64LE.Decls.va_update_vec",
"Vale.PPC64LE.Decls.va_update_reg",
"Vale.PPC64LE.Decls.va_update_ok",
"Vale.PPC64LE.Decls.va_lemma_upd_update",
"FStar.Pervasives.Native.tuple3",
"FStar.Pervasives.Native.tuple2",
"Vale.PPC64LE.Machine_s.state",
"Vale.AES.PPC64LE.AES256.va_lemma_AES256EncryptBlock",
"Vale.AES.PPC64LE.AES256.va_code_AES256EncryptBlock"
] | [] | false | false | false | false | false | let va_wpProof_AES256EncryptBlock input key round_keys keys_buffer va_s0 va_k =
| let va_sM, va_f0 =
va_lemma_AES256EncryptBlock (va_code_AES256EncryptBlock ()) va_s0 input key round_keys keys_buffer
in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM
(va_update_vec 2
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 2; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | false |
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_wpProof_KeyExpansionRoundUnrolledRecursive256 | val va_wpProof_KeyExpansionRoundUnrolledRecursive256 : key:(seq nat32) -> dst:buffer128 -> n:int ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundUnrolledRecursive256
n) ([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_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) | val va_wpProof_KeyExpansionRoundUnrolledRecursive256 : key:(seq nat32) -> dst:buffer128 -> n:int ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundUnrolledRecursive256
n) ([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_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) | let va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundUnrolledRecursive256
(va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 key dst n 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem 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_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 22,
"end_line": 573,
"start_col": 0,
"start_line": 563
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round
rcon) va_s0 round rcon dst key 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 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1
va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32)) :
(va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(va_QProc (va_code_KeyExpansionRoundEven256 round rcon) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem])
(va_wp_KeyExpansionRoundEven256 round rcon dst key) (va_wpProof_KeyExpansionRoundEven256 round
rcon dst key))
//--
//-- KeyExpansionRoundOdd256
val va_code_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundOdd256 round =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
()))))))))))))))
val va_codegen_success_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundOdd256 round =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundOdd256 (va_mods:va_mods_t) (round:nat8) (dst:buffer128) (key:(seq
nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) =
(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 114 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 115 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 116 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 117 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 118 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 120 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 121 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 123 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 124 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 125 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 127 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg23:Prims.int) = round + 1
in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg21:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg21 va_arg22 0 va_arg23)
(let (va_arg20:Prims.int) = round + 1 in let (va_arg19:Vale.Def.Types_s.quad32) = va_get_vec 1
va_old_s in let (va_arg18:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 129 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_round_key_256_rcon_odd va_arg18 va_arg19 0
va_arg20) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 130 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(())))))))))))))))))))
val va_lemma_KeyExpansionRoundOdd256 : va_b0:va_code -> va_s0:va_state -> round:nat8 ->
dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundOdd256 round) va_s0 /\ va_get_ok
va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0)
dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10
va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundOdd256 va_b0 va_s0 round dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundOdd256 va_mods round dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundOdd256 round) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 92 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 102 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 110 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 111 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 112 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32)
(va_x_v4:quad32) . let va_sM = va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem
va_x_mem va_s0)))))) in va_get_ok va_sM /\ Vale.PPC64LE.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15 (va_get_mem_layout va_sM) Secret /\
va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec 3 va_sM ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundOdd256 : round:nat8 -> dst:buffer128 -> key:(seq nat32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundOdd256 round dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundOdd256 round)
([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1;
va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundOdd256 round dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundOdd256 (va_code_KeyExpansionRoundOdd256 round)
va_s0 round dst key in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) : (va_quickCode
unit (va_code_KeyExpansionRoundOdd256 round)) =
(va_QProc (va_code_KeyExpansionRoundOdd256 round) ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_KeyExpansionRoundOdd256
round dst key) (va_wpProof_KeyExpansionRoundOdd256 round dst key))
//--
//-- KeyExpansionRoundUnrolledRecursive256
val va_code_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_code(decreases %[n])
[@ "opaque_to_smt"]
let rec va_code_KeyExpansionRoundUnrolledRecursive256 n =
(va_Block (va_CCons (if (1 < n && n <= 14) then va_Block (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_CCons (if (n `op_Modulus` 2 = 0)
then va_Block (va_CCons (va_code_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_CNil ())) else va_Block (va_CCons
(va_code_KeyExpansionRoundOdd256 (n - 1)) (va_CNil ()))) (va_CNil ()))) else va_Block (va_CNil
())) (va_CNil ())))
val va_codegen_success_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_pbool(decreases %[n])
[@ "opaque_to_smt"]
let rec va_codegen_success_KeyExpansionRoundUnrolledRecursive256 n =
(va_pbool_and (if (1 < n && n <= 14) then va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_pbool_and (if (n
`op_Modulus` 2 = 0) then va_pbool_and (va_codegen_success_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_ttrue ()) else va_pbool_and
(va_codegen_success_KeyExpansionRoundOdd256 (n - 1)) (va_ttrue ())) (va_ttrue ())) else
va_ttrue ()) (va_ttrue ()))
val va_lemma_KeyExpansionRoundUnrolledRecursive256 : va_b0:va_code -> va_s0:va_state -> key:(seq
nat32) -> dst:buffer128 -> n:int
-> Ghost (va_state & va_fuel)(decreases %[n])
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == (if (n `op_Modulus` 2 = 0) then va_get_vec 1 va_sM else
va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == (if ((n - 1) `op_Modulus` 2 = 0) then va_get_vec 1
va_sM else va_get_vec 3 va_sM) /\ (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read
dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j <= n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.AES256_helpers_BE.expand_key_256 key j) /\ 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_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let rec va_lemma_KeyExpansionRoundUnrolledRecursive256 va_b0 va_s0 key dst n =
va_reveal_opaque (`%va_code_KeyExpansionRoundUnrolledRecursive256)
(va_code_KeyExpansionRoundUnrolledRecursive256 n);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let va_b2 = va_tl va_b1 in
let va_c2 = va_hd va_b1 in
let (va_fc2, va_s2) =
(
if (1 < n && n <= 14) then
(
let va_b3 = va_get_block va_c2 in
let (va_s4, va_fc4) = va_lemma_KeyExpansionRoundUnrolledRecursive256 (va_hd va_b3) va_s0 key
dst (n - 1) in
let va_b4 = va_tl va_b3 in
let (old_mem:vale_heap) = va_get_mem_heaplet 1 va_s4 in
let va_b6 = va_tl va_b4 in
let va_c6 = va_hd va_b4 in
let (va_fc6, va_s6) =
(
if (n `op_Modulus` 2 = 0) then
(
let va_b7 = va_get_block va_c6 in
let (va_s8, va_fc8) = va_lemma_KeyExpansionRoundEven256 (va_hd va_b7) va_s4 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1)) dst key in
let va_b8 = va_tl va_b7 in
let (va_s6, va_f8) = va_lemma_empty_total va_s8 va_b8 in
let va_fc6 = va_lemma_merge_total va_b7 va_s4 va_fc8 va_s8 va_f8 va_s6 in
(va_fc6, va_s6)
)
else
(
let va_b9 = va_get_block va_c6 in
let (va_s10, va_fc10) = va_lemma_KeyExpansionRoundOdd256 (va_hd va_b9) va_s4 (n - 1) dst
key in
let va_b10 = va_tl va_b9 in
let (va_s6, va_f10) = va_lemma_empty_total va_s10 va_b10 in
let va_fc6 = va_lemma_merge_total va_b9 va_s4 va_fc10 va_s10 va_f10 va_s6 in
(va_fc6, va_s6)
)
) in
assert (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1
va_s6)))}0 <= j /\ j < n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_s6)) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j old_mem));
let (va_s2, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f4 = va_lemma_merge_total va_b4 va_s4 va_fc6 va_s6 va_f6 va_s2 in
let va_fc2 = va_lemma_merge_total va_b3 va_s0 va_fc4 va_s4 va_f4 va_s2 in
(va_fc2, va_s2)
)
else
(
let va_b12 = va_get_block va_c2 in
let (va_s2, va_fc2) = va_lemma_empty_total va_s0 va_b12 in
(va_fc2, va_s2)
)
) in
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_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)
/\ (forall (va_x_mem:vale_heap) (va_x_heap1:vale_heap) (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) . 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_upd_mem_heaplet 1
va_x_heap1 (va_upd_mem va_x_mem va_s0)))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == va_if (n `op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM)
(fun _ -> va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == va_if ((n - 1)
`op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM) (fun _ -> va_get_vec 3 va_sM) /\ (forall j .
{:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j
<= n ==> Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j
(va_get_mem_heaplet 1 va_sM)) == Vale.AES.AES256_helpers_BE.expand_key_256 key j) ==> va_k
va_sM (())))
val va_wpProof_KeyExpansionRoundUnrolledRecursive256 : key:(seq nat32) -> dst:buffer128 -> n:int ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundUnrolledRecursive256
n) ([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_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
key: FStar.Seq.Base.seq Vale.PPC64LE.Memory.nat32 ->
dst: Vale.PPC64LE.Memory.buffer128 ->
n: Prims.int ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Prims.Ghost ((Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) * Prims.unit) | Prims.Ghost | [] | [] | [
"FStar.Seq.Base.seq",
"Vale.PPC64LE.Memory.nat32",
"Vale.PPC64LE.Memory.buffer128",
"Prims.int",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Vale.PPC64LE.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple3",
"Vale.PPC64LE.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Vale.PPC64LE.QuickCode.va_Mod_mem_heaplet",
"Vale.PPC64LE.QuickCode.va_Mod_mem",
"Prims.Nil",
"Prims._assert",
"Vale.PPC64LE.Decls.va_state_eq",
"Vale.PPC64LE.Decls.va_update_vec",
"Vale.PPC64LE.Decls.va_update_reg",
"Vale.PPC64LE.Decls.va_update_mem_heaplet",
"Vale.PPC64LE.Decls.va_update_ok",
"Vale.PPC64LE.Decls.va_update_mem",
"Vale.PPC64LE.Decls.va_lemma_upd_update",
"FStar.Pervasives.Native.tuple3",
"FStar.Pervasives.Native.tuple2",
"Vale.PPC64LE.Machine_s.state",
"Vale.AES.PPC64LE.AES256.va_lemma_KeyExpansionRoundUnrolledRecursive256",
"Vale.AES.PPC64LE.AES256.va_code_KeyExpansionRoundUnrolledRecursive256"
] | [] | false | false | false | false | false | let va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0 va_k =
| let va_sM, va_f0 =
va_lemma_KeyExpansionRoundUnrolledRecursive256 (va_code_KeyExpansionRoundUnrolledRecursive256 n)
va_s0
key
dst
n
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_mem_heaplet 1
va_sM
(va_update_ok va_sM (va_update_mem 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_Mod_mem_heaplet 1;
va_Mod_mem
])
va_sM
va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | false |
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_quick_KeyExpansionRoundUnrolledRecursive256 | val va_quick_KeyExpansionRoundUnrolledRecursive256 (key: (seq nat32)) (dst: buffer128) (n: int)
: (va_quickCode unit (va_code_KeyExpansionRoundUnrolledRecursive256 n)) | val va_quick_KeyExpansionRoundUnrolledRecursive256 (key: (seq nat32)) (dst: buffer128) (n: int)
: (va_quickCode unit (va_code_KeyExpansionRoundUnrolledRecursive256 n)) | let va_quick_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int) :
(va_quickCode unit (va_code_KeyExpansionRoundUnrolledRecursive256 n)) =
(va_QProc (va_code_KeyExpansionRoundUnrolledRecursive256 n) ([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_mem_heaplet 1;
va_Mod_mem]) (va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n)
(va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n)) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 65,
"end_line": 581,
"start_col": 0,
"start_line": 576
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round
rcon) va_s0 round rcon dst key 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 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1
va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32)) :
(va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(va_QProc (va_code_KeyExpansionRoundEven256 round rcon) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem])
(va_wp_KeyExpansionRoundEven256 round rcon dst key) (va_wpProof_KeyExpansionRoundEven256 round
rcon dst key))
//--
//-- KeyExpansionRoundOdd256
val va_code_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundOdd256 round =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
()))))))))))))))
val va_codegen_success_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundOdd256 round =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundOdd256 (va_mods:va_mods_t) (round:nat8) (dst:buffer128) (key:(seq
nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) =
(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 114 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 115 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 116 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 117 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 118 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 120 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 121 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 123 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 124 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 125 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 127 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg23:Prims.int) = round + 1
in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg21:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg21 va_arg22 0 va_arg23)
(let (va_arg20:Prims.int) = round + 1 in let (va_arg19:Vale.Def.Types_s.quad32) = va_get_vec 1
va_old_s in let (va_arg18:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 129 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_round_key_256_rcon_odd va_arg18 va_arg19 0
va_arg20) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 130 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(())))))))))))))))))))
val va_lemma_KeyExpansionRoundOdd256 : va_b0:va_code -> va_s0:va_state -> round:nat8 ->
dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundOdd256 round) va_s0 /\ va_get_ok
va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0)
dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10
va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundOdd256 va_b0 va_s0 round dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundOdd256 va_mods round dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundOdd256 round) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 92 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 102 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 110 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 111 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 112 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32)
(va_x_v4:quad32) . let va_sM = va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem
va_x_mem va_s0)))))) in va_get_ok va_sM /\ Vale.PPC64LE.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15 (va_get_mem_layout va_sM) Secret /\
va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec 3 va_sM ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundOdd256 : round:nat8 -> dst:buffer128 -> key:(seq nat32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundOdd256 round dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundOdd256 round)
([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1;
va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundOdd256 round dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundOdd256 (va_code_KeyExpansionRoundOdd256 round)
va_s0 round dst key in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) : (va_quickCode
unit (va_code_KeyExpansionRoundOdd256 round)) =
(va_QProc (va_code_KeyExpansionRoundOdd256 round) ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_KeyExpansionRoundOdd256
round dst key) (va_wpProof_KeyExpansionRoundOdd256 round dst key))
//--
//-- KeyExpansionRoundUnrolledRecursive256
val va_code_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_code(decreases %[n])
[@ "opaque_to_smt"]
let rec va_code_KeyExpansionRoundUnrolledRecursive256 n =
(va_Block (va_CCons (if (1 < n && n <= 14) then va_Block (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_CCons (if (n `op_Modulus` 2 = 0)
then va_Block (va_CCons (va_code_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_CNil ())) else va_Block (va_CCons
(va_code_KeyExpansionRoundOdd256 (n - 1)) (va_CNil ()))) (va_CNil ()))) else va_Block (va_CNil
())) (va_CNil ())))
val va_codegen_success_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_pbool(decreases %[n])
[@ "opaque_to_smt"]
let rec va_codegen_success_KeyExpansionRoundUnrolledRecursive256 n =
(va_pbool_and (if (1 < n && n <= 14) then va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_pbool_and (if (n
`op_Modulus` 2 = 0) then va_pbool_and (va_codegen_success_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_ttrue ()) else va_pbool_and
(va_codegen_success_KeyExpansionRoundOdd256 (n - 1)) (va_ttrue ())) (va_ttrue ())) else
va_ttrue ()) (va_ttrue ()))
val va_lemma_KeyExpansionRoundUnrolledRecursive256 : va_b0:va_code -> va_s0:va_state -> key:(seq
nat32) -> dst:buffer128 -> n:int
-> Ghost (va_state & va_fuel)(decreases %[n])
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == (if (n `op_Modulus` 2 = 0) then va_get_vec 1 va_sM else
va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == (if ((n - 1) `op_Modulus` 2 = 0) then va_get_vec 1
va_sM else va_get_vec 3 va_sM) /\ (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read
dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j <= n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.AES256_helpers_BE.expand_key_256 key j) /\ 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_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let rec va_lemma_KeyExpansionRoundUnrolledRecursive256 va_b0 va_s0 key dst n =
va_reveal_opaque (`%va_code_KeyExpansionRoundUnrolledRecursive256)
(va_code_KeyExpansionRoundUnrolledRecursive256 n);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let va_b2 = va_tl va_b1 in
let va_c2 = va_hd va_b1 in
let (va_fc2, va_s2) =
(
if (1 < n && n <= 14) then
(
let va_b3 = va_get_block va_c2 in
let (va_s4, va_fc4) = va_lemma_KeyExpansionRoundUnrolledRecursive256 (va_hd va_b3) va_s0 key
dst (n - 1) in
let va_b4 = va_tl va_b3 in
let (old_mem:vale_heap) = va_get_mem_heaplet 1 va_s4 in
let va_b6 = va_tl va_b4 in
let va_c6 = va_hd va_b4 in
let (va_fc6, va_s6) =
(
if (n `op_Modulus` 2 = 0) then
(
let va_b7 = va_get_block va_c6 in
let (va_s8, va_fc8) = va_lemma_KeyExpansionRoundEven256 (va_hd va_b7) va_s4 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1)) dst key in
let va_b8 = va_tl va_b7 in
let (va_s6, va_f8) = va_lemma_empty_total va_s8 va_b8 in
let va_fc6 = va_lemma_merge_total va_b7 va_s4 va_fc8 va_s8 va_f8 va_s6 in
(va_fc6, va_s6)
)
else
(
let va_b9 = va_get_block va_c6 in
let (va_s10, va_fc10) = va_lemma_KeyExpansionRoundOdd256 (va_hd va_b9) va_s4 (n - 1) dst
key in
let va_b10 = va_tl va_b9 in
let (va_s6, va_f10) = va_lemma_empty_total va_s10 va_b10 in
let va_fc6 = va_lemma_merge_total va_b9 va_s4 va_fc10 va_s10 va_f10 va_s6 in
(va_fc6, va_s6)
)
) in
assert (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1
va_s6)))}0 <= j /\ j < n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_s6)) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j old_mem));
let (va_s2, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f4 = va_lemma_merge_total va_b4 va_s4 va_fc6 va_s6 va_f6 va_s2 in
let va_fc2 = va_lemma_merge_total va_b3 va_s0 va_fc4 va_s4 va_f4 va_s2 in
(va_fc2, va_s2)
)
else
(
let va_b12 = va_get_block va_c2 in
let (va_s2, va_fc2) = va_lemma_empty_total va_s0 va_b12 in
(va_fc2, va_s2)
)
) in
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_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)
/\ (forall (va_x_mem:vale_heap) (va_x_heap1:vale_heap) (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) . 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_upd_mem_heaplet 1
va_x_heap1 (va_upd_mem va_x_mem va_s0)))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == va_if (n `op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM)
(fun _ -> va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == va_if ((n - 1)
`op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM) (fun _ -> va_get_vec 3 va_sM) /\ (forall j .
{:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j
<= n ==> Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j
(va_get_mem_heaplet 1 va_sM)) == Vale.AES.AES256_helpers_BE.expand_key_256 key j) ==> va_k
va_sM (())))
val va_wpProof_KeyExpansionRoundUnrolledRecursive256 : key:(seq nat32) -> dst:buffer128 -> n:int ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundUnrolledRecursive256
n) ([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_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundUnrolledRecursive256
(va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 key dst n 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem 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_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
key: FStar.Seq.Base.seq Vale.PPC64LE.Memory.nat32 ->
dst: Vale.PPC64LE.Memory.buffer128 ->
n: Prims.int
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.AES.PPC64LE.AES256.va_code_KeyExpansionRoundUnrolledRecursive256 n) | Prims.Tot | [
"total"
] | [] | [
"FStar.Seq.Base.seq",
"Vale.PPC64LE.Memory.nat32",
"Vale.PPC64LE.Memory.buffer128",
"Prims.int",
"Vale.PPC64LE.QuickCode.va_QProc",
"Prims.unit",
"Vale.AES.PPC64LE.AES256.va_code_KeyExpansionRoundUnrolledRecursive256",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Vale.PPC64LE.QuickCode.va_Mod_mem_heaplet",
"Vale.PPC64LE.QuickCode.va_Mod_mem",
"Prims.Nil",
"Vale.AES.PPC64LE.AES256.va_wp_KeyExpansionRoundUnrolledRecursive256",
"Vale.AES.PPC64LE.AES256.va_wpProof_KeyExpansionRoundUnrolledRecursive256",
"Vale.PPC64LE.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_KeyExpansionRoundUnrolledRecursive256 (key: (seq nat32)) (dst: buffer128) (n: int)
: (va_quickCode unit (va_code_KeyExpansionRoundUnrolledRecursive256 n)) =
| (va_QProc (va_code_KeyExpansionRoundUnrolledRecursive256 n)
([
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_mem_heaplet 1;
va_Mod_mem
])
(va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n)
(va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n)) | false |
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_wpProof_AES256EncryptRound | val va_wpProof_AES256EncryptRound : n:nat8 -> init:quad32 -> round_keys:(seq quad32) ->
keys_buffer:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AES256EncryptRound n init round_keys keys_buffer va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AES256EncryptRound n) ([va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g)))) | val va_wpProof_AES256EncryptRound : n:nat8 -> init:quad32 -> round_keys:(seq quad32) ->
keys_buffer:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AES256EncryptRound n init round_keys keys_buffer va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AES256EncryptRound n) ([va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g)))) | let va_wpProof_AES256EncryptRound n init round_keys keys_buffer va_s0 va_k =
let (va_sM, va_f0) = va_lemma_AES256EncryptRound (va_code_AES256EncryptRound n) va_s0 n init
round_keys keys_buffer in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 2 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 2; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 22,
"end_line": 812,
"start_col": 0,
"start_line": 804
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round
rcon) va_s0 round rcon dst key 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 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1
va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32)) :
(va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(va_QProc (va_code_KeyExpansionRoundEven256 round rcon) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem])
(va_wp_KeyExpansionRoundEven256 round rcon dst key) (va_wpProof_KeyExpansionRoundEven256 round
rcon dst key))
//--
//-- KeyExpansionRoundOdd256
val va_code_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundOdd256 round =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
()))))))))))))))
val va_codegen_success_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundOdd256 round =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundOdd256 (va_mods:va_mods_t) (round:nat8) (dst:buffer128) (key:(seq
nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) =
(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 114 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 115 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 116 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 117 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 118 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 120 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 121 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 123 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 124 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 125 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 127 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg23:Prims.int) = round + 1
in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg21:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg21 va_arg22 0 va_arg23)
(let (va_arg20:Prims.int) = round + 1 in let (va_arg19:Vale.Def.Types_s.quad32) = va_get_vec 1
va_old_s in let (va_arg18:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 129 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_round_key_256_rcon_odd va_arg18 va_arg19 0
va_arg20) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 130 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(())))))))))))))))))))
val va_lemma_KeyExpansionRoundOdd256 : va_b0:va_code -> va_s0:va_state -> round:nat8 ->
dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundOdd256 round) va_s0 /\ va_get_ok
va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0)
dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10
va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundOdd256 va_b0 va_s0 round dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundOdd256 va_mods round dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundOdd256 round) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 92 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 102 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 110 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 111 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 112 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32)
(va_x_v4:quad32) . let va_sM = va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem
va_x_mem va_s0)))))) in va_get_ok va_sM /\ Vale.PPC64LE.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15 (va_get_mem_layout va_sM) Secret /\
va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec 3 va_sM ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundOdd256 : round:nat8 -> dst:buffer128 -> key:(seq nat32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundOdd256 round dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundOdd256 round)
([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1;
va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundOdd256 round dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundOdd256 (va_code_KeyExpansionRoundOdd256 round)
va_s0 round dst key in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) : (va_quickCode
unit (va_code_KeyExpansionRoundOdd256 round)) =
(va_QProc (va_code_KeyExpansionRoundOdd256 round) ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_KeyExpansionRoundOdd256
round dst key) (va_wpProof_KeyExpansionRoundOdd256 round dst key))
//--
//-- KeyExpansionRoundUnrolledRecursive256
val va_code_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_code(decreases %[n])
[@ "opaque_to_smt"]
let rec va_code_KeyExpansionRoundUnrolledRecursive256 n =
(va_Block (va_CCons (if (1 < n && n <= 14) then va_Block (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_CCons (if (n `op_Modulus` 2 = 0)
then va_Block (va_CCons (va_code_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_CNil ())) else va_Block (va_CCons
(va_code_KeyExpansionRoundOdd256 (n - 1)) (va_CNil ()))) (va_CNil ()))) else va_Block (va_CNil
())) (va_CNil ())))
val va_codegen_success_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_pbool(decreases %[n])
[@ "opaque_to_smt"]
let rec va_codegen_success_KeyExpansionRoundUnrolledRecursive256 n =
(va_pbool_and (if (1 < n && n <= 14) then va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_pbool_and (if (n
`op_Modulus` 2 = 0) then va_pbool_and (va_codegen_success_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_ttrue ()) else va_pbool_and
(va_codegen_success_KeyExpansionRoundOdd256 (n - 1)) (va_ttrue ())) (va_ttrue ())) else
va_ttrue ()) (va_ttrue ()))
val va_lemma_KeyExpansionRoundUnrolledRecursive256 : va_b0:va_code -> va_s0:va_state -> key:(seq
nat32) -> dst:buffer128 -> n:int
-> Ghost (va_state & va_fuel)(decreases %[n])
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == (if (n `op_Modulus` 2 = 0) then va_get_vec 1 va_sM else
va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == (if ((n - 1) `op_Modulus` 2 = 0) then va_get_vec 1
va_sM else va_get_vec 3 va_sM) /\ (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read
dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j <= n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.AES256_helpers_BE.expand_key_256 key j) /\ 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_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let rec va_lemma_KeyExpansionRoundUnrolledRecursive256 va_b0 va_s0 key dst n =
va_reveal_opaque (`%va_code_KeyExpansionRoundUnrolledRecursive256)
(va_code_KeyExpansionRoundUnrolledRecursive256 n);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let va_b2 = va_tl va_b1 in
let va_c2 = va_hd va_b1 in
let (va_fc2, va_s2) =
(
if (1 < n && n <= 14) then
(
let va_b3 = va_get_block va_c2 in
let (va_s4, va_fc4) = va_lemma_KeyExpansionRoundUnrolledRecursive256 (va_hd va_b3) va_s0 key
dst (n - 1) in
let va_b4 = va_tl va_b3 in
let (old_mem:vale_heap) = va_get_mem_heaplet 1 va_s4 in
let va_b6 = va_tl va_b4 in
let va_c6 = va_hd va_b4 in
let (va_fc6, va_s6) =
(
if (n `op_Modulus` 2 = 0) then
(
let va_b7 = va_get_block va_c6 in
let (va_s8, va_fc8) = va_lemma_KeyExpansionRoundEven256 (va_hd va_b7) va_s4 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1)) dst key in
let va_b8 = va_tl va_b7 in
let (va_s6, va_f8) = va_lemma_empty_total va_s8 va_b8 in
let va_fc6 = va_lemma_merge_total va_b7 va_s4 va_fc8 va_s8 va_f8 va_s6 in
(va_fc6, va_s6)
)
else
(
let va_b9 = va_get_block va_c6 in
let (va_s10, va_fc10) = va_lemma_KeyExpansionRoundOdd256 (va_hd va_b9) va_s4 (n - 1) dst
key in
let va_b10 = va_tl va_b9 in
let (va_s6, va_f10) = va_lemma_empty_total va_s10 va_b10 in
let va_fc6 = va_lemma_merge_total va_b9 va_s4 va_fc10 va_s10 va_f10 va_s6 in
(va_fc6, va_s6)
)
) in
assert (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1
va_s6)))}0 <= j /\ j < n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_s6)) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j old_mem));
let (va_s2, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f4 = va_lemma_merge_total va_b4 va_s4 va_fc6 va_s6 va_f6 va_s2 in
let va_fc2 = va_lemma_merge_total va_b3 va_s0 va_fc4 va_s4 va_f4 va_s2 in
(va_fc2, va_s2)
)
else
(
let va_b12 = va_get_block va_c2 in
let (va_s2, va_fc2) = va_lemma_empty_total va_s0 va_b12 in
(va_fc2, va_s2)
)
) in
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_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)
/\ (forall (va_x_mem:vale_heap) (va_x_heap1:vale_heap) (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) . 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_upd_mem_heaplet 1
va_x_heap1 (va_upd_mem va_x_mem va_s0)))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == va_if (n `op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM)
(fun _ -> va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == va_if ((n - 1)
`op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM) (fun _ -> va_get_vec 3 va_sM) /\ (forall j .
{:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j
<= n ==> Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j
(va_get_mem_heaplet 1 va_sM)) == Vale.AES.AES256_helpers_BE.expand_key_256 key j) ==> va_k
va_sM (())))
val va_wpProof_KeyExpansionRoundUnrolledRecursive256 : key:(seq nat32) -> dst:buffer128 -> n:int ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundUnrolledRecursive256
n) ([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_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundUnrolledRecursive256
(va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 key dst n 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem 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_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int) :
(va_quickCode unit (va_code_KeyExpansionRoundUnrolledRecursive256 n)) =
(va_QProc (va_code_KeyExpansionRoundUnrolledRecursive256 n) ([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_mem_heaplet 1;
va_Mod_mem]) (va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n)
(va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n))
//--
//-- KeyExpansion256Stdcall
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansion256Stdcall () =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_CCons
(va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret) (va_CCons (va_code_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg
10) Secret) (va_CCons (va_code_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) Secret) (va_CCons
(va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 14) (va_CCons (va_code_Vxor (va_op_vec_opr_vec
1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_CNil ()))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansion256Stdcall () =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg
10) Secret) (va_pbool_and (va_codegen_success_Store128_byte16_buffer (va_op_heaplet_mem_heaplet
1) (va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) Secret) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 14) (va_pbool_and
(va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_ttrue ())))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansion256Stdcall (va_mods:va_mods_t) (input_key_b:buffer128)
(output_key_expansion_b:buffer128) : (va_quickCode unit (va_code_KeyExpansion256Stdcall ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = Vale.AES.AES256_helpers_BE.make_AES256_key
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 0
(va_get_mem_heaplet 0 va_s))) (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet 0 va_s))) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 193 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 194 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret input_key_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 195 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret input_key_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 197 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) Secret output_key_expansion_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 198 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret output_key_expansion_b 1) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 200 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 201 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_KeyExpansionRoundUnrolledRecursive256 key output_key_expansion_b 14) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 202 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_expand_key_256 key 15) (va_QLemma va_range1
"***** PRECONDITION NOT MET AT line 203 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
true (fun _ -> va_reveal_eq (`%key_to_round_keys_word) key_to_round_keys_word
key_to_round_keys_word) (fun _ -> va_reveal_opaque (`%key_to_round_keys_word)
key_to_round_keys_word) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 206 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 207 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 208 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 209 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_QEmpty
(()))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansion256Stdcall va_b0 va_s0 input_key_b output_key_expansion_b =
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_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansion256Stdcall va_mods input_key_b output_key_expansion_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansion256Stdcall ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 174 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ (let (key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) =
Vale.AES.AES256_helpers_BE.make_AES256_key (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 0 (va_get_mem_heaplet 0 va_s0)))
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 1
(va_get_mem_heaplet 0 va_s0))) in label va_range1
"***** POSTCONDITION NOT MET AT line 186 column 71 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_sM) (va_get_reg 4 va_sM)
input_key_b 2 (va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 187 column 83 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM)
output_key_expansion_b 15 (va_get_mem_layout va_sM) Secret)) /\ (let (key:(FStar.Seq.Base.seq
Vale.Def.Types_s.nat32)) = Vale.AES.AES256_helpers_BE.make_AES256_key
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 0
(va_get_mem_heaplet 0 va_s0))) (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet 0 va_s0))) in label
va_range1
"***** POSTCONDITION NOT MET AT line 189 column 70 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer128 output_key_expansion_b (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 191 column 133 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(forall (j:nat) . {:pattern(reverse_bytes_quad32 (buffer128_read output_key_expansion_b j
(va_get_mem_heaplet 1 va_sM)))}j <= 14 ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read output_key_expansion_b j (va_get_mem_heaplet 1 va_sM)) ==
FStar.Seq.Base.index #Vale.Def.Types_s.quad32 (Vale.AES.AES_BE_s.key_to_round_keys_word AES_256
key) j))) 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_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_KeyExpansion256Stdcall input_key_b output_key_expansion_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansion256Stdcall (va_code_KeyExpansion256Stdcall ()) va_s0
input_key_b output_key_expansion_b 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem 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_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- AES256EncryptRound
val va_code_AES256EncryptRound : n:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_AES256EncryptRound n =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n)) (va_CCons
(va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_CNil ())))))
val va_codegen_success_AES256EncryptRound : n:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_AES256EncryptRound n =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n))
(va_pbool_and (va_codegen_success_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_Vcipher (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2))
(va_ttrue ()))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_AES256EncryptRound (va_mods:va_mods_t) (n:nat8) (init:quad32) (round_keys:(seq
quad32)) (keys_buffer:buffer128) : (va_quickCode unit (va_code_AES256EncryptRound n)) =
(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 235 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 236 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret keys_buffer n) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 237 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vcipher (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_QEmpty
(()))))))
val va_lemma_AES256EncryptRound : va_b0:va_code -> va_s0:va_state -> n:nat8 -> init:quad32 ->
round_keys:(seq quad32) -> keys_buffer:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AES256EncryptRound n) va_s0 /\ va_get_ok va_s0 /\ (1
<= n /\ n < 14 /\ 14 <= FStar.Seq.Base.length #quad32 round_keys) /\ va_get_vec 0 va_s0 ==
Vale.AES.AES_BE_s.eval_rounds_def init round_keys (n - 1) /\ va_get_reg 4 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 keys_buffer (va_get_mem_heaplet 0
va_s0) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0)
keys_buffer 15 (va_get_mem_layout va_s0) Secret /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read keys_buffer n (va_get_mem_heaplet 0 va_s0)) ==
FStar.Seq.Base.index #quad32 round_keys n))
(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 0 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init round_keys n /\ va_state_eq va_sM
(va_update_vec 2 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_AES256EncryptRound va_b0 va_s0 n init round_keys keys_buffer =
let (va_mods:va_mods_t) = [va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok] in
let va_qc = va_qcode_AES256EncryptRound va_mods n init round_keys keys_buffer in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_AES256EncryptRound n) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 216 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 233 column 51 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 0 va_sM == Vale.AES.AES_BE_s.eval_rounds_def init round_keys n)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_AES256EncryptRound (n:nat8) (init:quad32) (round_keys:(seq quad32))
(keys_buffer:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (1 <= n /\ n < 14 /\ 14 <= FStar.Seq.Base.length #quad32 round_keys) /\
va_get_vec 0 va_s0 == Vale.AES.AES_BE_s.eval_rounds_def init round_keys (n - 1) /\ va_get_reg 4
va_s0 == Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 keys_buffer
(va_get_mem_heaplet 0 va_s0) /\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0
va_s0) (va_get_reg 4 va_s0) keys_buffer 15 (va_get_mem_layout va_s0) Secret /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read keys_buffer n
(va_get_mem_heaplet 0 va_s0)) == FStar.Seq.Base.index #quad32 round_keys n /\ (forall
(va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) . let va_sM = va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 va_s0)) in va_get_ok va_sM /\ va_get_vec 0 va_sM
== Vale.AES.AES_BE_s.eval_rounds_def init round_keys n ==> va_k va_sM (())))
val va_wpProof_AES256EncryptRound : n:nat8 -> init:quad32 -> round_keys:(seq quad32) ->
keys_buffer:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AES256EncryptRound n init round_keys keys_buffer va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AES256EncryptRound n) ([va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
n: Vale.PPC64LE.Memory.nat8 ->
init: Vale.PPC64LE.Memory.quad32 ->
round_keys: FStar.Seq.Base.seq Vale.PPC64LE.Memory.quad32 ->
keys_buffer: Vale.PPC64LE.Memory.buffer128 ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Prims.Ghost ((Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) * Prims.unit) | Prims.Ghost | [] | [] | [
"Vale.PPC64LE.Memory.nat8",
"Vale.PPC64LE.Memory.quad32",
"FStar.Seq.Base.seq",
"Vale.PPC64LE.Memory.buffer128",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Vale.PPC64LE.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple3",
"Vale.PPC64LE.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Prims.Nil",
"Prims._assert",
"Vale.PPC64LE.Decls.va_state_eq",
"Vale.PPC64LE.Decls.va_update_vec",
"Vale.PPC64LE.Decls.va_update_reg",
"Vale.PPC64LE.Decls.va_update_ok",
"Vale.PPC64LE.Decls.va_lemma_upd_update",
"FStar.Pervasives.Native.tuple3",
"FStar.Pervasives.Native.tuple2",
"Vale.PPC64LE.Machine_s.state",
"Vale.AES.PPC64LE.AES256.va_lemma_AES256EncryptRound",
"Vale.AES.PPC64LE.AES256.va_code_AES256EncryptRound"
] | [] | false | false | false | false | false | let va_wpProof_AES256EncryptRound n init round_keys keys_buffer va_s0 va_k =
| let va_sM, va_f0 =
va_lemma_AES256EncryptRound (va_code_AES256EncryptRound n) va_s0 n init round_keys keys_buffer
in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM
(va_update_vec 2
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 2; va_Mod_vec 0; va_Mod_reg 10]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | false |
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_qcode_KeyExpansionRoundOdd256 | val va_qcode_KeyExpansionRoundOdd256
(va_mods: va_mods_t)
(round: nat8)
(dst: buffer128)
(key: (seq nat32))
: (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) | val va_qcode_KeyExpansionRoundOdd256
(va_mods: va_mods_t)
(round: nat8)
(dst: buffer128)
(key: (seq nat32))
: (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) | let va_qcode_KeyExpansionRoundOdd256 (va_mods:va_mods_t) (round:nat8) (dst:buffer128) (key:(seq
nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) =
(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 114 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 115 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 116 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 117 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 118 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 120 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 121 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 123 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 124 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 125 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 127 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg23:Prims.int) = round + 1
in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg21:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg21 va_arg22 0 va_arg23)
(let (va_arg20:Prims.int) = round + 1 in let (va_arg19:Vale.Def.Types_s.quad32) = va_get_vec 1
va_old_s in let (va_arg18:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 129 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_round_key_256_rcon_odd va_arg18 va_arg19 0
va_arg20) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 130 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 26,
"end_line": 316,
"start_col": 0,
"start_line": 266
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round
rcon) va_s0 round rcon dst key 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 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1
va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32)) :
(va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(va_QProc (va_code_KeyExpansionRoundEven256 round rcon) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem])
(va_wp_KeyExpansionRoundEven256 round rcon dst key) (va_wpProof_KeyExpansionRoundEven256 round
rcon dst key))
//--
//-- KeyExpansionRoundOdd256
val va_code_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundOdd256 round =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
()))))))))))))))
val va_codegen_success_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundOdd256 round =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
va_mods: Vale.PPC64LE.QuickCode.va_mods_t ->
round: Vale.PPC64LE.Memory.nat8 ->
dst: Vale.PPC64LE.Memory.buffer128 ->
key: FStar.Seq.Base.seq Vale.PPC64LE.Memory.nat32
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.AES.PPC64LE.AES256.va_code_KeyExpansionRoundOdd256 round) | Prims.Tot | [
"total"
] | [] | [
"Vale.PPC64LE.QuickCode.va_mods_t",
"Vale.PPC64LE.Memory.nat8",
"Vale.PPC64LE.Memory.buffer128",
"FStar.Seq.Base.seq",
"Vale.PPC64LE.Memory.nat32",
"Vale.PPC64LE.QuickCodes.qblock",
"Prims.unit",
"Prims.Cons",
"Vale.PPC64LE.Decls.va_code",
"Vale.PPC64LE.InsVector.va_code_Vspltisw",
"Vale.PPC64LE.Decls.va_op_vec_opr_vec",
"Vale.PPC64LE.InsVector.va_code_Vsbox",
"Vale.PPC64LE.InsVector.va_code_Vspltw",
"Vale.PPC64LE.InsVector.va_code_Vsldoi",
"Vale.PPC64LE.InsVector.va_code_Vxor",
"Vale.PPC64LE.InsBasic.va_code_LoadImm64",
"Vale.PPC64LE.Decls.va_op_reg_opr_reg",
"Prims.op_Multiply",
"Prims.op_Addition",
"Vale.PPC64LE.InsVector.va_code_Store128_byte16_buffer_index",
"Vale.PPC64LE.Decls.va_op_heaplet_mem_heaplet",
"Vale.Arch.HeapTypes_s.Secret",
"Prims.Nil",
"Vale.PPC64LE.Machine_s.precode",
"Vale.PPC64LE.Decls.ins",
"Vale.PPC64LE.Decls.ocmp",
"Vale.PPC64LE.Decls.va_state",
"Vale.PPC64LE.QuickCodes.va_QSeq",
"Vale.PPC64LE.QuickCodes.va_range1",
"Vale.PPC64LE.InsVector.va_quick_Vspltisw",
"Vale.PPC64LE.InsVector.va_quick_Vsbox",
"Vale.PPC64LE.InsVector.va_quick_Vspltw",
"Vale.PPC64LE.InsVector.va_quick_Vsldoi",
"Vale.PPC64LE.InsVector.va_quick_Vxor",
"Vale.PPC64LE.InsBasic.va_quick_LoadImm64",
"Vale.PPC64LE.QuickCodes.va_QBind",
"Vale.PPC64LE.InsVector.va_quick_Store128_byte16_buffer_index",
"Vale.PPC64LE.QuickCodes.va_qPURE",
"Prims.pure_post",
"Prims.l_and",
"Prims.l_True",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.eq2",
"Vale.Def.Types_s.quad32",
"Vale.Def.Types_s.quad32_xor",
"Vale.Def.Types_s.quad32_xor_def",
"Vale.Def.Types_s.quad32_xor_reveal",
"Vale.AES.AES256_helpers_BE.simd_round_key_256",
"Vale.AES.AES256_helpers_BE.round_key_256_rcon",
"Vale.AES.AES256_helpers_BE.lemma_simd_round_key",
"Prims.l_not",
"Prims.int",
"Prims.op_Modulus",
"Vale.AES.AES256_helpers_BE.lemma_round_key_256_rcon_odd",
"Vale.Def.Words_s.nat32",
"Prims.nat",
"Vale.AES.AES_BE_s.is_aes_key_word",
"Vale.AES.AES_common_s.AES_256",
"Vale.AES.AES256_helpers_BE.expand_key_256",
"Vale.AES.AES256_helpers_BE.expand_key_256_def",
"Vale.AES.AES256_helpers_BE.expand_key_256_reveal",
"Vale.PPC64LE.QuickCodes.va_QEmpty",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.PPC64LE.QuickCodes.quickCodes",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.QuickCode.va_quickCode",
"Vale.AES.PPC64LE.AES256.va_code_KeyExpansionRoundOdd256"
] | [] | false | false | false | false | false | let va_qcode_KeyExpansionRoundOdd256
(va_mods: va_mods_t)
(round: nat8)
(dst: buffer128)
(key: (seq nat32))
: (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) =
| (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 114 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 115 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 116 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 117 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3)
12)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 118 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 119 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3)
12)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 120 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 121 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3)
12)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 122 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 123 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 124 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10)
(16 `op_Multiply` (round + 1)))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 125 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet
1)
(va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3)
(va_op_reg_opr_reg 10)
Secret
dst
(round + 1))
(fun (va_s: va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 127 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_: unit) ->
Vale.Def.Types_s.quad32_xor_reveal ()
)
(let va_arg23:Prims.int = round + 1 in
let va_arg22:Vale.Def.Types_s.quad32 =
va_get_vec 1 va_old_s
in
let va_arg21:Vale.Def.Types_s.quad32 =
va_get_vec 3 va_old_s
in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_: unit) ->
Vale.AES.AES256_helpers_BE.lemma_simd_round_key
va_arg21
va_arg22
0
va_arg23)
(let va_arg20:Prims.int =
round + 1
in
let va_arg19:Vale.Def.Types_s.quad32
=
va_get_vec 1 va_old_s
in
let va_arg18:Vale.Def.Types_s.quad32
=
va_get_vec 3 va_old_s
in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 129 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_: unit) ->
Vale.AES.AES256_helpers_BE.lemma_round_key_256_rcon_odd
va_arg18
va_arg19
0
va_arg20)
(va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 130 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_: unit) ->
Vale.AES.AES256_helpers_BE.expand_key_256_reveal
())
(va_QEmpty (()))))))))))))))
))))) | false |
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_qcode_KeyExpansion256Stdcall | val va_qcode_KeyExpansion256Stdcall
(va_mods: va_mods_t)
(input_key_b output_key_expansion_b: buffer128)
: (va_quickCode unit (va_code_KeyExpansion256Stdcall ())) | val va_qcode_KeyExpansion256Stdcall
(va_mods: va_mods_t)
(input_key_b output_key_expansion_b: buffer128)
: (va_quickCode unit (va_code_KeyExpansion256Stdcall ())) | let va_qcode_KeyExpansion256Stdcall (va_mods:va_mods_t) (input_key_b:buffer128)
(output_key_expansion_b:buffer128) : (va_quickCode unit (va_code_KeyExpansion256Stdcall ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = Vale.AES.AES256_helpers_BE.make_AES256_key
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 0
(va_get_mem_heaplet 0 va_s))) (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet 0 va_s))) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 193 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 194 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret input_key_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 195 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret input_key_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 197 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) Secret output_key_expansion_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 198 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret output_key_expansion_b 1) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 200 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 201 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_KeyExpansionRoundUnrolledRecursive256 key output_key_expansion_b 14) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 202 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_expand_key_256 key 15) (va_QLemma va_range1
"***** PRECONDITION NOT MET AT line 203 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
true (fun _ -> va_reveal_eq (`%key_to_round_keys_word) key_to_round_keys_word
key_to_round_keys_word) (fun _ -> va_reveal_opaque (`%key_to_round_keys_word)
key_to_round_keys_word) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 206 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 207 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 208 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 209 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_QEmpty
(())))))))))))))))) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 23,
"end_line": 664,
"start_col": 0,
"start_line": 619
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round
rcon) va_s0 round rcon dst key 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 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1
va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32)) :
(va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(va_QProc (va_code_KeyExpansionRoundEven256 round rcon) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem])
(va_wp_KeyExpansionRoundEven256 round rcon dst key) (va_wpProof_KeyExpansionRoundEven256 round
rcon dst key))
//--
//-- KeyExpansionRoundOdd256
val va_code_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundOdd256 round =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
()))))))))))))))
val va_codegen_success_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundOdd256 round =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundOdd256 (va_mods:va_mods_t) (round:nat8) (dst:buffer128) (key:(seq
nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) =
(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 114 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 115 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 116 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 117 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 118 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 120 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 121 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 123 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 124 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 125 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 127 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg23:Prims.int) = round + 1
in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg21:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg21 va_arg22 0 va_arg23)
(let (va_arg20:Prims.int) = round + 1 in let (va_arg19:Vale.Def.Types_s.quad32) = va_get_vec 1
va_old_s in let (va_arg18:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 129 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_round_key_256_rcon_odd va_arg18 va_arg19 0
va_arg20) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 130 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(())))))))))))))))))))
val va_lemma_KeyExpansionRoundOdd256 : va_b0:va_code -> va_s0:va_state -> round:nat8 ->
dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundOdd256 round) va_s0 /\ va_get_ok
va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0)
dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10
va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundOdd256 va_b0 va_s0 round dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundOdd256 va_mods round dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundOdd256 round) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 92 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 102 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 110 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 111 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 112 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32)
(va_x_v4:quad32) . let va_sM = va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem
va_x_mem va_s0)))))) in va_get_ok va_sM /\ Vale.PPC64LE.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15 (va_get_mem_layout va_sM) Secret /\
va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec 3 va_sM ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundOdd256 : round:nat8 -> dst:buffer128 -> key:(seq nat32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundOdd256 round dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundOdd256 round)
([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1;
va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundOdd256 round dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundOdd256 (va_code_KeyExpansionRoundOdd256 round)
va_s0 round dst key in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) : (va_quickCode
unit (va_code_KeyExpansionRoundOdd256 round)) =
(va_QProc (va_code_KeyExpansionRoundOdd256 round) ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_KeyExpansionRoundOdd256
round dst key) (va_wpProof_KeyExpansionRoundOdd256 round dst key))
//--
//-- KeyExpansionRoundUnrolledRecursive256
val va_code_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_code(decreases %[n])
[@ "opaque_to_smt"]
let rec va_code_KeyExpansionRoundUnrolledRecursive256 n =
(va_Block (va_CCons (if (1 < n && n <= 14) then va_Block (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_CCons (if (n `op_Modulus` 2 = 0)
then va_Block (va_CCons (va_code_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_CNil ())) else va_Block (va_CCons
(va_code_KeyExpansionRoundOdd256 (n - 1)) (va_CNil ()))) (va_CNil ()))) else va_Block (va_CNil
())) (va_CNil ())))
val va_codegen_success_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_pbool(decreases %[n])
[@ "opaque_to_smt"]
let rec va_codegen_success_KeyExpansionRoundUnrolledRecursive256 n =
(va_pbool_and (if (1 < n && n <= 14) then va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_pbool_and (if (n
`op_Modulus` 2 = 0) then va_pbool_and (va_codegen_success_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_ttrue ()) else va_pbool_and
(va_codegen_success_KeyExpansionRoundOdd256 (n - 1)) (va_ttrue ())) (va_ttrue ())) else
va_ttrue ()) (va_ttrue ()))
val va_lemma_KeyExpansionRoundUnrolledRecursive256 : va_b0:va_code -> va_s0:va_state -> key:(seq
nat32) -> dst:buffer128 -> n:int
-> Ghost (va_state & va_fuel)(decreases %[n])
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == (if (n `op_Modulus` 2 = 0) then va_get_vec 1 va_sM else
va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == (if ((n - 1) `op_Modulus` 2 = 0) then va_get_vec 1
va_sM else va_get_vec 3 va_sM) /\ (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read
dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j <= n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.AES256_helpers_BE.expand_key_256 key j) /\ 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_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let rec va_lemma_KeyExpansionRoundUnrolledRecursive256 va_b0 va_s0 key dst n =
va_reveal_opaque (`%va_code_KeyExpansionRoundUnrolledRecursive256)
(va_code_KeyExpansionRoundUnrolledRecursive256 n);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let va_b2 = va_tl va_b1 in
let va_c2 = va_hd va_b1 in
let (va_fc2, va_s2) =
(
if (1 < n && n <= 14) then
(
let va_b3 = va_get_block va_c2 in
let (va_s4, va_fc4) = va_lemma_KeyExpansionRoundUnrolledRecursive256 (va_hd va_b3) va_s0 key
dst (n - 1) in
let va_b4 = va_tl va_b3 in
let (old_mem:vale_heap) = va_get_mem_heaplet 1 va_s4 in
let va_b6 = va_tl va_b4 in
let va_c6 = va_hd va_b4 in
let (va_fc6, va_s6) =
(
if (n `op_Modulus` 2 = 0) then
(
let va_b7 = va_get_block va_c6 in
let (va_s8, va_fc8) = va_lemma_KeyExpansionRoundEven256 (va_hd va_b7) va_s4 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1)) dst key in
let va_b8 = va_tl va_b7 in
let (va_s6, va_f8) = va_lemma_empty_total va_s8 va_b8 in
let va_fc6 = va_lemma_merge_total va_b7 va_s4 va_fc8 va_s8 va_f8 va_s6 in
(va_fc6, va_s6)
)
else
(
let va_b9 = va_get_block va_c6 in
let (va_s10, va_fc10) = va_lemma_KeyExpansionRoundOdd256 (va_hd va_b9) va_s4 (n - 1) dst
key in
let va_b10 = va_tl va_b9 in
let (va_s6, va_f10) = va_lemma_empty_total va_s10 va_b10 in
let va_fc6 = va_lemma_merge_total va_b9 va_s4 va_fc10 va_s10 va_f10 va_s6 in
(va_fc6, va_s6)
)
) in
assert (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1
va_s6)))}0 <= j /\ j < n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_s6)) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j old_mem));
let (va_s2, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f4 = va_lemma_merge_total va_b4 va_s4 va_fc6 va_s6 va_f6 va_s2 in
let va_fc2 = va_lemma_merge_total va_b3 va_s0 va_fc4 va_s4 va_f4 va_s2 in
(va_fc2, va_s2)
)
else
(
let va_b12 = va_get_block va_c2 in
let (va_s2, va_fc2) = va_lemma_empty_total va_s0 va_b12 in
(va_fc2, va_s2)
)
) in
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_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)
/\ (forall (va_x_mem:vale_heap) (va_x_heap1:vale_heap) (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) . 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_upd_mem_heaplet 1
va_x_heap1 (va_upd_mem va_x_mem va_s0)))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == va_if (n `op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM)
(fun _ -> va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == va_if ((n - 1)
`op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM) (fun _ -> va_get_vec 3 va_sM) /\ (forall j .
{:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j
<= n ==> Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j
(va_get_mem_heaplet 1 va_sM)) == Vale.AES.AES256_helpers_BE.expand_key_256 key j) ==> va_k
va_sM (())))
val va_wpProof_KeyExpansionRoundUnrolledRecursive256 : key:(seq nat32) -> dst:buffer128 -> n:int ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundUnrolledRecursive256
n) ([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_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundUnrolledRecursive256
(va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 key dst n 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem 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_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int) :
(va_quickCode unit (va_code_KeyExpansionRoundUnrolledRecursive256 n)) =
(va_QProc (va_code_KeyExpansionRoundUnrolledRecursive256 n) ([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_mem_heaplet 1;
va_Mod_mem]) (va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n)
(va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n))
//--
//-- KeyExpansion256Stdcall
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansion256Stdcall () =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_CCons
(va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret) (va_CCons (va_code_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg
10) Secret) (va_CCons (va_code_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) Secret) (va_CCons
(va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 14) (va_CCons (va_code_Vxor (va_op_vec_opr_vec
1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_CNil ()))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansion256Stdcall () =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg
10) Secret) (va_pbool_and (va_codegen_success_Store128_byte16_buffer (va_op_heaplet_mem_heaplet
1) (va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) Secret) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 14) (va_pbool_and
(va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_ttrue ()))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
va_mods: Vale.PPC64LE.QuickCode.va_mods_t ->
input_key_b: Vale.PPC64LE.Memory.buffer128 ->
output_key_expansion_b: Vale.PPC64LE.Memory.buffer128
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.AES.PPC64LE.AES256.va_code_KeyExpansion256Stdcall ()) | Prims.Tot | [
"total"
] | [] | [
"Vale.PPC64LE.QuickCode.va_mods_t",
"Vale.PPC64LE.Memory.buffer128",
"Vale.PPC64LE.QuickCodes.qblock",
"Prims.unit",
"Prims.Cons",
"Vale.PPC64LE.Decls.va_code",
"Vale.PPC64LE.InsBasic.va_code_LoadImm64",
"Vale.PPC64LE.Decls.va_op_reg_opr_reg",
"Vale.PPC64LE.InsVector.va_code_Load128_byte16_buffer",
"Vale.PPC64LE.Decls.va_op_heaplet_mem_heaplet",
"Vale.PPC64LE.Decls.va_op_vec_opr_vec",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.PPC64LE.InsVector.va_code_Load128_byte16_buffer_index",
"Vale.PPC64LE.InsVector.va_code_Store128_byte16_buffer",
"Vale.PPC64LE.InsVector.va_code_Store128_byte16_buffer_index",
"Vale.AES.PPC64LE.AES256.va_code_KeyExpansionRoundUnrolledRecursive256",
"Vale.PPC64LE.InsVector.va_code_Vxor",
"Prims.Nil",
"Vale.PPC64LE.Machine_s.precode",
"Vale.PPC64LE.Decls.ins",
"Vale.PPC64LE.Decls.ocmp",
"Vale.PPC64LE.Decls.va_state",
"Vale.PPC64LE.QuickCodes.va_QSeq",
"Vale.PPC64LE.QuickCodes.va_range1",
"Vale.PPC64LE.InsBasic.va_quick_LoadImm64",
"Vale.PPC64LE.InsVector.va_quick_Load128_byte16_buffer",
"Vale.PPC64LE.InsVector.va_quick_Load128_byte16_buffer_index",
"Vale.PPC64LE.InsVector.va_quick_Store128_byte16_buffer",
"Vale.PPC64LE.QuickCodes.va_QBind",
"Vale.PPC64LE.InsVector.va_quick_Store128_byte16_buffer_index",
"Vale.PPC64LE.QuickCodes.va_qPURE",
"Prims.pure_post",
"Prims.l_and",
"Prims.l_True",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.eq2",
"FStar.Seq.Base.seq",
"Vale.Def.Words_s.nat32",
"Prims.nat",
"Vale.Def.Types_s.quad32",
"Vale.AES.AES_BE_s.is_aes_key_word",
"Vale.AES.AES_common_s.AES_256",
"Vale.AES.AES256_helpers_BE.expand_key_256",
"Vale.AES.AES256_helpers_BE.expand_key_256_def",
"Vale.AES.AES256_helpers_BE.expand_key_256_reveal",
"Vale.AES.PPC64LE.AES256.va_quick_KeyExpansionRoundUnrolledRecursive256",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"FStar.Seq.Base.index",
"Vale.AES.AES_BE_s.key_schedule_to_round_keys",
"Vale.AES.AES_BE_s.expand_key",
"Vale.AES.AES256_helpers_BE.lemma_expand_key_256",
"Vale.PPC64LE.QuickCodes.va_QLemma",
"Prims.squash",
"Vale.PPC64LE.Decls.va_reveal_eq",
"Vale.AES.AES_common_s.algorithm",
"Vale.Def.Types_s.nat32",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.op_Addition",
"Vale.AES.AES_common_s.nr",
"Vale.AES.AES_BE_s.key_to_round_keys_word",
"Vale.PPC64LE.Decls.va_reveal_opaque",
"Vale.PPC64LE.InsVector.va_quick_Vxor",
"Vale.PPC64LE.QuickCodes.va_QEmpty",
"Vale.PPC64LE.QuickCodes.quickCodes",
"Vale.AES.AES256_helpers_BE.make_AES256_key",
"Vale.Def.Types_s.reverse_bytes_quad32",
"Vale.PPC64LE.Decls.buffer128_read",
"Vale.PPC64LE.Decls.va_get_mem_heaplet",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.QuickCode.va_quickCode",
"Vale.AES.PPC64LE.AES256.va_code_KeyExpansion256Stdcall"
] | [] | false | false | false | false | false | let va_qcode_KeyExpansion256Stdcall
(va_mods: va_mods_t)
(input_key_b output_key_expansion_b: buffer128)
: (va_quickCode unit (va_code_KeyExpansion256Stdcall ())) =
| (qblock va_mods
(fun (va_s: va_state) ->
let va_old_s:va_state = va_s in
let key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32) =
Vale.AES.AES256_helpers_BE.make_AES256_key (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
input_key_b
0
(va_get_mem_heaplet 0 va_s)))
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b
1
(va_get_mem_heaplet 0 va_s)))
in
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 193 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) 16)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 194 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4)
Secret
input_key_b
0)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 195 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 4)
(va_op_reg_opr_reg 10)
Secret
input_key_b
1)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 197 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3)
Secret
output_key_expansion_b
0)
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 198 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3)
(va_op_reg_opr_reg 10)
Secret
output_key_expansion_b
1)
(fun (va_s: va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 200 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_: unit) ->
Vale.AES.AES256_helpers_BE.expand_key_256_reveal ())
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 201 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_KeyExpansionRoundUnrolledRecursive256 key
output_key_expansion_b
14)
(fun (va_s: va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 202 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_: unit) ->
Vale.AES.AES256_helpers_BE.lemma_expand_key_256 key 15
)
(va_QLemma va_range1
"***** PRECONDITION NOT MET AT line 203 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
true
(fun _ ->
va_reveal_eq (`%key_to_round_keys_word)
key_to_round_keys_word
key_to_round_keys_word)
(fun _ ->
va_reveal_opaque (`%key_to_round_keys_word)
key_to_round_keys_word)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 206 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 207 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 208 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 209 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4))
(va_QEmpty (())))))))))))))))) | false |
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_wpProof_KeyExpansion256Stdcall | val va_wpProof_KeyExpansion256Stdcall : input_key_b:buffer128 -> output_key_expansion_b:buffer128
-> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansion256Stdcall input_key_b output_key_expansion_b
va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansion256Stdcall ())
([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_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) | val va_wpProof_KeyExpansion256Stdcall : input_key_b:buffer128 -> output_key_expansion_b:buffer128
-> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansion256Stdcall input_key_b output_key_expansion_b
va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansion256Stdcall ())
([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_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) | let va_wpProof_KeyExpansion256Stdcall input_key_b output_key_expansion_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansion256Stdcall (va_code_KeyExpansion256Stdcall ()) va_s0
input_key_b output_key_expansion_b 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem 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_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 22,
"end_line": 716,
"start_col": 0,
"start_line": 706
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round
rcon) va_s0 round rcon dst key 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 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1
va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32)) :
(va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(va_QProc (va_code_KeyExpansionRoundEven256 round rcon) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem])
(va_wp_KeyExpansionRoundEven256 round rcon dst key) (va_wpProof_KeyExpansionRoundEven256 round
rcon dst key))
//--
//-- KeyExpansionRoundOdd256
val va_code_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundOdd256 round =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
()))))))))))))))
val va_codegen_success_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundOdd256 round =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundOdd256 (va_mods:va_mods_t) (round:nat8) (dst:buffer128) (key:(seq
nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) =
(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 114 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 115 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 116 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 117 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 118 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 120 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 121 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 123 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 124 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 125 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 127 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg23:Prims.int) = round + 1
in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg21:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg21 va_arg22 0 va_arg23)
(let (va_arg20:Prims.int) = round + 1 in let (va_arg19:Vale.Def.Types_s.quad32) = va_get_vec 1
va_old_s in let (va_arg18:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 129 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_round_key_256_rcon_odd va_arg18 va_arg19 0
va_arg20) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 130 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(())))))))))))))))))))
val va_lemma_KeyExpansionRoundOdd256 : va_b0:va_code -> va_s0:va_state -> round:nat8 ->
dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundOdd256 round) va_s0 /\ va_get_ok
va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0)
dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10
va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundOdd256 va_b0 va_s0 round dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundOdd256 va_mods round dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundOdd256 round) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 92 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 102 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 110 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 111 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 112 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32)
(va_x_v4:quad32) . let va_sM = va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem
va_x_mem va_s0)))))) in va_get_ok va_sM /\ Vale.PPC64LE.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15 (va_get_mem_layout va_sM) Secret /\
va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec 3 va_sM ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundOdd256 : round:nat8 -> dst:buffer128 -> key:(seq nat32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundOdd256 round dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundOdd256 round)
([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1;
va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundOdd256 round dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundOdd256 (va_code_KeyExpansionRoundOdd256 round)
va_s0 round dst key in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) : (va_quickCode
unit (va_code_KeyExpansionRoundOdd256 round)) =
(va_QProc (va_code_KeyExpansionRoundOdd256 round) ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_KeyExpansionRoundOdd256
round dst key) (va_wpProof_KeyExpansionRoundOdd256 round dst key))
//--
//-- KeyExpansionRoundUnrolledRecursive256
val va_code_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_code(decreases %[n])
[@ "opaque_to_smt"]
let rec va_code_KeyExpansionRoundUnrolledRecursive256 n =
(va_Block (va_CCons (if (1 < n && n <= 14) then va_Block (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_CCons (if (n `op_Modulus` 2 = 0)
then va_Block (va_CCons (va_code_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_CNil ())) else va_Block (va_CCons
(va_code_KeyExpansionRoundOdd256 (n - 1)) (va_CNil ()))) (va_CNil ()))) else va_Block (va_CNil
())) (va_CNil ())))
val va_codegen_success_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_pbool(decreases %[n])
[@ "opaque_to_smt"]
let rec va_codegen_success_KeyExpansionRoundUnrolledRecursive256 n =
(va_pbool_and (if (1 < n && n <= 14) then va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_pbool_and (if (n
`op_Modulus` 2 = 0) then va_pbool_and (va_codegen_success_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_ttrue ()) else va_pbool_and
(va_codegen_success_KeyExpansionRoundOdd256 (n - 1)) (va_ttrue ())) (va_ttrue ())) else
va_ttrue ()) (va_ttrue ()))
val va_lemma_KeyExpansionRoundUnrolledRecursive256 : va_b0:va_code -> va_s0:va_state -> key:(seq
nat32) -> dst:buffer128 -> n:int
-> Ghost (va_state & va_fuel)(decreases %[n])
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == (if (n `op_Modulus` 2 = 0) then va_get_vec 1 va_sM else
va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == (if ((n - 1) `op_Modulus` 2 = 0) then va_get_vec 1
va_sM else va_get_vec 3 va_sM) /\ (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read
dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j <= n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.AES256_helpers_BE.expand_key_256 key j) /\ 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_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let rec va_lemma_KeyExpansionRoundUnrolledRecursive256 va_b0 va_s0 key dst n =
va_reveal_opaque (`%va_code_KeyExpansionRoundUnrolledRecursive256)
(va_code_KeyExpansionRoundUnrolledRecursive256 n);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let va_b2 = va_tl va_b1 in
let va_c2 = va_hd va_b1 in
let (va_fc2, va_s2) =
(
if (1 < n && n <= 14) then
(
let va_b3 = va_get_block va_c2 in
let (va_s4, va_fc4) = va_lemma_KeyExpansionRoundUnrolledRecursive256 (va_hd va_b3) va_s0 key
dst (n - 1) in
let va_b4 = va_tl va_b3 in
let (old_mem:vale_heap) = va_get_mem_heaplet 1 va_s4 in
let va_b6 = va_tl va_b4 in
let va_c6 = va_hd va_b4 in
let (va_fc6, va_s6) =
(
if (n `op_Modulus` 2 = 0) then
(
let va_b7 = va_get_block va_c6 in
let (va_s8, va_fc8) = va_lemma_KeyExpansionRoundEven256 (va_hd va_b7) va_s4 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1)) dst key in
let va_b8 = va_tl va_b7 in
let (va_s6, va_f8) = va_lemma_empty_total va_s8 va_b8 in
let va_fc6 = va_lemma_merge_total va_b7 va_s4 va_fc8 va_s8 va_f8 va_s6 in
(va_fc6, va_s6)
)
else
(
let va_b9 = va_get_block va_c6 in
let (va_s10, va_fc10) = va_lemma_KeyExpansionRoundOdd256 (va_hd va_b9) va_s4 (n - 1) dst
key in
let va_b10 = va_tl va_b9 in
let (va_s6, va_f10) = va_lemma_empty_total va_s10 va_b10 in
let va_fc6 = va_lemma_merge_total va_b9 va_s4 va_fc10 va_s10 va_f10 va_s6 in
(va_fc6, va_s6)
)
) in
assert (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1
va_s6)))}0 <= j /\ j < n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_s6)) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j old_mem));
let (va_s2, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f4 = va_lemma_merge_total va_b4 va_s4 va_fc6 va_s6 va_f6 va_s2 in
let va_fc2 = va_lemma_merge_total va_b3 va_s0 va_fc4 va_s4 va_f4 va_s2 in
(va_fc2, va_s2)
)
else
(
let va_b12 = va_get_block va_c2 in
let (va_s2, va_fc2) = va_lemma_empty_total va_s0 va_b12 in
(va_fc2, va_s2)
)
) in
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_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)
/\ (forall (va_x_mem:vale_heap) (va_x_heap1:vale_heap) (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) . 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_upd_mem_heaplet 1
va_x_heap1 (va_upd_mem va_x_mem va_s0)))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == va_if (n `op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM)
(fun _ -> va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == va_if ((n - 1)
`op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM) (fun _ -> va_get_vec 3 va_sM) /\ (forall j .
{:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j
<= n ==> Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j
(va_get_mem_heaplet 1 va_sM)) == Vale.AES.AES256_helpers_BE.expand_key_256 key j) ==> va_k
va_sM (())))
val va_wpProof_KeyExpansionRoundUnrolledRecursive256 : key:(seq nat32) -> dst:buffer128 -> n:int ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundUnrolledRecursive256
n) ([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_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundUnrolledRecursive256
(va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 key dst n 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem 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_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int) :
(va_quickCode unit (va_code_KeyExpansionRoundUnrolledRecursive256 n)) =
(va_QProc (va_code_KeyExpansionRoundUnrolledRecursive256 n) ([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_mem_heaplet 1;
va_Mod_mem]) (va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n)
(va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n))
//--
//-- KeyExpansion256Stdcall
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansion256Stdcall () =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_CCons
(va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret) (va_CCons (va_code_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg
10) Secret) (va_CCons (va_code_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) Secret) (va_CCons
(va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 14) (va_CCons (va_code_Vxor (va_op_vec_opr_vec
1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_CNil ()))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansion256Stdcall () =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg
10) Secret) (va_pbool_and (va_codegen_success_Store128_byte16_buffer (va_op_heaplet_mem_heaplet
1) (va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) Secret) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 14) (va_pbool_and
(va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_ttrue ())))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansion256Stdcall (va_mods:va_mods_t) (input_key_b:buffer128)
(output_key_expansion_b:buffer128) : (va_quickCode unit (va_code_KeyExpansion256Stdcall ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = Vale.AES.AES256_helpers_BE.make_AES256_key
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 0
(va_get_mem_heaplet 0 va_s))) (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet 0 va_s))) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 193 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 194 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret input_key_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 195 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret input_key_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 197 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) Secret output_key_expansion_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 198 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret output_key_expansion_b 1) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 200 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 201 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_KeyExpansionRoundUnrolledRecursive256 key output_key_expansion_b 14) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 202 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_expand_key_256 key 15) (va_QLemma va_range1
"***** PRECONDITION NOT MET AT line 203 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
true (fun _ -> va_reveal_eq (`%key_to_round_keys_word) key_to_round_keys_word
key_to_round_keys_word) (fun _ -> va_reveal_opaque (`%key_to_round_keys_word)
key_to_round_keys_word) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 206 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 207 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 208 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 209 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_QEmpty
(()))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansion256Stdcall va_b0 va_s0 input_key_b output_key_expansion_b =
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_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansion256Stdcall va_mods input_key_b output_key_expansion_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansion256Stdcall ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 174 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ (let (key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) =
Vale.AES.AES256_helpers_BE.make_AES256_key (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 0 (va_get_mem_heaplet 0 va_s0)))
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 1
(va_get_mem_heaplet 0 va_s0))) in label va_range1
"***** POSTCONDITION NOT MET AT line 186 column 71 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_sM) (va_get_reg 4 va_sM)
input_key_b 2 (va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 187 column 83 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM)
output_key_expansion_b 15 (va_get_mem_layout va_sM) Secret)) /\ (let (key:(FStar.Seq.Base.seq
Vale.Def.Types_s.nat32)) = Vale.AES.AES256_helpers_BE.make_AES256_key
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 0
(va_get_mem_heaplet 0 va_s0))) (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet 0 va_s0))) in label
va_range1
"***** POSTCONDITION NOT MET AT line 189 column 70 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer128 output_key_expansion_b (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 191 column 133 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(forall (j:nat) . {:pattern(reverse_bytes_quad32 (buffer128_read output_key_expansion_b j
(va_get_mem_heaplet 1 va_sM)))}j <= 14 ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read output_key_expansion_b j (va_get_mem_heaplet 1 va_sM)) ==
FStar.Seq.Base.index #Vale.Def.Types_s.quad32 (Vale.AES.AES_BE_s.key_to_round_keys_word AES_256
key) j))) 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_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
input_key_b: Vale.PPC64LE.Memory.buffer128 ->
output_key_expansion_b: Vale.PPC64LE.Memory.buffer128 ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Prims.Ghost ((Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) * Prims.unit) | Prims.Ghost | [] | [] | [
"Vale.PPC64LE.Memory.buffer128",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Vale.PPC64LE.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple3",
"Vale.PPC64LE.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Vale.PPC64LE.QuickCode.va_Mod_mem_heaplet",
"Vale.PPC64LE.QuickCode.va_Mod_mem",
"Prims.Nil",
"Prims._assert",
"Vale.PPC64LE.Decls.va_state_eq",
"Vale.PPC64LE.Decls.va_update_vec",
"Vale.PPC64LE.Decls.va_update_reg",
"Vale.PPC64LE.Decls.va_update_mem_heaplet",
"Vale.PPC64LE.Decls.va_update_ok",
"Vale.PPC64LE.Decls.va_update_mem",
"Vale.PPC64LE.Decls.va_lemma_upd_update",
"FStar.Pervasives.Native.tuple3",
"FStar.Pervasives.Native.tuple2",
"Vale.PPC64LE.Machine_s.state",
"Vale.AES.PPC64LE.AES256.va_lemma_KeyExpansion256Stdcall",
"Vale.AES.PPC64LE.AES256.va_code_KeyExpansion256Stdcall"
] | [] | false | false | false | false | false | let va_wpProof_KeyExpansion256Stdcall input_key_b output_key_expansion_b va_s0 va_k =
| let va_sM, va_f0 =
va_lemma_KeyExpansion256Stdcall (va_code_KeyExpansion256Stdcall ())
va_s0
input_key_b
output_key_expansion_b
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_mem_heaplet 1
va_sM
(va_update_ok va_sM (va_update_mem 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_Mod_mem_heaplet 1;
va_Mod_mem
])
va_sM
va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | false |
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_code_AES256EncryptRound | val va_code_AES256EncryptRound : n:nat8 -> Tot va_code | val va_code_AES256EncryptRound : n:nat8 -> Tot va_code | let va_code_AES256EncryptRound n =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n)) (va_CCons
(va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret) (va_CCons (va_code_Vcipher
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 2)) (va_CNil ()))))) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 87,
"end_line": 727,
"start_col": 0,
"start_line": 723
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round
rcon) va_s0 round rcon dst key 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 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1
va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32)) :
(va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(va_QProc (va_code_KeyExpansionRoundEven256 round rcon) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem])
(va_wp_KeyExpansionRoundEven256 round rcon dst key) (va_wpProof_KeyExpansionRoundEven256 round
rcon dst key))
//--
//-- KeyExpansionRoundOdd256
val va_code_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundOdd256 round =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
()))))))))))))))
val va_codegen_success_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundOdd256 round =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundOdd256 (va_mods:va_mods_t) (round:nat8) (dst:buffer128) (key:(seq
nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) =
(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 114 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 115 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 116 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 117 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 118 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 120 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 121 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 123 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 124 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 125 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 127 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg23:Prims.int) = round + 1
in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg21:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg21 va_arg22 0 va_arg23)
(let (va_arg20:Prims.int) = round + 1 in let (va_arg19:Vale.Def.Types_s.quad32) = va_get_vec 1
va_old_s in let (va_arg18:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 129 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_round_key_256_rcon_odd va_arg18 va_arg19 0
va_arg20) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 130 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(())))))))))))))))))))
val va_lemma_KeyExpansionRoundOdd256 : va_b0:va_code -> va_s0:va_state -> round:nat8 ->
dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundOdd256 round) va_s0 /\ va_get_ok
va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0)
dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10
va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundOdd256 va_b0 va_s0 round dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundOdd256 va_mods round dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundOdd256 round) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 92 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 102 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 110 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 111 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 112 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32)
(va_x_v4:quad32) . let va_sM = va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem
va_x_mem va_s0)))))) in va_get_ok va_sM /\ Vale.PPC64LE.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15 (va_get_mem_layout va_sM) Secret /\
va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec 3 va_sM ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundOdd256 : round:nat8 -> dst:buffer128 -> key:(seq nat32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundOdd256 round dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundOdd256 round)
([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1;
va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundOdd256 round dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundOdd256 (va_code_KeyExpansionRoundOdd256 round)
va_s0 round dst key in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) : (va_quickCode
unit (va_code_KeyExpansionRoundOdd256 round)) =
(va_QProc (va_code_KeyExpansionRoundOdd256 round) ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_KeyExpansionRoundOdd256
round dst key) (va_wpProof_KeyExpansionRoundOdd256 round dst key))
//--
//-- KeyExpansionRoundUnrolledRecursive256
val va_code_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_code(decreases %[n])
[@ "opaque_to_smt"]
let rec va_code_KeyExpansionRoundUnrolledRecursive256 n =
(va_Block (va_CCons (if (1 < n && n <= 14) then va_Block (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_CCons (if (n `op_Modulus` 2 = 0)
then va_Block (va_CCons (va_code_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_CNil ())) else va_Block (va_CCons
(va_code_KeyExpansionRoundOdd256 (n - 1)) (va_CNil ()))) (va_CNil ()))) else va_Block (va_CNil
())) (va_CNil ())))
val va_codegen_success_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_pbool(decreases %[n])
[@ "opaque_to_smt"]
let rec va_codegen_success_KeyExpansionRoundUnrolledRecursive256 n =
(va_pbool_and (if (1 < n && n <= 14) then va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_pbool_and (if (n
`op_Modulus` 2 = 0) then va_pbool_and (va_codegen_success_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_ttrue ()) else va_pbool_and
(va_codegen_success_KeyExpansionRoundOdd256 (n - 1)) (va_ttrue ())) (va_ttrue ())) else
va_ttrue ()) (va_ttrue ()))
val va_lemma_KeyExpansionRoundUnrolledRecursive256 : va_b0:va_code -> va_s0:va_state -> key:(seq
nat32) -> dst:buffer128 -> n:int
-> Ghost (va_state & va_fuel)(decreases %[n])
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == (if (n `op_Modulus` 2 = 0) then va_get_vec 1 va_sM else
va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == (if ((n - 1) `op_Modulus` 2 = 0) then va_get_vec 1
va_sM else va_get_vec 3 va_sM) /\ (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read
dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j <= n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.AES256_helpers_BE.expand_key_256 key j) /\ 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_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0))))))))))))
[@"opaque_to_smt"]
let rec va_lemma_KeyExpansionRoundUnrolledRecursive256 va_b0 va_s0 key dst n =
va_reveal_opaque (`%va_code_KeyExpansionRoundUnrolledRecursive256)
(va_code_KeyExpansionRoundUnrolledRecursive256 n);
let (va_old_s:va_state) = va_s0 in
let (va_b1:va_codes) = va_get_block va_b0 in
let va_b2 = va_tl va_b1 in
let va_c2 = va_hd va_b1 in
let (va_fc2, va_s2) =
(
if (1 < n && n <= 14) then
(
let va_b3 = va_get_block va_c2 in
let (va_s4, va_fc4) = va_lemma_KeyExpansionRoundUnrolledRecursive256 (va_hd va_b3) va_s0 key
dst (n - 1) in
let va_b4 = va_tl va_b3 in
let (old_mem:vale_heap) = va_get_mem_heaplet 1 va_s4 in
let va_b6 = va_tl va_b4 in
let va_c6 = va_hd va_b4 in
let (va_fc6, va_s6) =
(
if (n `op_Modulus` 2 = 0) then
(
let va_b7 = va_get_block va_c6 in
let (va_s8, va_fc8) = va_lemma_KeyExpansionRoundEven256 (va_hd va_b7) va_s4 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1)) dst key in
let va_b8 = va_tl va_b7 in
let (va_s6, va_f8) = va_lemma_empty_total va_s8 va_b8 in
let va_fc6 = va_lemma_merge_total va_b7 va_s4 va_fc8 va_s8 va_f8 va_s6 in
(va_fc6, va_s6)
)
else
(
let va_b9 = va_get_block va_c6 in
let (va_s10, va_fc10) = va_lemma_KeyExpansionRoundOdd256 (va_hd va_b9) va_s4 (n - 1) dst
key in
let va_b10 = va_tl va_b9 in
let (va_s6, va_f10) = va_lemma_empty_total va_s10 va_b10 in
let va_fc6 = va_lemma_merge_total va_b9 va_s4 va_fc10 va_s10 va_f10 va_s6 in
(va_fc6, va_s6)
)
) in
assert (forall j . {:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1
va_s6)))}0 <= j /\ j < n ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst j (va_get_mem_heaplet 1 va_s6)) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j old_mem));
let (va_s2, va_f6) = va_lemma_empty_total va_s6 va_b6 in
let va_f4 = va_lemma_merge_total va_b4 va_s4 va_fc6 va_s6 va_f6 va_s2 in
let va_fc2 = va_lemma_merge_total va_b3 va_s0 va_fc4 va_s4 va_f4 va_s2 in
(va_fc2, va_s2)
)
else
(
let va_b12 = va_get_block va_c2 in
let (va_s2, va_fc2) = va_lemma_empty_total va_s0 va_b12 in
(va_fc2, va_s2)
)
) in
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_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (0 < n /\ n <= 14) /\
Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 0 /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key 1 /\ va_get_vec 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst 0
(va_get_mem_heaplet 1 va_s0)) /\ va_get_vec 3 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst 1 (va_get_mem_heaplet 1 va_s0)) /\ va_get_reg 3 va_s0 ==
Vale.PPC64LE.Memory.buffer_addr #Vale.PPC64LE.Memory.vuint128 dst (va_get_mem_heaplet 1 va_s0)
/\ (forall (va_x_mem:vale_heap) (va_x_heap1:vale_heap) (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) . 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_upd_mem_heaplet 1
va_x_heap1 (va_upd_mem va_x_mem va_s0)))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ Vale.PPC64LE.Decls.modifies_buffer128 dst
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst n
(va_get_mem_heaplet 1 va_sM)) == va_if (n `op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM)
(fun _ -> va_get_vec 3 va_sM) /\ Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (n - 1) (va_get_mem_heaplet 1 va_sM)) == va_if ((n - 1)
`op_Modulus` 2 = 0) (fun _ -> va_get_vec 1 va_sM) (fun _ -> va_get_vec 3 va_sM) /\ (forall j .
{:pattern(reverse_bytes_quad32 (buffer128_read dst j (va_get_mem_heaplet 1 va_sM)))}0 <= j /\ j
<= n ==> Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read dst j
(va_get_mem_heaplet 1 va_sM)) == Vale.AES.AES256_helpers_BE.expand_key_256 key j) ==> va_k
va_sM (())))
val va_wpProof_KeyExpansionRoundUnrolledRecursive256 : key:(seq nat32) -> dst:buffer128 -> n:int ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0
va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundUnrolledRecursive256
n) ([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_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundUnrolledRecursive256
(va_code_KeyExpansionRoundUnrolledRecursive256 n) va_s0 key dst n 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem 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_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundUnrolledRecursive256 (key:(seq nat32)) (dst:buffer128) (n:int) :
(va_quickCode unit (va_code_KeyExpansionRoundUnrolledRecursive256 n)) =
(va_QProc (va_code_KeyExpansionRoundUnrolledRecursive256 n) ([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_mem_heaplet 1;
va_Mod_mem]) (va_wp_KeyExpansionRoundUnrolledRecursive256 key dst n)
(va_wpProof_KeyExpansionRoundUnrolledRecursive256 key dst n))
//--
//-- KeyExpansion256Stdcall
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansion256Stdcall () =
(va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_CCons
(va_code_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret) (va_CCons (va_code_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg
10) Secret) (va_CCons (va_code_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) Secret) (va_CCons
(va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 14) (va_CCons (va_code_Vxor (va_op_vec_opr_vec
1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_CNil ()))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansion256Stdcall () =
(va_pbool_and (va_codegen_success_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_pbool_and
(va_codegen_success_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret) (va_pbool_and (va_codegen_success_Load128_byte16_buffer_index
(va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3) (va_op_reg_opr_reg 4) (va_op_reg_opr_reg
10) Secret) (va_pbool_and (va_codegen_success_Store128_byte16_buffer (va_op_heaplet_mem_heaplet
1) (va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) Secret) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_pbool_and
(va_codegen_success_KeyExpansionRoundUnrolledRecursive256 14) (va_pbool_and
(va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1))
(va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_ttrue ())))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansion256Stdcall (va_mods:va_mods_t) (input_key_b:buffer128)
(output_key_expansion_b:buffer128) : (va_quickCode unit (va_code_KeyExpansion256Stdcall ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = Vale.AES.AES256_helpers_BE.make_AES256_key
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 0
(va_get_mem_heaplet 0 va_s))) (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet 0 va_s))) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 193 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) 16) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 194 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 4) Secret input_key_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 195 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 4) (va_op_reg_opr_reg 10) Secret input_key_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 197 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) Secret output_key_expansion_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 198 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret output_key_expansion_b 1) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 200 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 201 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_KeyExpansionRoundUnrolledRecursive256 key output_key_expansion_b 14) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 202 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_expand_key_256 key 15) (va_QLemma va_range1
"***** PRECONDITION NOT MET AT line 203 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
true (fun _ -> va_reveal_eq (`%key_to_round_keys_word) key_to_round_keys_word
key_to_round_keys_word) (fun _ -> va_reveal_opaque (`%key_to_round_keys_word)
key_to_round_keys_word) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 206 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 207 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 208 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 209 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 4)) (va_QEmpty
(()))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansion256Stdcall va_b0 va_s0 input_key_b output_key_expansion_b =
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_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansion256Stdcall va_mods input_key_b output_key_expansion_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansion256Stdcall ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 174 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ (let (key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) =
Vale.AES.AES256_helpers_BE.make_AES256_key (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 0 (va_get_mem_heaplet 0 va_s0)))
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 1
(va_get_mem_heaplet 0 va_s0))) in label va_range1
"***** POSTCONDITION NOT MET AT line 186 column 71 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_sM) (va_get_reg 4 va_sM)
input_key_b 2 (va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 187 column 83 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM)
output_key_expansion_b 15 (va_get_mem_layout va_sM) Secret)) /\ (let (key:(FStar.Seq.Base.seq
Vale.Def.Types_s.nat32)) = Vale.AES.AES256_helpers_BE.make_AES256_key
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 0
(va_get_mem_heaplet 0 va_s0))) (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read input_key_b 1 (va_get_mem_heaplet 0 va_s0))) in label
va_range1
"***** POSTCONDITION NOT MET AT line 189 column 70 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer128 output_key_expansion_b (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 191 column 133 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(forall (j:nat) . {:pattern(reverse_bytes_quad32 (buffer128_read output_key_expansion_b j
(va_get_mem_heaplet 1 va_sM)))}j <= 14 ==> Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read output_key_expansion_b j (va_get_mem_heaplet 1 va_sM)) ==
FStar.Seq.Base.index #Vale.Def.Types_s.quad32 (Vale.AES.AES_BE_s.key_to_round_keys_word AES_256
key) j))) 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_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_KeyExpansion256Stdcall input_key_b output_key_expansion_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansion256Stdcall (va_code_KeyExpansion256Stdcall ()) va_s0
input_key_b output_key_expansion_b 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem 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_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- AES256EncryptRound
val va_code_AES256EncryptRound : n:nat8 -> Tot va_code | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | n: Vale.PPC64LE.Memory.nat8 -> Vale.PPC64LE.Decls.va_code | Prims.Tot | [
"total"
] | [] | [
"Vale.PPC64LE.Memory.nat8",
"Vale.PPC64LE.Decls.va_Block",
"Vale.PPC64LE.Decls.va_CCons",
"Vale.PPC64LE.InsBasic.va_code_LoadImm64",
"Vale.PPC64LE.Decls.va_op_reg_opr_reg",
"Prims.op_Multiply",
"Vale.PPC64LE.InsVector.va_code_Load128_byte16_buffer_index",
"Vale.PPC64LE.Decls.va_op_heaplet_mem_heaplet",
"Vale.PPC64LE.Decls.va_op_vec_opr_vec",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.PPC64LE.InsVector.va_code_Vcipher",
"Vale.PPC64LE.Decls.va_CNil",
"Vale.PPC64LE.Decls.va_code"
] | [] | false | false | false | true | false | let va_code_AES256EncryptRound n =
| (va_Block (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` n))
(va_CCons (va_code_Load128_byte16_buffer_index (va_op_heaplet_mem_heaplet 0)
(va_op_vec_opr_vec 2)
(va_op_reg_opr_reg 4)
(va_op_reg_opr_reg 10)
Secret)
(va_CCons (va_code_Vcipher (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 2))
(va_CNil ()))))) | false |
Vale.AES.PPC64LE.AES256.fst | Vale.AES.PPC64LE.AES256.va_code_KeyExpansionRoundUnrolledRecursive256 | val va_code_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_code(decreases %[n]) | val va_code_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_code(decreases %[n]) | let rec va_code_KeyExpansionRoundUnrolledRecursive256 n =
(va_Block (va_CCons (if (1 < n && n <= 14) then va_Block (va_CCons
(va_code_KeyExpansionRoundUnrolledRecursive256 (n - 1)) (va_CCons (if (n `op_Modulus` 2 = 0)
then va_Block (va_CCons (va_code_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1))) (va_CNil ())) else va_Block (va_CCons
(va_code_KeyExpansionRoundOdd256 (n - 1)) (va_CNil ()))) (va_CNil ()))) else va_Block (va_CNil
())) (va_CNil ()))) | {
"file_name": "obj/Vale.AES.PPC64LE.AES256.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 23,
"end_line": 420,
"start_col": 0,
"start_line": 414
} | module Vale.AES.PPC64LE.AES256
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.AES.AES_BE_s
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
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.Arch.Types
open Vale.AES.AES256_helpers_BE
#reset-options "--z3rlimit 20"
//-- KeyExpansionRoundEven256
val va_code_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundEven256 round rcon =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vspltisw
(va_op_vec_opr_vec 4) 8) (va_CCons (va_code_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3))
(va_CCons (va_code_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_CCons (va_code_Mtvsrws
(va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_CCons (va_code_RotWord (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
())))))))))))))))))))
val va_codegen_success_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundEven256 round rcon =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vspltisw (va_op_vec_opr_vec 4) 8) (va_pbool_and (va_codegen_success_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_pbool_and (va_codegen_success_LoadImmShl64
(va_op_reg_opr_reg 10) rcon) (va_pbool_and (va_codegen_success_Mtvsrws (va_op_vec_opr_vec 5)
(va_op_reg_opr_reg 10)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_pbool_and (va_codegen_success_RotWord
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 1) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
()))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundEven256 (va_mods:va_mods_t) (round:nat8) (rcon:nat8) (dst:buffer128)
(key:(seq nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(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 67 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 68 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 4) 8) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 69 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 3)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 70 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImmShl64 (va_op_reg_opr_reg 10) rcon) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 71 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Mtvsrws (va_op_vec_opr_vec 5) (va_op_reg_opr_reg 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 72 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 5)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 73 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_RotWord (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 74 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 75 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 76 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 77 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 78 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 79 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 80 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 81 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 1) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 82 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 83 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 1)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 85 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg27:Vale.Def.Types_s.nat8) =
rcon in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 86 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES_BE_s.lemma_shl_rcon va_arg27) (let (va_arg26:Prims.int) = round +
1 in let (va_arg25:Vale.Def.Types_s.nat32) = rcon in let (va_arg24:Vale.Def.Types_s.quad32) =
va_get_vec 3 va_old_s in let (va_arg23:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 87 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg23 va_arg24 va_arg25
va_arg26) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 88 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(()))))))))))))))))))))))))
val va_lemma_KeyExpansionRoundEven256 : va_b0:va_code -> va_s0:va_state -> round:nat8 -> rcon:nat8
-> dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundEven256 round rcon) va_s0 /\
va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 5
va_sM (va_update_vec 4 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_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundEven256 va_b0 va_s0 round rcon dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundEven256 va_mods round rcon dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundEven256 round rcon)
va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 43 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 54 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 64 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 == 0 /\ rcon == Vale.AES.AES_common_s.aes_rcon ((round + 1) `op_Division` 2 - 1)
/\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)
(va_x_v4:quad32) (va_x_v5:quad32) . let va_sM = va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4
(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_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem va_s0))))))) in va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
1 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundEven256 : round:nat8 -> rcon:nat8 -> dst:buffer128 -> key:(seq
nat32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundEven256 round rcon)
([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundEven256 round rcon dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundEven256 (va_code_KeyExpansionRoundEven256 round
rcon) va_s0 round rcon dst key 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 2 va_sM
(va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1
va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))));
va_lemma_norm_mods ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0;
va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundEven256 (round:nat8) (rcon:nat8) (dst:buffer128) (key:(seq nat32)) :
(va_quickCode unit (va_code_KeyExpansionRoundEven256 round rcon)) =
(va_QProc (va_code_KeyExpansionRoundEven256 round rcon) ([va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem])
(va_wp_KeyExpansionRoundEven256 round rcon dst key) (va_wpProof_KeyExpansionRoundEven256 round
rcon dst key))
//--
//-- KeyExpansionRoundOdd256
val va_code_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_KeyExpansionRoundOdd256 round =
(va_Block (va_CCons (va_code_Vspltisw (va_op_vec_opr_vec 0) 0) (va_CCons (va_code_Vsbox
(va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_CCons (va_code_Vspltw (va_op_vec_opr_vec 2)
(va_op_vec_opr_vec 2) 3) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 3) 12) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_CCons (va_code_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 2)) (va_CCons (va_code_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply`
(round + 1))) (va_CCons (va_code_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_CNil
()))))))))))))))
val va_codegen_success_KeyExpansionRoundOdd256 : round:nat8 -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_KeyExpansionRoundOdd256 round =
(va_pbool_and (va_codegen_success_Vspltisw (va_op_vec_opr_vec 0) 0) (va_pbool_and
(va_codegen_success_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_pbool_and
(va_codegen_success_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vsldoi (va_op_vec_opr_vec 4)
(va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_pbool_and (va_codegen_success_Vxor
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3)
12) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 4)) (va_pbool_and (va_codegen_success_Vxor (va_op_vec_opr_vec 3)
(va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_pbool_and (va_codegen_success_LoadImm64
(va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_pbool_and
(va_codegen_success_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1)
(va_op_vec_opr_vec 3) (va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret) (va_ttrue
())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_KeyExpansionRoundOdd256 (va_mods:va_mods_t) (round:nat8) (dst:buffer128) (key:(seq
nat32)) : (va_quickCode unit (va_code_KeyExpansionRoundOdd256 round)) =
(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 114 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltisw (va_op_vec_opr_vec 0) 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 115 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsbox (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 116 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vspltw (va_op_vec_opr_vec 2) (va_op_vec_opr_vec 2) 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 117 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 118 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 120 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 121 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vsldoi (va_op_vec_opr_vec 4) (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 3) 12) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 4)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 123 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Vxor (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 3) (va_op_vec_opr_vec 2)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 124 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_LoadImm64 (va_op_reg_opr_reg 10) (16 `op_Multiply` (round + 1))) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 125 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_quick_Store128_byte16_buffer_index (va_op_heaplet_mem_heaplet 1) (va_op_vec_opr_vec 3)
(va_op_reg_opr_reg 3) (va_op_reg_opr_reg 10) Secret dst (round + 1)) (fun (va_s:va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 127 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.Def.Types_s.quad32_xor_reveal ()) (let (va_arg23:Prims.int) = round + 1
in let (va_arg22:Vale.Def.Types_s.quad32) = va_get_vec 1 va_old_s in let
(va_arg21:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_simd_round_key va_arg21 va_arg22 0 va_arg23)
(let (va_arg20:Prims.int) = round + 1 in let (va_arg19:Vale.Def.Types_s.quad32) = va_get_vec 1
va_old_s in let (va_arg18:Vale.Def.Types_s.quad32) = va_get_vec 3 va_old_s in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 129 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.lemma_round_key_256_rcon_odd va_arg18 va_arg19 0
va_arg20) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 130 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(fun (_:unit) -> Vale.AES.AES256_helpers_BE.expand_key_256_reveal ()) (va_QEmpty
(())))))))))))))))))))
val va_lemma_KeyExpansionRoundOdd256 : va_b0:va_code -> va_s0:va_state -> round:nat8 ->
dst:buffer128 -> key:(seq nat32)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_KeyExpansionRoundOdd256 round) va_s0 /\ va_get_ok
va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg 3 va_s0)
dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret /\ va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.PPC64LE.Decls.buffer128_read dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec
3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) /\ va_state_eq va_sM (va_update_vec 4
va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 0 va_sM (va_update_reg 10
va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_KeyExpansionRoundOdd256 va_b0 va_s0 round dst key =
let (va_mods:va_mods_t) = [va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_KeyExpansionRoundOdd256 va_mods round dst key in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_KeyExpansionRoundOdd256 round) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 92 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 102 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15
(va_get_mem_layout va_sM) Secret) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 110 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 111 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(va_get_vec 3 va_sM == Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 112 column 82 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.AES256.vaf *****"
(Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg
3 va_s0) dst 15 (va_get_mem_layout va_s0) Secret /\ (1 <= round /\ round < 14) /\ (round + 1)
`op_Modulus` 2 =!= 0 /\ Vale.AES.AES_BE_s.is_aes_key_word AES_256 key /\ va_get_vec 3 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1) /\ va_get_vec 1 va_s0 ==
Vale.AES.AES256_helpers_BE.expand_key_256 key round /\ (forall (va_x_mem:vale_heap)
(va_x_heap1:vale_heap) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v2:quad32) (va_x_v3:quad32)
(va_x_v4:quad32) . let va_sM = va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2
(va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem
va_x_mem va_s0)))))) in va_get_ok va_sM /\ Vale.PPC64LE.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_sM) (va_get_reg 3 va_sM) dst 15 (va_get_mem_layout va_sM) Secret /\
va_get_vec 3 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read
dst (round + 1) (va_get_mem_heaplet 1 va_sM)) /\ va_get_vec 3 va_sM ==
Vale.AES.AES256_helpers_BE.expand_key_256 key (round + 1) /\
Vale.PPC64LE.Decls.modifies_buffer_specific128 dst (va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) (round + 1) (round + 1) ==> va_k va_sM (())))
val va_wpProof_KeyExpansionRoundOdd256 : round:nat8 -> dst:buffer128 -> key:(seq nat32) ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_KeyExpansionRoundOdd256 round dst key va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_KeyExpansionRoundOdd256 round)
([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1;
va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_KeyExpansionRoundOdd256 round dst key va_s0 va_k =
let (va_sM, va_f0) = va_lemma_KeyExpansionRoundOdd256 (va_code_KeyExpansionRoundOdd256 round)
va_s0 round dst key in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM
(va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 0; va_Mod_reg 10;
va_Mod_mem_heaplet 1; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_KeyExpansionRoundOdd256 (round:nat8) (dst:buffer128) (key:(seq nat32)) : (va_quickCode
unit (va_code_KeyExpansionRoundOdd256 round)) =
(va_QProc (va_code_KeyExpansionRoundOdd256 round) ([va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 0; va_Mod_reg 10; va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_KeyExpansionRoundOdd256
round dst key) (va_wpProof_KeyExpansionRoundOdd256 round dst key))
//--
//-- KeyExpansionRoundUnrolledRecursive256
val va_code_KeyExpansionRoundUnrolledRecursive256 : n:int -> Tot va_code(decreases %[n]) | {
"checked_file": "/",
"dependencies": [
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.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.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES_BE_s.fst.checked",
"Vale.AES.AES256_helpers_BE.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.PPC64LE.AES256.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers_BE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"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.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_BE_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_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
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | n: Prims.int -> Prims.Tot Vale.PPC64LE.Decls.va_code | Prims.Tot | [
"total",
""
] | [] | [
"Prims.int",
"Vale.PPC64LE.Decls.va_Block",
"Vale.PPC64LE.Decls.va_CCons",
"Prims.op_AmpAmp",
"Prims.op_LessThan",
"Prims.op_LessThanOrEqual",
"Vale.AES.PPC64LE.AES256.va_code_KeyExpansionRoundUnrolledRecursive256",
"Prims.op_Subtraction",
"Prims.op_Equality",
"Prims.op_Modulus",
"Vale.AES.PPC64LE.AES256.va_code_KeyExpansionRoundEven256",
"Vale.AES.AES_common_s.aes_rcon",
"Prims.op_Division",
"Vale.PPC64LE.Decls.va_CNil",
"Prims.bool",
"Vale.AES.PPC64LE.AES256.va_code_KeyExpansionRoundOdd256",
"Vale.PPC64LE.Decls.va_code"
] | [
"recursion"
] | false | false | false | true | false | let rec va_code_KeyExpansionRoundUnrolledRecursive256 n =
| (va_Block (va_CCons (if (1 < n && n <= 14)
then
va_Block (va_CCons (va_code_KeyExpansionRoundUnrolledRecursive256 (n - 1))
(va_CCons (if (n `op_Modulus` 2 = 0)
then
va_Block (va_CCons (va_code_KeyExpansionRoundEven256 (n - 1)
(Vale.AES.AES_common_s.aes_rcon (n `op_Division` 2 - 1)))
(va_CNil ()))
else
va_Block (va_CCons (va_code_KeyExpansionRoundOdd256 (n - 1)) (va_CNil ()))
)
(va_CNil ())))
else va_Block (va_CNil ()))
(va_CNil ()))) | false |
TwoLockQueue.fst | TwoLockQueue.pack_queue_invariant | val pack_queue_invariant (#a #u: _) (x y: erased (Q.t a)) (head tail: q_ptr a)
: SteelGhostT unit
u
(((ghost_pts_to head.ghost half x) `star` (ghost_pts_to tail.ghost half y))
`star`
(Q.queue x y))
(fun _ -> queue_invariant head tail) | val pack_queue_invariant (#a #u: _) (x y: erased (Q.t a)) (head tail: q_ptr a)
: SteelGhostT unit
u
(((ghost_pts_to head.ghost half x) `star` (ghost_pts_to tail.ghost half y))
`star`
(Q.queue x y))
(fun _ -> queue_invariant head tail) | let pack_queue_invariant (#a:_) (#u:_) (x:erased (Q.t a)) (y:erased (Q.t a)) (head tail:q_ptr a)
: SteelGhostT unit u
(ghost_pts_to head.ghost half x `star`
ghost_pts_to tail.ghost half y `star`
Q.queue x y)
(fun _ -> queue_invariant head tail)
= intro_exists (reveal y) (fun y -> ghost_pts_to head.ghost half x `star`
ghost_pts_to tail.ghost half y `star`
Q.queue x y);
intro_exists (reveal x) (fun x -> h_exists (fun y -> ghost_pts_to head.ghost half x `star`
ghost_pts_to tail.ghost half y `star`
Q.queue x y)) | {
"file_name": "share/steel/examples/steel/TwoLockQueue.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 54,
"end_line": 126,
"start_col": 0,
"start_line": 115
} | module TwoLockQueue
open FStar.Ghost
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.FractionalPermission
open Steel.Reference
open Steel.SpinLock
module L = FStar.List.Tot
module U = Steel.Utils
module Q = Queue
/// This module provides an implementation of Michael and Scott's two lock queue, using the
/// abstract interface for queues provided in Queue.fsti.
/// This implementation allows an enqueue and a dequeue operation to safely operate in parallel.
/// There is a lock associated to both the enqueuer and the dequeuer, which guards each of those operation,
/// ensuring that at most one enqueue (resp. dequeue) is happening at any time
/// We only prove that this implementation is memory safe, and do not prove the functional correctness of the concurrent queue
#push-options "--ide_id_info_off"
/// Adding the definition of the vprop equivalence to the context, for proof purposes
let _: squash (forall p q. p `equiv` q <==> hp_of p `Steel.Memory.equiv` hp_of q) =
Classical.forall_intro_2 reveal_equiv
(* Some wrappers to reduce clutter in the code *)
[@@__reduce__]
let full = full_perm
[@@__reduce__]
let half = half_perm full
(* Wrappers around fst and snd to avoid overnormalization.
TODO: The frame inference tactic should not normalize fst and snd *)
let fst x = fst x
let snd x = snd x
(* Some wrappers around Steel functions which are easier to use inside this module *)
let ghost_gather (#a:Type) (#u:_)
(#p0 #p1:perm) (#p:perm{p == sum_perm p0 p1})
(x0 #x1:erased a)
(r:ghost_ref a)
: SteelGhost unit u
(ghost_pts_to r p0 x0 `star`
ghost_pts_to r p1 x1)
(fun _ -> ghost_pts_to r p x0)
(requires fun _ -> True)
(ensures fun _ _ _ -> x0 == x1)
= let _ = ghost_gather_pt #a #u #p0 #p1 r in ()
let rewrite #u (p q:vprop)
: SteelGhost unit u p (fun _ -> q)
(requires fun _ -> p `equiv` q)
(ensures fun _ _ _ -> True)
= rewrite_slprop p q (fun _ -> reveal_equiv p q)
let elim_pure (#p:prop) #u ()
: SteelGhost unit u
(pure p) (fun _ -> emp)
(requires fun _ -> True)
(ensures fun _ _ _ -> p)
= let _ = Steel.Effect.Atomic.elim_pure p in ()
let open_exists (#a:Type) (#opened_invariants:_) (#p:a -> vprop) (_:unit)
: SteelGhostT (Ghost.erased a) opened_invariants
(h_exists p) (fun r -> p (reveal r))
= let v : erased a = witness_exists () in
v
(*** Queue invariant ***)
/// The invariant associated to the lock. Basically a variant of the
/// Owicki-Gries invariant, but applied to queues
[@@__reduce__]
let lock_inv #a (ptr:ref (Q.t a)) (ghost:ghost_ref (Q.t a)) =
h_exists (fun (v:Q.t a) ->
pts_to ptr full v `star`
ghost_pts_to ghost half v)
let intro_lock_inv #a #u (ptr:ref (Q.t a)) (ghost:ghost_ref (Q.t a))
: SteelGhostT unit u
(h_exists (fun (v:Q.t a) -> pts_to ptr full v `star` ghost_pts_to ghost half v))
(fun _ -> lock_inv ptr ghost)
= assert_spinoff
(h_exists (fun (v:Q.t a) -> pts_to ptr full v `star` ghost_pts_to ghost half v) == lock_inv ptr ghost);
rewrite_slprop
(h_exists (fun (v:Q.t a) -> pts_to ptr full v `star` ghost_pts_to ghost half v))
(lock_inv _ _)
(fun _ -> ())
/// The type of a queue pointer.
/// Contains the concrete pointer [ptr], the pointer to ghost state [ghost],
/// and a lock [lock] protecting the invariant relating the concrete and ghost states
noeq
type q_ptr (a:Type) = {
ptr : ref (Q.t a);
ghost: ghost_ref (Q.t a);
lock: lock (lock_inv ptr ghost);
}
/// The global queue invariant, which will be shared by the enqueuer and the dequeuer.
/// Again, inspired by the Owicki-Gries counter: It contains half the permission for the ghost
/// state of the enqueuer and dequeuer, while ensuring that the concrete queue always remains
/// a valid queue
let queue_invariant (#a:_) ([@@@smt_fallback]head:q_ptr a) ([@@@smt_fallback] tail:q_ptr a) =
h_exists (fun (h:Q.t a) ->
h_exists (fun (t:Q.t a) ->
ghost_pts_to head.ghost half h `star`
ghost_pts_to tail.ghost half t `star`
Q.queue h t)) | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.Reference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Queue.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "TwoLockQueue.fst"
} | [
{
"abbrev": true,
"full_module": "Queue",
"short_module": "Q"
},
{
"abbrev": true,
"full_module": "Steel.Utils",
"short_module": "U"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
x: FStar.Ghost.erased (Queue.Def.t a) ->
y: FStar.Ghost.erased (Queue.Def.t a) ->
head: TwoLockQueue.q_ptr a ->
tail: TwoLockQueue.q_ptr a
-> Steel.Effect.Atomic.SteelGhostT Prims.unit | Steel.Effect.Atomic.SteelGhostT | [] | [] | [
"Steel.Memory.inames",
"FStar.Ghost.erased",
"Queue.Def.t",
"TwoLockQueue.q_ptr",
"Steel.Effect.Atomic.intro_exists",
"FStar.Ghost.reveal",
"Steel.Effect.Atomic.h_exists",
"Steel.Effect.Common.star",
"Steel.Reference.ghost_pts_to",
"TwoLockQueue.__proj__Mkq_ptr__item__ghost",
"TwoLockQueue.half",
"Queue.queue",
"Steel.Effect.Common.vprop",
"Prims.unit",
"TwoLockQueue.queue_invariant"
] | [] | false | true | false | false | false | let pack_queue_invariant (#a #u: _) (x y: erased (Q.t a)) (head tail: q_ptr a)
: SteelGhostT unit
u
(((ghost_pts_to head.ghost half x) `star` (ghost_pts_to tail.ghost half y))
`star`
(Q.queue x y))
(fun _ -> queue_invariant head tail) =
| intro_exists (reveal y)
(fun y ->
((ghost_pts_to head.ghost half x) `star` (ghost_pts_to tail.ghost half y))
`star`
(Q.queue x y));
intro_exists (reveal x)
(fun x ->
h_exists (fun y ->
((ghost_pts_to head.ghost half x) `star` (ghost_pts_to tail.ghost half y))
`star`
(Q.queue x y))) | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.