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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
HoareSTPolyBind.fst | HoareSTPolyBind.upd | val upd (#a: Type0) (x: array a) (i: nat) (v: a)
: HoareST unit
(fun h -> i < Seq.length (sel h x))
(fun h0 _ h1 ->
i < Seq.length (sel h0 x) /\ modifies (Set.singleton (addr_of x)) h0 h1 /\
sel h1 x == Seq.upd (sel h0 x) i v) | val upd (#a: Type0) (x: array a) (i: nat) (v: a)
: HoareST unit
(fun h -> i < Seq.length (sel h x))
(fun h0 _ h1 ->
i < Seq.length (sel h0 x) /\ modifies (Set.singleton (addr_of x)) h0 h1 /\
sel h1 x == Seq.upd (sel h0 x) i v) | let upd (#a:Type0) (x:array a) (i:nat) (v:a)
: HoareST unit
(fun h -> i < Seq.length (sel h x))
(fun h0 _ h1 ->
i < Seq.length (sel h0 x) /\
modifies (Set.singleton (addr_of x)) h0 h1 /\
sel h1 x == Seq.upd (sel h0 x) i v)
= let s = !x in
let s = Seq.upd s i v in
x := s | {
"file_name": "examples/layeredeffects/HoareSTPolyBind.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 8,
"end_line": 291,
"start_col": 0,
"start_line": 282
} | (*
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 HoareSTPolyBind
open FStar.Heap
open FStar.ST
module P = FStar.Preorder
module ST = FStar.ST
/// ST effect implemented as a layered effect over STATE
///
/// This module uses polymonadic binds to compose HoareST and PURE computations
///
/// See the `copy_aux` function below for some limitations of the polymonadic bind
#set-options "--max_fuel 0 --max_ifuel 0"
type pre_t = heap -> Type0
type post_t (a:Type) = heap -> a -> heap -> Type0
/// It has two indices: one for the precondition and one for the postcondition
///
/// Its encoding in STATE is as expected
type repr (a:Type) (pre:pre_t) (post:post_t a) : Type =
unit -> STATE a (fun p h -> pre h /\ (forall (x:a) (h1:heap). post h x h1 ==> p x h1))
let returnc (a:Type) (x:a)
: repr a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1)
= fun _ -> x
/// bind bakes in the weakening of f's post to compose it with g's pre
let bind (a:Type) (b:Type)
(#pre_f:pre_t) (#post_f:post_t a) (#pre_g:a -> pre_t) (#post_g:a -> post_t b)
(f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x)))
: repr b
(fun h0 -> pre_f h0 /\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1))
(fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\ post_f h0 x h1 /\ post_g x h1 y h2)
= fun _ ->
let x = f () in
g x ()
/// sub comp rule
let subcomp (a:Type)
(#pre_f:pre_t) (#post_f:post_t a)
(#pre_g:pre_t) (#post_g:post_t a)
(f:repr a pre_f post_f)
: Pure (repr a pre_g post_g)
(requires
(forall (h:heap). pre_g h ==> pre_f h) /\
(forall (h0 h1:heap) (x:a). (pre_g h0 /\ post_f h0 x h1) ==> post_g h0 x h1))
(ensures fun _ -> True)
= f
let if_then_else (a:Type)
(#pre_f:pre_t) (#post_f:post_t a)
(#pre_g:pre_t) (#post_g:post_t a)
(f:repr a pre_f post_f)
(g:repr a pre_g post_g)
(p:bool)
: Type
= repr a
(fun h -> (p ==> pre_f h) /\ ((~ p) ==> pre_g h))
(fun h0 r h1 -> (p ==> post_f h0 r h1) /\ ((~ p) ==> post_g h0 r h1))
reflectable
effect {
HoareST (a:Type) (pre:pre_t) (post:post_t a)
with {repr;
return = returnc;
bind;
subcomp;
if_then_else}
}
/// Effect actions from FStar.ST
let recall (#a:Type) (#rel:P.preorder a) (r:mref a rel)
: HoareST unit
(fun _ -> True)
(fun h0 _ h1 ->
h0 == h1 /\
h1 `Heap.contains` r)
= HoareST?.reflect (fun _ -> recall r)
let alloc (#a:Type) (#rel:P.preorder a) (init:a)
: HoareST (mref a rel)
(fun _ -> True)
(fun h0 r h1 ->
fresh r h0 h1 /\
modifies Set.empty h0 h1 /\
sel h1 r == init)
= HoareST?.reflect (fun _ -> alloc init)
let op_Bang (#a:Type) (#rel:P.preorder a) (r:mref a rel)
: HoareST a
(fun _ -> True)
(fun h0 x h1 ->
h0 == h1 /\
x == sel h1 r)
= HoareST?.reflect (fun _ -> read r)
let op_Colon_Equals (#a:Type) (#rel:P.preorder a) (r:mref a rel) (x:a)
: HoareST unit
(fun h -> rel (sel h r) x)
(fun h0 _ h1 ->
modifies (Set.singleton (addr_of r)) h0 h1 /\
equal_dom h0 h1 /\
sel h1 r == x)
= HoareST?.reflect (fun _ -> write r x)
let get ()
: HoareST heap
(fun _ -> True)
(fun h0 h h1 -> h0 == h1 /\ h == h1)
= HoareST?.reflect get
/// We don't define a traditional lift from PURE to HoareST
///
/// But rather we define two polymonadic binds
let bind_pure_hoarest (a:Type) (b:Type) (wp:pure_wp a) (req:a -> pre_t) (ens:a -> post_t b)
(f:unit -> PURE a wp) (g:(x:a -> repr b (req x) (ens x)))
: repr b
(fun h -> wp (fun x -> req x h))
(fun h0 r h1 -> exists x. (~ (wp (fun r -> r =!= x))) /\ ens x h0 r h1)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun _ ->
let x = f () in
g x ()
polymonadic_bind (PURE, HoareST) |> HoareST = bind_pure_hoarest
let bind_hoarest_pure (a:Type) (b:Type) (req:pre_t) (ens:post_t a) (wp:a -> pure_wp b)
(f:repr a req ens) (g:(x:a -> unit -> PURE b (wp x)))
: repr b
(fun h -> req h /\ (forall x h1. ens h x h1 ==> (wp x) (fun _ -> True)))
(fun h0 r h1 -> exists x. ens h0 x h1 /\ (~ ((wp x) (fun y -> y =!= r))))
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall ();
fun _ ->
let x = f () in
(g x) ()
polymonadic_bind (HoareST, PURE) |> HoareST = bind_hoarest_pure
(*
// * PURE a wp <: HoareST a req ens
// *)
let subcomp_pure_hoarest (a:Type) (wp:pure_wp a) (req:pre_t) (ens:post_t a)
(f:unit -> PURE a wp)
: Pure (repr a req ens)
(requires
(forall h. req h ==> wp (fun _ -> True)) /\
(forall h0 r h1. (~ (wp (fun x -> x =!= r \/ h0 =!= h1))) ==> ens h0 r h1))
(ensures fun _ -> True)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall ();
fun _ -> f ()
polymonadic_subcomp PURE <: HoareST = subcomp_pure_hoarest
let test_subcomp () : HoareST int (fun _ -> True) (fun _ r _ -> r == 0) = 0
assume val f_test_subcomp (n:int) : Pure int (n > 0) (fun r -> r > 0)
[@expect_failure]
let test_subcomp2 (n:int) : HoareST int (fun _ -> True) (fun _ _ _ -> True) = f_test_subcomp n
let test_subcomp3 (n:int) : HoareST int (fun _ -> n > 2) (fun _ _ _ -> True) = f_test_subcomp n
assume val f : x:int -> HoareST int (fun _ -> True) (fun _ r _ -> r == x + 1)
let test () : HoareST int (fun _ -> True) (fun _ r _ -> r == 1)
= f 0
open FStar.Monotonic.Pure
assume val g : int -> int -> PURE int (as_pure_wp (fun p -> forall x. p x))
let test2 () : HoareST int (fun _ -> True) (fun _ _ _ -> True)
= g 2 (f 0)
(*
// * In the polymonadic bind (PURE, HoareST) |> HoareST, the return type of
// * g is not allowed to depend on x, the return value of f
// *
// * So then what happens when a function f whose return type depends on its argument
// * is applied to a PURE term
// * NOTE: PURE and not Tot, since Tot will just be substituted,
// * without even invoking the bind
// *
// * When typechecking f e, the comp type is roughly
// * bind C_e C_ret_f, where C_ret_f is the comp type of f (below the arrow binder)
// * This is where bind comes in
// *)
assume type t_int (x:int) : Type0
assume val dep_f (x:int) : HoareST (t_int x) (fun _ -> True) (fun _ _ _ -> True)
assume val pure_g (_:unit) : PURE int (as_pure_wp (fun p -> forall (x:int). x >= 2 ==> p x))
let test_dep_f () : HoareST (t_int (pure_g ())) (fun _ -> True) (fun _ _ _ -> True) =
dep_f (pure_g ())
(*
// * This works!
// *
// * The reason is that, before bind is called, the typechecker has already
// * substituted the pure term (pure_g ()) into the comp type of dep_f
// * (below the binder)
// *)
(*
// * But what happens when this is an explicit let binding?
// * as opposed to a function application
// *)
let test_dep_f2 () : HoareST (t_int (pure_g ())) (fun _ -> True) (fun _ _ _ -> True) =
let x = pure_g () in
dep_f x
(*
// * This also works because weakening the type using the annotation saves us!
// *)
module Seq = FStar.Seq
type array (a:Type0) = ref (Seq.seq a)
let op_At_Bar (#a:Type0) (s1:array a) (s2:array a)
: HoareST (array a)
(fun _ -> True)
(fun h0 r h1 ->
sel h1 r == Seq.append (sel h0 s1) (sel h0 s2) /\
modifies Set.empty h0 h1)
= let s1 = !s1 in
let s2 = !s2 in
alloc (Seq.append s1 s2)
let index (#a:Type0) (x:array a) (i:nat)
: HoareST a
(fun h -> i < Seq.length (sel h x))
(fun h0 v h1 ->
i < Seq.length (sel h0 x) /\
h0 == h1 /\
v == Seq.index (sel h0 x) i)
= let s = !x in
Seq.index s i | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.ST.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Preorder.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "HoareSTPolyBind.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.Preorder",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Heap",
"short_module": null
},
{
"abbrev": 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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: HoareSTPolyBind.array a -> i: Prims.nat -> v: a -> HoareSTPolyBind.HoareST Prims.unit | HoareSTPolyBind.HoareST | [] | [] | [
"HoareSTPolyBind.array",
"Prims.nat",
"HoareSTPolyBind.op_Colon_Equals",
"FStar.Seq.Base.seq",
"FStar.Heap.trivial_preorder",
"Prims.unit",
"FStar.Seq.Base.upd",
"HoareSTPolyBind.op_Bang",
"FStar.Monotonic.Heap.heap",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Seq.Base.length",
"FStar.Monotonic.Heap.sel",
"Prims.l_and",
"FStar.Monotonic.Heap.modifies",
"FStar.Set.singleton",
"FStar.Monotonic.Heap.addr_of",
"Prims.eq2"
] | [] | false | true | false | false | false | let upd (#a: Type0) (x: array a) (i: nat) (v: a)
: HoareST unit
(fun h -> i < Seq.length (sel h x))
(fun h0 _ h1 ->
i < Seq.length (sel h0 x) /\ modifies (Set.singleton (addr_of x)) h0 h1 /\
sel h1 x == Seq.upd (sel h0 x) i v) =
| let s = !x in
let s = Seq.upd s i v in
x := s | false |
Vale.AES.GHash_s.fst | Vale.AES.GHash_s.ghash_LE_def | val ghash_LE_def (h_LE: quad32) (x: ghash_plain_LE) : Tot quad32 (decreases %[length x]) | val ghash_LE_def (h_LE: quad32) (x: ghash_plain_LE) : Tot quad32 (decreases %[length x]) | let rec ghash_LE_def (h_LE:quad32) (x:ghash_plain_LE) : Tot quad32 (decreases %[length x]) =
let y_i_minus_1 =
(if length x = 1 then
Mkfour 0 0 0 0
else
ghash_LE_def h_LE (all_but_last x)) in
let x_i = last x in
let xor_LE = quad32_xor y_i_minus_1 x_i in
gf128_mul_LE xor_LE h_LE | {
"file_name": "vale/specs/crypto/Vale.AES.GHash_s.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 26,
"end_line": 27,
"start_col": 0,
"start_line": 19
} | module Vale.AES.GHash_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.AES.GF128_s
open Vale.Lib.Seqs_s
open FStar.Mul
open FStar.Seq
type ghash_plain_LE:eqtype = s:seq quad32 { length s > 0 }
let gf128_mul_LE (a_LE b_LE:quad32) : quad32 =
let a_BE = reverse_bytes_quad32 a_LE in
let b_BE = reverse_bytes_quad32 b_LE in
let ab_BE = gf128_to_quad32 (gf128_mul (gf128_of_quad32 a_BE) (gf128_of_quad32 b_BE)) in
reverse_bytes_quad32 ab_BE | {
"checked_file": "/",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.GHash_s.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"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 | h_LE: Vale.Def.Types_s.quad32 -> x: Vale.AES.GHash_s.ghash_plain_LE
-> Prims.Tot Vale.Def.Types_s.quad32 | Prims.Tot | [
"total",
""
] | [] | [
"Vale.Def.Types_s.quad32",
"Vale.AES.GHash_s.ghash_plain_LE",
"Vale.AES.GHash_s.gf128_mul_LE",
"Vale.Def.Types_s.quad32_xor",
"FStar.Seq.Properties.last",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"Vale.Def.Words_s.Mkfour",
"Vale.Def.Types_s.nat32",
"Prims.bool",
"Vale.AES.GHash_s.ghash_LE_def",
"Vale.Lib.Seqs_s.all_but_last"
] | [
"recursion"
] | false | false | false | true | false | let rec ghash_LE_def (h_LE: quad32) (x: ghash_plain_LE) : Tot quad32 (decreases %[length x]) =
| let y_i_minus_1 = (if length x = 1 then Mkfour 0 0 0 0 else ghash_LE_def h_LE (all_but_last x)) in
let x_i = last x in
let xor_LE = quad32_xor y_i_minus_1 x_i in
gf128_mul_LE xor_LE h_LE | false |
HoareSTPolyBind.fst | HoareSTPolyBind.swap | val swap (#a: Type0) (x: array a) (i: nat) (j: nat{i <= j})
: HoareST unit
(fun h -> j < Seq.length (sel h x))
(fun h0 _ h1 ->
j < Seq.length (sel h0 x) /\ modifies (Set.singleton (addr_of x)) h0 h1 /\
sel h1 x == Seq.swap (sel h0 x) i j) | val swap (#a: Type0) (x: array a) (i: nat) (j: nat{i <= j})
: HoareST unit
(fun h -> j < Seq.length (sel h x))
(fun h0 _ h1 ->
j < Seq.length (sel h0 x) /\ modifies (Set.singleton (addr_of x)) h0 h1 /\
sel h1 x == Seq.swap (sel h0 x) i j) | let swap (#a:Type0) (x:array a) (i:nat) (j:nat{i <= j})
: HoareST unit
(fun h -> j < Seq.length (sel h x))
(fun h0 _ h1 ->
j < Seq.length (sel h0 x) /\
modifies (Set.singleton (addr_of x)) h0 h1 /\
sel h1 x == Seq.swap (sel h0 x) i j)
= let v_i = index x i in
let v_j = index x j in
upd x j v_i;
upd x i v_j | {
"file_name": "examples/layeredeffects/HoareSTPolyBind.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 13,
"end_line": 310,
"start_col": 0,
"start_line": 300
} | (*
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 HoareSTPolyBind
open FStar.Heap
open FStar.ST
module P = FStar.Preorder
module ST = FStar.ST
/// ST effect implemented as a layered effect over STATE
///
/// This module uses polymonadic binds to compose HoareST and PURE computations
///
/// See the `copy_aux` function below for some limitations of the polymonadic bind
#set-options "--max_fuel 0 --max_ifuel 0"
type pre_t = heap -> Type0
type post_t (a:Type) = heap -> a -> heap -> Type0
/// It has two indices: one for the precondition and one for the postcondition
///
/// Its encoding in STATE is as expected
type repr (a:Type) (pre:pre_t) (post:post_t a) : Type =
unit -> STATE a (fun p h -> pre h /\ (forall (x:a) (h1:heap). post h x h1 ==> p x h1))
let returnc (a:Type) (x:a)
: repr a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1)
= fun _ -> x
/// bind bakes in the weakening of f's post to compose it with g's pre
let bind (a:Type) (b:Type)
(#pre_f:pre_t) (#post_f:post_t a) (#pre_g:a -> pre_t) (#post_g:a -> post_t b)
(f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x)))
: repr b
(fun h0 -> pre_f h0 /\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1))
(fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\ post_f h0 x h1 /\ post_g x h1 y h2)
= fun _ ->
let x = f () in
g x ()
/// sub comp rule
let subcomp (a:Type)
(#pre_f:pre_t) (#post_f:post_t a)
(#pre_g:pre_t) (#post_g:post_t a)
(f:repr a pre_f post_f)
: Pure (repr a pre_g post_g)
(requires
(forall (h:heap). pre_g h ==> pre_f h) /\
(forall (h0 h1:heap) (x:a). (pre_g h0 /\ post_f h0 x h1) ==> post_g h0 x h1))
(ensures fun _ -> True)
= f
let if_then_else (a:Type)
(#pre_f:pre_t) (#post_f:post_t a)
(#pre_g:pre_t) (#post_g:post_t a)
(f:repr a pre_f post_f)
(g:repr a pre_g post_g)
(p:bool)
: Type
= repr a
(fun h -> (p ==> pre_f h) /\ ((~ p) ==> pre_g h))
(fun h0 r h1 -> (p ==> post_f h0 r h1) /\ ((~ p) ==> post_g h0 r h1))
reflectable
effect {
HoareST (a:Type) (pre:pre_t) (post:post_t a)
with {repr;
return = returnc;
bind;
subcomp;
if_then_else}
}
/// Effect actions from FStar.ST
let recall (#a:Type) (#rel:P.preorder a) (r:mref a rel)
: HoareST unit
(fun _ -> True)
(fun h0 _ h1 ->
h0 == h1 /\
h1 `Heap.contains` r)
= HoareST?.reflect (fun _ -> recall r)
let alloc (#a:Type) (#rel:P.preorder a) (init:a)
: HoareST (mref a rel)
(fun _ -> True)
(fun h0 r h1 ->
fresh r h0 h1 /\
modifies Set.empty h0 h1 /\
sel h1 r == init)
= HoareST?.reflect (fun _ -> alloc init)
let op_Bang (#a:Type) (#rel:P.preorder a) (r:mref a rel)
: HoareST a
(fun _ -> True)
(fun h0 x h1 ->
h0 == h1 /\
x == sel h1 r)
= HoareST?.reflect (fun _ -> read r)
let op_Colon_Equals (#a:Type) (#rel:P.preorder a) (r:mref a rel) (x:a)
: HoareST unit
(fun h -> rel (sel h r) x)
(fun h0 _ h1 ->
modifies (Set.singleton (addr_of r)) h0 h1 /\
equal_dom h0 h1 /\
sel h1 r == x)
= HoareST?.reflect (fun _ -> write r x)
let get ()
: HoareST heap
(fun _ -> True)
(fun h0 h h1 -> h0 == h1 /\ h == h1)
= HoareST?.reflect get
/// We don't define a traditional lift from PURE to HoareST
///
/// But rather we define two polymonadic binds
let bind_pure_hoarest (a:Type) (b:Type) (wp:pure_wp a) (req:a -> pre_t) (ens:a -> post_t b)
(f:unit -> PURE a wp) (g:(x:a -> repr b (req x) (ens x)))
: repr b
(fun h -> wp (fun x -> req x h))
(fun h0 r h1 -> exists x. (~ (wp (fun r -> r =!= x))) /\ ens x h0 r h1)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun _ ->
let x = f () in
g x ()
polymonadic_bind (PURE, HoareST) |> HoareST = bind_pure_hoarest
let bind_hoarest_pure (a:Type) (b:Type) (req:pre_t) (ens:post_t a) (wp:a -> pure_wp b)
(f:repr a req ens) (g:(x:a -> unit -> PURE b (wp x)))
: repr b
(fun h -> req h /\ (forall x h1. ens h x h1 ==> (wp x) (fun _ -> True)))
(fun h0 r h1 -> exists x. ens h0 x h1 /\ (~ ((wp x) (fun y -> y =!= r))))
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall ();
fun _ ->
let x = f () in
(g x) ()
polymonadic_bind (HoareST, PURE) |> HoareST = bind_hoarest_pure
(*
// * PURE a wp <: HoareST a req ens
// *)
let subcomp_pure_hoarest (a:Type) (wp:pure_wp a) (req:pre_t) (ens:post_t a)
(f:unit -> PURE a wp)
: Pure (repr a req ens)
(requires
(forall h. req h ==> wp (fun _ -> True)) /\
(forall h0 r h1. (~ (wp (fun x -> x =!= r \/ h0 =!= h1))) ==> ens h0 r h1))
(ensures fun _ -> True)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall ();
fun _ -> f ()
polymonadic_subcomp PURE <: HoareST = subcomp_pure_hoarest
let test_subcomp () : HoareST int (fun _ -> True) (fun _ r _ -> r == 0) = 0
assume val f_test_subcomp (n:int) : Pure int (n > 0) (fun r -> r > 0)
[@expect_failure]
let test_subcomp2 (n:int) : HoareST int (fun _ -> True) (fun _ _ _ -> True) = f_test_subcomp n
let test_subcomp3 (n:int) : HoareST int (fun _ -> n > 2) (fun _ _ _ -> True) = f_test_subcomp n
assume val f : x:int -> HoareST int (fun _ -> True) (fun _ r _ -> r == x + 1)
let test () : HoareST int (fun _ -> True) (fun _ r _ -> r == 1)
= f 0
open FStar.Monotonic.Pure
assume val g : int -> int -> PURE int (as_pure_wp (fun p -> forall x. p x))
let test2 () : HoareST int (fun _ -> True) (fun _ _ _ -> True)
= g 2 (f 0)
(*
// * In the polymonadic bind (PURE, HoareST) |> HoareST, the return type of
// * g is not allowed to depend on x, the return value of f
// *
// * So then what happens when a function f whose return type depends on its argument
// * is applied to a PURE term
// * NOTE: PURE and not Tot, since Tot will just be substituted,
// * without even invoking the bind
// *
// * When typechecking f e, the comp type is roughly
// * bind C_e C_ret_f, where C_ret_f is the comp type of f (below the arrow binder)
// * This is where bind comes in
// *)
assume type t_int (x:int) : Type0
assume val dep_f (x:int) : HoareST (t_int x) (fun _ -> True) (fun _ _ _ -> True)
assume val pure_g (_:unit) : PURE int (as_pure_wp (fun p -> forall (x:int). x >= 2 ==> p x))
let test_dep_f () : HoareST (t_int (pure_g ())) (fun _ -> True) (fun _ _ _ -> True) =
dep_f (pure_g ())
(*
// * This works!
// *
// * The reason is that, before bind is called, the typechecker has already
// * substituted the pure term (pure_g ()) into the comp type of dep_f
// * (below the binder)
// *)
(*
// * But what happens when this is an explicit let binding?
// * as opposed to a function application
// *)
let test_dep_f2 () : HoareST (t_int (pure_g ())) (fun _ -> True) (fun _ _ _ -> True) =
let x = pure_g () in
dep_f x
(*
// * This also works because weakening the type using the annotation saves us!
// *)
module Seq = FStar.Seq
type array (a:Type0) = ref (Seq.seq a)
let op_At_Bar (#a:Type0) (s1:array a) (s2:array a)
: HoareST (array a)
(fun _ -> True)
(fun h0 r h1 ->
sel h1 r == Seq.append (sel h0 s1) (sel h0 s2) /\
modifies Set.empty h0 h1)
= let s1 = !s1 in
let s2 = !s2 in
alloc (Seq.append s1 s2)
let index (#a:Type0) (x:array a) (i:nat)
: HoareST a
(fun h -> i < Seq.length (sel h x))
(fun h0 v h1 ->
i < Seq.length (sel h0 x) /\
h0 == h1 /\
v == Seq.index (sel h0 x) i)
= let s = !x in
Seq.index s i
let upd (#a:Type0) (x:array a) (i:nat) (v:a)
: HoareST unit
(fun h -> i < Seq.length (sel h x))
(fun h0 _ h1 ->
i < Seq.length (sel h0 x) /\
modifies (Set.singleton (addr_of x)) h0 h1 /\
sel h1 x == Seq.upd (sel h0 x) i v)
= let s = !x in
let s = Seq.upd s i v in
x := s
let length (#a:Type0) (x:array a)
: HoareST nat
(fun _ -> True)
(fun h0 y h1 -> y == Seq.length (sel h0 x) /\ h0 == h1)
= let s = !x in
Seq.length s | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.ST.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Preorder.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "HoareSTPolyBind.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.Preorder",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Heap",
"short_module": null
},
{
"abbrev": 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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: HoareSTPolyBind.array a -> i: Prims.nat -> j: Prims.nat{i <= j}
-> HoareSTPolyBind.HoareST Prims.unit | HoareSTPolyBind.HoareST | [] | [] | [
"HoareSTPolyBind.array",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"HoareSTPolyBind.upd",
"Prims.unit",
"HoareSTPolyBind.index",
"FStar.Monotonic.Heap.heap",
"Prims.op_LessThan",
"FStar.Seq.Base.length",
"FStar.Monotonic.Heap.sel",
"FStar.Seq.Base.seq",
"FStar.Heap.trivial_preorder",
"Prims.l_and",
"FStar.Monotonic.Heap.modifies",
"FStar.Set.singleton",
"FStar.Monotonic.Heap.addr_of",
"Prims.eq2",
"FStar.Seq.Properties.swap"
] | [] | false | true | false | false | false | let swap (#a: Type0) (x: array a) (i: nat) (j: nat{i <= j})
: HoareST unit
(fun h -> j < Seq.length (sel h x))
(fun h0 _ h1 ->
j < Seq.length (sel h0 x) /\ modifies (Set.singleton (addr_of x)) h0 h1 /\
sel h1 x == Seq.swap (sel h0 x) i j) =
| let v_i = index x i in
let v_j = index x j in
upd x j v_i;
upd x i v_j | false |
HoareSTPolyBind.fst | HoareSTPolyBind.test_lift | val test_lift (b: bool) : HoareST int (fun _ -> b == true) (fun h0 x h1 -> h0 == h1 /\ x == 0) | val test_lift (b: bool) : HoareST int (fun _ -> b == true) (fun h0 x h1 -> h0 == h1 /\ x == 0) | let test_lift (b:bool) : HoareST int (fun _ -> b == true) (fun h0 x h1 -> h0 == h1 /\ x == 0)
= match b with
| true -> return 0
| false -> return 1 | {
"file_name": "examples/layeredeffects/HoareSTPolyBind.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 21,
"end_line": 330,
"start_col": 0,
"start_line": 327
} | (*
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 HoareSTPolyBind
open FStar.Heap
open FStar.ST
module P = FStar.Preorder
module ST = FStar.ST
/// ST effect implemented as a layered effect over STATE
///
/// This module uses polymonadic binds to compose HoareST and PURE computations
///
/// See the `copy_aux` function below for some limitations of the polymonadic bind
#set-options "--max_fuel 0 --max_ifuel 0"
type pre_t = heap -> Type0
type post_t (a:Type) = heap -> a -> heap -> Type0
/// It has two indices: one for the precondition and one for the postcondition
///
/// Its encoding in STATE is as expected
type repr (a:Type) (pre:pre_t) (post:post_t a) : Type =
unit -> STATE a (fun p h -> pre h /\ (forall (x:a) (h1:heap). post h x h1 ==> p x h1))
let returnc (a:Type) (x:a)
: repr a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1)
= fun _ -> x
/// bind bakes in the weakening of f's post to compose it with g's pre
let bind (a:Type) (b:Type)
(#pre_f:pre_t) (#post_f:post_t a) (#pre_g:a -> pre_t) (#post_g:a -> post_t b)
(f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x)))
: repr b
(fun h0 -> pre_f h0 /\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1))
(fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\ post_f h0 x h1 /\ post_g x h1 y h2)
= fun _ ->
let x = f () in
g x ()
/// sub comp rule
let subcomp (a:Type)
(#pre_f:pre_t) (#post_f:post_t a)
(#pre_g:pre_t) (#post_g:post_t a)
(f:repr a pre_f post_f)
: Pure (repr a pre_g post_g)
(requires
(forall (h:heap). pre_g h ==> pre_f h) /\
(forall (h0 h1:heap) (x:a). (pre_g h0 /\ post_f h0 x h1) ==> post_g h0 x h1))
(ensures fun _ -> True)
= f
let if_then_else (a:Type)
(#pre_f:pre_t) (#post_f:post_t a)
(#pre_g:pre_t) (#post_g:post_t a)
(f:repr a pre_f post_f)
(g:repr a pre_g post_g)
(p:bool)
: Type
= repr a
(fun h -> (p ==> pre_f h) /\ ((~ p) ==> pre_g h))
(fun h0 r h1 -> (p ==> post_f h0 r h1) /\ ((~ p) ==> post_g h0 r h1))
reflectable
effect {
HoareST (a:Type) (pre:pre_t) (post:post_t a)
with {repr;
return = returnc;
bind;
subcomp;
if_then_else}
}
/// Effect actions from FStar.ST
let recall (#a:Type) (#rel:P.preorder a) (r:mref a rel)
: HoareST unit
(fun _ -> True)
(fun h0 _ h1 ->
h0 == h1 /\
h1 `Heap.contains` r)
= HoareST?.reflect (fun _ -> recall r)
let alloc (#a:Type) (#rel:P.preorder a) (init:a)
: HoareST (mref a rel)
(fun _ -> True)
(fun h0 r h1 ->
fresh r h0 h1 /\
modifies Set.empty h0 h1 /\
sel h1 r == init)
= HoareST?.reflect (fun _ -> alloc init)
let op_Bang (#a:Type) (#rel:P.preorder a) (r:mref a rel)
: HoareST a
(fun _ -> True)
(fun h0 x h1 ->
h0 == h1 /\
x == sel h1 r)
= HoareST?.reflect (fun _ -> read r)
let op_Colon_Equals (#a:Type) (#rel:P.preorder a) (r:mref a rel) (x:a)
: HoareST unit
(fun h -> rel (sel h r) x)
(fun h0 _ h1 ->
modifies (Set.singleton (addr_of r)) h0 h1 /\
equal_dom h0 h1 /\
sel h1 r == x)
= HoareST?.reflect (fun _ -> write r x)
let get ()
: HoareST heap
(fun _ -> True)
(fun h0 h h1 -> h0 == h1 /\ h == h1)
= HoareST?.reflect get
/// We don't define a traditional lift from PURE to HoareST
///
/// But rather we define two polymonadic binds
let bind_pure_hoarest (a:Type) (b:Type) (wp:pure_wp a) (req:a -> pre_t) (ens:a -> post_t b)
(f:unit -> PURE a wp) (g:(x:a -> repr b (req x) (ens x)))
: repr b
(fun h -> wp (fun x -> req x h))
(fun h0 r h1 -> exists x. (~ (wp (fun r -> r =!= x))) /\ ens x h0 r h1)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun _ ->
let x = f () in
g x ()
polymonadic_bind (PURE, HoareST) |> HoareST = bind_pure_hoarest
let bind_hoarest_pure (a:Type) (b:Type) (req:pre_t) (ens:post_t a) (wp:a -> pure_wp b)
(f:repr a req ens) (g:(x:a -> unit -> PURE b (wp x)))
: repr b
(fun h -> req h /\ (forall x h1. ens h x h1 ==> (wp x) (fun _ -> True)))
(fun h0 r h1 -> exists x. ens h0 x h1 /\ (~ ((wp x) (fun y -> y =!= r))))
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall ();
fun _ ->
let x = f () in
(g x) ()
polymonadic_bind (HoareST, PURE) |> HoareST = bind_hoarest_pure
(*
// * PURE a wp <: HoareST a req ens
// *)
let subcomp_pure_hoarest (a:Type) (wp:pure_wp a) (req:pre_t) (ens:post_t a)
(f:unit -> PURE a wp)
: Pure (repr a req ens)
(requires
(forall h. req h ==> wp (fun _ -> True)) /\
(forall h0 r h1. (~ (wp (fun x -> x =!= r \/ h0 =!= h1))) ==> ens h0 r h1))
(ensures fun _ -> True)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall ();
fun _ -> f ()
polymonadic_subcomp PURE <: HoareST = subcomp_pure_hoarest
let test_subcomp () : HoareST int (fun _ -> True) (fun _ r _ -> r == 0) = 0
assume val f_test_subcomp (n:int) : Pure int (n > 0) (fun r -> r > 0)
[@expect_failure]
let test_subcomp2 (n:int) : HoareST int (fun _ -> True) (fun _ _ _ -> True) = f_test_subcomp n
let test_subcomp3 (n:int) : HoareST int (fun _ -> n > 2) (fun _ _ _ -> True) = f_test_subcomp n
assume val f : x:int -> HoareST int (fun _ -> True) (fun _ r _ -> r == x + 1)
let test () : HoareST int (fun _ -> True) (fun _ r _ -> r == 1)
= f 0
open FStar.Monotonic.Pure
assume val g : int -> int -> PURE int (as_pure_wp (fun p -> forall x. p x))
let test2 () : HoareST int (fun _ -> True) (fun _ _ _ -> True)
= g 2 (f 0)
(*
// * In the polymonadic bind (PURE, HoareST) |> HoareST, the return type of
// * g is not allowed to depend on x, the return value of f
// *
// * So then what happens when a function f whose return type depends on its argument
// * is applied to a PURE term
// * NOTE: PURE and not Tot, since Tot will just be substituted,
// * without even invoking the bind
// *
// * When typechecking f e, the comp type is roughly
// * bind C_e C_ret_f, where C_ret_f is the comp type of f (below the arrow binder)
// * This is where bind comes in
// *)
assume type t_int (x:int) : Type0
assume val dep_f (x:int) : HoareST (t_int x) (fun _ -> True) (fun _ _ _ -> True)
assume val pure_g (_:unit) : PURE int (as_pure_wp (fun p -> forall (x:int). x >= 2 ==> p x))
let test_dep_f () : HoareST (t_int (pure_g ())) (fun _ -> True) (fun _ _ _ -> True) =
dep_f (pure_g ())
(*
// * This works!
// *
// * The reason is that, before bind is called, the typechecker has already
// * substituted the pure term (pure_g ()) into the comp type of dep_f
// * (below the binder)
// *)
(*
// * But what happens when this is an explicit let binding?
// * as opposed to a function application
// *)
let test_dep_f2 () : HoareST (t_int (pure_g ())) (fun _ -> True) (fun _ _ _ -> True) =
let x = pure_g () in
dep_f x
(*
// * This also works because weakening the type using the annotation saves us!
// *)
module Seq = FStar.Seq
type array (a:Type0) = ref (Seq.seq a)
let op_At_Bar (#a:Type0) (s1:array a) (s2:array a)
: HoareST (array a)
(fun _ -> True)
(fun h0 r h1 ->
sel h1 r == Seq.append (sel h0 s1) (sel h0 s2) /\
modifies Set.empty h0 h1)
= let s1 = !s1 in
let s2 = !s2 in
alloc (Seq.append s1 s2)
let index (#a:Type0) (x:array a) (i:nat)
: HoareST a
(fun h -> i < Seq.length (sel h x))
(fun h0 v h1 ->
i < Seq.length (sel h0 x) /\
h0 == h1 /\
v == Seq.index (sel h0 x) i)
= let s = !x in
Seq.index s i
let upd (#a:Type0) (x:array a) (i:nat) (v:a)
: HoareST unit
(fun h -> i < Seq.length (sel h x))
(fun h0 _ h1 ->
i < Seq.length (sel h0 x) /\
modifies (Set.singleton (addr_of x)) h0 h1 /\
sel h1 x == Seq.upd (sel h0 x) i v)
= let s = !x in
let s = Seq.upd s i v in
x := s
let length (#a:Type0) (x:array a)
: HoareST nat
(fun _ -> True)
(fun h0 y h1 -> y == Seq.length (sel h0 x) /\ h0 == h1)
= let s = !x in
Seq.length s
let swap (#a:Type0) (x:array a) (i:nat) (j:nat{i <= j})
: HoareST unit
(fun h -> j < Seq.length (sel h x))
(fun h0 _ h1 ->
j < Seq.length (sel h0 x) /\
modifies (Set.singleton (addr_of x)) h0 h1 /\
sel h1 x == Seq.swap (sel h0 x) i j)
= let v_i = index x i in
let v_j = index x j in
upd x j v_i;
upd x i v_j
/// `match` with PURE code in one branch and HoareST in another doesn't work
///
/// Since it requires lifts
///
/// Just writing `admit ()` at the end of a HoareST function also doesn't work for the same reason
/// But we can define a return combinator and use it
let return (#a:Type) (x:a)
: HoareST a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1)
= HoareST?.reflect (returnc a x) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.ST.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Preorder.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "HoareSTPolyBind.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.Preorder",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Heap",
"short_module": null
},
{
"abbrev": 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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | b: Prims.bool -> HoareSTPolyBind.HoareST Prims.int | HoareSTPolyBind.HoareST | [] | [] | [
"Prims.bool",
"HoareSTPolyBind.return",
"Prims.int",
"FStar.Monotonic.Heap.heap",
"Prims.eq2",
"Prims.l_and"
] | [] | false | true | false | false | false | let test_lift (b: bool) : HoareST int (fun _ -> b == true) (fun h0 x h1 -> h0 == h1 /\ x == 0) =
| match b with
| true -> return 0
| false -> return 1 | false |
Hacl.Bignum256_32.fsti | Hacl.Bignum256_32.lbignum | val lbignum : t: Hacl.Bignum.Definitions.limb_t -> len: Lib.IntTypes.size_t -> Type0 | let lbignum = Hacl.Bignum.Definitions.lbignum | {
"file_name": "code/bignum/Hacl.Bignum256_32.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 45,
"end_line": 28,
"start_col": 0,
"start_line": 28
} | module Hacl.Bignum256_32
open FStar.Mul
module BN = Hacl.Bignum
module BS = Hacl.Bignum.SafeAPI
module MA = Hacl.Bignum.MontArithmetic
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let t_limbs: Hacl.Bignum.Definitions.limb_t = Lib.IntTypes.U32
inline_for_extraction noextract
let n_limbs: BN.meta_len t_limbs = 8ul
inline_for_extraction noextract
let n_bytes = n_limbs `FStar.UInt32.mul` 4ul
// A static assert that the number of bytes vs number of blocks matches. This is
// important for bn_to_bytes_be which takes a number of bytes, not a number of
// limbs. (It would be nice to fix this.)
let _ = assert_norm (Hacl.Bignum.Definitions.blocks n_bytes 4ul = n_limbs)
let _ = assert_norm (256ul = Lib.IntTypes.(size (bits t_limbs)) `FStar.UInt32.mul` n_limbs) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Bignum.SafeAPI.fst.checked",
"Hacl.Bignum.MontArithmetic.fsti.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Bignum256_32.fsti"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | t: Hacl.Bignum.Definitions.limb_t -> len: Lib.IntTypes.size_t -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Definitions.lbignum"
] | [] | false | false | false | true | true | let lbignum =
| Hacl.Bignum.Definitions.lbignum | false |
|
HoareSTPolyBind.fst | HoareSTPolyBind.op_At_Bar | val ( @| ) (#a: Type0) (s1 s2: array a)
: HoareST (array a)
(fun _ -> True)
(fun h0 r h1 -> sel h1 r == Seq.append (sel h0 s1) (sel h0 s2) /\ modifies Set.empty h0 h1) | val ( @| ) (#a: Type0) (s1 s2: array a)
: HoareST (array a)
(fun _ -> True)
(fun h0 r h1 -> sel h1 r == Seq.append (sel h0 s1) (sel h0 s2) /\ modifies Set.empty h0 h1) | let op_At_Bar (#a:Type0) (s1:array a) (s2:array a)
: HoareST (array a)
(fun _ -> True)
(fun h0 r h1 ->
sel h1 r == Seq.append (sel h0 s1) (sel h0 s2) /\
modifies Set.empty h0 h1)
= let s1 = !s1 in
let s2 = !s2 in
alloc (Seq.append s1 s2) | {
"file_name": "examples/layeredeffects/HoareSTPolyBind.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 26,
"end_line": 270,
"start_col": 0,
"start_line": 262
} | (*
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 HoareSTPolyBind
open FStar.Heap
open FStar.ST
module P = FStar.Preorder
module ST = FStar.ST
/// ST effect implemented as a layered effect over STATE
///
/// This module uses polymonadic binds to compose HoareST and PURE computations
///
/// See the `copy_aux` function below for some limitations of the polymonadic bind
#set-options "--max_fuel 0 --max_ifuel 0"
type pre_t = heap -> Type0
type post_t (a:Type) = heap -> a -> heap -> Type0
/// It has two indices: one for the precondition and one for the postcondition
///
/// Its encoding in STATE is as expected
type repr (a:Type) (pre:pre_t) (post:post_t a) : Type =
unit -> STATE a (fun p h -> pre h /\ (forall (x:a) (h1:heap). post h x h1 ==> p x h1))
let returnc (a:Type) (x:a)
: repr a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1)
= fun _ -> x
/// bind bakes in the weakening of f's post to compose it with g's pre
let bind (a:Type) (b:Type)
(#pre_f:pre_t) (#post_f:post_t a) (#pre_g:a -> pre_t) (#post_g:a -> post_t b)
(f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x)))
: repr b
(fun h0 -> pre_f h0 /\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1))
(fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\ post_f h0 x h1 /\ post_g x h1 y h2)
= fun _ ->
let x = f () in
g x ()
/// sub comp rule
let subcomp (a:Type)
(#pre_f:pre_t) (#post_f:post_t a)
(#pre_g:pre_t) (#post_g:post_t a)
(f:repr a pre_f post_f)
: Pure (repr a pre_g post_g)
(requires
(forall (h:heap). pre_g h ==> pre_f h) /\
(forall (h0 h1:heap) (x:a). (pre_g h0 /\ post_f h0 x h1) ==> post_g h0 x h1))
(ensures fun _ -> True)
= f
let if_then_else (a:Type)
(#pre_f:pre_t) (#post_f:post_t a)
(#pre_g:pre_t) (#post_g:post_t a)
(f:repr a pre_f post_f)
(g:repr a pre_g post_g)
(p:bool)
: Type
= repr a
(fun h -> (p ==> pre_f h) /\ ((~ p) ==> pre_g h))
(fun h0 r h1 -> (p ==> post_f h0 r h1) /\ ((~ p) ==> post_g h0 r h1))
reflectable
effect {
HoareST (a:Type) (pre:pre_t) (post:post_t a)
with {repr;
return = returnc;
bind;
subcomp;
if_then_else}
}
/// Effect actions from FStar.ST
let recall (#a:Type) (#rel:P.preorder a) (r:mref a rel)
: HoareST unit
(fun _ -> True)
(fun h0 _ h1 ->
h0 == h1 /\
h1 `Heap.contains` r)
= HoareST?.reflect (fun _ -> recall r)
let alloc (#a:Type) (#rel:P.preorder a) (init:a)
: HoareST (mref a rel)
(fun _ -> True)
(fun h0 r h1 ->
fresh r h0 h1 /\
modifies Set.empty h0 h1 /\
sel h1 r == init)
= HoareST?.reflect (fun _ -> alloc init)
let op_Bang (#a:Type) (#rel:P.preorder a) (r:mref a rel)
: HoareST a
(fun _ -> True)
(fun h0 x h1 ->
h0 == h1 /\
x == sel h1 r)
= HoareST?.reflect (fun _ -> read r)
let op_Colon_Equals (#a:Type) (#rel:P.preorder a) (r:mref a rel) (x:a)
: HoareST unit
(fun h -> rel (sel h r) x)
(fun h0 _ h1 ->
modifies (Set.singleton (addr_of r)) h0 h1 /\
equal_dom h0 h1 /\
sel h1 r == x)
= HoareST?.reflect (fun _ -> write r x)
let get ()
: HoareST heap
(fun _ -> True)
(fun h0 h h1 -> h0 == h1 /\ h == h1)
= HoareST?.reflect get
/// We don't define a traditional lift from PURE to HoareST
///
/// But rather we define two polymonadic binds
let bind_pure_hoarest (a:Type) (b:Type) (wp:pure_wp a) (req:a -> pre_t) (ens:a -> post_t b)
(f:unit -> PURE a wp) (g:(x:a -> repr b (req x) (ens x)))
: repr b
(fun h -> wp (fun x -> req x h))
(fun h0 r h1 -> exists x. (~ (wp (fun r -> r =!= x))) /\ ens x h0 r h1)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun _ ->
let x = f () in
g x ()
polymonadic_bind (PURE, HoareST) |> HoareST = bind_pure_hoarest
let bind_hoarest_pure (a:Type) (b:Type) (req:pre_t) (ens:post_t a) (wp:a -> pure_wp b)
(f:repr a req ens) (g:(x:a -> unit -> PURE b (wp x)))
: repr b
(fun h -> req h /\ (forall x h1. ens h x h1 ==> (wp x) (fun _ -> True)))
(fun h0 r h1 -> exists x. ens h0 x h1 /\ (~ ((wp x) (fun y -> y =!= r))))
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall ();
fun _ ->
let x = f () in
(g x) ()
polymonadic_bind (HoareST, PURE) |> HoareST = bind_hoarest_pure
(*
// * PURE a wp <: HoareST a req ens
// *)
let subcomp_pure_hoarest (a:Type) (wp:pure_wp a) (req:pre_t) (ens:post_t a)
(f:unit -> PURE a wp)
: Pure (repr a req ens)
(requires
(forall h. req h ==> wp (fun _ -> True)) /\
(forall h0 r h1. (~ (wp (fun x -> x =!= r \/ h0 =!= h1))) ==> ens h0 r h1))
(ensures fun _ -> True)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall ();
fun _ -> f ()
polymonadic_subcomp PURE <: HoareST = subcomp_pure_hoarest
let test_subcomp () : HoareST int (fun _ -> True) (fun _ r _ -> r == 0) = 0
assume val f_test_subcomp (n:int) : Pure int (n > 0) (fun r -> r > 0)
[@expect_failure]
let test_subcomp2 (n:int) : HoareST int (fun _ -> True) (fun _ _ _ -> True) = f_test_subcomp n
let test_subcomp3 (n:int) : HoareST int (fun _ -> n > 2) (fun _ _ _ -> True) = f_test_subcomp n
assume val f : x:int -> HoareST int (fun _ -> True) (fun _ r _ -> r == x + 1)
let test () : HoareST int (fun _ -> True) (fun _ r _ -> r == 1)
= f 0
open FStar.Monotonic.Pure
assume val g : int -> int -> PURE int (as_pure_wp (fun p -> forall x. p x))
let test2 () : HoareST int (fun _ -> True) (fun _ _ _ -> True)
= g 2 (f 0)
(*
// * In the polymonadic bind (PURE, HoareST) |> HoareST, the return type of
// * g is not allowed to depend on x, the return value of f
// *
// * So then what happens when a function f whose return type depends on its argument
// * is applied to a PURE term
// * NOTE: PURE and not Tot, since Tot will just be substituted,
// * without even invoking the bind
// *
// * When typechecking f e, the comp type is roughly
// * bind C_e C_ret_f, where C_ret_f is the comp type of f (below the arrow binder)
// * This is where bind comes in
// *)
assume type t_int (x:int) : Type0
assume val dep_f (x:int) : HoareST (t_int x) (fun _ -> True) (fun _ _ _ -> True)
assume val pure_g (_:unit) : PURE int (as_pure_wp (fun p -> forall (x:int). x >= 2 ==> p x))
let test_dep_f () : HoareST (t_int (pure_g ())) (fun _ -> True) (fun _ _ _ -> True) =
dep_f (pure_g ())
(*
// * This works!
// *
// * The reason is that, before bind is called, the typechecker has already
// * substituted the pure term (pure_g ()) into the comp type of dep_f
// * (below the binder)
// *)
(*
// * But what happens when this is an explicit let binding?
// * as opposed to a function application
// *)
let test_dep_f2 () : HoareST (t_int (pure_g ())) (fun _ -> True) (fun _ _ _ -> True) =
let x = pure_g () in
dep_f x
(*
// * This also works because weakening the type using the annotation saves us!
// *)
module Seq = FStar.Seq
type array (a:Type0) = ref (Seq.seq a) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.ST.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Preorder.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "HoareSTPolyBind.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.Preorder",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Heap",
"short_module": null
},
{
"abbrev": 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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | s1: HoareSTPolyBind.array a -> s2: HoareSTPolyBind.array a
-> HoareSTPolyBind.HoareST (HoareSTPolyBind.array a) | HoareSTPolyBind.HoareST | [] | [] | [
"HoareSTPolyBind.array",
"HoareSTPolyBind.alloc",
"FStar.Seq.Base.seq",
"FStar.Heap.trivial_preorder",
"FStar.Seq.Base.append",
"FStar.ST.mref",
"HoareSTPolyBind.op_Bang",
"FStar.Monotonic.Heap.heap",
"Prims.l_True",
"Prims.l_and",
"Prims.eq2",
"FStar.Monotonic.Heap.sel",
"FStar.Monotonic.Heap.modifies",
"FStar.Set.empty",
"Prims.nat"
] | [] | false | true | false | false | false | let ( @| ) (#a: Type0) (s1 s2: array a)
: HoareST (array a)
(fun _ -> True)
(fun h0 r h1 -> sel h1 r == Seq.append (sel h0 s1) (sel h0 s2) /\ modifies Set.empty h0 h1) =
| let s1 = !s1 in
let s2 = !s2 in
alloc (Seq.append s1 s2) | false |
Vale.AES.X64.GF128_Init.fst | Vale.AES.X64.GF128_Init.va_quick_ShiftKey1_gf128_power | val va_quick_ShiftKey1_gf128_power (h: poly) (n: nat)
: (va_quickCode unit (va_code_ShiftKey1_gf128_power ())) | val va_quick_ShiftKey1_gf128_power (h: poly) (n: nat)
: (va_quickCode unit (va_code_ShiftKey1_gf128_power ())) | let va_quick_ShiftKey1_gf128_power (h:poly) (n:nat) : (va_quickCode unit
(va_code_ShiftKey1_gf128_power ())) =
(va_QProc (va_code_ShiftKey1_gf128_power ()) ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_reg64 rR12; va_Mod_flags]) (va_wp_ShiftKey1_gf128_power h n)
(va_wpProof_ShiftKey1_gf128_power h n)) | {
"file_name": "obj/Vale.AES.X64.GF128_Init.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 43,
"end_line": 286,
"start_col": 0,
"start_line": 282
} | module Vale.AES.X64.GF128_Init
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.AES_s
open Vale.AES.AES256_helpers
open Vale.AES.X64.AES
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.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.AES.X64.GF128_Mul
open Vale.AES.GHash
open Vale.AES.OptPublic
//-- ShiftKey1_128
val va_code_ShiftKey1_128 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_ShiftKey1_128 () =
(va_Block (va_CCons (va_code_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_CCons
(va_code_ShiftLeft128_1 ()) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5))
(va_CCons (va_code_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 4)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_CNil ())))))))))
val va_codegen_success_ShiftKey1_128 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ShiftKey1_128 () =
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_ShiftLeft128_1 ()) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm
3) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pcmpeqd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3)
255) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4))
(va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_ttrue ()))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ShiftKey1_128 (va_mods:va_mods_t) (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s) in
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 88 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftLeft128_1 h) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 89 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32_mask h1) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 90 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_shift_define_i h 1 128) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 92 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 93 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 94 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_test_high_bit h) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 95 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 96 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_zero ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 97 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_ones ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 100 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 101 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_and_consts ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 102 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_opr128_xmm 3)) (va_QEmpty
(()))))))))))))))))
val va_lemma_ShiftKey1_128 : va_b0:va_code -> va_s0:va_state -> f:poly
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_128 ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127)))
(ensures (fun (va_sM, va_fM) -> 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 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) /\
va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0)))))))
[@"opaque_to_smt"]
let va_lemma_ShiftKey1_128 va_b0 va_s0 f =
let (va_mods:va_mods_t) = [va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok] in
let va_qc = va_qcode_ShiftKey1_128 va_mods f in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftKey1_128 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 68 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
label va_range1
"***** POSTCONDITION NOT MET AT line 85 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h)))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_ShiftKey1_128 (f:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) . let
va_sM = va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_flags
va_x_efl va_s0))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2_s.shift h 1 in let (offset:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) ==> va_k va_sM (())))
val va_wpProof_ShiftKey1_128 : f:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ShiftKey1_128 f va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_ShiftKey1_128 f va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ShiftKey1_128 (va_code_ShiftKey1_128 ()) va_s0 f in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0))))));
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_ShiftKey1_128 (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128 ())) =
(va_QProc (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags])
(va_wp_ShiftKey1_128 f) (va_wpProof_ShiftKey1_128 f))
//--
//-- ShiftKey1_gf128_power
val va_code_ShiftKey1_gf128_power : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_ShiftKey1_gf128_power () =
(va_Block (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm 4)) (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm
5)) (va_CCons (va_code_PinsrdImm (va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12))
(va_CCons (va_code_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_ShiftKey1_128 ()) (va_CNil ()))))))))
val va_codegen_success_ShiftKey1_gf128_power : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ShiftKey1_gf128_power () =
(va_pbool_and (va_codegen_success_ZeroXmm (va_op_xmm_xmm 4)) (va_pbool_and
(va_codegen_success_ZeroXmm (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_PinsrdImm
(va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12))
(va_pbool_and (va_codegen_success_ShiftKey1_128 ()) (va_ttrue ())))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ShiftKey1_gf128_power (va_mods:va_mods_t) (h:poly) (n:nat) : (va_quickCode unit
(va_code_ShiftKey1_gf128_power ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 4)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 120 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 5)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 121 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 123 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12)) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 124 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_high_bit ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 125 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_low_shift_1 ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 127 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_128 gf128_modulus_low_terms) (fun (va_s:va_state) _ -> let
(va_arg16:Prims.nat) = n in let (va_arg15:Vale.Math.Poly2_s.poly) = h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_gf128_power va_arg15 va_arg16) (va_QEmpty (()))))))))))))
val va_lemma_ShiftKey1_gf128_power : va_b0:va_code -> va_s0:va_state -> h:poly -> n:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_gf128_power ()) va_s0 /\ va_get_ok va_s0 /\
(let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
avx_enabled /\ sse_enabled /\ hn == Vale.AES.GHash.g_power h n)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n) /\
va_state_eq 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_reg64 rR12 va_sM (va_update_flags
va_sM (va_update_ok va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_ShiftKey1_gf128_power va_b0 va_s0 h n =
let (va_mods:va_mods_t) = [va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags; va_Mod_ok] in
let va_qc = va_qcode_ShiftKey1_gf128_power va_mods h n in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftKey1_gf128_power ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 105 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ (let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in label va_range1
"***** POSTCONDITION NOT MET AT line 117 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_ShiftKey1_gf128_power (h:poly) (n:nat) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in avx_enabled /\ sse_enabled /\ hn == Vale.AES.GHash.g_power h n) /\
(forall (va_x_efl:Vale.X64.Flags.t) (va_x_r12:nat64) (va_x_xmm1:quad32) (va_x_xmm2:quad32)
(va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) . let va_sM = 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_reg64 rR12 va_x_r12 (va_upd_flags va_x_efl va_s0)))))) in va_get_ok va_sM /\ (let
(hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n) ==>
va_k va_sM (())))
val va_wpProof_ShiftKey1_gf128_power : h:poly -> n:nat -> va_s0:va_state -> va_k:(va_state -> unit
-> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ShiftKey1_gf128_power h n va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftKey1_gf128_power ()) ([va_Mod_xmm
5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_reg64 rR12; va_Mod_flags])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_ShiftKey1_gf128_power h n va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ShiftKey1_gf128_power (va_code_ShiftKey1_gf128_power ()) va_s0 h n
in
va_lemma_upd_update va_sM;
assert (va_state_eq 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_reg64 rR12 va_sM (va_update_flags
va_sM (va_update_ok va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags]) va_sM va_s0;
let va_g = () in
(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.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Words.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.GF128_Mul.fsti.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.OptPublic.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES256_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.GF128_Init.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"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.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"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.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.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.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"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.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"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.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.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.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"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 | h: Vale.Math.Poly2_s.poly -> n: Prims.nat
-> Vale.X64.QuickCode.va_quickCode Prims.unit
(Vale.AES.X64.GF128_Init.va_code_ShiftKey1_gf128_power ()) | Prims.Tot | [
"total"
] | [] | [
"Vale.Math.Poly2_s.poly",
"Prims.nat",
"Vale.X64.QuickCode.va_QProc",
"Prims.unit",
"Vale.AES.X64.GF128_Init.va_code_ShiftKey1_gf128_power",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_xmm",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR12",
"Vale.X64.QuickCode.va_Mod_flags",
"Prims.Nil",
"Vale.AES.X64.GF128_Init.va_wp_ShiftKey1_gf128_power",
"Vale.AES.X64.GF128_Init.va_wpProof_ShiftKey1_gf128_power",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_ShiftKey1_gf128_power (h: poly) (n: nat)
: (va_quickCode unit (va_code_ShiftKey1_gf128_power ())) =
| (va_QProc (va_code_ShiftKey1_gf128_power ())
([
va_Mod_xmm 5;
va_Mod_xmm 4;
va_Mod_xmm 3;
va_Mod_xmm 2;
va_Mod_xmm 1;
va_Mod_reg64 rR12;
va_Mod_flags
])
(va_wp_ShiftKey1_gf128_power h n)
(va_wpProof_ShiftKey1_gf128_power h n)) | false |
HoareSTPolyBind.fst | HoareSTPolyBind.copy_aux | val copy_aux (#a: Type) (s cpy: array a) (ctr: nat)
: HoareST unit
(fun h ->
addr_of s =!= addr_of cpy /\ Seq.length (sel h cpy) == Seq.length (sel h s) /\
ctr <= Seq.length (sel h cpy) /\
(forall (i: nat). i < ctr ==> Seq.index (sel h s) i == Seq.index (sel h cpy) i))
(fun h0 _ h1 -> modifies (only cpy) h0 h1 /\ Seq.equal (sel h1 cpy) (sel h1 s)) | val copy_aux (#a: Type) (s cpy: array a) (ctr: nat)
: HoareST unit
(fun h ->
addr_of s =!= addr_of cpy /\ Seq.length (sel h cpy) == Seq.length (sel h s) /\
ctr <= Seq.length (sel h cpy) /\
(forall (i: nat). i < ctr ==> Seq.index (sel h s) i == Seq.index (sel h cpy) i))
(fun h0 _ h1 -> modifies (only cpy) h0 h1 /\ Seq.equal (sel h1 cpy) (sel h1 s)) | let rec copy_aux
(#a:Type) (s:array a) (cpy:array a) (ctr:nat)
: HoareST unit
(fun h ->
addr_of s =!= addr_of cpy /\
Seq.length (sel h cpy) == Seq.length (sel h s) /\
ctr <= Seq.length (sel h cpy) /\
(forall (i:nat). i < ctr ==> Seq.index (sel h s) i == Seq.index (sel h cpy) i))
(fun h0 _ h1 ->
modifies (only cpy) h0 h1 /\
Seq.equal (sel h1 cpy) (sel h1 s))
= recall s; recall cpy;
let diff = length cpy - ctr in
match diff with
| 0 -> return ()
| _ ->
upd cpy ctr (index s ctr);
copy_aux s cpy (ctr + 1) | {
"file_name": "examples/layeredeffects/HoareSTPolyBind.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 28,
"end_line": 349,
"start_col": 0,
"start_line": 332
} | (*
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 HoareSTPolyBind
open FStar.Heap
open FStar.ST
module P = FStar.Preorder
module ST = FStar.ST
/// ST effect implemented as a layered effect over STATE
///
/// This module uses polymonadic binds to compose HoareST and PURE computations
///
/// See the `copy_aux` function below for some limitations of the polymonadic bind
#set-options "--max_fuel 0 --max_ifuel 0"
type pre_t = heap -> Type0
type post_t (a:Type) = heap -> a -> heap -> Type0
/// It has two indices: one for the precondition and one for the postcondition
///
/// Its encoding in STATE is as expected
type repr (a:Type) (pre:pre_t) (post:post_t a) : Type =
unit -> STATE a (fun p h -> pre h /\ (forall (x:a) (h1:heap). post h x h1 ==> p x h1))
let returnc (a:Type) (x:a)
: repr a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1)
= fun _ -> x
/// bind bakes in the weakening of f's post to compose it with g's pre
let bind (a:Type) (b:Type)
(#pre_f:pre_t) (#post_f:post_t a) (#pre_g:a -> pre_t) (#post_g:a -> post_t b)
(f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x)))
: repr b
(fun h0 -> pre_f h0 /\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1))
(fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\ post_f h0 x h1 /\ post_g x h1 y h2)
= fun _ ->
let x = f () in
g x ()
/// sub comp rule
let subcomp (a:Type)
(#pre_f:pre_t) (#post_f:post_t a)
(#pre_g:pre_t) (#post_g:post_t a)
(f:repr a pre_f post_f)
: Pure (repr a pre_g post_g)
(requires
(forall (h:heap). pre_g h ==> pre_f h) /\
(forall (h0 h1:heap) (x:a). (pre_g h0 /\ post_f h0 x h1) ==> post_g h0 x h1))
(ensures fun _ -> True)
= f
let if_then_else (a:Type)
(#pre_f:pre_t) (#post_f:post_t a)
(#pre_g:pre_t) (#post_g:post_t a)
(f:repr a pre_f post_f)
(g:repr a pre_g post_g)
(p:bool)
: Type
= repr a
(fun h -> (p ==> pre_f h) /\ ((~ p) ==> pre_g h))
(fun h0 r h1 -> (p ==> post_f h0 r h1) /\ ((~ p) ==> post_g h0 r h1))
reflectable
effect {
HoareST (a:Type) (pre:pre_t) (post:post_t a)
with {repr;
return = returnc;
bind;
subcomp;
if_then_else}
}
/// Effect actions from FStar.ST
let recall (#a:Type) (#rel:P.preorder a) (r:mref a rel)
: HoareST unit
(fun _ -> True)
(fun h0 _ h1 ->
h0 == h1 /\
h1 `Heap.contains` r)
= HoareST?.reflect (fun _ -> recall r)
let alloc (#a:Type) (#rel:P.preorder a) (init:a)
: HoareST (mref a rel)
(fun _ -> True)
(fun h0 r h1 ->
fresh r h0 h1 /\
modifies Set.empty h0 h1 /\
sel h1 r == init)
= HoareST?.reflect (fun _ -> alloc init)
let op_Bang (#a:Type) (#rel:P.preorder a) (r:mref a rel)
: HoareST a
(fun _ -> True)
(fun h0 x h1 ->
h0 == h1 /\
x == sel h1 r)
= HoareST?.reflect (fun _ -> read r)
let op_Colon_Equals (#a:Type) (#rel:P.preorder a) (r:mref a rel) (x:a)
: HoareST unit
(fun h -> rel (sel h r) x)
(fun h0 _ h1 ->
modifies (Set.singleton (addr_of r)) h0 h1 /\
equal_dom h0 h1 /\
sel h1 r == x)
= HoareST?.reflect (fun _ -> write r x)
let get ()
: HoareST heap
(fun _ -> True)
(fun h0 h h1 -> h0 == h1 /\ h == h1)
= HoareST?.reflect get
/// We don't define a traditional lift from PURE to HoareST
///
/// But rather we define two polymonadic binds
let bind_pure_hoarest (a:Type) (b:Type) (wp:pure_wp a) (req:a -> pre_t) (ens:a -> post_t b)
(f:unit -> PURE a wp) (g:(x:a -> repr b (req x) (ens x)))
: repr b
(fun h -> wp (fun x -> req x h))
(fun h0 r h1 -> exists x. (~ (wp (fun r -> r =!= x))) /\ ens x h0 r h1)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun _ ->
let x = f () in
g x ()
polymonadic_bind (PURE, HoareST) |> HoareST = bind_pure_hoarest
let bind_hoarest_pure (a:Type) (b:Type) (req:pre_t) (ens:post_t a) (wp:a -> pure_wp b)
(f:repr a req ens) (g:(x:a -> unit -> PURE b (wp x)))
: repr b
(fun h -> req h /\ (forall x h1. ens h x h1 ==> (wp x) (fun _ -> True)))
(fun h0 r h1 -> exists x. ens h0 x h1 /\ (~ ((wp x) (fun y -> y =!= r))))
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall ();
fun _ ->
let x = f () in
(g x) ()
polymonadic_bind (HoareST, PURE) |> HoareST = bind_hoarest_pure
(*
// * PURE a wp <: HoareST a req ens
// *)
let subcomp_pure_hoarest (a:Type) (wp:pure_wp a) (req:pre_t) (ens:post_t a)
(f:unit -> PURE a wp)
: Pure (repr a req ens)
(requires
(forall h. req h ==> wp (fun _ -> True)) /\
(forall h0 r h1. (~ (wp (fun x -> x =!= r \/ h0 =!= h1))) ==> ens h0 r h1))
(ensures fun _ -> True)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall ();
fun _ -> f ()
polymonadic_subcomp PURE <: HoareST = subcomp_pure_hoarest
let test_subcomp () : HoareST int (fun _ -> True) (fun _ r _ -> r == 0) = 0
assume val f_test_subcomp (n:int) : Pure int (n > 0) (fun r -> r > 0)
[@expect_failure]
let test_subcomp2 (n:int) : HoareST int (fun _ -> True) (fun _ _ _ -> True) = f_test_subcomp n
let test_subcomp3 (n:int) : HoareST int (fun _ -> n > 2) (fun _ _ _ -> True) = f_test_subcomp n
assume val f : x:int -> HoareST int (fun _ -> True) (fun _ r _ -> r == x + 1)
let test () : HoareST int (fun _ -> True) (fun _ r _ -> r == 1)
= f 0
open FStar.Monotonic.Pure
assume val g : int -> int -> PURE int (as_pure_wp (fun p -> forall x. p x))
let test2 () : HoareST int (fun _ -> True) (fun _ _ _ -> True)
= g 2 (f 0)
(*
// * In the polymonadic bind (PURE, HoareST) |> HoareST, the return type of
// * g is not allowed to depend on x, the return value of f
// *
// * So then what happens when a function f whose return type depends on its argument
// * is applied to a PURE term
// * NOTE: PURE and not Tot, since Tot will just be substituted,
// * without even invoking the bind
// *
// * When typechecking f e, the comp type is roughly
// * bind C_e C_ret_f, where C_ret_f is the comp type of f (below the arrow binder)
// * This is where bind comes in
// *)
assume type t_int (x:int) : Type0
assume val dep_f (x:int) : HoareST (t_int x) (fun _ -> True) (fun _ _ _ -> True)
assume val pure_g (_:unit) : PURE int (as_pure_wp (fun p -> forall (x:int). x >= 2 ==> p x))
let test_dep_f () : HoareST (t_int (pure_g ())) (fun _ -> True) (fun _ _ _ -> True) =
dep_f (pure_g ())
(*
// * This works!
// *
// * The reason is that, before bind is called, the typechecker has already
// * substituted the pure term (pure_g ()) into the comp type of dep_f
// * (below the binder)
// *)
(*
// * But what happens when this is an explicit let binding?
// * as opposed to a function application
// *)
let test_dep_f2 () : HoareST (t_int (pure_g ())) (fun _ -> True) (fun _ _ _ -> True) =
let x = pure_g () in
dep_f x
(*
// * This also works because weakening the type using the annotation saves us!
// *)
module Seq = FStar.Seq
type array (a:Type0) = ref (Seq.seq a)
let op_At_Bar (#a:Type0) (s1:array a) (s2:array a)
: HoareST (array a)
(fun _ -> True)
(fun h0 r h1 ->
sel h1 r == Seq.append (sel h0 s1) (sel h0 s2) /\
modifies Set.empty h0 h1)
= let s1 = !s1 in
let s2 = !s2 in
alloc (Seq.append s1 s2)
let index (#a:Type0) (x:array a) (i:nat)
: HoareST a
(fun h -> i < Seq.length (sel h x))
(fun h0 v h1 ->
i < Seq.length (sel h0 x) /\
h0 == h1 /\
v == Seq.index (sel h0 x) i)
= let s = !x in
Seq.index s i
let upd (#a:Type0) (x:array a) (i:nat) (v:a)
: HoareST unit
(fun h -> i < Seq.length (sel h x))
(fun h0 _ h1 ->
i < Seq.length (sel h0 x) /\
modifies (Set.singleton (addr_of x)) h0 h1 /\
sel h1 x == Seq.upd (sel h0 x) i v)
= let s = !x in
let s = Seq.upd s i v in
x := s
let length (#a:Type0) (x:array a)
: HoareST nat
(fun _ -> True)
(fun h0 y h1 -> y == Seq.length (sel h0 x) /\ h0 == h1)
= let s = !x in
Seq.length s
let swap (#a:Type0) (x:array a) (i:nat) (j:nat{i <= j})
: HoareST unit
(fun h -> j < Seq.length (sel h x))
(fun h0 _ h1 ->
j < Seq.length (sel h0 x) /\
modifies (Set.singleton (addr_of x)) h0 h1 /\
sel h1 x == Seq.swap (sel h0 x) i j)
= let v_i = index x i in
let v_j = index x j in
upd x j v_i;
upd x i v_j
/// `match` with PURE code in one branch and HoareST in another doesn't work
///
/// Since it requires lifts
///
/// Just writing `admit ()` at the end of a HoareST function also doesn't work for the same reason
/// But we can define a return combinator and use it
let return (#a:Type) (x:a)
: HoareST a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1)
= HoareST?.reflect (returnc a x)
let test_lift (b:bool) : HoareST int (fun _ -> b == true) (fun h0 x h1 -> h0 == h1 /\ x == 0)
= match b with
| true -> return 0
| false -> return 1 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.ST.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Preorder.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "HoareSTPolyBind.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.Preorder",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Heap",
"short_module": null
},
{
"abbrev": 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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | s: HoareSTPolyBind.array a -> cpy: HoareSTPolyBind.array a -> ctr: Prims.nat
-> HoareSTPolyBind.HoareST Prims.unit | HoareSTPolyBind.HoareST | [] | [] | [
"HoareSTPolyBind.array",
"Prims.nat",
"HoareSTPolyBind.return",
"Prims.unit",
"Prims.int",
"HoareSTPolyBind.copy_aux",
"Prims.op_Addition",
"HoareSTPolyBind.upd",
"HoareSTPolyBind.index",
"Prims.op_Subtraction",
"HoareSTPolyBind.length",
"HoareSTPolyBind.recall",
"FStar.Seq.Base.seq",
"FStar.Heap.trivial_preorder",
"FStar.Monotonic.Heap.heap",
"Prims.l_and",
"Prims.l_not",
"Prims.eq2",
"Prims.pos",
"FStar.Monotonic.Heap.addr_of",
"FStar.Seq.Base.length",
"FStar.Monotonic.Heap.sel",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.op_LessThan",
"FStar.Seq.Base.index",
"FStar.Monotonic.Heap.modifies",
"FStar.Monotonic.Heap.only",
"FStar.Seq.Base.equal"
] | [
"recursion"
] | false | true | false | false | false | let rec copy_aux (#a: Type) (s cpy: array a) (ctr: nat)
: HoareST unit
(fun h ->
addr_of s =!= addr_of cpy /\ Seq.length (sel h cpy) == Seq.length (sel h s) /\
ctr <= Seq.length (sel h cpy) /\
(forall (i: nat). i < ctr ==> Seq.index (sel h s) i == Seq.index (sel h cpy) i))
(fun h0 _ h1 -> modifies (only cpy) h0 h1 /\ Seq.equal (sel h1 cpy) (sel h1 s)) =
| recall s;
recall cpy;
let diff = length cpy - ctr in
match diff with
| 0 -> return ()
| _ ->
upd cpy ctr (index s ctr);
copy_aux s cpy (ctr + 1) | false |
HoareSTPolyBind.fst | HoareSTPolyBind.copy | val copy (#a: Type0) (s: array a)
: HoareST (array a)
(fun h -> Seq.length (sel h s) > 0)
(fun h0 r h1 ->
modifies Set.empty h0 h1 /\ r `unused_in` h0 /\ contains h1 r /\ sel h1 r == sel h0 s) | val copy (#a: Type0) (s: array a)
: HoareST (array a)
(fun h -> Seq.length (sel h s) > 0)
(fun h0 r h1 ->
modifies Set.empty h0 h1 /\ r `unused_in` h0 /\ contains h1 r /\ sel h1 r == sel h0 s) | let copy (#a:Type0) (s:array a)
: HoareST (array a)
(fun h -> Seq.length (sel h s) > 0)
(fun h0 r h1 ->
modifies Set.empty h0 h1 /\
r `unused_in` h0 /\
contains h1 r /\
sel h1 r == sel h0 s)
= recall s;
let cpy = alloc (Seq.create (length s) (index s 0)) in
copy_aux s cpy 0;
cpy | {
"file_name": "examples/layeredeffects/HoareSTPolyBind.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 5,
"end_line": 362,
"start_col": 0,
"start_line": 351
} | (*
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 HoareSTPolyBind
open FStar.Heap
open FStar.ST
module P = FStar.Preorder
module ST = FStar.ST
/// ST effect implemented as a layered effect over STATE
///
/// This module uses polymonadic binds to compose HoareST and PURE computations
///
/// See the `copy_aux` function below for some limitations of the polymonadic bind
#set-options "--max_fuel 0 --max_ifuel 0"
type pre_t = heap -> Type0
type post_t (a:Type) = heap -> a -> heap -> Type0
/// It has two indices: one for the precondition and one for the postcondition
///
/// Its encoding in STATE is as expected
type repr (a:Type) (pre:pre_t) (post:post_t a) : Type =
unit -> STATE a (fun p h -> pre h /\ (forall (x:a) (h1:heap). post h x h1 ==> p x h1))
let returnc (a:Type) (x:a)
: repr a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1)
= fun _ -> x
/// bind bakes in the weakening of f's post to compose it with g's pre
let bind (a:Type) (b:Type)
(#pre_f:pre_t) (#post_f:post_t a) (#pre_g:a -> pre_t) (#post_g:a -> post_t b)
(f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x)))
: repr b
(fun h0 -> pre_f h0 /\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1))
(fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\ post_f h0 x h1 /\ post_g x h1 y h2)
= fun _ ->
let x = f () in
g x ()
/// sub comp rule
let subcomp (a:Type)
(#pre_f:pre_t) (#post_f:post_t a)
(#pre_g:pre_t) (#post_g:post_t a)
(f:repr a pre_f post_f)
: Pure (repr a pre_g post_g)
(requires
(forall (h:heap). pre_g h ==> pre_f h) /\
(forall (h0 h1:heap) (x:a). (pre_g h0 /\ post_f h0 x h1) ==> post_g h0 x h1))
(ensures fun _ -> True)
= f
let if_then_else (a:Type)
(#pre_f:pre_t) (#post_f:post_t a)
(#pre_g:pre_t) (#post_g:post_t a)
(f:repr a pre_f post_f)
(g:repr a pre_g post_g)
(p:bool)
: Type
= repr a
(fun h -> (p ==> pre_f h) /\ ((~ p) ==> pre_g h))
(fun h0 r h1 -> (p ==> post_f h0 r h1) /\ ((~ p) ==> post_g h0 r h1))
reflectable
effect {
HoareST (a:Type) (pre:pre_t) (post:post_t a)
with {repr;
return = returnc;
bind;
subcomp;
if_then_else}
}
/// Effect actions from FStar.ST
let recall (#a:Type) (#rel:P.preorder a) (r:mref a rel)
: HoareST unit
(fun _ -> True)
(fun h0 _ h1 ->
h0 == h1 /\
h1 `Heap.contains` r)
= HoareST?.reflect (fun _ -> recall r)
let alloc (#a:Type) (#rel:P.preorder a) (init:a)
: HoareST (mref a rel)
(fun _ -> True)
(fun h0 r h1 ->
fresh r h0 h1 /\
modifies Set.empty h0 h1 /\
sel h1 r == init)
= HoareST?.reflect (fun _ -> alloc init)
let op_Bang (#a:Type) (#rel:P.preorder a) (r:mref a rel)
: HoareST a
(fun _ -> True)
(fun h0 x h1 ->
h0 == h1 /\
x == sel h1 r)
= HoareST?.reflect (fun _ -> read r)
let op_Colon_Equals (#a:Type) (#rel:P.preorder a) (r:mref a rel) (x:a)
: HoareST unit
(fun h -> rel (sel h r) x)
(fun h0 _ h1 ->
modifies (Set.singleton (addr_of r)) h0 h1 /\
equal_dom h0 h1 /\
sel h1 r == x)
= HoareST?.reflect (fun _ -> write r x)
let get ()
: HoareST heap
(fun _ -> True)
(fun h0 h h1 -> h0 == h1 /\ h == h1)
= HoareST?.reflect get
/// We don't define a traditional lift from PURE to HoareST
///
/// But rather we define two polymonadic binds
let bind_pure_hoarest (a:Type) (b:Type) (wp:pure_wp a) (req:a -> pre_t) (ens:a -> post_t b)
(f:unit -> PURE a wp) (g:(x:a -> repr b (req x) (ens x)))
: repr b
(fun h -> wp (fun x -> req x h))
(fun h0 r h1 -> exists x. (~ (wp (fun r -> r =!= x))) /\ ens x h0 r h1)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;
fun _ ->
let x = f () in
g x ()
polymonadic_bind (PURE, HoareST) |> HoareST = bind_pure_hoarest
let bind_hoarest_pure (a:Type) (b:Type) (req:pre_t) (ens:post_t a) (wp:a -> pure_wp b)
(f:repr a req ens) (g:(x:a -> unit -> PURE b (wp x)))
: repr b
(fun h -> req h /\ (forall x h1. ens h x h1 ==> (wp x) (fun _ -> True)))
(fun h0 r h1 -> exists x. ens h0 x h1 /\ (~ ((wp x) (fun y -> y =!= r))))
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall ();
fun _ ->
let x = f () in
(g x) ()
polymonadic_bind (HoareST, PURE) |> HoareST = bind_hoarest_pure
(*
// * PURE a wp <: HoareST a req ens
// *)
let subcomp_pure_hoarest (a:Type) (wp:pure_wp a) (req:pre_t) (ens:post_t a)
(f:unit -> PURE a wp)
: Pure (repr a req ens)
(requires
(forall h. req h ==> wp (fun _ -> True)) /\
(forall h0 r h1. (~ (wp (fun x -> x =!= r \/ h0 =!= h1))) ==> ens h0 r h1))
(ensures fun _ -> True)
= FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall ();
fun _ -> f ()
polymonadic_subcomp PURE <: HoareST = subcomp_pure_hoarest
let test_subcomp () : HoareST int (fun _ -> True) (fun _ r _ -> r == 0) = 0
assume val f_test_subcomp (n:int) : Pure int (n > 0) (fun r -> r > 0)
[@expect_failure]
let test_subcomp2 (n:int) : HoareST int (fun _ -> True) (fun _ _ _ -> True) = f_test_subcomp n
let test_subcomp3 (n:int) : HoareST int (fun _ -> n > 2) (fun _ _ _ -> True) = f_test_subcomp n
assume val f : x:int -> HoareST int (fun _ -> True) (fun _ r _ -> r == x + 1)
let test () : HoareST int (fun _ -> True) (fun _ r _ -> r == 1)
= f 0
open FStar.Monotonic.Pure
assume val g : int -> int -> PURE int (as_pure_wp (fun p -> forall x. p x))
let test2 () : HoareST int (fun _ -> True) (fun _ _ _ -> True)
= g 2 (f 0)
(*
// * In the polymonadic bind (PURE, HoareST) |> HoareST, the return type of
// * g is not allowed to depend on x, the return value of f
// *
// * So then what happens when a function f whose return type depends on its argument
// * is applied to a PURE term
// * NOTE: PURE and not Tot, since Tot will just be substituted,
// * without even invoking the bind
// *
// * When typechecking f e, the comp type is roughly
// * bind C_e C_ret_f, where C_ret_f is the comp type of f (below the arrow binder)
// * This is where bind comes in
// *)
assume type t_int (x:int) : Type0
assume val dep_f (x:int) : HoareST (t_int x) (fun _ -> True) (fun _ _ _ -> True)
assume val pure_g (_:unit) : PURE int (as_pure_wp (fun p -> forall (x:int). x >= 2 ==> p x))
let test_dep_f () : HoareST (t_int (pure_g ())) (fun _ -> True) (fun _ _ _ -> True) =
dep_f (pure_g ())
(*
// * This works!
// *
// * The reason is that, before bind is called, the typechecker has already
// * substituted the pure term (pure_g ()) into the comp type of dep_f
// * (below the binder)
// *)
(*
// * But what happens when this is an explicit let binding?
// * as opposed to a function application
// *)
let test_dep_f2 () : HoareST (t_int (pure_g ())) (fun _ -> True) (fun _ _ _ -> True) =
let x = pure_g () in
dep_f x
(*
// * This also works because weakening the type using the annotation saves us!
// *)
module Seq = FStar.Seq
type array (a:Type0) = ref (Seq.seq a)
let op_At_Bar (#a:Type0) (s1:array a) (s2:array a)
: HoareST (array a)
(fun _ -> True)
(fun h0 r h1 ->
sel h1 r == Seq.append (sel h0 s1) (sel h0 s2) /\
modifies Set.empty h0 h1)
= let s1 = !s1 in
let s2 = !s2 in
alloc (Seq.append s1 s2)
let index (#a:Type0) (x:array a) (i:nat)
: HoareST a
(fun h -> i < Seq.length (sel h x))
(fun h0 v h1 ->
i < Seq.length (sel h0 x) /\
h0 == h1 /\
v == Seq.index (sel h0 x) i)
= let s = !x in
Seq.index s i
let upd (#a:Type0) (x:array a) (i:nat) (v:a)
: HoareST unit
(fun h -> i < Seq.length (sel h x))
(fun h0 _ h1 ->
i < Seq.length (sel h0 x) /\
modifies (Set.singleton (addr_of x)) h0 h1 /\
sel h1 x == Seq.upd (sel h0 x) i v)
= let s = !x in
let s = Seq.upd s i v in
x := s
let length (#a:Type0) (x:array a)
: HoareST nat
(fun _ -> True)
(fun h0 y h1 -> y == Seq.length (sel h0 x) /\ h0 == h1)
= let s = !x in
Seq.length s
let swap (#a:Type0) (x:array a) (i:nat) (j:nat{i <= j})
: HoareST unit
(fun h -> j < Seq.length (sel h x))
(fun h0 _ h1 ->
j < Seq.length (sel h0 x) /\
modifies (Set.singleton (addr_of x)) h0 h1 /\
sel h1 x == Seq.swap (sel h0 x) i j)
= let v_i = index x i in
let v_j = index x j in
upd x j v_i;
upd x i v_j
/// `match` with PURE code in one branch and HoareST in another doesn't work
///
/// Since it requires lifts
///
/// Just writing `admit ()` at the end of a HoareST function also doesn't work for the same reason
/// But we can define a return combinator and use it
let return (#a:Type) (x:a)
: HoareST a (fun _ -> True) (fun h0 r h1 -> r == x /\ h0 == h1)
= HoareST?.reflect (returnc a x)
let test_lift (b:bool) : HoareST int (fun _ -> b == true) (fun h0 x h1 -> h0 == h1 /\ x == 0)
= match b with
| true -> return 0
| false -> return 1
let rec copy_aux
(#a:Type) (s:array a) (cpy:array a) (ctr:nat)
: HoareST unit
(fun h ->
addr_of s =!= addr_of cpy /\
Seq.length (sel h cpy) == Seq.length (sel h s) /\
ctr <= Seq.length (sel h cpy) /\
(forall (i:nat). i < ctr ==> Seq.index (sel h s) i == Seq.index (sel h cpy) i))
(fun h0 _ h1 ->
modifies (only cpy) h0 h1 /\
Seq.equal (sel h1 cpy) (sel h1 s))
= recall s; recall cpy;
let diff = length cpy - ctr in
match diff with
| 0 -> return ()
| _ ->
upd cpy ctr (index s ctr);
copy_aux s cpy (ctr + 1) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.ST.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Preorder.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "HoareSTPolyBind.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.Preorder",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Heap",
"short_module": null
},
{
"abbrev": 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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | s: HoareSTPolyBind.array a -> HoareSTPolyBind.HoareST (HoareSTPolyBind.array a) | HoareSTPolyBind.HoareST | [] | [] | [
"HoareSTPolyBind.array",
"Prims.unit",
"HoareSTPolyBind.copy_aux",
"FStar.ST.mref",
"FStar.Seq.Base.seq",
"FStar.Heap.trivial_preorder",
"HoareSTPolyBind.alloc",
"FStar.Seq.Base.create",
"HoareSTPolyBind.index",
"Prims.nat",
"HoareSTPolyBind.length",
"HoareSTPolyBind.recall",
"FStar.Monotonic.Heap.heap",
"Prims.b2t",
"Prims.op_GreaterThan",
"FStar.Seq.Base.length",
"FStar.Monotonic.Heap.sel",
"Prims.l_and",
"FStar.Monotonic.Heap.modifies",
"FStar.Set.empty",
"FStar.Monotonic.Heap.unused_in",
"FStar.Monotonic.Heap.contains",
"Prims.eq2"
] | [] | false | true | false | false | false | let copy (#a: Type0) (s: array a)
: HoareST (array a)
(fun h -> Seq.length (sel h s) > 0)
(fun h0 r h1 ->
modifies Set.empty h0 h1 /\ r `unused_in` h0 /\ contains h1 r /\ sel h1 r == sel h0 s) =
| recall s;
let cpy = alloc (Seq.create (length s) (index s 0)) in
copy_aux s cpy 0;
cpy | false |
Vale.AES.GHash_s.fst | Vale.AES.GHash_s.ghash_LE_reveal | val ghash_LE_reveal : _: Prims.unit
-> FStar.Pervasives.Lemma (ensures Vale.AES.GHash_s.ghash_LE == Vale.AES.GHash_s.ghash_LE_def) | let ghash_LE_reveal = opaque_revealer (`%ghash_LE) ghash_LE ghash_LE_def | {
"file_name": "vale/specs/crypto/Vale.AES.GHash_s.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 84,
"end_line": 29,
"start_col": 12,
"start_line": 29
} | module Vale.AES.GHash_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open Vale.AES.GF128_s
open Vale.Lib.Seqs_s
open FStar.Mul
open FStar.Seq
type ghash_plain_LE:eqtype = s:seq quad32 { length s > 0 }
let gf128_mul_LE (a_LE b_LE:quad32) : quad32 =
let a_BE = reverse_bytes_quad32 a_LE in
let b_BE = reverse_bytes_quad32 b_LE in
let ab_BE = gf128_to_quad32 (gf128_mul (gf128_of_quad32 a_BE) (gf128_of_quad32 b_BE)) in
reverse_bytes_quad32 ab_BE
let rec ghash_LE_def (h_LE:quad32) (x:ghash_plain_LE) : Tot quad32 (decreases %[length x]) =
let y_i_minus_1 =
(if length x = 1 then
Mkfour 0 0 0 0
else
ghash_LE_def h_LE (all_but_last x)) in
let x_i = last x in
let xor_LE = quad32_xor y_i_minus_1 x_i in
gf128_mul_LE xor_LE h_LE | {
"checked_file": "/",
"dependencies": [
"Vale.Lib.Seqs_s.fst.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.GHash_s.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Seqs_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"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 | _: Prims.unit
-> FStar.Pervasives.Lemma (ensures Vale.AES.GHash_s.ghash_LE == Vale.AES.GHash_s.ghash_LE_def) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Vale.Def.Opaque_s.opaque_revealer",
"Vale.Def.Types_s.quad32",
"Vale.AES.GHash_s.ghash_plain_LE",
"Vale.AES.GHash_s.ghash_LE",
"Vale.AES.GHash_s.ghash_LE_def"
] | [] | true | false | true | false | false | let ghash_LE_reveal =
| opaque_revealer (`%ghash_LE) ghash_LE ghash_LE_def | false |
|
Vale.AES.X64.GF128_Init.fst | Vale.AES.X64.GF128_Init.va_wpProof_ShiftKey1_128 | val va_wpProof_ShiftKey1_128 : f:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ShiftKey1_128 f va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g)))) | val va_wpProof_ShiftKey1_128 : f:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ShiftKey1_128 f va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g)))) | let va_wpProof_ShiftKey1_128 f va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ShiftKey1_128 (va_code_ShiftKey1_128 ()) va_s0 f in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0))))));
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | {
"file_name": "obj/Vale.AES.X64.GF128_Init.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 22,
"end_line": 162,
"start_col": 0,
"start_line": 155
} | module Vale.AES.X64.GF128_Init
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.AES_s
open Vale.AES.AES256_helpers
open Vale.AES.X64.AES
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.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.AES.X64.GF128_Mul
open Vale.AES.GHash
open Vale.AES.OptPublic
//-- ShiftKey1_128
val va_code_ShiftKey1_128 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_ShiftKey1_128 () =
(va_Block (va_CCons (va_code_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_CCons
(va_code_ShiftLeft128_1 ()) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5))
(va_CCons (va_code_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 4)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_CNil ())))))))))
val va_codegen_success_ShiftKey1_128 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ShiftKey1_128 () =
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_ShiftLeft128_1 ()) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm
3) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pcmpeqd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3)
255) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4))
(va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_ttrue ()))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ShiftKey1_128 (va_mods:va_mods_t) (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s) in
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 88 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftLeft128_1 h) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 89 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32_mask h1) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 90 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_shift_define_i h 1 128) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 92 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 93 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 94 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_test_high_bit h) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 95 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 96 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_zero ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 97 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_ones ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 100 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 101 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_and_consts ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 102 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_opr128_xmm 3)) (va_QEmpty
(()))))))))))))))))
val va_lemma_ShiftKey1_128 : va_b0:va_code -> va_s0:va_state -> f:poly
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_128 ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127)))
(ensures (fun (va_sM, va_fM) -> 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 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) /\
va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0)))))))
[@"opaque_to_smt"]
let va_lemma_ShiftKey1_128 va_b0 va_s0 f =
let (va_mods:va_mods_t) = [va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok] in
let va_qc = va_qcode_ShiftKey1_128 va_mods f in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftKey1_128 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 68 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
label va_range1
"***** POSTCONDITION NOT MET AT line 85 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h)))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_ShiftKey1_128 (f:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) . let
va_sM = va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_flags
va_x_efl va_s0))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2_s.shift h 1 in let (offset:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) ==> va_k va_sM (())))
val va_wpProof_ShiftKey1_128 : f:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ShiftKey1_128 f va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) 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.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Words.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.GF128_Mul.fsti.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.OptPublic.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES256_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.GF128_Init.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"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.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"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.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.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.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"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.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"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.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.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.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"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 |
f: Vale.Math.Poly2_s.poly ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Prims.Ghost ((Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) * Prims.unit) | Prims.Ghost | [] | [] | [
"Vale.Math.Poly2_s.poly",
"Vale.X64.Decls.va_state",
"Prims.unit",
"Vale.X64.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple3",
"Vale.X64.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_xmm",
"Vale.X64.QuickCode.va_Mod_flags",
"Prims.Nil",
"Prims._assert",
"Vale.X64.Decls.va_state_eq",
"Vale.X64.Decls.va_update_xmm",
"Vale.X64.Decls.va_update_flags",
"Vale.X64.Decls.va_update_ok",
"Vale.X64.Decls.va_lemma_upd_update",
"FStar.Pervasives.Native.tuple3",
"FStar.Pervasives.Native.tuple2",
"Vale.X64.State.vale_state",
"Vale.AES.X64.GF128_Init.va_lemma_ShiftKey1_128",
"Vale.AES.X64.GF128_Init.va_code_ShiftKey1_128"
] | [] | false | false | false | false | false | let va_wpProof_ShiftKey1_128 f va_s0 va_k =
| let va_sM, va_f0 = va_lemma_ShiftKey1_128 (va_code_ShiftKey1_128 ()) va_s0 f in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM
(va_update_xmm 3
va_sM
(va_update_xmm 2
va_sM
(va_update_xmm 1 va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))));
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | false |
Vale.AES.X64.GF128_Init.fst | Vale.AES.X64.GF128_Init.va_lemma_ShiftKey1_128 | val va_lemma_ShiftKey1_128 : va_b0:va_code -> va_s0:va_state -> f:poly
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_128 ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127)))
(ensures (fun (va_sM, va_fM) -> 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 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) /\
va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0))))))) | val va_lemma_ShiftKey1_128 : va_b0:va_code -> va_s0:va_state -> f:poly
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_128 ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127)))
(ensures (fun (va_sM, va_fM) -> 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 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) /\
va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0))))))) | let va_lemma_ShiftKey1_128 va_b0 va_s0 f =
let (va_mods:va_mods_t) = [va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok] in
let va_qc = va_qcode_ShiftKey1_128 va_mods f in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftKey1_128 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 68 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
label va_range1
"***** POSTCONDITION NOT MET AT line 85 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h)))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM) | {
"file_name": "obj/Vale.AES.X64.GF128_Init.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 16,
"end_line": 130,
"start_col": 0,
"start_line": 114
} | module Vale.AES.X64.GF128_Init
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.AES_s
open Vale.AES.AES256_helpers
open Vale.AES.X64.AES
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.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.AES.X64.GF128_Mul
open Vale.AES.GHash
open Vale.AES.OptPublic
//-- ShiftKey1_128
val va_code_ShiftKey1_128 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_ShiftKey1_128 () =
(va_Block (va_CCons (va_code_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_CCons
(va_code_ShiftLeft128_1 ()) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5))
(va_CCons (va_code_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 4)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_CNil ())))))))))
val va_codegen_success_ShiftKey1_128 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ShiftKey1_128 () =
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_ShiftLeft128_1 ()) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm
3) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pcmpeqd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3)
255) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4))
(va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_ttrue ()))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ShiftKey1_128 (va_mods:va_mods_t) (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s) in
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 88 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftLeft128_1 h) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 89 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32_mask h1) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 90 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_shift_define_i h 1 128) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 92 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 93 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 94 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_test_high_bit h) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 95 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 96 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_zero ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 97 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_ones ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 100 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 101 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_and_consts ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 102 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_opr128_xmm 3)) (va_QEmpty
(()))))))))))))))))
val va_lemma_ShiftKey1_128 : va_b0:va_code -> va_s0:va_state -> f:poly
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_128 ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127)))
(ensures (fun (va_sM, va_fM) -> 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 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) /\
va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok 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.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Words.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.GF128_Mul.fsti.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.OptPublic.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES256_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.GF128_Init.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"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.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"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.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.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.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"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.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"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.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.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.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"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 | va_b0: Vale.X64.Decls.va_code -> va_s0: Vale.X64.Decls.va_state -> f: Vale.Math.Poly2_s.poly
-> Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) | Prims.Ghost | [] | [] | [
"Vale.X64.Decls.va_code",
"Vale.X64.Decls.va_state",
"Vale.Math.Poly2_s.poly",
"Vale.X64.QuickCodes.fuel",
"Prims.unit",
"FStar.Pervasives.Native.Mktuple2",
"Vale.X64.Decls.va_fuel",
"Vale.X64.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_xmm",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_ok",
"Prims.Nil",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.list",
"Vale.X64.QuickCode.__proj__QProc__item__mods",
"Vale.AES.X64.GF128_Init.va_code_ShiftKey1_128",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.tuple3",
"Vale.X64.State.vale_state",
"Vale.X64.QuickCodes.va_wp_sound_code_norm",
"Prims.l_and",
"Vale.X64.QuickCodes.label",
"Vale.X64.QuickCodes.va_range1",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Vale.X64.Decls.va_get_xmm",
"Vale.AES.GF128.shift_key_1",
"Vale.Math.Poly2_s.shift",
"Vale.X64.QuickCode.quickCode",
"Vale.AES.X64.GF128_Init.va_qcode_ShiftKey1_128"
] | [] | false | false | false | false | false | let va_lemma_ShiftKey1_128 va_b0 va_s0 f =
| let va_mods:va_mods_t = [va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok] in
let va_qc = va_qcode_ShiftKey1_128 va_mods f in
let va_sM, va_fM, va_g =
va_wp_sound_code_norm (va_code_ShiftKey1_128 ())
va_qc
va_s0
(fun va_s0 va_sM va_g ->
let () = va_g in
label va_range1
"***** POSTCONDITION NOT MET AT line 68 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\
(let h:Vale.Math.Poly2_s.poly = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
let h1:Vale.Math.Poly2_s.poly = Vale.Math.Poly2_s.shift h 1 in
let offset:Vale.Math.Poly2_s.poly =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)
in
label va_range1
"***** POSTCONDITION NOT MET AT line 85 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) ==
Vale.AES.GF128.shift_key_1 128 f h)))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM) | false |
Vale.AES.X64.GF128_Init.fst | Vale.AES.X64.GF128_Init.va_wpProof_ShiftKey1_gf128_power | val va_wpProof_ShiftKey1_gf128_power : h:poly -> n:nat -> va_s0:va_state -> va_k:(va_state -> unit
-> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ShiftKey1_gf128_power h n va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftKey1_gf128_power ()) ([va_Mod_xmm
5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_reg64 rR12; va_Mod_flags])
va_s0 va_k ((va_sM, va_f0, va_g)))) | val va_wpProof_ShiftKey1_gf128_power : h:poly -> n:nat -> va_s0:va_state -> va_k:(va_state -> unit
-> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ShiftKey1_gf128_power h n va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftKey1_gf128_power ()) ([va_Mod_xmm
5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_reg64 rR12; va_Mod_flags])
va_s0 va_k ((va_sM, va_f0, va_g)))) | let va_wpProof_ShiftKey1_gf128_power h n va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ShiftKey1_gf128_power (va_code_ShiftKey1_gf128_power ()) va_s0 h n
in
va_lemma_upd_update va_sM;
assert (va_state_eq 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_reg64 rR12 va_sM (va_update_flags
va_sM (va_update_ok va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | {
"file_name": "obj/Vale.AES.X64.GF128_Init.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 22,
"end_line": 279,
"start_col": 0,
"start_line": 269
} | module Vale.AES.X64.GF128_Init
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.AES_s
open Vale.AES.AES256_helpers
open Vale.AES.X64.AES
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.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.AES.X64.GF128_Mul
open Vale.AES.GHash
open Vale.AES.OptPublic
//-- ShiftKey1_128
val va_code_ShiftKey1_128 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_ShiftKey1_128 () =
(va_Block (va_CCons (va_code_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_CCons
(va_code_ShiftLeft128_1 ()) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5))
(va_CCons (va_code_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 4)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_CNil ())))))))))
val va_codegen_success_ShiftKey1_128 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ShiftKey1_128 () =
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_ShiftLeft128_1 ()) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm
3) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pcmpeqd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3)
255) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4))
(va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_ttrue ()))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ShiftKey1_128 (va_mods:va_mods_t) (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s) in
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 88 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftLeft128_1 h) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 89 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32_mask h1) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 90 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_shift_define_i h 1 128) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 92 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 93 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 94 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_test_high_bit h) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 95 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 96 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_zero ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 97 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_ones ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 100 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 101 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_and_consts ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 102 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_opr128_xmm 3)) (va_QEmpty
(()))))))))))))))))
val va_lemma_ShiftKey1_128 : va_b0:va_code -> va_s0:va_state -> f:poly
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_128 ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127)))
(ensures (fun (va_sM, va_fM) -> 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 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) /\
va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0)))))))
[@"opaque_to_smt"]
let va_lemma_ShiftKey1_128 va_b0 va_s0 f =
let (va_mods:va_mods_t) = [va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok] in
let va_qc = va_qcode_ShiftKey1_128 va_mods f in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftKey1_128 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 68 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
label va_range1
"***** POSTCONDITION NOT MET AT line 85 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h)))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_ShiftKey1_128 (f:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) . let
va_sM = va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_flags
va_x_efl va_s0))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2_s.shift h 1 in let (offset:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) ==> va_k va_sM (())))
val va_wpProof_ShiftKey1_128 : f:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ShiftKey1_128 f va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_ShiftKey1_128 f va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ShiftKey1_128 (va_code_ShiftKey1_128 ()) va_s0 f in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0))))));
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_ShiftKey1_128 (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128 ())) =
(va_QProc (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags])
(va_wp_ShiftKey1_128 f) (va_wpProof_ShiftKey1_128 f))
//--
//-- ShiftKey1_gf128_power
val va_code_ShiftKey1_gf128_power : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_ShiftKey1_gf128_power () =
(va_Block (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm 4)) (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm
5)) (va_CCons (va_code_PinsrdImm (va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12))
(va_CCons (va_code_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_ShiftKey1_128 ()) (va_CNil ()))))))))
val va_codegen_success_ShiftKey1_gf128_power : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ShiftKey1_gf128_power () =
(va_pbool_and (va_codegen_success_ZeroXmm (va_op_xmm_xmm 4)) (va_pbool_and
(va_codegen_success_ZeroXmm (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_PinsrdImm
(va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12))
(va_pbool_and (va_codegen_success_ShiftKey1_128 ()) (va_ttrue ())))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ShiftKey1_gf128_power (va_mods:va_mods_t) (h:poly) (n:nat) : (va_quickCode unit
(va_code_ShiftKey1_gf128_power ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 4)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 120 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 5)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 121 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 123 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12)) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 124 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_high_bit ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 125 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_low_shift_1 ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 127 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_128 gf128_modulus_low_terms) (fun (va_s:va_state) _ -> let
(va_arg16:Prims.nat) = n in let (va_arg15:Vale.Math.Poly2_s.poly) = h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_gf128_power va_arg15 va_arg16) (va_QEmpty (()))))))))))))
val va_lemma_ShiftKey1_gf128_power : va_b0:va_code -> va_s0:va_state -> h:poly -> n:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_gf128_power ()) va_s0 /\ va_get_ok va_s0 /\
(let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
avx_enabled /\ sse_enabled /\ hn == Vale.AES.GHash.g_power h n)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n) /\
va_state_eq 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_reg64 rR12 va_sM (va_update_flags
va_sM (va_update_ok va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_ShiftKey1_gf128_power va_b0 va_s0 h n =
let (va_mods:va_mods_t) = [va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags; va_Mod_ok] in
let va_qc = va_qcode_ShiftKey1_gf128_power va_mods h n in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftKey1_gf128_power ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 105 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ (let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in label va_range1
"***** POSTCONDITION NOT MET AT line 117 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_ShiftKey1_gf128_power (h:poly) (n:nat) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in avx_enabled /\ sse_enabled /\ hn == Vale.AES.GHash.g_power h n) /\
(forall (va_x_efl:Vale.X64.Flags.t) (va_x_r12:nat64) (va_x_xmm1:quad32) (va_x_xmm2:quad32)
(va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) . let va_sM = 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_reg64 rR12 va_x_r12 (va_upd_flags va_x_efl va_s0)))))) in va_get_ok va_sM /\ (let
(hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n) ==>
va_k va_sM (())))
val va_wpProof_ShiftKey1_gf128_power : h:poly -> n:nat -> va_s0:va_state -> va_k:(va_state -> unit
-> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ShiftKey1_gf128_power h n va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftKey1_gf128_power ()) ([va_Mod_xmm
5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_reg64 rR12; va_Mod_flags])
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.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Words.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.GF128_Mul.fsti.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.OptPublic.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES256_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.GF128_Init.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"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.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"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.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.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.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"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.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"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.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.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.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"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 |
h: Vale.Math.Poly2_s.poly ->
n: Prims.nat ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Prims.Ghost ((Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) * Prims.unit) | Prims.Ghost | [] | [] | [
"Vale.Math.Poly2_s.poly",
"Prims.nat",
"Vale.X64.Decls.va_state",
"Prims.unit",
"Vale.X64.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple3",
"Vale.X64.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_xmm",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR12",
"Vale.X64.QuickCode.va_Mod_flags",
"Prims.Nil",
"Prims._assert",
"Vale.X64.Decls.va_state_eq",
"Vale.X64.Decls.va_update_xmm",
"Vale.X64.Decls.va_update_reg64",
"Vale.X64.Decls.va_update_flags",
"Vale.X64.Decls.va_update_ok",
"Vale.X64.Decls.va_lemma_upd_update",
"FStar.Pervasives.Native.tuple3",
"FStar.Pervasives.Native.tuple2",
"Vale.X64.State.vale_state",
"Vale.AES.X64.GF128_Init.va_lemma_ShiftKey1_gf128_power",
"Vale.AES.X64.GF128_Init.va_code_ShiftKey1_gf128_power"
] | [] | false | false | false | false | false | let va_wpProof_ShiftKey1_gf128_power h n va_s0 va_k =
| let va_sM, va_f0 = va_lemma_ShiftKey1_gf128_power (va_code_ShiftKey1_gf128_power ()) va_s0 h n in
va_lemma_upd_update va_sM;
assert (va_state_eq 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_reg64 rR12
va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0)))))))));
va_lemma_norm_mods ([
va_Mod_xmm 5;
va_Mod_xmm 4;
va_Mod_xmm 3;
va_Mod_xmm 2;
va_Mod_xmm 1;
va_Mod_reg64 rR12;
va_Mod_flags
])
va_sM
va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | false |
Vale.AES.X64.GF128_Init.fst | Vale.AES.X64.GF128_Init.va_qcode_ShiftKey1_128 | val va_qcode_ShiftKey1_128 (va_mods: va_mods_t) (f: poly)
: (va_quickCode unit (va_code_ShiftKey1_128 ())) | val va_qcode_ShiftKey1_128 (va_mods: va_mods_t) (f: poly)
: (va_quickCode unit (va_code_ShiftKey1_128 ())) | let va_qcode_ShiftKey1_128 (va_mods:va_mods_t) (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s) in
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 88 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftLeft128_1 h) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 89 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32_mask h1) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 90 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_shift_define_i h 1 128) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 92 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 93 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 94 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_test_high_bit h) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 95 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 96 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_zero ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 97 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_ones ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 100 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 101 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_and_consts ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 102 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_opr128_xmm 3)) (va_QEmpty
(())))))))))))))))) | {
"file_name": "obj/Vale.AES.X64.GF128_Init.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 23,
"end_line": 94,
"start_col": 0,
"start_line": 58
} | module Vale.AES.X64.GF128_Init
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.AES_s
open Vale.AES.AES256_helpers
open Vale.AES.X64.AES
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.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.AES.X64.GF128_Mul
open Vale.AES.GHash
open Vale.AES.OptPublic
//-- ShiftKey1_128
val va_code_ShiftKey1_128 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_ShiftKey1_128 () =
(va_Block (va_CCons (va_code_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_CCons
(va_code_ShiftLeft128_1 ()) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5))
(va_CCons (va_code_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 4)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_CNil ())))))))))
val va_codegen_success_ShiftKey1_128 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ShiftKey1_128 () =
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_ShiftLeft128_1 ()) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm
3) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pcmpeqd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3)
255) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4))
(va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_ttrue ())))))))) | {
"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.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Words.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.GF128_Mul.fsti.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.OptPublic.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES256_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.GF128_Init.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"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.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"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.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.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.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"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.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"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.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.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.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"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 | va_mods: Vale.X64.QuickCode.va_mods_t -> f: Vale.Math.Poly2_s.poly
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.AES.X64.GF128_Init.va_code_ShiftKey1_128 ()) | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCode.va_mods_t",
"Vale.Math.Poly2_s.poly",
"Vale.X64.QuickCodes.qblock",
"Prims.unit",
"Prims.Cons",
"Vale.X64.Decls.va_code",
"Vale.X64.InsVector.va_code_Mov128",
"Vale.X64.Decls.va_op_xmm_xmm",
"Vale.AES.X64.GF128_Mul.va_code_ShiftLeft128_1",
"Vale.AES.X64.PolyOps.va_code_PolyAnd",
"Vale.X64.InsVector.va_code_Pcmpeqd",
"Vale.X64.InsVector.va_code_Pshufd",
"Vale.AES.X64.PolyOps.va_code_VPolyAdd",
"Vale.X64.Decls.va_op_opr128_xmm",
"Prims.Nil",
"Vale.X64.Machine_s.precode",
"Vale.X64.Decls.ins",
"Vale.X64.Decls.ocmp",
"Vale.X64.Decls.va_state",
"Vale.X64.QuickCodes.va_QSeq",
"Vale.X64.QuickCodes.va_range1",
"Vale.X64.InsVector.va_quick_Mov128",
"Vale.X64.QuickCodes.va_QBind",
"Vale.AES.X64.GF128_Mul.va_quick_ShiftLeft128_1",
"Vale.X64.QuickCodes.va_qPURE",
"Prims.pure_post",
"Prims.l_and",
"Prims.l_True",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.eq2",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Vale.Math.Poly2.Bits_s.to_quad32",
"Vale.Math.Poly2.mask",
"Vale.Math.Poly2.Bits.lemma_of_to_quad32_mask",
"Prims.bool",
"Vale.Math.Poly2_s.poly_index",
"Vale.Math.Poly2_s.shift",
"Prims.op_AmpAmp",
"Prims.op_Subtraction",
"Prims.op_GreaterThanOrEqual",
"Vale.Math.Poly2.lemma_shift_define_i",
"Vale.AES.X64.PolyOps.va_quick_PolyAnd",
"Vale.X64.InsVector.va_quick_Pcmpeqd",
"Prims.b2t",
"Prims.op_LessThan",
"Vale.Math.Poly2_s.degree",
"Prims.op_Equality",
"Vale.Def.Words_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Vale.Math.Poly2.poly_and",
"Vale.Math.Poly2_s.monomial",
"Vale.AES.GF128.lemma_test_high_bit",
"Vale.X64.InsVector.va_quick_Pshufd",
"Vale.Def.Words_s.Mkfour",
"Vale.Math.Poly2_s.zero",
"Vale.Def.Words_s.four",
"Vale.Math.Poly2.Words.lemma_quad32_zero",
"Vale.Math.Poly2.ones",
"Vale.Math.Poly2.Words.lemma_quad32_ones",
"Prims.nat",
"Vale.Math.Poly2.Lemmas.lemma_and_consts",
"Vale.AES.X64.PolyOps.va_quick_VPolyAdd",
"Vale.X64.QuickCodes.va_QEmpty",
"Vale.X64.QuickCodes.quickCodes",
"Vale.X64.Decls.va_get_xmm",
"Vale.X64.State.vale_state",
"Vale.X64.QuickCode.va_quickCode",
"Vale.AES.X64.GF128_Init.va_code_ShiftKey1_128"
] | [] | false | false | false | false | false | let va_qcode_ShiftKey1_128 (va_mods: va_mods_t) (f: poly)
: (va_quickCode unit (va_code_ShiftKey1_128 ())) =
| (qblock va_mods
(fun (va_s: va_state) ->
let va_old_s:va_state = va_s in
let h:Vale.Math.Poly2_s.poly = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in
let h1:Vale.Math.Poly2_s.poly = Vale.Math.Poly2_s.shift h 1 in
let offset:Vale.Math.Poly2_s.poly = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s) in
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 88 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftLeft128_1 h)
(fun (va_s: va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 89 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_: unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32_mask h1)
(va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 90 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_: unit) -> Vale.Math.Poly2.lemma_shift_define_i h 1 128)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 92 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 93 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5))
(fun (va_s: va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 94 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_: unit) -> Vale.AES.GF128.lemma_test_high_bit h)
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 95 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255)
(fun (va_s: va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 96 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_: unit) ->
Vale.Math.Poly2.Words.lemma_quad32_zero ())
(va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 97 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_: unit) ->
Vale.Math.Poly2.Words.lemma_quad32_ones ())
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 100 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 4))
(fun (va_s: va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 101 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_: unit) ->
Vale.Math.Poly2.Lemmas.lemma_and_consts
())
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 102 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_VPolyAdd (va_op_xmm_xmm 1
)
(va_op_xmm_xmm 1)
(va_op_opr128_xmm 3))
(va_QEmpty (())))))))))))))))) | false |
Vale.AES.X64.GF128_Init.fst | Vale.AES.X64.GF128_Init.va_quick_Gf128_powers | val va_quick_Gf128_powers (h: poly) (hkeys_b: buffer128)
: (va_quickCode unit (va_code_Gf128_powers ())) | val va_quick_Gf128_powers (h: poly) (hkeys_b: buffer128)
: (va_quickCode unit (va_code_Gf128_powers ())) | let va_quick_Gf128_powers (h:poly) (hkeys_b:buffer128) : (va_quickCode unit (va_code_Gf128_powers
())) =
(va_QProc (va_code_Gf128_powers ()) ([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 rR12; va_Mod_reg64 rRax; va_Mod_flags;
va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_Gf128_powers h hkeys_b) (va_wpProof_Gf128_powers h
hkeys_b)) | {
"file_name": "obj/Vale.AES.X64.GF128_Init.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 13,
"end_line": 642,
"start_col": 0,
"start_line": 637
} | module Vale.AES.X64.GF128_Init
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.AES_s
open Vale.AES.AES256_helpers
open Vale.AES.X64.AES
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.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.AES.X64.GF128_Mul
open Vale.AES.GHash
open Vale.AES.OptPublic
//-- ShiftKey1_128
val va_code_ShiftKey1_128 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_ShiftKey1_128 () =
(va_Block (va_CCons (va_code_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_CCons
(va_code_ShiftLeft128_1 ()) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5))
(va_CCons (va_code_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 4)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_CNil ())))))))))
val va_codegen_success_ShiftKey1_128 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ShiftKey1_128 () =
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_ShiftLeft128_1 ()) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm
3) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pcmpeqd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3)
255) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4))
(va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_ttrue ()))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ShiftKey1_128 (va_mods:va_mods_t) (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s) in
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 88 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftLeft128_1 h) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 89 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32_mask h1) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 90 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_shift_define_i h 1 128) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 92 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 93 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 94 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_test_high_bit h) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 95 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 96 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_zero ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 97 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_ones ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 100 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 101 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_and_consts ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 102 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_opr128_xmm 3)) (va_QEmpty
(()))))))))))))))))
val va_lemma_ShiftKey1_128 : va_b0:va_code -> va_s0:va_state -> f:poly
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_128 ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127)))
(ensures (fun (va_sM, va_fM) -> 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 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) /\
va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0)))))))
[@"opaque_to_smt"]
let va_lemma_ShiftKey1_128 va_b0 va_s0 f =
let (va_mods:va_mods_t) = [va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok] in
let va_qc = va_qcode_ShiftKey1_128 va_mods f in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftKey1_128 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 68 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
label va_range1
"***** POSTCONDITION NOT MET AT line 85 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h)))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_ShiftKey1_128 (f:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) . let
va_sM = va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_flags
va_x_efl va_s0))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2_s.shift h 1 in let (offset:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) ==> va_k va_sM (())))
val va_wpProof_ShiftKey1_128 : f:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ShiftKey1_128 f va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_ShiftKey1_128 f va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ShiftKey1_128 (va_code_ShiftKey1_128 ()) va_s0 f in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0))))));
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_ShiftKey1_128 (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128 ())) =
(va_QProc (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags])
(va_wp_ShiftKey1_128 f) (va_wpProof_ShiftKey1_128 f))
//--
//-- ShiftKey1_gf128_power
val va_code_ShiftKey1_gf128_power : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_ShiftKey1_gf128_power () =
(va_Block (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm 4)) (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm
5)) (va_CCons (va_code_PinsrdImm (va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12))
(va_CCons (va_code_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_ShiftKey1_128 ()) (va_CNil ()))))))))
val va_codegen_success_ShiftKey1_gf128_power : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ShiftKey1_gf128_power () =
(va_pbool_and (va_codegen_success_ZeroXmm (va_op_xmm_xmm 4)) (va_pbool_and
(va_codegen_success_ZeroXmm (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_PinsrdImm
(va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12))
(va_pbool_and (va_codegen_success_ShiftKey1_128 ()) (va_ttrue ())))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ShiftKey1_gf128_power (va_mods:va_mods_t) (h:poly) (n:nat) : (va_quickCode unit
(va_code_ShiftKey1_gf128_power ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 4)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 120 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 5)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 121 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 123 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12)) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 124 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_high_bit ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 125 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_low_shift_1 ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 127 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_128 gf128_modulus_low_terms) (fun (va_s:va_state) _ -> let
(va_arg16:Prims.nat) = n in let (va_arg15:Vale.Math.Poly2_s.poly) = h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_gf128_power va_arg15 va_arg16) (va_QEmpty (()))))))))))))
val va_lemma_ShiftKey1_gf128_power : va_b0:va_code -> va_s0:va_state -> h:poly -> n:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_gf128_power ()) va_s0 /\ va_get_ok va_s0 /\
(let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
avx_enabled /\ sse_enabled /\ hn == Vale.AES.GHash.g_power h n)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n) /\
va_state_eq 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_reg64 rR12 va_sM (va_update_flags
va_sM (va_update_ok va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_ShiftKey1_gf128_power va_b0 va_s0 h n =
let (va_mods:va_mods_t) = [va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags; va_Mod_ok] in
let va_qc = va_qcode_ShiftKey1_gf128_power va_mods h n in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftKey1_gf128_power ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 105 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ (let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in label va_range1
"***** POSTCONDITION NOT MET AT line 117 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_ShiftKey1_gf128_power (h:poly) (n:nat) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in avx_enabled /\ sse_enabled /\ hn == Vale.AES.GHash.g_power h n) /\
(forall (va_x_efl:Vale.X64.Flags.t) (va_x_r12:nat64) (va_x_xmm1:quad32) (va_x_xmm2:quad32)
(va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) . let va_sM = 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_reg64 rR12 va_x_r12 (va_upd_flags va_x_efl va_s0)))))) in va_get_ok va_sM /\ (let
(hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n) ==>
va_k va_sM (())))
val va_wpProof_ShiftKey1_gf128_power : h:poly -> n:nat -> va_s0:va_state -> va_k:(va_state -> unit
-> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ShiftKey1_gf128_power h n va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftKey1_gf128_power ()) ([va_Mod_xmm
5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_reg64 rR12; va_Mod_flags])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_ShiftKey1_gf128_power h n va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ShiftKey1_gf128_power (va_code_ShiftKey1_gf128_power ()) va_s0 h n
in
va_lemma_upd_update va_sM;
assert (va_state_eq 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_reg64 rR12 va_sM (va_update_flags
va_sM (va_update_ok va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_ShiftKey1_gf128_power (h:poly) (n:nat) : (va_quickCode unit
(va_code_ShiftKey1_gf128_power ())) =
(va_QProc (va_code_ShiftKey1_gf128_power ()) ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_reg64 rR12; va_Mod_flags]) (va_wp_ShiftKey1_gf128_power h n)
(va_wpProof_ShiftKey1_gf128_power h n))
//--
//-- Gf128_powers
val va_code_Gf128_powers : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gf128_powers () =
(va_Block (va_CCons (va_code_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) 32 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128
(va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons (va_code_ShiftKey1_gf128_power ()) (va_CCons
(va_code_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 0 Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 6))
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1))
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 16 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 48 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 64 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 96 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 112 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 0)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRax)) (va_CNil
()))))))))))))))))))))))))))))))))))))))))))))))
val va_codegen_success_Gf128_powers : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gf128_powers () =
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm
1)) (va_pbool_and (va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and
(va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 0 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 1)
(va_op_xmm_xmm 6)) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm
6)) (va_pbool_and (va_codegen_success_Gf128MulRev128 ()) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 16 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 48 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 64 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 96 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 112 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 0)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRax)) (va_ttrue
())))))))))))))))))))))))))))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gf128_powers (va_mods:va_mods_t) (h:poly) (hkeys_b:buffer128) : (va_quickCode unit
(va_code_Gf128_powers ())) =
(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 158 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 159 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 161 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (fun (va_s:va_state) _ -> let (va_arg57:Vale.Math.Poly2_s.poly) = h
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 162 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_1 va_arg57) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 163 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 164 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 165 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 166 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 0 Secret hkeys_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 168 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 169 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 170 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg56:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 171 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg56 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 172 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 173 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 174 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 2) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 175 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 16 Secret hkeys_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 177 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 178 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 179 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg55:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 180 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg55 2) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 181 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 182 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 183 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 184 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 48 Secret hkeys_b 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 186 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 187 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 188 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg54:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 189 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg54 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 190 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 191 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 192 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 193 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 64 Secret hkeys_b 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 195 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 196 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 197 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg53:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 198 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg53 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 199 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 200 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 5) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 202 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 96 Secret hkeys_b 6) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 205 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 206 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg52:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 207 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg52 5) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 208 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 209 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 210 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 6) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 211 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 112 Secret hkeys_b 7) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 213 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 0)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 214 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRax)) (va_QEmpty
(())))))))))))))))))))))))))))))))))))))))))))))))))))))
val va_lemma_Gf128_powers : va_b0:va_code -> va_s0:va_state -> h:poly -> hkeys_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gf128_powers ()) va_s0 /\ va_get_ok va_s0 /\
(pclmulqdq_enabled /\ avx_enabled /\ sse_enabled) /\ Vale.X64.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2
(va_get_mem_heaplet 1 va_s0)) == h))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_get_xmm 6 va_sM == va_get_xmm 6 va_s0 /\ va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0
/\ Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 hkeys_b)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 1 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 1 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 2 /\ Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1
va_sM) == Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_s0) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 3 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 3 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 4 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 4 /\ Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1
va_sM) == Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_s0) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 6 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 5 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 7 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 6 /\ va_state_eq 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 rR12 va_sM (va_update_reg64 rRax va_sM
(va_update_flags 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_Gf128_powers va_b0 va_s0 h hkeys_b =
let (va_mods:va_mods_t) = [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 rR12; va_Mod_reg64 rRax; va_Mod_flags;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gf128_powers va_mods h hkeys_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gf128_powers ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 131 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 145 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_xmm 6 va_sM == va_get_xmm 6 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 146 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 147 column 61 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 hkeys_b)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 148 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 1) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 149 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 1 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 2) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 151 column 84 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_sM) ==
Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 152 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 3 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 3) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 153 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 4 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 4) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 154 column 84 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_sM) ==
Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 155 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 6 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 5) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 156 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 7 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 6)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([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 rR12; va_Mod_reg64 rRax; va_Mod_flags;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Gf128_powers (h:poly) (hkeys_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (pclmulqdq_enabled /\ avx_enabled /\ sse_enabled) /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) hkeys_b
8 (va_get_mem_layout va_s0) Secret /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_s0)) == h /\ (forall
(va_x_mem:vale_heap) (va_x_heap1:vale_heap) (va_x_efl:Vale.X64.Flags.t) (va_x_rax:nat64)
(va_x_r12: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) . let va_sM = 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 rR12 va_x_r12 (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem
va_s0))))))))))) in va_get_ok va_sM /\ va_get_xmm 6 va_sM == va_get_xmm 6 va_s0 /\ va_get_reg64
rR12 va_sM == va_get_reg64 rR12 va_s0 /\ Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer
#Vale.X64.Memory.vuint128 hkeys_b) (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 1 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 1 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 2 /\ Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1
va_sM) == Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_s0) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 3 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 3 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 4 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 4 /\ Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1
va_sM) == Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_s0) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 6 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 5 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 7 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 6 ==> va_k va_sM (())))
val va_wpProof_Gf128_powers : h:poly -> hkeys_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_Gf128_powers h hkeys_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gf128_powers ()) ([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 rR12; va_Mod_reg64 rRax; va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Gf128_powers h hkeys_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Gf128_powers (va_code_Gf128_powers ()) va_s0 h hkeys_b in
va_lemma_upd_update va_sM;
assert (va_state_eq 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 rR12 va_sM (va_update_reg64 rRax va_sM (va_update_flags 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_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 rR12; va_Mod_reg64 rRax; va_Mod_flags;
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.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.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Words.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.GF128_Mul.fsti.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.OptPublic.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES256_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.GF128_Init.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"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.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"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.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.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.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"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.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"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.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.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.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"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 | h: Vale.Math.Poly2_s.poly -> hkeys_b: Vale.X64.Memory.buffer128
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.AES.X64.GF128_Init.va_code_Gf128_powers ()) | Prims.Tot | [
"total"
] | [] | [
"Vale.Math.Poly2_s.poly",
"Vale.X64.Memory.buffer128",
"Vale.X64.QuickCode.va_QProc",
"Prims.unit",
"Vale.AES.X64.GF128_Init.va_code_Gf128_powers",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_xmm",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR12",
"Vale.X64.Machine_s.rRax",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_mem_heaplet",
"Vale.X64.QuickCode.va_Mod_mem",
"Prims.Nil",
"Vale.AES.X64.GF128_Init.va_wp_Gf128_powers",
"Vale.AES.X64.GF128_Init.va_wpProof_Gf128_powers",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Gf128_powers (h: poly) (hkeys_b: buffer128)
: (va_quickCode unit (va_code_Gf128_powers ())) =
| (va_QProc (va_code_Gf128_powers ())
([
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 rR12; va_Mod_reg64 rRax; va_Mod_flags; va_Mod_mem_heaplet 1;
va_Mod_mem
])
(va_wp_Gf128_powers h hkeys_b)
(va_wpProof_Gf128_powers h hkeys_b)) | false |
Vale.AES.X64.GF128_Init.fst | Vale.AES.X64.GF128_Init.va_lemma_ShiftKey1_gf128_power | val va_lemma_ShiftKey1_gf128_power : va_b0:va_code -> va_s0:va_state -> h:poly -> n:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_gf128_power ()) va_s0 /\ va_get_ok va_s0 /\
(let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
avx_enabled /\ sse_enabled /\ hn == Vale.AES.GHash.g_power h n)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n) /\
va_state_eq 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_reg64 rR12 va_sM (va_update_flags
va_sM (va_update_ok va_sM va_s0)))))))))) | val va_lemma_ShiftKey1_gf128_power : va_b0:va_code -> va_s0:va_state -> h:poly -> n:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_gf128_power ()) va_s0 /\ va_get_ok va_s0 /\
(let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
avx_enabled /\ sse_enabled /\ hn == Vale.AES.GHash.g_power h n)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n) /\
va_state_eq 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_reg64 rR12 va_sM (va_update_flags
va_sM (va_update_ok va_sM va_s0)))))))))) | let va_lemma_ShiftKey1_gf128_power va_b0 va_s0 h n =
let (va_mods:va_mods_t) = [va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags; va_Mod_ok] in
let va_qc = va_qcode_ShiftKey1_gf128_power va_mods h n in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftKey1_gf128_power ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 105 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ (let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in label va_range1
"***** POSTCONDITION NOT MET AT line 117 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM) | {
"file_name": "obj/Vale.AES.X64.GF128_Init.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 16,
"end_line": 245,
"start_col": 0,
"start_line": 231
} | module Vale.AES.X64.GF128_Init
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.AES_s
open Vale.AES.AES256_helpers
open Vale.AES.X64.AES
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.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.AES.X64.GF128_Mul
open Vale.AES.GHash
open Vale.AES.OptPublic
//-- ShiftKey1_128
val va_code_ShiftKey1_128 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_ShiftKey1_128 () =
(va_Block (va_CCons (va_code_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_CCons
(va_code_ShiftLeft128_1 ()) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5))
(va_CCons (va_code_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 4)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_CNil ())))))))))
val va_codegen_success_ShiftKey1_128 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ShiftKey1_128 () =
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_ShiftLeft128_1 ()) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm
3) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pcmpeqd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3)
255) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4))
(va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_ttrue ()))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ShiftKey1_128 (va_mods:va_mods_t) (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s) in
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 88 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftLeft128_1 h) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 89 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32_mask h1) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 90 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_shift_define_i h 1 128) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 92 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 93 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 94 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_test_high_bit h) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 95 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 96 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_zero ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 97 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_ones ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 100 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 101 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_and_consts ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 102 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_opr128_xmm 3)) (va_QEmpty
(()))))))))))))))))
val va_lemma_ShiftKey1_128 : va_b0:va_code -> va_s0:va_state -> f:poly
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_128 ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127)))
(ensures (fun (va_sM, va_fM) -> 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 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) /\
va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0)))))))
[@"opaque_to_smt"]
let va_lemma_ShiftKey1_128 va_b0 va_s0 f =
let (va_mods:va_mods_t) = [va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok] in
let va_qc = va_qcode_ShiftKey1_128 va_mods f in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftKey1_128 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 68 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
label va_range1
"***** POSTCONDITION NOT MET AT line 85 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h)))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_ShiftKey1_128 (f:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) . let
va_sM = va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_flags
va_x_efl va_s0))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2_s.shift h 1 in let (offset:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) ==> va_k va_sM (())))
val va_wpProof_ShiftKey1_128 : f:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ShiftKey1_128 f va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_ShiftKey1_128 f va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ShiftKey1_128 (va_code_ShiftKey1_128 ()) va_s0 f in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0))))));
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_ShiftKey1_128 (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128 ())) =
(va_QProc (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags])
(va_wp_ShiftKey1_128 f) (va_wpProof_ShiftKey1_128 f))
//--
//-- ShiftKey1_gf128_power
val va_code_ShiftKey1_gf128_power : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_ShiftKey1_gf128_power () =
(va_Block (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm 4)) (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm
5)) (va_CCons (va_code_PinsrdImm (va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12))
(va_CCons (va_code_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_ShiftKey1_128 ()) (va_CNil ()))))))))
val va_codegen_success_ShiftKey1_gf128_power : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ShiftKey1_gf128_power () =
(va_pbool_and (va_codegen_success_ZeroXmm (va_op_xmm_xmm 4)) (va_pbool_and
(va_codegen_success_ZeroXmm (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_PinsrdImm
(va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12))
(va_pbool_and (va_codegen_success_ShiftKey1_128 ()) (va_ttrue ())))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ShiftKey1_gf128_power (va_mods:va_mods_t) (h:poly) (n:nat) : (va_quickCode unit
(va_code_ShiftKey1_gf128_power ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 4)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 120 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 5)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 121 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 123 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12)) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 124 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_high_bit ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 125 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_low_shift_1 ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 127 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_128 gf128_modulus_low_terms) (fun (va_s:va_state) _ -> let
(va_arg16:Prims.nat) = n in let (va_arg15:Vale.Math.Poly2_s.poly) = h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_gf128_power va_arg15 va_arg16) (va_QEmpty (()))))))))))))
val va_lemma_ShiftKey1_gf128_power : va_b0:va_code -> va_s0:va_state -> h:poly -> n:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_gf128_power ()) va_s0 /\ va_get_ok va_s0 /\
(let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
avx_enabled /\ sse_enabled /\ hn == Vale.AES.GHash.g_power h n)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n) /\
va_state_eq 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_reg64 rR12 va_sM (va_update_flags
va_sM (va_update_ok 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.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Words.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.GF128_Mul.fsti.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.OptPublic.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES256_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.GF128_Init.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"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.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"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.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.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.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"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.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"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.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.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.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"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 |
va_b0: Vale.X64.Decls.va_code ->
va_s0: Vale.X64.Decls.va_state ->
h: Vale.Math.Poly2_s.poly ->
n: Prims.nat
-> Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) | Prims.Ghost | [] | [] | [
"Vale.X64.Decls.va_code",
"Vale.X64.Decls.va_state",
"Vale.Math.Poly2_s.poly",
"Prims.nat",
"Vale.X64.QuickCodes.fuel",
"Prims.unit",
"FStar.Pervasives.Native.Mktuple2",
"Vale.X64.Decls.va_fuel",
"Vale.X64.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_xmm",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR12",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_ok",
"Prims.Nil",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.list",
"Vale.X64.QuickCode.__proj__QProc__item__mods",
"Vale.AES.X64.GF128_Init.va_code_ShiftKey1_gf128_power",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.tuple3",
"Vale.X64.State.vale_state",
"Vale.X64.QuickCodes.va_wp_sound_code_norm",
"Prims.l_and",
"Vale.X64.QuickCodes.label",
"Vale.X64.QuickCodes.va_range1",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Vale.X64.Decls.va_get_xmm",
"Vale.AES.GHash.gf128_power",
"Vale.X64.QuickCode.quickCode",
"Vale.AES.X64.GF128_Init.va_qcode_ShiftKey1_gf128_power"
] | [] | false | false | false | false | false | let va_lemma_ShiftKey1_gf128_power va_b0 va_s0 h n =
| let va_mods:va_mods_t =
[
va_Mod_xmm 5;
va_Mod_xmm 4;
va_Mod_xmm 3;
va_Mod_xmm 2;
va_Mod_xmm 1;
va_Mod_reg64 rR12;
va_Mod_flags;
va_Mod_ok
]
in
let va_qc = va_qcode_ShiftKey1_gf128_power va_mods h n in
let va_sM, va_fM, va_g =
va_wp_sound_code_norm (va_code_ShiftKey1_gf128_power ())
va_qc
va_s0
(fun va_s0 va_sM va_g ->
let () = va_g in
label va_range1
"***** POSTCONDITION NOT MET AT line 105 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\
(let hn:Vale.Math.Poly2_s.poly = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
label va_range1
"***** POSTCONDITION NOT MET AT line 117 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n
)))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([
va_Mod_xmm 5;
va_Mod_xmm 4;
va_Mod_xmm 3;
va_Mod_xmm 2;
va_Mod_xmm 1;
va_Mod_reg64 rR12;
va_Mod_flags;
va_Mod_ok
])
va_sM
va_s0;
(va_sM, va_fM) | false |
Vale.AES.X64.GF128_Init.fst | Vale.AES.X64.GF128_Init.va_qcode_ShiftKey1_gf128_power | val va_qcode_ShiftKey1_gf128_power (va_mods: va_mods_t) (h: poly) (n: nat)
: (va_quickCode unit (va_code_ShiftKey1_gf128_power ())) | val va_qcode_ShiftKey1_gf128_power (va_mods: va_mods_t) (h: poly) (n: nat)
: (va_quickCode unit (va_code_ShiftKey1_gf128_power ())) | let va_qcode_ShiftKey1_gf128_power (va_mods:va_mods_t) (h:poly) (n:nat) : (va_quickCode unit
(va_code_ShiftKey1_gf128_power ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 4)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 120 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 5)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 121 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 123 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12)) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 124 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_high_bit ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 125 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_low_shift_1 ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 127 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_128 gf128_modulus_low_terms) (fun (va_s:va_state) _ -> let
(va_arg16:Prims.nat) = n in let (va_arg15:Vale.Math.Poly2_s.poly) = h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_gf128_power va_arg15 va_arg16) (va_QEmpty (())))))))))))) | {
"file_name": "obj/Vale.AES.X64.GF128_Init.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 99,
"end_line": 216,
"start_col": 0,
"start_line": 191
} | module Vale.AES.X64.GF128_Init
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.AES_s
open Vale.AES.AES256_helpers
open Vale.AES.X64.AES
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.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.AES.X64.GF128_Mul
open Vale.AES.GHash
open Vale.AES.OptPublic
//-- ShiftKey1_128
val va_code_ShiftKey1_128 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_ShiftKey1_128 () =
(va_Block (va_CCons (va_code_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_CCons
(va_code_ShiftLeft128_1 ()) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5))
(va_CCons (va_code_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 4)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_CNil ())))))))))
val va_codegen_success_ShiftKey1_128 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ShiftKey1_128 () =
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_ShiftLeft128_1 ()) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm
3) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pcmpeqd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3)
255) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4))
(va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_ttrue ()))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ShiftKey1_128 (va_mods:va_mods_t) (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s) in
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 88 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftLeft128_1 h) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 89 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32_mask h1) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 90 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_shift_define_i h 1 128) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 92 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 93 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 94 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_test_high_bit h) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 95 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 96 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_zero ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 97 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_ones ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 100 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 101 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_and_consts ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 102 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_opr128_xmm 3)) (va_QEmpty
(()))))))))))))))))
val va_lemma_ShiftKey1_128 : va_b0:va_code -> va_s0:va_state -> f:poly
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_128 ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127)))
(ensures (fun (va_sM, va_fM) -> 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 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) /\
va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0)))))))
[@"opaque_to_smt"]
let va_lemma_ShiftKey1_128 va_b0 va_s0 f =
let (va_mods:va_mods_t) = [va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok] in
let va_qc = va_qcode_ShiftKey1_128 va_mods f in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftKey1_128 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 68 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
label va_range1
"***** POSTCONDITION NOT MET AT line 85 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h)))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_ShiftKey1_128 (f:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) . let
va_sM = va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_flags
va_x_efl va_s0))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2_s.shift h 1 in let (offset:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) ==> va_k va_sM (())))
val va_wpProof_ShiftKey1_128 : f:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ShiftKey1_128 f va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_ShiftKey1_128 f va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ShiftKey1_128 (va_code_ShiftKey1_128 ()) va_s0 f in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0))))));
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_ShiftKey1_128 (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128 ())) =
(va_QProc (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags])
(va_wp_ShiftKey1_128 f) (va_wpProof_ShiftKey1_128 f))
//--
//-- ShiftKey1_gf128_power
val va_code_ShiftKey1_gf128_power : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_ShiftKey1_gf128_power () =
(va_Block (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm 4)) (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm
5)) (va_CCons (va_code_PinsrdImm (va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12))
(va_CCons (va_code_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_ShiftKey1_128 ()) (va_CNil ()))))))))
val va_codegen_success_ShiftKey1_gf128_power : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ShiftKey1_gf128_power () =
(va_pbool_and (va_codegen_success_ZeroXmm (va_op_xmm_xmm 4)) (va_pbool_and
(va_codegen_success_ZeroXmm (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_PinsrdImm
(va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12))
(va_pbool_and (va_codegen_success_ShiftKey1_128 ()) (va_ttrue ()))))))) | {
"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.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Words.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.GF128_Mul.fsti.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.OptPublic.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES256_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.GF128_Init.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"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.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"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.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.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.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"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.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"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.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.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.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"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 | va_mods: Vale.X64.QuickCode.va_mods_t -> h: Vale.Math.Poly2_s.poly -> n: Prims.nat
-> Vale.X64.QuickCode.va_quickCode Prims.unit
(Vale.AES.X64.GF128_Init.va_code_ShiftKey1_gf128_power ()) | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCode.va_mods_t",
"Vale.Math.Poly2_s.poly",
"Prims.nat",
"Vale.X64.QuickCodes.qblock",
"Prims.unit",
"Prims.Cons",
"Vale.X64.Decls.va_code",
"Vale.X64.InsVector.va_code_ZeroXmm",
"Vale.X64.Decls.va_op_xmm_xmm",
"Vale.X64.InsVector.va_code_PinsrdImm",
"Vale.X64.Decls.va_op_reg_opr64_reg64",
"Vale.X64.Machine_s.rR12",
"Vale.AES.X64.GF128_Init.va_code_ShiftKey1_128",
"Prims.Nil",
"Vale.X64.Machine_s.precode",
"Vale.X64.Decls.ins",
"Vale.X64.Decls.ocmp",
"Vale.X64.Decls.va_state",
"Vale.X64.QuickCodes.va_QSeq",
"Vale.X64.QuickCodes.va_range1",
"Vale.X64.InsVector.va_quick_ZeroXmm",
"Vale.X64.InsVector.va_quick_PinsrdImm",
"Vale.X64.QuickCodes.va_QBind",
"Vale.X64.QuickCodes.va_qPURE",
"Prims.pure_post",
"Prims.l_and",
"Prims.l_True",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.eq2",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Vale.Def.Words_s.Mkfour",
"Vale.Def.Words_s.nat32",
"Vale.Math.Poly2_s.monomial",
"Vale.AES.GF128.lemma_gf128_high_bit",
"Vale.Math.Poly2_s.reverse",
"Vale.Math.Poly2_s.shift",
"Vale.Math.Poly2_s.add",
"Vale.AES.GF128_s.gf128_modulus_low_terms",
"Prims.op_Minus",
"Vale.AES.GF128.lemma_gf128_low_shift_1",
"Vale.AES.X64.GF128_Init.va_quick_ShiftKey1_128",
"Vale.AES.GHash.gf128_power",
"Vale.AES.GF128.shift_key_1",
"Vale.AES.GHash.g_power",
"Vale.AES.GHash.lemma_gf128_power",
"Vale.X64.QuickCodes.va_QEmpty",
"Vale.X64.QuickCodes.quickCodes",
"Vale.X64.Decls.va_get_xmm",
"Vale.X64.State.vale_state",
"Vale.X64.QuickCode.va_quickCode",
"Vale.AES.X64.GF128_Init.va_code_ShiftKey1_gf128_power"
] | [] | false | false | false | false | false | let va_qcode_ShiftKey1_gf128_power (va_mods: va_mods_t) (h: poly) (n: nat)
: (va_quickCode unit (va_code_ShiftKey1_gf128_power ())) =
| (qblock va_mods
(fun (va_s: va_state) ->
let va_old_s:va_state = va_s in
let hn:Vale.Math.Poly2_s.poly = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 119 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 4))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 120 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 5))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 121 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 122 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 123 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 5)
2147483648
3
(va_op_reg_opr64_reg64 rR12))
(fun (va_s: va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 124 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_: unit) -> Vale.AES.GF128.lemma_gf128_high_bit ())
(va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 125 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_: unit) -> Vale.AES.GF128.lemma_gf128_low_shift_1 ())
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 127 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_128 gf128_modulus_low_terms)
(fun (va_s: va_state) _ ->
let va_arg16:Prims.nat = n in
let va_arg15:Vale.Math.Poly2_s.poly = h in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_: unit) ->
Vale.AES.GHash.lemma_gf128_power va_arg15 va_arg16
)
(va_QEmpty (())))))))))))) | false |
Vale.AES.X64.GF128_Init.fst | Vale.AES.X64.GF128_Init.va_wpProof_Keyhash_init | val va_wpProof_Keyhash_init : win:bool -> alg:algorithm -> key:(seq nat32) -> roundkeys_b:buffer128
-> hkeys_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_Keyhash_init win alg key roundkeys_b hkeys_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Keyhash_init win alg) ([va_Mod_flags;
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_mem_layout; va_Mod_mem_heaplet 1; va_Mod_reg64 rR12; va_Mod_reg64 rR8; va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) | val va_wpProof_Keyhash_init : win:bool -> alg:algorithm -> key:(seq nat32) -> roundkeys_b:buffer128
-> hkeys_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_Keyhash_init win alg key roundkeys_b hkeys_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Keyhash_init win alg) ([va_Mod_flags;
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_mem_layout; va_Mod_mem_heaplet 1; va_Mod_reg64 rR12; va_Mod_reg64 rR8; va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) | let va_wpProof_Keyhash_init win alg key roundkeys_b hkeys_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Keyhash_init (va_code_Keyhash_init win alg) va_s0 win alg key
roundkeys_b hkeys_b in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags 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_mem_layout va_sM (va_update_mem_heaplet 1 va_sM
(va_update_reg64 rR12 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRdx va_sM
(va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0))))))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; 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_mem_layout; va_Mod_mem_heaplet 1; va_Mod_reg64
rR12; va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem])
va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | {
"file_name": "obj/Vale.AES.X64.GF128_Init.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 22,
"end_line": 798,
"start_col": 0,
"start_line": 783
} | module Vale.AES.X64.GF128_Init
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.AES_s
open Vale.AES.AES256_helpers
open Vale.AES.X64.AES
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.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.AES.X64.GF128_Mul
open Vale.AES.GHash
open Vale.AES.OptPublic
//-- ShiftKey1_128
val va_code_ShiftKey1_128 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_ShiftKey1_128 () =
(va_Block (va_CCons (va_code_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_CCons
(va_code_ShiftLeft128_1 ()) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5))
(va_CCons (va_code_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 4)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_CNil ())))))))))
val va_codegen_success_ShiftKey1_128 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ShiftKey1_128 () =
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_ShiftLeft128_1 ()) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm
3) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pcmpeqd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3)
255) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4))
(va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_ttrue ()))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ShiftKey1_128 (va_mods:va_mods_t) (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s) in
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 88 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftLeft128_1 h) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 89 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32_mask h1) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 90 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_shift_define_i h 1 128) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 92 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 93 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 94 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_test_high_bit h) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 95 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 96 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_zero ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 97 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_ones ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 100 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 101 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_and_consts ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 102 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_opr128_xmm 3)) (va_QEmpty
(()))))))))))))))))
val va_lemma_ShiftKey1_128 : va_b0:va_code -> va_s0:va_state -> f:poly
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_128 ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127)))
(ensures (fun (va_sM, va_fM) -> 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 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) /\
va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0)))))))
[@"opaque_to_smt"]
let va_lemma_ShiftKey1_128 va_b0 va_s0 f =
let (va_mods:va_mods_t) = [va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok] in
let va_qc = va_qcode_ShiftKey1_128 va_mods f in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftKey1_128 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 68 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
label va_range1
"***** POSTCONDITION NOT MET AT line 85 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h)))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_ShiftKey1_128 (f:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) . let
va_sM = va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_flags
va_x_efl va_s0))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2_s.shift h 1 in let (offset:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) ==> va_k va_sM (())))
val va_wpProof_ShiftKey1_128 : f:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ShiftKey1_128 f va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_ShiftKey1_128 f va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ShiftKey1_128 (va_code_ShiftKey1_128 ()) va_s0 f in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0))))));
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_ShiftKey1_128 (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128 ())) =
(va_QProc (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags])
(va_wp_ShiftKey1_128 f) (va_wpProof_ShiftKey1_128 f))
//--
//-- ShiftKey1_gf128_power
val va_code_ShiftKey1_gf128_power : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_ShiftKey1_gf128_power () =
(va_Block (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm 4)) (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm
5)) (va_CCons (va_code_PinsrdImm (va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12))
(va_CCons (va_code_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_ShiftKey1_128 ()) (va_CNil ()))))))))
val va_codegen_success_ShiftKey1_gf128_power : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ShiftKey1_gf128_power () =
(va_pbool_and (va_codegen_success_ZeroXmm (va_op_xmm_xmm 4)) (va_pbool_and
(va_codegen_success_ZeroXmm (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_PinsrdImm
(va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12))
(va_pbool_and (va_codegen_success_ShiftKey1_128 ()) (va_ttrue ())))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ShiftKey1_gf128_power (va_mods:va_mods_t) (h:poly) (n:nat) : (va_quickCode unit
(va_code_ShiftKey1_gf128_power ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 4)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 120 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 5)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 121 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 123 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12)) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 124 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_high_bit ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 125 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_low_shift_1 ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 127 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_128 gf128_modulus_low_terms) (fun (va_s:va_state) _ -> let
(va_arg16:Prims.nat) = n in let (va_arg15:Vale.Math.Poly2_s.poly) = h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_gf128_power va_arg15 va_arg16) (va_QEmpty (()))))))))))))
val va_lemma_ShiftKey1_gf128_power : va_b0:va_code -> va_s0:va_state -> h:poly -> n:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_gf128_power ()) va_s0 /\ va_get_ok va_s0 /\
(let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
avx_enabled /\ sse_enabled /\ hn == Vale.AES.GHash.g_power h n)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n) /\
va_state_eq 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_reg64 rR12 va_sM (va_update_flags
va_sM (va_update_ok va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_ShiftKey1_gf128_power va_b0 va_s0 h n =
let (va_mods:va_mods_t) = [va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags; va_Mod_ok] in
let va_qc = va_qcode_ShiftKey1_gf128_power va_mods h n in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftKey1_gf128_power ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 105 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ (let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in label va_range1
"***** POSTCONDITION NOT MET AT line 117 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_ShiftKey1_gf128_power (h:poly) (n:nat) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in avx_enabled /\ sse_enabled /\ hn == Vale.AES.GHash.g_power h n) /\
(forall (va_x_efl:Vale.X64.Flags.t) (va_x_r12:nat64) (va_x_xmm1:quad32) (va_x_xmm2:quad32)
(va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) . let va_sM = 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_reg64 rR12 va_x_r12 (va_upd_flags va_x_efl va_s0)))))) in va_get_ok va_sM /\ (let
(hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n) ==>
va_k va_sM (())))
val va_wpProof_ShiftKey1_gf128_power : h:poly -> n:nat -> va_s0:va_state -> va_k:(va_state -> unit
-> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ShiftKey1_gf128_power h n va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftKey1_gf128_power ()) ([va_Mod_xmm
5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_reg64 rR12; va_Mod_flags])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_ShiftKey1_gf128_power h n va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ShiftKey1_gf128_power (va_code_ShiftKey1_gf128_power ()) va_s0 h n
in
va_lemma_upd_update va_sM;
assert (va_state_eq 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_reg64 rR12 va_sM (va_update_flags
va_sM (va_update_ok va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_ShiftKey1_gf128_power (h:poly) (n:nat) : (va_quickCode unit
(va_code_ShiftKey1_gf128_power ())) =
(va_QProc (va_code_ShiftKey1_gf128_power ()) ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_reg64 rR12; va_Mod_flags]) (va_wp_ShiftKey1_gf128_power h n)
(va_wpProof_ShiftKey1_gf128_power h n))
//--
//-- Gf128_powers
val va_code_Gf128_powers : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gf128_powers () =
(va_Block (va_CCons (va_code_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) 32 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128
(va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons (va_code_ShiftKey1_gf128_power ()) (va_CCons
(va_code_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 0 Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 6))
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1))
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 16 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 48 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 64 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 96 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 112 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 0)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRax)) (va_CNil
()))))))))))))))))))))))))))))))))))))))))))))))
val va_codegen_success_Gf128_powers : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gf128_powers () =
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm
1)) (va_pbool_and (va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and
(va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 0 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 1)
(va_op_xmm_xmm 6)) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm
6)) (va_pbool_and (va_codegen_success_Gf128MulRev128 ()) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 16 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 48 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 64 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 96 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 112 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 0)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRax)) (va_ttrue
())))))))))))))))))))))))))))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gf128_powers (va_mods:va_mods_t) (h:poly) (hkeys_b:buffer128) : (va_quickCode unit
(va_code_Gf128_powers ())) =
(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 158 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 159 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 161 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (fun (va_s:va_state) _ -> let (va_arg57:Vale.Math.Poly2_s.poly) = h
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 162 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_1 va_arg57) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 163 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 164 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 165 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 166 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 0 Secret hkeys_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 168 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 169 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 170 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg56:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 171 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg56 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 172 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 173 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 174 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 2) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 175 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 16 Secret hkeys_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 177 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 178 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 179 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg55:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 180 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg55 2) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 181 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 182 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 183 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 184 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 48 Secret hkeys_b 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 186 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 187 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 188 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg54:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 189 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg54 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 190 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 191 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 192 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 193 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 64 Secret hkeys_b 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 195 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 196 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 197 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg53:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 198 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg53 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 199 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 200 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 5) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 202 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 96 Secret hkeys_b 6) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 205 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 206 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg52:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 207 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg52 5) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 208 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 209 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 210 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 6) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 211 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 112 Secret hkeys_b 7) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 213 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 0)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 214 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRax)) (va_QEmpty
(())))))))))))))))))))))))))))))))))))))))))))))))))))))
val va_lemma_Gf128_powers : va_b0:va_code -> va_s0:va_state -> h:poly -> hkeys_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gf128_powers ()) va_s0 /\ va_get_ok va_s0 /\
(pclmulqdq_enabled /\ avx_enabled /\ sse_enabled) /\ Vale.X64.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2
(va_get_mem_heaplet 1 va_s0)) == h))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_get_xmm 6 va_sM == va_get_xmm 6 va_s0 /\ va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0
/\ Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 hkeys_b)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 1 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 1 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 2 /\ Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1
va_sM) == Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_s0) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 3 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 3 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 4 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 4 /\ Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1
va_sM) == Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_s0) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 6 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 5 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 7 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 6 /\ va_state_eq 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 rR12 va_sM (va_update_reg64 rRax va_sM
(va_update_flags 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_Gf128_powers va_b0 va_s0 h hkeys_b =
let (va_mods:va_mods_t) = [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 rR12; va_Mod_reg64 rRax; va_Mod_flags;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gf128_powers va_mods h hkeys_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gf128_powers ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 131 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 145 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_xmm 6 va_sM == va_get_xmm 6 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 146 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 147 column 61 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 hkeys_b)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 148 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 1) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 149 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 1 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 2) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 151 column 84 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_sM) ==
Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 152 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 3 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 3) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 153 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 4 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 4) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 154 column 84 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_sM) ==
Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 155 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 6 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 5) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 156 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 7 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 6)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([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 rR12; va_Mod_reg64 rRax; va_Mod_flags;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Gf128_powers (h:poly) (hkeys_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (pclmulqdq_enabled /\ avx_enabled /\ sse_enabled) /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) hkeys_b
8 (va_get_mem_layout va_s0) Secret /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_s0)) == h /\ (forall
(va_x_mem:vale_heap) (va_x_heap1:vale_heap) (va_x_efl:Vale.X64.Flags.t) (va_x_rax:nat64)
(va_x_r12: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) . let va_sM = 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 rR12 va_x_r12 (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem
va_s0))))))))))) in va_get_ok va_sM /\ va_get_xmm 6 va_sM == va_get_xmm 6 va_s0 /\ va_get_reg64
rR12 va_sM == va_get_reg64 rR12 va_s0 /\ Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer
#Vale.X64.Memory.vuint128 hkeys_b) (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 1 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 1 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 2 /\ Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1
va_sM) == Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_s0) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 3 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 3 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 4 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 4 /\ Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1
va_sM) == Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_s0) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 6 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 5 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 7 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 6 ==> va_k va_sM (())))
val va_wpProof_Gf128_powers : h:poly -> hkeys_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_Gf128_powers h hkeys_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gf128_powers ()) ([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 rR12; va_Mod_reg64 rRax; va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Gf128_powers h hkeys_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Gf128_powers (va_code_Gf128_powers ()) va_s0 h hkeys_b in
va_lemma_upd_update va_sM;
assert (va_state_eq 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 rR12 va_sM (va_update_reg64 rRax va_sM (va_update_flags 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_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 rR12; va_Mod_reg64 rRax; va_Mod_flags;
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_Gf128_powers (h:poly) (hkeys_b:buffer128) : (va_quickCode unit (va_code_Gf128_powers
())) =
(va_QProc (va_code_Gf128_powers ()) ([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 rR12; va_Mod_reg64 rRax; va_Mod_flags;
va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_Gf128_powers h hkeys_b) (va_wpProof_Gf128_powers h
hkeys_b))
//--
//-- Keyhash_init
[@ "opaque_to_smt" va_qattr]
let va_code_Keyhash_init win alg =
(va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_InitPshufbMask (va_op_xmm_xmm
4) (va_op_reg_opr64_reg64 rR8)) (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm 0)) (va_CCons (if win
then va_Block (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRdx) (va_op_xmm_xmm 0) 80 Secret) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx)) (va_CNil ()))) else va_Block (va_CCons
(va_code_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRsi)
(va_op_xmm_xmm 0) 80 Secret) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR8)
(va_op_opr64_reg64 rRdi)) (va_CNil ())))) (va_CCons (va_code_AESEncryptBlock alg) (va_CCons
(va_code_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 4)) (va_CCons (if win then va_Block (va_CCons
(va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRdx)) (va_CNil ())) else
va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRsi))
(va_CNil ()))) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 0) 32 Secret) (va_CCons (va_code_Gf128_powers ())
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil
())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Keyhash_init win alg =
(va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and
(va_codegen_success_InitPshufbMask (va_op_xmm_xmm 4) (va_op_reg_opr64_reg64 rR8)) (va_pbool_and
(va_codegen_success_ZeroXmm (va_op_xmm_xmm 0)) (va_pbool_and (if win then va_pbool_and
(va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdx)
(va_op_xmm_xmm 0) 80 Secret) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64
rR8) (va_op_opr64_reg64 rRcx)) (va_ttrue ())) else va_pbool_and
(va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRsi)
(va_op_xmm_xmm 0) 80 Secret) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64
rR8) (va_op_opr64_reg64 rRdi)) (va_ttrue ()))) (va_pbool_and
(va_codegen_success_AESEncryptBlock alg) (va_pbool_and (va_codegen_success_Pshufb
(va_op_xmm_xmm 0) (va_op_xmm_xmm 4)) (va_pbool_and (if win then va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRdx)) (va_ttrue ())
else va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64
rRsi)) (va_ttrue ())) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 0) 32 Secret)
(va_pbool_and (va_codegen_success_Gf128_powers ()) (va_pbool_and
(va_codegen_success_DestroyHeaplets ()) (va_ttrue ())))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Keyhash_init (va_mods:va_mods_t) (win:bool) (alg:algorithm) (key:(seq nat32))
(roundkeys_b:buffer128) (hkeys_b:buffer128) : (va_quickCode unit (va_code_Keyhash_init win alg)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(round_ptr:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s)
(fun _ -> va_get_reg64 rRdi va_s) in let (hkey_ptr:(va_int_range 0 18446744073709551615)) =
va_if win (fun _ -> va_get_reg64 rRdx va_s) (fun _ -> va_get_reg64 rRsi va_s) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 252 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_CreateHeaplets ([declare_buffer128 roundkeys_b 0 Secret Immutable; declare_buffer128
hkeys_b 1 Secret Mutable])) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 256 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_InitPshufbMask (va_op_xmm_xmm 4) (va_op_reg_opr64_reg64 rR8)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 257 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 0)) (fun (va_s:va_state) _ -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 258 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 260 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdx)
(va_op_xmm_xmm 0) 80 Secret hkeys_b 5) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 261 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx)) (va_QEmpty (())))))
(qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 265 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRsi)
(va_op_xmm_xmm 0) 80 Secret hkeys_b 5) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 266 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRdi)) (va_QEmpty (())))))) (fun
(va_s:va_state) va_g -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 268 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_AESEncryptBlock alg (va_get_xmm 0 va_s) key (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s) roundkeys_b) roundkeys_b) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 269 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 4)) (fun (va_s:va_state) _ -> va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 270 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 272 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRdx)) (va_QEmpty (()))))
(qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 276 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRsi)) (va_QEmpty (()))))) (fun
(va_s:va_state) va_g -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 278 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 0) 32 Secret hkeys_b 2) (fun (va_s:va_state) _ -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 280 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128_powers (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 0 va_s)) hkeys_b) (fun
(va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 282 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
((fun (alg_10639:Vale.AES.AES_common_s.algorithm) (key_10640:(FStar.Seq.Base.seq
Vale.Def.Types_s.nat32)) (input_LE_10641:Vale.Def.Types_s.quad32) ->
Vale.AES.AES_s.is_aes_key_LE alg_10639 key_10640) alg key (Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 0)) (fun _ -> let (va_arg27:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.AES_s.aes_encrypt_LE alg key
(Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0)) in let (va_arg26:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s) hkeys_b in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 282 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_hkeys_reqs_pub_priv va_arg26 va_arg27) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 284 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_DestroyHeaplets ()) (va_QEmpty (())))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Keyhash_init va_b0 va_s0 win alg key roundkeys_b hkeys_b =
let (va_mods:va_mods_t) = [va_Mod_flags; 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_mem_layout; va_Mod_mem_heaplet 1; va_Mod_reg64
rR12; va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok;
va_Mod_mem] in
let va_qc = va_qcode_Keyhash_init va_mods win alg key roundkeys_b hkeys_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Keyhash_init win alg) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 219 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ (let (round_ptr:(va_int_range 0 18446744073709551615)) = va_if win (fun _
-> va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (hkey_ptr:(va_int_range 0
18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64
rRsi va_s0) in label va_range1
"***** POSTCONDITION NOT MET AT line 246 column 51 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.X64.Decls.modifies_buffer128 hkeys_b (va_get_mem va_s0) (va_get_mem va_sM)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 247 column 111 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.AES.OptPublic.hkeys_reqs_pub (Vale.X64.Decls.s128 (va_get_mem va_sM) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.AES_s.aes_encrypt_LE alg key
(Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0)))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 249 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_xmm 6 va_sM == va_get_xmm 6 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 250 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; 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_mem_layout; va_Mod_mem_heaplet 1; va_Mod_reg64
rR12; va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok;
va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM) | {
"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.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Words.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.GF128_Mul.fsti.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.OptPublic.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES256_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.GF128_Init.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"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.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"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.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.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.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"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 |
win: Prims.bool ->
alg: Vale.AES.AES_common_s.algorithm ->
key: FStar.Seq.Base.seq Vale.X64.Memory.nat32 ->
roundkeys_b: Vale.X64.Memory.buffer128 ->
hkeys_b: Vale.X64.Memory.buffer128 ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Prims.Ghost ((Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) * Prims.unit) | Prims.Ghost | [] | [] | [
"Prims.bool",
"Vale.AES.AES_common_s.algorithm",
"FStar.Seq.Base.seq",
"Vale.X64.Memory.nat32",
"Vale.X64.Memory.buffer128",
"Vale.X64.Decls.va_state",
"Prims.unit",
"Vale.X64.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple3",
"Vale.X64.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_xmm",
"Vale.X64.QuickCode.va_Mod_mem_layout",
"Vale.X64.QuickCode.va_Mod_mem_heaplet",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR12",
"Vale.X64.Machine_s.rR8",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRax",
"Vale.X64.QuickCode.va_Mod_mem",
"Prims.Nil",
"Prims._assert",
"Vale.X64.Decls.va_state_eq",
"Vale.X64.Decls.va_update_flags",
"Vale.X64.Decls.va_update_xmm",
"Vale.X64.Decls.va_update_mem_layout",
"Vale.X64.Decls.va_update_mem_heaplet",
"Vale.X64.Decls.va_update_reg64",
"Vale.X64.Decls.va_update_ok",
"Vale.X64.Decls.va_update_mem",
"Vale.X64.Decls.va_lemma_upd_update",
"FStar.Pervasives.Native.tuple3",
"FStar.Pervasives.Native.tuple2",
"Vale.X64.State.vale_state",
"Vale.AES.X64.GF128_Init.va_lemma_Keyhash_init",
"Vale.AES.X64.GF128_Init.va_code_Keyhash_init"
] | [] | false | false | false | false | false | let va_wpProof_Keyhash_init win alg key roundkeys_b hkeys_b va_s0 va_k =
| let va_sM, va_f0 =
va_lemma_Keyhash_init (va_code_Keyhash_init win alg) va_s0 win alg key roundkeys_b hkeys_b
in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM
(va_update_flags 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_mem_layout va_sM
(va_update_mem_heaplet 1
va_sM
(va_update_reg64 rR12
va_sM
(va_update_reg64 rR8
va_sM
(va_update_reg64 rRdx
va_sM
(va_update_reg64 rRcx
va_sM
(va_update_reg64 rRax
va_sM
(va_update_ok va_sM
(va_update_mem va_sM va_s0))))
))))))))))))));
va_lemma_norm_mods ([
va_Mod_flags; 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_mem_layout; va_Mod_mem_heaplet 1; va_Mod_reg64 rR12;
va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem
])
va_sM
va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | false |
Pulse.Lib.FlippableInv.fst | Pulse.Lib.FlippableInv.finv_p | val finv_p (p: vprop) (r: GR.ref bool) : vprop | val finv_p (p: vprop) (r: GR.ref bool) : vprop | let finv_p (p:vprop) (r : GR.ref bool) : vprop =
exists* (b:bool). GR.pts_to r #one_half b ** (if b then p else emp) | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.FlippableInv.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 69,
"end_line": 23,
"start_col": 0,
"start_line": 22
} | (*
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.Lib.FlippableInv
open Pulse.Lib.Pervasives
module GR = Pulse.Lib.GhostReference | {
"checked_file": "/",
"dependencies": [
"Pulse.Lib.Pervasives.fst.checked",
"Pulse.Lib.GhostReference.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Lib.FlippableInv.fst"
} | [
{
"abbrev": true,
"full_module": "Pulse.Lib.GhostReference",
"short_module": "GR"
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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: Pulse.Lib.Core.vprop -> r: Pulse.Lib.GhostReference.ref Prims.bool -> Pulse.Lib.Core.vprop | Prims.Tot | [
"total"
] | [] | [
"Pulse.Lib.Core.vprop",
"Pulse.Lib.GhostReference.ref",
"Prims.bool",
"Pulse.Lib.Core.op_exists_Star",
"Pulse.Lib.Core.op_Star_Star",
"Pulse.Lib.GhostReference.pts_to",
"Pulse.Lib.Core.one_half",
"Pulse.Lib.Core.emp"
] | [] | false | false | false | true | false | let finv_p (p: vprop) (r: GR.ref bool) : vprop =
| exists* (b: bool). GR.pts_to r #one_half b ** (if b then p else emp) | false |
Pulse.Lib.FlippableInv.fst | Pulse.Lib.FlippableInv.off | val off #p (fi : finv p) : vprop | val off #p (fi : finv p) : vprop | let off #p (fi : finv p) : vprop = GR.pts_to fi.r #one_half false | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.FlippableInv.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 65,
"end_line": 31,
"start_col": 0,
"start_line": 31
} | (*
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.Lib.FlippableInv
open Pulse.Lib.Pervasives
module GR = Pulse.Lib.GhostReference
let finv_p (p:vprop) (r : GR.ref bool) : vprop =
exists* (b:bool). GR.pts_to r #one_half b ** (if b then p else emp)
noeq
type finv (p:vprop) = {
r : GR.ref bool;
i : inv (finv_p p r);
} | {
"checked_file": "/",
"dependencies": [
"Pulse.Lib.Pervasives.fst.checked",
"Pulse.Lib.GhostReference.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Lib.FlippableInv.fst"
} | [
{
"abbrev": true,
"full_module": "Pulse.Lib.GhostReference",
"short_module": "GR"
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | fi: Pulse.Lib.FlippableInv.finv p -> Pulse.Lib.Core.vprop | Prims.Tot | [
"total"
] | [] | [
"Pulse.Lib.Core.vprop",
"Pulse.Lib.FlippableInv.finv",
"Pulse.Lib.GhostReference.pts_to",
"Prims.bool",
"Pulse.Lib.FlippableInv.__proj__Mkfinv__item__r",
"Pulse.Lib.Core.one_half"
] | [] | false | false | false | false | false | let off #p (fi: finv p) : vprop =
| GR.pts_to fi.r #one_half false | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.u8 | val u8: n:nat{n < 0x100} -> uint8 | val u8: n:nat{n < 0x100} -> uint8 | let u8 n = u8 n | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 15,
"end_line": 81,
"start_col": 0,
"start_line": 81
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | n: Prims.nat{n < 0x100} -> Lib.IntTypes.uint8 | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Lib.IntTypes.u8",
"Lib.IntTypes.uint8"
] | [] | false | false | false | false | false | let u8 n =
| u8 n | false |
Vale.AES.X64.GF128_Init.fst | Vale.AES.X64.GF128_Init.va_wpProof_Gf128_powers | val va_wpProof_Gf128_powers : h:poly -> hkeys_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_Gf128_powers h hkeys_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gf128_powers ()) ([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 rR12; va_Mod_reg64 rRax; va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0
va_k ((va_sM, va_f0, va_g)))) | val va_wpProof_Gf128_powers : h:poly -> hkeys_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_Gf128_powers h hkeys_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gf128_powers ()) ([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 rR12; va_Mod_reg64 rRax; va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0
va_k ((va_sM, va_f0, va_g)))) | let va_wpProof_Gf128_powers h hkeys_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Gf128_powers (va_code_Gf128_powers ()) va_s0 h hkeys_b in
va_lemma_upd_update va_sM;
assert (va_state_eq 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 rR12 va_sM (va_update_reg64 rRax va_sM (va_update_flags 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_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 rR12; va_Mod_reg64 rRax; va_Mod_flags;
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.X64.GF128_Init.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 22,
"end_line": 634,
"start_col": 0,
"start_line": 623
} | module Vale.AES.X64.GF128_Init
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.AES_s
open Vale.AES.AES256_helpers
open Vale.AES.X64.AES
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.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.AES.X64.GF128_Mul
open Vale.AES.GHash
open Vale.AES.OptPublic
//-- ShiftKey1_128
val va_code_ShiftKey1_128 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_ShiftKey1_128 () =
(va_Block (va_CCons (va_code_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_CCons
(va_code_ShiftLeft128_1 ()) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5))
(va_CCons (va_code_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 4)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_CNil ())))))))))
val va_codegen_success_ShiftKey1_128 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ShiftKey1_128 () =
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_ShiftLeft128_1 ()) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm
3) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pcmpeqd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3)
255) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4))
(va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_ttrue ()))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ShiftKey1_128 (va_mods:va_mods_t) (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s) in
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 88 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftLeft128_1 h) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 89 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32_mask h1) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 90 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_shift_define_i h 1 128) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 92 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 93 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 94 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_test_high_bit h) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 95 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 96 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_zero ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 97 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_ones ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 100 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 101 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_and_consts ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 102 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_opr128_xmm 3)) (va_QEmpty
(()))))))))))))))))
val va_lemma_ShiftKey1_128 : va_b0:va_code -> va_s0:va_state -> f:poly
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_128 ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127)))
(ensures (fun (va_sM, va_fM) -> 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 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) /\
va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0)))))))
[@"opaque_to_smt"]
let va_lemma_ShiftKey1_128 va_b0 va_s0 f =
let (va_mods:va_mods_t) = [va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok] in
let va_qc = va_qcode_ShiftKey1_128 va_mods f in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftKey1_128 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 68 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
label va_range1
"***** POSTCONDITION NOT MET AT line 85 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h)))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_ShiftKey1_128 (f:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) . let
va_sM = va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_flags
va_x_efl va_s0))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2_s.shift h 1 in let (offset:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) ==> va_k va_sM (())))
val va_wpProof_ShiftKey1_128 : f:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ShiftKey1_128 f va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_ShiftKey1_128 f va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ShiftKey1_128 (va_code_ShiftKey1_128 ()) va_s0 f in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0))))));
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_ShiftKey1_128 (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128 ())) =
(va_QProc (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags])
(va_wp_ShiftKey1_128 f) (va_wpProof_ShiftKey1_128 f))
//--
//-- ShiftKey1_gf128_power
val va_code_ShiftKey1_gf128_power : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_ShiftKey1_gf128_power () =
(va_Block (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm 4)) (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm
5)) (va_CCons (va_code_PinsrdImm (va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12))
(va_CCons (va_code_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_ShiftKey1_128 ()) (va_CNil ()))))))))
val va_codegen_success_ShiftKey1_gf128_power : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ShiftKey1_gf128_power () =
(va_pbool_and (va_codegen_success_ZeroXmm (va_op_xmm_xmm 4)) (va_pbool_and
(va_codegen_success_ZeroXmm (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_PinsrdImm
(va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12))
(va_pbool_and (va_codegen_success_ShiftKey1_128 ()) (va_ttrue ())))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ShiftKey1_gf128_power (va_mods:va_mods_t) (h:poly) (n:nat) : (va_quickCode unit
(va_code_ShiftKey1_gf128_power ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 4)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 120 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 5)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 121 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 123 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12)) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 124 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_high_bit ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 125 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_low_shift_1 ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 127 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_128 gf128_modulus_low_terms) (fun (va_s:va_state) _ -> let
(va_arg16:Prims.nat) = n in let (va_arg15:Vale.Math.Poly2_s.poly) = h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_gf128_power va_arg15 va_arg16) (va_QEmpty (()))))))))))))
val va_lemma_ShiftKey1_gf128_power : va_b0:va_code -> va_s0:va_state -> h:poly -> n:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_gf128_power ()) va_s0 /\ va_get_ok va_s0 /\
(let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
avx_enabled /\ sse_enabled /\ hn == Vale.AES.GHash.g_power h n)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n) /\
va_state_eq 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_reg64 rR12 va_sM (va_update_flags
va_sM (va_update_ok va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_ShiftKey1_gf128_power va_b0 va_s0 h n =
let (va_mods:va_mods_t) = [va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags; va_Mod_ok] in
let va_qc = va_qcode_ShiftKey1_gf128_power va_mods h n in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftKey1_gf128_power ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 105 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ (let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in label va_range1
"***** POSTCONDITION NOT MET AT line 117 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_ShiftKey1_gf128_power (h:poly) (n:nat) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in avx_enabled /\ sse_enabled /\ hn == Vale.AES.GHash.g_power h n) /\
(forall (va_x_efl:Vale.X64.Flags.t) (va_x_r12:nat64) (va_x_xmm1:quad32) (va_x_xmm2:quad32)
(va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) . let va_sM = 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_reg64 rR12 va_x_r12 (va_upd_flags va_x_efl va_s0)))))) in va_get_ok va_sM /\ (let
(hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n) ==>
va_k va_sM (())))
val va_wpProof_ShiftKey1_gf128_power : h:poly -> n:nat -> va_s0:va_state -> va_k:(va_state -> unit
-> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ShiftKey1_gf128_power h n va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftKey1_gf128_power ()) ([va_Mod_xmm
5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_reg64 rR12; va_Mod_flags])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_ShiftKey1_gf128_power h n va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ShiftKey1_gf128_power (va_code_ShiftKey1_gf128_power ()) va_s0 h n
in
va_lemma_upd_update va_sM;
assert (va_state_eq 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_reg64 rR12 va_sM (va_update_flags
va_sM (va_update_ok va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_ShiftKey1_gf128_power (h:poly) (n:nat) : (va_quickCode unit
(va_code_ShiftKey1_gf128_power ())) =
(va_QProc (va_code_ShiftKey1_gf128_power ()) ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_reg64 rR12; va_Mod_flags]) (va_wp_ShiftKey1_gf128_power h n)
(va_wpProof_ShiftKey1_gf128_power h n))
//--
//-- Gf128_powers
val va_code_Gf128_powers : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gf128_powers () =
(va_Block (va_CCons (va_code_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) 32 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128
(va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons (va_code_ShiftKey1_gf128_power ()) (va_CCons
(va_code_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 0 Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 6))
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1))
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 16 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 48 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 64 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 96 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 112 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 0)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRax)) (va_CNil
()))))))))))))))))))))))))))))))))))))))))))))))
val va_codegen_success_Gf128_powers : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gf128_powers () =
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm
1)) (va_pbool_and (va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and
(va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 0 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 1)
(va_op_xmm_xmm 6)) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm
6)) (va_pbool_and (va_codegen_success_Gf128MulRev128 ()) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 16 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 48 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 64 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 96 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 112 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 0)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRax)) (va_ttrue
())))))))))))))))))))))))))))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gf128_powers (va_mods:va_mods_t) (h:poly) (hkeys_b:buffer128) : (va_quickCode unit
(va_code_Gf128_powers ())) =
(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 158 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 159 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 161 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (fun (va_s:va_state) _ -> let (va_arg57:Vale.Math.Poly2_s.poly) = h
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 162 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_1 va_arg57) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 163 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 164 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 165 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 166 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 0 Secret hkeys_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 168 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 169 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 170 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg56:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 171 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg56 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 172 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 173 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 174 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 2) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 175 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 16 Secret hkeys_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 177 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 178 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 179 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg55:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 180 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg55 2) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 181 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 182 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 183 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 184 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 48 Secret hkeys_b 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 186 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 187 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 188 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg54:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 189 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg54 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 190 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 191 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 192 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 193 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 64 Secret hkeys_b 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 195 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 196 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 197 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg53:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 198 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg53 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 199 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 200 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 5) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 202 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 96 Secret hkeys_b 6) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 205 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 206 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg52:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 207 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg52 5) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 208 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 209 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 210 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 6) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 211 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 112 Secret hkeys_b 7) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 213 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 0)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 214 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRax)) (va_QEmpty
(())))))))))))))))))))))))))))))))))))))))))))))))))))))
val va_lemma_Gf128_powers : va_b0:va_code -> va_s0:va_state -> h:poly -> hkeys_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gf128_powers ()) va_s0 /\ va_get_ok va_s0 /\
(pclmulqdq_enabled /\ avx_enabled /\ sse_enabled) /\ Vale.X64.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2
(va_get_mem_heaplet 1 va_s0)) == h))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_get_xmm 6 va_sM == va_get_xmm 6 va_s0 /\ va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0
/\ Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 hkeys_b)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 1 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 1 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 2 /\ Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1
va_sM) == Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_s0) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 3 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 3 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 4 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 4 /\ Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1
va_sM) == Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_s0) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 6 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 5 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 7 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 6 /\ va_state_eq 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 rR12 va_sM (va_update_reg64 rRax va_sM
(va_update_flags 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_Gf128_powers va_b0 va_s0 h hkeys_b =
let (va_mods:va_mods_t) = [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 rR12; va_Mod_reg64 rRax; va_Mod_flags;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gf128_powers va_mods h hkeys_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gf128_powers ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 131 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 145 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_xmm 6 va_sM == va_get_xmm 6 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 146 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 147 column 61 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 hkeys_b)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 148 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 1) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 149 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 1 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 2) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 151 column 84 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_sM) ==
Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 152 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 3 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 3) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 153 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 4 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 4) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 154 column 84 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_sM) ==
Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 155 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 6 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 5) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 156 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 7 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 6)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([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 rR12; va_Mod_reg64 rRax; va_Mod_flags;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Gf128_powers (h:poly) (hkeys_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (pclmulqdq_enabled /\ avx_enabled /\ sse_enabled) /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) hkeys_b
8 (va_get_mem_layout va_s0) Secret /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_s0)) == h /\ (forall
(va_x_mem:vale_heap) (va_x_heap1:vale_heap) (va_x_efl:Vale.X64.Flags.t) (va_x_rax:nat64)
(va_x_r12: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) . let va_sM = 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 rR12 va_x_r12 (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem
va_s0))))))))))) in va_get_ok va_sM /\ va_get_xmm 6 va_sM == va_get_xmm 6 va_s0 /\ va_get_reg64
rR12 va_sM == va_get_reg64 rR12 va_s0 /\ Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer
#Vale.X64.Memory.vuint128 hkeys_b) (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 1 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 1 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 2 /\ Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1
va_sM) == Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_s0) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 3 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 3 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 4 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 4 /\ Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1
va_sM) == Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_s0) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 6 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 5 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 7 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 6 ==> va_k va_sM (())))
val va_wpProof_Gf128_powers : h:poly -> hkeys_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_Gf128_powers h hkeys_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gf128_powers ()) ([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 rR12; va_Mod_reg64 rRax; va_Mod_flags; va_Mod_mem_heaplet 1; 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.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Words.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.GF128_Mul.fsti.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.OptPublic.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES256_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.GF128_Init.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"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.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"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.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.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.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"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.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"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.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.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.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"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 |
h: Vale.Math.Poly2_s.poly ->
hkeys_b: Vale.X64.Memory.buffer128 ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Prims.Ghost ((Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) * Prims.unit) | Prims.Ghost | [] | [] | [
"Vale.Math.Poly2_s.poly",
"Vale.X64.Memory.buffer128",
"Vale.X64.Decls.va_state",
"Prims.unit",
"Vale.X64.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple3",
"Vale.X64.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_xmm",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR12",
"Vale.X64.Machine_s.rRax",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_mem_heaplet",
"Vale.X64.QuickCode.va_Mod_mem",
"Prims.Nil",
"Prims._assert",
"Vale.X64.Decls.va_state_eq",
"Vale.X64.Decls.va_update_xmm",
"Vale.X64.Decls.va_update_reg64",
"Vale.X64.Decls.va_update_flags",
"Vale.X64.Decls.va_update_mem_heaplet",
"Vale.X64.Decls.va_update_ok",
"Vale.X64.Decls.va_update_mem",
"Vale.X64.Decls.va_lemma_upd_update",
"FStar.Pervasives.Native.tuple3",
"FStar.Pervasives.Native.tuple2",
"Vale.X64.State.vale_state",
"Vale.AES.X64.GF128_Init.va_lemma_Gf128_powers",
"Vale.AES.X64.GF128_Init.va_code_Gf128_powers"
] | [] | false | false | false | false | false | let va_wpProof_Gf128_powers h hkeys_b va_s0 va_k =
| let va_sM, va_f0 = va_lemma_Gf128_powers (va_code_Gf128_powers ()) va_s0 h hkeys_b in
va_lemma_upd_update va_sM;
assert (va_state_eq 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 rR12
va_sM
(va_update_reg64 rRax
va_sM
(va_update_flags 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_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 rR12; va_Mod_reg64 rRax; va_Mod_flags; 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.X64.GF128_Init.fst | Vale.AES.X64.GF128_Init.va_qcode_Keyhash_init | val va_qcode_Keyhash_init
(va_mods: va_mods_t)
(win: bool)
(alg: algorithm)
(key: (seq nat32))
(roundkeys_b hkeys_b: buffer128)
: (va_quickCode unit (va_code_Keyhash_init win alg)) | val va_qcode_Keyhash_init
(va_mods: va_mods_t)
(win: bool)
(alg: algorithm)
(key: (seq nat32))
(roundkeys_b hkeys_b: buffer128)
: (va_quickCode unit (va_code_Keyhash_init win alg)) | let va_qcode_Keyhash_init (va_mods:va_mods_t) (win:bool) (alg:algorithm) (key:(seq nat32))
(roundkeys_b:buffer128) (hkeys_b:buffer128) : (va_quickCode unit (va_code_Keyhash_init win alg)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(round_ptr:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s)
(fun _ -> va_get_reg64 rRdi va_s) in let (hkey_ptr:(va_int_range 0 18446744073709551615)) =
va_if win (fun _ -> va_get_reg64 rRdx va_s) (fun _ -> va_get_reg64 rRsi va_s) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 252 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_CreateHeaplets ([declare_buffer128 roundkeys_b 0 Secret Immutable; declare_buffer128
hkeys_b 1 Secret Mutable])) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 256 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_InitPshufbMask (va_op_xmm_xmm 4) (va_op_reg_opr64_reg64 rR8)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 257 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 0)) (fun (va_s:va_state) _ -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 258 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 260 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdx)
(va_op_xmm_xmm 0) 80 Secret hkeys_b 5) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 261 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx)) (va_QEmpty (())))))
(qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 265 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRsi)
(va_op_xmm_xmm 0) 80 Secret hkeys_b 5) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 266 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRdi)) (va_QEmpty (())))))) (fun
(va_s:va_state) va_g -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 268 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_AESEncryptBlock alg (va_get_xmm 0 va_s) key (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s) roundkeys_b) roundkeys_b) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 269 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 4)) (fun (va_s:va_state) _ -> va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 270 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 272 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRdx)) (va_QEmpty (()))))
(qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 276 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRsi)) (va_QEmpty (()))))) (fun
(va_s:va_state) va_g -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 278 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 0) 32 Secret hkeys_b 2) (fun (va_s:va_state) _ -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 280 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128_powers (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 0 va_s)) hkeys_b) (fun
(va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 282 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
((fun (alg_10639:Vale.AES.AES_common_s.algorithm) (key_10640:(FStar.Seq.Base.seq
Vale.Def.Types_s.nat32)) (input_LE_10641:Vale.Def.Types_s.quad32) ->
Vale.AES.AES_s.is_aes_key_LE alg_10639 key_10640) alg key (Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 0)) (fun _ -> let (va_arg27:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.AES_s.aes_encrypt_LE alg key
(Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0)) in let (va_arg26:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s) hkeys_b in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 282 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_hkeys_reqs_pub_priv va_arg26 va_arg27) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 284 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))))))))))) | {
"file_name": "obj/Vale.AES.X64.GF128_Init.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 63,
"end_line": 745,
"start_col": 0,
"start_line": 685
} | module Vale.AES.X64.GF128_Init
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.AES_s
open Vale.AES.AES256_helpers
open Vale.AES.X64.AES
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.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.AES.X64.GF128_Mul
open Vale.AES.GHash
open Vale.AES.OptPublic
//-- ShiftKey1_128
val va_code_ShiftKey1_128 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_ShiftKey1_128 () =
(va_Block (va_CCons (va_code_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_CCons
(va_code_ShiftLeft128_1 ()) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5))
(va_CCons (va_code_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 4)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_CNil ())))))))))
val va_codegen_success_ShiftKey1_128 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ShiftKey1_128 () =
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_ShiftLeft128_1 ()) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm
3) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pcmpeqd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3)
255) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4))
(va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_ttrue ()))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ShiftKey1_128 (va_mods:va_mods_t) (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s) in
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 88 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftLeft128_1 h) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 89 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32_mask h1) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 90 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_shift_define_i h 1 128) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 92 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 93 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 94 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_test_high_bit h) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 95 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 96 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_zero ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 97 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_ones ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 100 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 101 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_and_consts ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 102 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_opr128_xmm 3)) (va_QEmpty
(()))))))))))))))))
val va_lemma_ShiftKey1_128 : va_b0:va_code -> va_s0:va_state -> f:poly
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_128 ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127)))
(ensures (fun (va_sM, va_fM) -> 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 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) /\
va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0)))))))
[@"opaque_to_smt"]
let va_lemma_ShiftKey1_128 va_b0 va_s0 f =
let (va_mods:va_mods_t) = [va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok] in
let va_qc = va_qcode_ShiftKey1_128 va_mods f in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftKey1_128 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 68 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
label va_range1
"***** POSTCONDITION NOT MET AT line 85 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h)))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_ShiftKey1_128 (f:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) . let
va_sM = va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_flags
va_x_efl va_s0))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2_s.shift h 1 in let (offset:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) ==> va_k va_sM (())))
val va_wpProof_ShiftKey1_128 : f:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ShiftKey1_128 f va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_ShiftKey1_128 f va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ShiftKey1_128 (va_code_ShiftKey1_128 ()) va_s0 f in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0))))));
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_ShiftKey1_128 (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128 ())) =
(va_QProc (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags])
(va_wp_ShiftKey1_128 f) (va_wpProof_ShiftKey1_128 f))
//--
//-- ShiftKey1_gf128_power
val va_code_ShiftKey1_gf128_power : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_ShiftKey1_gf128_power () =
(va_Block (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm 4)) (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm
5)) (va_CCons (va_code_PinsrdImm (va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12))
(va_CCons (va_code_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_ShiftKey1_128 ()) (va_CNil ()))))))))
val va_codegen_success_ShiftKey1_gf128_power : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ShiftKey1_gf128_power () =
(va_pbool_and (va_codegen_success_ZeroXmm (va_op_xmm_xmm 4)) (va_pbool_and
(va_codegen_success_ZeroXmm (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_PinsrdImm
(va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12))
(va_pbool_and (va_codegen_success_ShiftKey1_128 ()) (va_ttrue ())))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ShiftKey1_gf128_power (va_mods:va_mods_t) (h:poly) (n:nat) : (va_quickCode unit
(va_code_ShiftKey1_gf128_power ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 4)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 120 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 5)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 121 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 123 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12)) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 124 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_high_bit ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 125 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_low_shift_1 ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 127 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_128 gf128_modulus_low_terms) (fun (va_s:va_state) _ -> let
(va_arg16:Prims.nat) = n in let (va_arg15:Vale.Math.Poly2_s.poly) = h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_gf128_power va_arg15 va_arg16) (va_QEmpty (()))))))))))))
val va_lemma_ShiftKey1_gf128_power : va_b0:va_code -> va_s0:va_state -> h:poly -> n:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_gf128_power ()) va_s0 /\ va_get_ok va_s0 /\
(let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
avx_enabled /\ sse_enabled /\ hn == Vale.AES.GHash.g_power h n)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n) /\
va_state_eq 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_reg64 rR12 va_sM (va_update_flags
va_sM (va_update_ok va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_ShiftKey1_gf128_power va_b0 va_s0 h n =
let (va_mods:va_mods_t) = [va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags; va_Mod_ok] in
let va_qc = va_qcode_ShiftKey1_gf128_power va_mods h n in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftKey1_gf128_power ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 105 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ (let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in label va_range1
"***** POSTCONDITION NOT MET AT line 117 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_ShiftKey1_gf128_power (h:poly) (n:nat) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in avx_enabled /\ sse_enabled /\ hn == Vale.AES.GHash.g_power h n) /\
(forall (va_x_efl:Vale.X64.Flags.t) (va_x_r12:nat64) (va_x_xmm1:quad32) (va_x_xmm2:quad32)
(va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) . let va_sM = 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_reg64 rR12 va_x_r12 (va_upd_flags va_x_efl va_s0)))))) in va_get_ok va_sM /\ (let
(hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n) ==>
va_k va_sM (())))
val va_wpProof_ShiftKey1_gf128_power : h:poly -> n:nat -> va_s0:va_state -> va_k:(va_state -> unit
-> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ShiftKey1_gf128_power h n va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftKey1_gf128_power ()) ([va_Mod_xmm
5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_reg64 rR12; va_Mod_flags])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_ShiftKey1_gf128_power h n va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ShiftKey1_gf128_power (va_code_ShiftKey1_gf128_power ()) va_s0 h n
in
va_lemma_upd_update va_sM;
assert (va_state_eq 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_reg64 rR12 va_sM (va_update_flags
va_sM (va_update_ok va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_ShiftKey1_gf128_power (h:poly) (n:nat) : (va_quickCode unit
(va_code_ShiftKey1_gf128_power ())) =
(va_QProc (va_code_ShiftKey1_gf128_power ()) ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_reg64 rR12; va_Mod_flags]) (va_wp_ShiftKey1_gf128_power h n)
(va_wpProof_ShiftKey1_gf128_power h n))
//--
//-- Gf128_powers
val va_code_Gf128_powers : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gf128_powers () =
(va_Block (va_CCons (va_code_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) 32 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128
(va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons (va_code_ShiftKey1_gf128_power ()) (va_CCons
(va_code_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 0 Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 6))
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1))
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 16 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 48 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 64 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 96 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 112 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 0)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRax)) (va_CNil
()))))))))))))))))))))))))))))))))))))))))))))))
val va_codegen_success_Gf128_powers : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gf128_powers () =
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm
1)) (va_pbool_and (va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and
(va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 0 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 1)
(va_op_xmm_xmm 6)) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm
6)) (va_pbool_and (va_codegen_success_Gf128MulRev128 ()) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 16 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 48 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 64 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 96 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 112 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 0)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRax)) (va_ttrue
())))))))))))))))))))))))))))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gf128_powers (va_mods:va_mods_t) (h:poly) (hkeys_b:buffer128) : (va_quickCode unit
(va_code_Gf128_powers ())) =
(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 158 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 159 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 161 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (fun (va_s:va_state) _ -> let (va_arg57:Vale.Math.Poly2_s.poly) = h
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 162 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_1 va_arg57) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 163 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 164 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 165 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 166 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 0 Secret hkeys_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 168 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 169 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 170 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg56:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 171 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg56 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 172 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 173 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 174 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 2) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 175 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 16 Secret hkeys_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 177 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 178 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 179 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg55:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 180 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg55 2) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 181 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 182 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 183 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 184 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 48 Secret hkeys_b 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 186 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 187 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 188 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg54:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 189 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg54 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 190 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 191 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 192 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 193 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 64 Secret hkeys_b 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 195 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 196 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 197 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg53:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 198 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg53 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 199 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 200 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 5) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 202 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 96 Secret hkeys_b 6) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 205 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 206 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg52:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 207 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg52 5) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 208 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 209 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 210 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 6) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 211 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 112 Secret hkeys_b 7) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 213 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 0)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 214 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRax)) (va_QEmpty
(())))))))))))))))))))))))))))))))))))))))))))))))))))))
val va_lemma_Gf128_powers : va_b0:va_code -> va_s0:va_state -> h:poly -> hkeys_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gf128_powers ()) va_s0 /\ va_get_ok va_s0 /\
(pclmulqdq_enabled /\ avx_enabled /\ sse_enabled) /\ Vale.X64.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2
(va_get_mem_heaplet 1 va_s0)) == h))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_get_xmm 6 va_sM == va_get_xmm 6 va_s0 /\ va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0
/\ Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 hkeys_b)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 1 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 1 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 2 /\ Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1
va_sM) == Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_s0) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 3 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 3 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 4 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 4 /\ Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1
va_sM) == Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_s0) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 6 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 5 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 7 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 6 /\ va_state_eq 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 rR12 va_sM (va_update_reg64 rRax va_sM
(va_update_flags 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_Gf128_powers va_b0 va_s0 h hkeys_b =
let (va_mods:va_mods_t) = [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 rR12; va_Mod_reg64 rRax; va_Mod_flags;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gf128_powers va_mods h hkeys_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gf128_powers ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 131 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 145 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_xmm 6 va_sM == va_get_xmm 6 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 146 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 147 column 61 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 hkeys_b)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 148 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 1) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 149 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 1 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 2) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 151 column 84 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_sM) ==
Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 152 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 3 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 3) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 153 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 4 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 4) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 154 column 84 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_sM) ==
Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 155 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 6 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 5) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 156 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 7 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 6)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([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 rR12; va_Mod_reg64 rRax; va_Mod_flags;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Gf128_powers (h:poly) (hkeys_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (pclmulqdq_enabled /\ avx_enabled /\ sse_enabled) /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) hkeys_b
8 (va_get_mem_layout va_s0) Secret /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_s0)) == h /\ (forall
(va_x_mem:vale_heap) (va_x_heap1:vale_heap) (va_x_efl:Vale.X64.Flags.t) (va_x_rax:nat64)
(va_x_r12: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) . let va_sM = 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 rR12 va_x_r12 (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem
va_s0))))))))))) in va_get_ok va_sM /\ va_get_xmm 6 va_sM == va_get_xmm 6 va_s0 /\ va_get_reg64
rR12 va_sM == va_get_reg64 rR12 va_s0 /\ Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer
#Vale.X64.Memory.vuint128 hkeys_b) (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 1 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 1 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 2 /\ Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1
va_sM) == Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_s0) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 3 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 3 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 4 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 4 /\ Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1
va_sM) == Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_s0) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 6 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 5 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 7 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 6 ==> va_k va_sM (())))
val va_wpProof_Gf128_powers : h:poly -> hkeys_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_Gf128_powers h hkeys_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gf128_powers ()) ([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 rR12; va_Mod_reg64 rRax; va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Gf128_powers h hkeys_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Gf128_powers (va_code_Gf128_powers ()) va_s0 h hkeys_b in
va_lemma_upd_update va_sM;
assert (va_state_eq 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 rR12 va_sM (va_update_reg64 rRax va_sM (va_update_flags 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_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 rR12; va_Mod_reg64 rRax; va_Mod_flags;
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_Gf128_powers (h:poly) (hkeys_b:buffer128) : (va_quickCode unit (va_code_Gf128_powers
())) =
(va_QProc (va_code_Gf128_powers ()) ([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 rR12; va_Mod_reg64 rRax; va_Mod_flags;
va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_Gf128_powers h hkeys_b) (va_wpProof_Gf128_powers h
hkeys_b))
//--
//-- Keyhash_init
[@ "opaque_to_smt" va_qattr]
let va_code_Keyhash_init win alg =
(va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_InitPshufbMask (va_op_xmm_xmm
4) (va_op_reg_opr64_reg64 rR8)) (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm 0)) (va_CCons (if win
then va_Block (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRdx) (va_op_xmm_xmm 0) 80 Secret) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx)) (va_CNil ()))) else va_Block (va_CCons
(va_code_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRsi)
(va_op_xmm_xmm 0) 80 Secret) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR8)
(va_op_opr64_reg64 rRdi)) (va_CNil ())))) (va_CCons (va_code_AESEncryptBlock alg) (va_CCons
(va_code_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 4)) (va_CCons (if win then va_Block (va_CCons
(va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRdx)) (va_CNil ())) else
va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRsi))
(va_CNil ()))) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 0) 32 Secret) (va_CCons (va_code_Gf128_powers ())
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil
())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Keyhash_init win alg =
(va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and
(va_codegen_success_InitPshufbMask (va_op_xmm_xmm 4) (va_op_reg_opr64_reg64 rR8)) (va_pbool_and
(va_codegen_success_ZeroXmm (va_op_xmm_xmm 0)) (va_pbool_and (if win then va_pbool_and
(va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdx)
(va_op_xmm_xmm 0) 80 Secret) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64
rR8) (va_op_opr64_reg64 rRcx)) (va_ttrue ())) else va_pbool_and
(va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRsi)
(va_op_xmm_xmm 0) 80 Secret) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64
rR8) (va_op_opr64_reg64 rRdi)) (va_ttrue ()))) (va_pbool_and
(va_codegen_success_AESEncryptBlock alg) (va_pbool_and (va_codegen_success_Pshufb
(va_op_xmm_xmm 0) (va_op_xmm_xmm 4)) (va_pbool_and (if win then va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRdx)) (va_ttrue ())
else va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64
rRsi)) (va_ttrue ())) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 0) 32 Secret)
(va_pbool_and (va_codegen_success_Gf128_powers ()) (va_pbool_and
(va_codegen_success_DestroyHeaplets ()) (va_ttrue ()))))))))))) | {
"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.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Words.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.GF128_Mul.fsti.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.OptPublic.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES256_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.GF128_Init.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"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.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"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.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.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.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"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.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"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.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.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.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"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 |
va_mods: Vale.X64.QuickCode.va_mods_t ->
win: Prims.bool ->
alg: Vale.AES.AES_common_s.algorithm ->
key: FStar.Seq.Base.seq Vale.X64.Memory.nat32 ->
roundkeys_b: Vale.X64.Memory.buffer128 ->
hkeys_b: Vale.X64.Memory.buffer128
-> Vale.X64.QuickCode.va_quickCode Prims.unit
(Vale.AES.X64.GF128_Init.va_code_Keyhash_init win alg) | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCode.va_mods_t",
"Prims.bool",
"Vale.AES.AES_common_s.algorithm",
"FStar.Seq.Base.seq",
"Vale.X64.Memory.nat32",
"Vale.X64.Memory.buffer128",
"Vale.X64.QuickCodes.qblock",
"Prims.unit",
"Prims.Cons",
"Vale.X64.Decls.va_code",
"Vale.X64.InsMem.va_code_CreateHeaplets",
"Vale.X64.InsVector.va_code_InitPshufbMask",
"Vale.X64.Decls.va_op_xmm_xmm",
"Vale.X64.Decls.va_op_reg_opr64_reg64",
"Vale.X64.Machine_s.rR8",
"Vale.X64.InsVector.va_code_ZeroXmm",
"Vale.X64.QuickCodes.if_code",
"Vale.X64.QuickCodes.block",
"Vale.X64.InsVector.va_code_Store128_buffer",
"Vale.X64.Decls.va_op_heaplet_mem_heaplet",
"Vale.X64.Machine_s.rRdx",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.X64.InsBasic.va_code_Mov64",
"Vale.X64.Decls.va_op_dst_opr64_reg64",
"Vale.X64.Decls.va_op_opr64_reg64",
"Vale.X64.Machine_s.rRcx",
"Prims.Nil",
"Vale.X64.Machine_s.precode",
"Vale.X64.Decls.ins",
"Vale.X64.Decls.ocmp",
"Vale.X64.Machine_s.rRsi",
"Vale.X64.Machine_s.rRdi",
"Vale.AES.X64.AES.va_code_AESEncryptBlock",
"Vale.X64.InsVector.va_code_Pshufb",
"Vale.AES.X64.GF128_Init.va_code_Gf128_powers",
"Vale.X64.Machine_s.Block",
"Vale.X64.InsMem.va_code_DestroyHeaplets",
"Vale.X64.Decls.va_state",
"Vale.X64.QuickCodes.va_QSeq",
"Vale.X64.QuickCodes.va_range1",
"Vale.X64.InsMem.va_quick_CreateHeaplets",
"Vale.Arch.HeapImpl.buffer_info",
"Vale.X64.InsMem.declare_buffer128",
"Vale.Arch.HeapImpl.Immutable",
"Vale.Arch.HeapImpl.Mutable",
"Vale.X64.InsVector.va_quick_InitPshufbMask",
"Vale.X64.QuickCodes.va_QBind",
"Vale.X64.InsVector.va_quick_ZeroXmm",
"Vale.X64.QuickCodes.va_qInlineIf",
"Vale.X64.InsVector.va_quick_Store128_buffer",
"Vale.X64.InsBasic.va_quick_Mov64",
"Vale.X64.QuickCodes.va_QEmpty",
"Vale.X64.QuickCodes.quickCodes",
"Vale.AES.X64.AES.va_quick_AESEncryptBlock",
"Vale.X64.Decls.va_get_xmm",
"Vale.X64.Decls.buffer128_as_seq",
"Vale.X64.Decls.va_get_mem_heaplet",
"Vale.X64.InsVector.va_quick_Pshufb",
"Vale.AES.X64.GF128_Init.va_quick_Gf128_powers",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Vale.X64.QuickCodes.va_qAssertSquash",
"Vale.AES.AES_s.is_aes_key_LE",
"Prims.squash",
"Vale.X64.QuickCodes.va_qPURE",
"Prims.pure_post",
"Prims.l_and",
"Prims.l_True",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.l_iff",
"Vale.AES.OptPublic.hkeys_reqs_pub",
"Vale.AES.GHash.hkeys_reqs_priv",
"Vale.AES.GHash.lemma_hkeys_reqs_pub_priv",
"Vale.X64.InsMem.va_quick_DestroyHeaplets",
"Vale.Def.Types_s.quad32",
"Vale.X64.Decls.s128",
"Vale.Def.Types_s.reverse_bytes_quad32",
"Vale.AES.AES_s.aes_encrypt_LE",
"Vale.Def.Words_s.Mkfour",
"Vale.Def.Types_s.nat32",
"Vale.X64.Decls.va_int_range",
"Vale.X64.Decls.va_if",
"Vale.Def.Types_s.nat64",
"Prims.b2t",
"Vale.X64.Decls.va_get_reg64",
"Prims.l_not",
"Vale.X64.State.vale_state",
"Vale.X64.QuickCode.va_quickCode",
"Vale.AES.X64.GF128_Init.va_code_Keyhash_init"
] | [] | false | false | false | false | false | let va_qcode_Keyhash_init
(va_mods: va_mods_t)
(win: bool)
(alg: algorithm)
(key: (seq nat32))
(roundkeys_b hkeys_b: buffer128)
: (va_quickCode unit (va_code_Keyhash_init win alg)) =
| (qblock va_mods
(fun (va_s: va_state) ->
let va_old_s:va_state = va_s in
let round_ptr:(va_int_range 0 18446744073709551615) =
va_if win (fun _ -> va_get_reg64 rRcx va_s) (fun _ -> va_get_reg64 rRdi va_s)
in
let hkey_ptr:(va_int_range 0 18446744073709551615) =
va_if win (fun _ -> va_get_reg64 rRdx va_s) (fun _ -> va_get_reg64 rRsi va_s)
in
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 252 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_CreateHeaplets ([
declare_buffer128 roundkeys_b 0 Secret Immutable;
declare_buffer128 hkeys_b 1 Secret Mutable
]))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 256 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_InitPshufbMask (va_op_xmm_xmm 4) (va_op_reg_opr64_reg64 rR8))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 257 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 0))
(fun (va_s: va_state) _ ->
va_QBind va_range1
"***** PRECONDITION NOT MET AT line 258 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_qInlineIf va_mods
win
(qblock va_mods
(fun (va_s: va_state) ->
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 260 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRdx)
(va_op_xmm_xmm 0)
80
Secret
hkeys_b
5)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 261 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR8)
(va_op_opr64_reg64 rRcx))
(va_QEmpty (())))))
(qblock va_mods
(fun (va_s: va_state) ->
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 265 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRsi)
(va_op_xmm_xmm 0)
80
Secret
hkeys_b
5)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 266 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR8)
(va_op_opr64_reg64 rRdi))
(va_QEmpty (()))))))
(fun (va_s: va_state) va_g ->
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 268 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_AESEncryptBlock alg
(va_get_xmm 0 va_s)
key
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s)
roundkeys_b)
roundkeys_b)
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 269 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 4))
(fun (va_s: va_state) _ ->
va_QBind va_range1
"***** PRECONDITION NOT MET AT line 270 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_qInlineIf va_mods
win
(qblock va_mods
(fun (va_s: va_state) ->
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 272 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx)
(va_op_opr64_reg64 rRdx))
(va_QEmpty (()))))
(qblock va_mods
(fun (va_s: va_state) ->
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 276 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx)
(va_op_opr64_reg64 rRsi))
(va_QEmpty (())))))
(fun (va_s: va_state) va_g ->
va_QBind va_range1
"***** PRECONDITION NOT MET AT line 278 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1
)
(va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 0)
32
Secret
hkeys_b
2)
(fun (va_s: va_state) _ ->
va_QBind va_range1
"***** PRECONDITION NOT MET AT line 280 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128_powers (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 0 va_s))
hkeys_b)
(fun (va_s: va_state) _ ->
va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 282 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
((fun
(alg_10639:
Vale.AES.AES_common_s.algorithm)
(key_10640:
(FStar.Seq.Base.seq Vale.Def.Types_s.nat32
))
(input_LE_10641:
Vale.Def.Types_s.quad32)
->
Vale.AES.AES_s.is_aes_key_LE alg_10639
key_10640) alg
key
(Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 0))
(fun _ ->
let va_arg27:Vale.Def.Types_s.quad32 =
Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.AES_s.aes_encrypt_LE alg
key
(Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32
0
0
0
0))
in
let va_arg26:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32
) =
Vale.X64.Decls.s128 (va_get_mem_heaplet
1
va_s)
hkeys_b
in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 282 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_: unit) ->
Vale.AES.GHash.lemma_hkeys_reqs_pub_priv
va_arg26
va_arg27)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 284 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_DestroyHeaplets ())
(va_QEmpty (()))))))))))))))) | false |
Pulse.Lib.FlippableInv.fst | Pulse.Lib.FlippableInv.iname_of | val iname_of #p (f : finv p) : erased iname | val iname_of #p (f : finv p) : erased iname | let iname_of #p (f : finv p) : erased iname = name_of_inv f.i | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.FlippableInv.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 61,
"end_line": 55,
"start_col": 0,
"start_line": 55
} | (*
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.Lib.FlippableInv
open Pulse.Lib.Pervasives
module GR = Pulse.Lib.GhostReference
let finv_p (p:vprop) (r : GR.ref bool) : vprop =
exists* (b:bool). GR.pts_to r #one_half b ** (if b then p else emp)
noeq
type finv (p:vprop) = {
r : GR.ref bool;
i : inv (finv_p p r);
}
let off #p (fi : finv p) : vprop = GR.pts_to fi.r #one_half false
let on #p (fi : finv p) : vprop = GR.pts_to fi.r #one_half true
```pulse
fn __mk_finv (p:vprop)
requires emp
returns f:(finv p)
ensures off f
{
let r = GR.alloc false;
GR.share2 r;
rewrite emp
as (if false then p else emp);
fold finv_p p r;
let i = new_invariant (finv_p p r);
let fi = Mkfinv r i; // See #121
rewrite (GR.pts_to r #one_half false)
as (GR.pts_to fi.r #one_half false);
fold (off #p fi);
fi
}
```
let mk_finv = __mk_finv | {
"checked_file": "/",
"dependencies": [
"Pulse.Lib.Pervasives.fst.checked",
"Pulse.Lib.GhostReference.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Lib.FlippableInv.fst"
} | [
{
"abbrev": true,
"full_module": "Pulse.Lib.GhostReference",
"short_module": "GR"
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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: Pulse.Lib.FlippableInv.finv p -> FStar.Ghost.erased Pulse.Lib.Core.iname | Prims.Tot | [
"total"
] | [] | [
"Pulse.Lib.Core.vprop",
"Pulse.Lib.FlippableInv.finv",
"FStar.Ghost.hide",
"Pulse.Lib.Core.iname",
"Pulse.Lib.Core.name_of_inv",
"Pulse.Lib.FlippableInv.finv_p",
"Pulse.Lib.FlippableInv.__proj__Mkfinv__item__r",
"Pulse.Lib.FlippableInv.__proj__Mkfinv__item__i",
"FStar.Ghost.erased"
] | [] | false | false | false | false | false | let iname_of #p (f: finv p) : erased iname =
| name_of_inv f.i | false |
Hacl.Bignum256_32.fsti | Hacl.Bignum256_32.n_limbs | val n_limbs:BN.meta_len t_limbs | val n_limbs:BN.meta_len t_limbs | let n_limbs: BN.meta_len t_limbs = 8ul | {
"file_name": "code/bignum/Hacl.Bignum256_32.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 38,
"end_line": 15,
"start_col": 0,
"start_line": 15
} | module Hacl.Bignum256_32
open FStar.Mul
module BN = Hacl.Bignum
module BS = Hacl.Bignum.SafeAPI
module MA = Hacl.Bignum.MontArithmetic
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let t_limbs: Hacl.Bignum.Definitions.limb_t = Lib.IntTypes.U32 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Bignum.SafeAPI.fst.checked",
"Hacl.Bignum.MontArithmetic.fsti.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Bignum256_32.fsti"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | Hacl.Bignum.meta_len Hacl.Bignum256_32.t_limbs | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt32.__uint_to_t"
] | [] | false | false | false | true | false | let n_limbs:BN.meta_len t_limbs =
| 8ul | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test2_plaintext | val test2_plaintext:b: lbuffer uint8 3ul {recallable b} | val test2_plaintext:b: lbuffer uint8 3ul {recallable b} | let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 147,
"start_col": 0,
"start_line": 140
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(3ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test2_plaintext:b: lbuffer uint8 3ul {recallable b} =
| [@@ inline_let ]let l:list uint8 = normalize_term (List.Tot.map u8 [0x61; 0x62; 0x63]) in
assert_norm (List.Tot.length l == 3);
createL_mglobal l | false |
Pulse.Lib.FlippableInv.fst | Pulse.Lib.FlippableInv.mk_finv | val mk_finv (p:vprop) : stt (finv p) emp off | val mk_finv (p:vprop) : stt (finv p) emp off | let mk_finv = __mk_finv | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.FlippableInv.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 23,
"end_line": 53,
"start_col": 0,
"start_line": 53
} | (*
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.Lib.FlippableInv
open Pulse.Lib.Pervasives
module GR = Pulse.Lib.GhostReference
let finv_p (p:vprop) (r : GR.ref bool) : vprop =
exists* (b:bool). GR.pts_to r #one_half b ** (if b then p else emp)
noeq
type finv (p:vprop) = {
r : GR.ref bool;
i : inv (finv_p p r);
}
let off #p (fi : finv p) : vprop = GR.pts_to fi.r #one_half false
let on #p (fi : finv p) : vprop = GR.pts_to fi.r #one_half true
```pulse
fn __mk_finv (p:vprop)
requires emp
returns f:(finv p)
ensures off f
{
let r = GR.alloc false;
GR.share2 r;
rewrite emp
as (if false then p else emp);
fold finv_p p r;
let i = new_invariant (finv_p p r);
let fi = Mkfinv r i; // See #121
rewrite (GR.pts_to r #one_half false)
as (GR.pts_to fi.r #one_half false);
fold (off #p fi);
fi
} | {
"checked_file": "/",
"dependencies": [
"Pulse.Lib.Pervasives.fst.checked",
"Pulse.Lib.GhostReference.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Lib.FlippableInv.fst"
} | [
{
"abbrev": true,
"full_module": "Pulse.Lib.GhostReference",
"short_module": "GR"
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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: Pulse.Lib.Core.vprop
-> Pulse.Lib.Core.stt (Pulse.Lib.FlippableInv.finv p)
Pulse.Lib.Core.emp
Pulse.Lib.FlippableInv.off | Prims.Tot | [
"total"
] | [] | [
"Pulse.Lib.FlippableInv.__mk_finv"
] | [] | false | false | false | false | false | let mk_finv =
| __mk_finv | false |
Pulse.Lib.FlippableInv.fst | Pulse.Lib.FlippableInv.flip_on | val flip_on (#p:vprop) (fi : finv p) : stt_atomic unit (add_iname emp_inames (iname_of fi)) (off fi ** p) (fun () -> on fi) | val flip_on (#p:vprop) (fi : finv p) : stt_atomic unit (add_iname emp_inames (iname_of fi)) (off fi ** p) (fun () -> on fi) | let flip_on = _flip_on | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.FlippableInv.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 22,
"end_line": 83,
"start_col": 0,
"start_line": 83
} | (*
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.Lib.FlippableInv
open Pulse.Lib.Pervasives
module GR = Pulse.Lib.GhostReference
let finv_p (p:vprop) (r : GR.ref bool) : vprop =
exists* (b:bool). GR.pts_to r #one_half b ** (if b then p else emp)
noeq
type finv (p:vprop) = {
r : GR.ref bool;
i : inv (finv_p p r);
}
let off #p (fi : finv p) : vprop = GR.pts_to fi.r #one_half false
let on #p (fi : finv p) : vprop = GR.pts_to fi.r #one_half true
```pulse
fn __mk_finv (p:vprop)
requires emp
returns f:(finv p)
ensures off f
{
let r = GR.alloc false;
GR.share2 r;
rewrite emp
as (if false then p else emp);
fold finv_p p r;
let i = new_invariant (finv_p p r);
let fi = Mkfinv r i; // See #121
rewrite (GR.pts_to r #one_half false)
as (GR.pts_to fi.r #one_half false);
fold (off #p fi);
fi
}
```
let mk_finv = __mk_finv
let iname_of #p (f : finv p) : erased iname = name_of_inv f.i
```pulse
atomic
fn _flip_on (#p:vprop) (fi : finv p)
requires off fi ** p
ensures on fi
opens add_iname emp_inames (iname_of fi)
{
open Pulse.Lib.GhostReference;
with_invariants fi.i {
unfold off fi;
unfold finv_p p fi.r;
GR.gather2 fi.r;
rewrite (if false then p else emp)
as emp;
fi.r := true;
GR.share2 fi.r;
fold finv_p p fi.r;
fold (on fi)
}
} | {
"checked_file": "/",
"dependencies": [
"Pulse.Lib.Pervasives.fst.checked",
"Pulse.Lib.GhostReference.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Lib.FlippableInv.fst"
} | [
{
"abbrev": true,
"full_module": "Pulse.Lib.GhostReference",
"short_module": "GR"
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | fi: Pulse.Lib.FlippableInv.finv p
-> Pulse.Lib.Core.stt_atomic Prims.unit
(Pulse.Lib.Core.add_iname Pulse.Lib.Core.emp_inames
(FStar.Ghost.reveal (Pulse.Lib.FlippableInv.iname_of fi)))
(Pulse.Lib.FlippableInv.off fi ** p)
(fun _ -> Pulse.Lib.FlippableInv.on fi) | Prims.Tot | [
"total"
] | [] | [
"Pulse.Lib.FlippableInv._flip_on"
] | [] | false | false | false | false | false | let flip_on =
| _flip_on | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test1_plaintext | val test1_plaintext:b: lbuffer uint8 0ul {recallable b} | val test1_plaintext:b: lbuffer uint8 0ul {recallable b} | let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 92,
"start_col": 0,
"start_line": 86
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(0ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Nil"
] | [] | false | false | false | false | false | let test1_plaintext:b: lbuffer uint8 0ul {recallable b} =
| let open Lib.RawIntTypes in
[@@ inline_let ]let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test1_expected_sha3_224 | val test1_expected_sha3_224:b: lbuffer uint8 28ul {recallable b} | val test1_expected_sha3_224:b: lbuffer uint8 28ul {recallable b} | let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 102,
"start_col": 0,
"start_line": 94
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(28ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test1_expected_sha3_224:b: lbuffer uint8 28ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1;
0xab; 0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7
])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test3_expected_sha3_224 | val test3_expected_sha3_224:b: lbuffer uint8 28ul {recallable b} | val test3_expected_sha3_224:b: lbuffer uint8 28ul {recallable b} | let test3_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79; 0xba;
0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 215,
"start_col": 0,
"start_line": 207
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3
//
let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(28ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test3_expected_sha3_224:b: lbuffer uint8 28ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79;
0xba; 0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33
])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l | false |
Pulse.Lib.FlippableInv.fst | Pulse.Lib.FlippableInv.on | val on #p (fi : finv p) : vprop | val on #p (fi : finv p) : vprop | let on #p (fi : finv p) : vprop = GR.pts_to fi.r #one_half true | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.FlippableInv.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 64,
"end_line": 32,
"start_col": 0,
"start_line": 32
} | (*
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.Lib.FlippableInv
open Pulse.Lib.Pervasives
module GR = Pulse.Lib.GhostReference
let finv_p (p:vprop) (r : GR.ref bool) : vprop =
exists* (b:bool). GR.pts_to r #one_half b ** (if b then p else emp)
noeq
type finv (p:vprop) = {
r : GR.ref bool;
i : inv (finv_p p r);
} | {
"checked_file": "/",
"dependencies": [
"Pulse.Lib.Pervasives.fst.checked",
"Pulse.Lib.GhostReference.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Lib.FlippableInv.fst"
} | [
{
"abbrev": true,
"full_module": "Pulse.Lib.GhostReference",
"short_module": "GR"
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | fi: Pulse.Lib.FlippableInv.finv p -> Pulse.Lib.Core.vprop | Prims.Tot | [
"total"
] | [] | [
"Pulse.Lib.Core.vprop",
"Pulse.Lib.FlippableInv.finv",
"Pulse.Lib.GhostReference.pts_to",
"Prims.bool",
"Pulse.Lib.FlippableInv.__proj__Mkfinv__item__r",
"Pulse.Lib.Core.one_half"
] | [] | false | false | false | false | false | let on #p (fi: finv p) : vprop =
| GR.pts_to fi.r #one_half true | false |
Hacl.Bignum256_32.fsti | Hacl.Bignum256_32.n_bytes | val n_bytes : FStar.UInt32.t | let n_bytes = n_limbs `FStar.UInt32.mul` 4ul | {
"file_name": "code/bignum/Hacl.Bignum256_32.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 44,
"end_line": 18,
"start_col": 0,
"start_line": 18
} | module Hacl.Bignum256_32
open FStar.Mul
module BN = Hacl.Bignum
module BS = Hacl.Bignum.SafeAPI
module MA = Hacl.Bignum.MontArithmetic
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let t_limbs: Hacl.Bignum.Definitions.limb_t = Lib.IntTypes.U32
inline_for_extraction noextract
let n_limbs: BN.meta_len t_limbs = 8ul | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Bignum.SafeAPI.fst.checked",
"Hacl.Bignum.MontArithmetic.fsti.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Bignum256_32.fsti"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | FStar.UInt32.t | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt32.mul",
"Hacl.Bignum256_32.n_limbs",
"FStar.UInt32.__uint_to_t"
] | [] | false | false | false | true | false | let n_bytes =
| n_limbs `FStar.UInt32.mul` 4ul | false |
|
Pulse.Checker.Prover.Substs.fsti | Pulse.Checker.Prover.Substs.sel | val sel : ss: Pulse.Checker.Prover.Substs.ss_t ->
x: Pulse.Syntax.Base.var{Pulse.Checker.Prover.Substs.contains ss x}
-> Pulse.Syntax.Base.term | let sel (ss:ss_t) (x:var { contains ss x }) = Map.sel (as_map ss) x | {
"file_name": "lib/steel/pulse/Pulse.Checker.Prover.Substs.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 67,
"end_line": 37,
"start_col": 0,
"start_line": 37
} | (*
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.Prover.Substs
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Typing.Env
open Pulse.Typing
module L = FStar.List.Tot
module T = FStar.Tactics
module Env = Pulse.Typing.Env
val ss_t : Type0
val ln_ss_t (s:ss_t) : bool
val as_map (ss:ss_t) : Map.t var term
let dom (ss:ss_t) = Map.domain (as_map ss) | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Env.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"prims.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Checker.Prover.Substs.fsti"
} | [
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Env",
"short_module": "Env"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Env",
"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": "Pulse.Typing.Env",
"short_module": "Env"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"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.Env",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Prover",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Prover",
"short_module": null
},
{
"abbrev": 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 |
ss: Pulse.Checker.Prover.Substs.ss_t ->
x: Pulse.Syntax.Base.var{Pulse.Checker.Prover.Substs.contains ss x}
-> Pulse.Syntax.Base.term | Prims.Tot | [
"total"
] | [] | [
"Pulse.Checker.Prover.Substs.ss_t",
"Pulse.Syntax.Base.var",
"Prims.b2t",
"Pulse.Checker.Prover.Substs.contains",
"FStar.Map.sel",
"Pulse.Syntax.Base.term",
"Pulse.Checker.Prover.Substs.as_map"
] | [] | false | false | false | false | false | let sel (ss: ss_t) (x: var{contains ss x}) =
| Map.sel (as_map ss) x | false |
|
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test_shake128 | val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1) | val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1) | let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame () | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 14,
"end_line": 59,
"start_col": 0,
"start_line": 54
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 |
msg_len: Lib.IntTypes.size_t ->
msg: Lib.Buffer.lbuffer Lib.IntTypes.uint8 msg_len ->
out_len: Lib.IntTypes.size_t{Lib.IntTypes.v out_len > 0} ->
expected: Lib.Buffer.lbuffer Lib.IntTypes.uint8 out_len
-> FStar.HyperStack.ST.Stack Prims.unit | FStar.HyperStack.ST.Stack | [] | [] | [
"Lib.IntTypes.size_t",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"Prims.b2t",
"Prims.op_GreaterThan",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"FStar.HyperStack.ST.pop_frame",
"Prims.unit",
"C.exit",
"FStar.Int32.__int_to_t",
"Prims.bool",
"Prims.op_Negation",
"Lib.PrintBuffer.result_compare_display",
"Lib.Buffer.to_const",
"Lib.Buffer.MUT",
"Hacl.SHA3.shake128_hacl",
"Lib.Buffer.lbuffer_t",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.create",
"Lib.IntTypes.u8",
"FStar.HyperStack.ST.push_frame"
] | [] | false | true | false | false | false | let test_shake128 msg_len msg out_len expected =
| push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame () | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test2_expected_sha3_256 | val test2_expected_sha3_256:b: lbuffer uint8 32ul {recallable b} | val test2_expected_sha3_256:b: lbuffer uint8 32ul {recallable b} | let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 167,
"start_col": 0,
"start_line": 159
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(32ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test2_expected_sha3_256:b: lbuffer uint8 32ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90;
0xbd; 0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43;
0x15; 0x32
])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test_shake256 | val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1) | val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1) | let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame () | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 14,
"end_line": 76,
"start_col": 0,
"start_line": 71
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 |
msg_len: Lib.IntTypes.size_t ->
msg: Lib.Buffer.lbuffer Lib.IntTypes.uint8 msg_len ->
out_len: Lib.IntTypes.size_t{Lib.IntTypes.v out_len > 0} ->
expected: Lib.Buffer.lbuffer Lib.IntTypes.uint8 out_len
-> FStar.HyperStack.ST.Stack Prims.unit | FStar.HyperStack.ST.Stack | [] | [] | [
"Lib.IntTypes.size_t",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"Prims.b2t",
"Prims.op_GreaterThan",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"FStar.HyperStack.ST.pop_frame",
"Prims.unit",
"C.exit",
"FStar.Int32.__int_to_t",
"Prims.bool",
"Prims.op_Negation",
"Lib.PrintBuffer.result_compare_display",
"Lib.Buffer.to_const",
"Lib.Buffer.MUT",
"Hacl.SHA3.shake256_hacl",
"Lib.Buffer.lbuffer_t",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.create",
"Lib.IntTypes.u8",
"FStar.HyperStack.ST.push_frame"
] | [] | false | true | false | false | false | let test_shake256 msg_len msg out_len expected =
| push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame () | false |
Pulse.Lib.FlippableInv.fst | Pulse.Lib.FlippableInv.flip_off | val flip_off (#p:vprop) (fi : finv p) : stt_atomic unit (add_iname emp_inames (iname_of fi)) (on fi) (fun () -> off fi ** p) | val flip_off (#p:vprop) (fi : finv p) : stt_atomic unit (add_iname emp_inames (iname_of fi)) (on fi) (fun () -> off fi ** p) | let flip_off = _flip_off | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.FlippableInv.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 24,
"end_line": 111,
"start_col": 0,
"start_line": 111
} | (*
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.Lib.FlippableInv
open Pulse.Lib.Pervasives
module GR = Pulse.Lib.GhostReference
let finv_p (p:vprop) (r : GR.ref bool) : vprop =
exists* (b:bool). GR.pts_to r #one_half b ** (if b then p else emp)
noeq
type finv (p:vprop) = {
r : GR.ref bool;
i : inv (finv_p p r);
}
let off #p (fi : finv p) : vprop = GR.pts_to fi.r #one_half false
let on #p (fi : finv p) : vprop = GR.pts_to fi.r #one_half true
```pulse
fn __mk_finv (p:vprop)
requires emp
returns f:(finv p)
ensures off f
{
let r = GR.alloc false;
GR.share2 r;
rewrite emp
as (if false then p else emp);
fold finv_p p r;
let i = new_invariant (finv_p p r);
let fi = Mkfinv r i; // See #121
rewrite (GR.pts_to r #one_half false)
as (GR.pts_to fi.r #one_half false);
fold (off #p fi);
fi
}
```
let mk_finv = __mk_finv
let iname_of #p (f : finv p) : erased iname = name_of_inv f.i
```pulse
atomic
fn _flip_on (#p:vprop) (fi : finv p)
requires off fi ** p
ensures on fi
opens add_iname emp_inames (iname_of fi)
{
open Pulse.Lib.GhostReference;
with_invariants fi.i {
unfold off fi;
unfold finv_p p fi.r;
GR.gather2 fi.r;
rewrite (if false then p else emp)
as emp;
fi.r := true;
GR.share2 fi.r;
fold finv_p p fi.r;
fold (on fi)
}
}
```
let flip_on = _flip_on
```pulse
atomic
fn _flip_off (#p:vprop) (fi : finv p)
requires on fi
ensures off fi ** p
opens add_iname emp_inames (iname_of fi)
{
open Pulse.Lib.GhostReference;
with_invariants fi.i {
unfold on fi;
unfold finv_p p fi.r;
GR.gather2 fi.r;
fi.r := false;
GR.share2 fi.r;
rewrite emp
as (if false then p else emp);
fold finv_p p fi.r;
fold (off fi)
}
} | {
"checked_file": "/",
"dependencies": [
"Pulse.Lib.Pervasives.fst.checked",
"Pulse.Lib.GhostReference.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Lib.FlippableInv.fst"
} | [
{
"abbrev": true,
"full_module": "Pulse.Lib.GhostReference",
"short_module": "GR"
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | fi: Pulse.Lib.FlippableInv.finv p
-> Pulse.Lib.Core.stt_atomic Prims.unit
(Pulse.Lib.Core.add_iname Pulse.Lib.Core.emp_inames
(FStar.Ghost.reveal (Pulse.Lib.FlippableInv.iname_of fi)))
(Pulse.Lib.FlippableInv.on fi)
(fun _ -> Pulse.Lib.FlippableInv.off fi ** p) | Prims.Tot | [
"total"
] | [] | [
"Pulse.Lib.FlippableInv._flip_off"
] | [] | false | false | false | false | false | let flip_off =
| _flip_off | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test3_plaintext | val test3_plaintext:b: lbuffer uint8 56ul {recallable b} | val test3_plaintext:b: lbuffer uint8 56ul {recallable b} | let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 205,
"start_col": 0,
"start_line": 195
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(56ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test3_plaintext:b: lbuffer uint8 56ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66;
0x67; 0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69;
0x6a; 0x6b; 0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c;
0x6d; 0x6e; 0x6f; 0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71
])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test5_plaintext_shake128 | val test5_plaintext_shake128:b: lbuffer uint8 0ul {recallable b} | val test5_plaintext_shake128:b: lbuffer uint8 0ul {recallable b} | let test5_plaintext_shake128: b:lbuffer uint8 0ul{ recallable b } =
[@ inline_let]
let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 318,
"start_col": 0,
"start_line": 314
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3
//
let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l
let test3_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79; 0xba;
0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test3_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x41; 0xc0; 0xdb; 0xa2; 0xa9; 0xd6; 0x24; 0x08; 0x49; 0x10; 0x03; 0x76; 0xa8; 0x23; 0x5e; 0x2c;
0x82; 0xe1; 0xb9; 0x99; 0x8a; 0x99; 0x9e; 0x21; 0xdb; 0x32; 0xdd; 0x97; 0x49; 0x6d; 0x33; 0x76])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test3_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x99; 0x1c; 0x66; 0x57; 0x55; 0xeb; 0x3a; 0x4b; 0x6b; 0xbd; 0xfb; 0x75; 0xc7; 0x8a; 0x49; 0x2e;
0x8c; 0x56; 0xa2; 0x2c; 0x5c; 0x4d; 0x7e; 0x42; 0x9b; 0xfd; 0xbc; 0x32; 0xb9; 0xd4; 0xad; 0x5a;
0xa0; 0x4a; 0x1f; 0x07; 0x6e; 0x62; 0xfe; 0xa1; 0x9e; 0xef; 0x51; 0xac; 0xd0; 0x65; 0x7c; 0x22])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test3_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x04; 0xa3; 0x71; 0xe8; 0x4e; 0xcf; 0xb5; 0xb8; 0xb7; 0x7c; 0xb4; 0x86; 0x10; 0xfc; 0xa8; 0x18;
0x2d; 0xd4; 0x57; 0xce; 0x6f; 0x32; 0x6a; 0x0f; 0xd3; 0xd7; 0xec; 0x2f; 0x1e; 0x91; 0x63; 0x6d;
0xee; 0x69; 0x1f; 0xbe; 0x0c; 0x98; 0x53; 0x02; 0xba; 0x1b; 0x0d; 0x8d; 0xc7; 0x8c; 0x08; 0x63;
0x46; 0xb5; 0x33; 0xb4; 0x9c; 0x03; 0x0d; 0x99; 0xa2; 0x7d; 0xaf; 0x11; 0x39; 0xd6; 0xe7; 0x5e])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test4_SHA3
//
let test4_plaintext: b:lbuffer uint8 112ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69;
0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b;
0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d;
0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f;
0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71;
0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73;
0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x75])
in
assert_norm (List.Tot.length l == 112);
createL_mglobal l
let test4_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x54; 0x3e; 0x68; 0x68; 0xe1; 0x66; 0x6c; 0x1a; 0x64; 0x36; 0x30; 0xdf; 0x77; 0x36; 0x7a; 0xe5;
0xa6; 0x2a; 0x85; 0x07; 0x0a; 0x51; 0xc1; 0x4c; 0xbf; 0x66; 0x5c; 0xbc])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test4_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x91; 0x6f; 0x60; 0x61; 0xfe; 0x87; 0x97; 0x41; 0xca; 0x64; 0x69; 0xb4; 0x39; 0x71; 0xdf; 0xdb;
0x28; 0xb1; 0xa3; 0x2d; 0xc3; 0x6c; 0xb3; 0x25; 0x4e; 0x81; 0x2b; 0xe2; 0x7a; 0xad; 0x1d; 0x18])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test4_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x79; 0x40; 0x7d; 0x3b; 0x59; 0x16; 0xb5; 0x9c; 0x3e; 0x30; 0xb0; 0x98; 0x22; 0x97; 0x47; 0x91;
0xc3; 0x13; 0xfb; 0x9e; 0xcc; 0x84; 0x9e; 0x40; 0x6f; 0x23; 0x59; 0x2d; 0x04; 0xf6; 0x25; 0xdc;
0x8c; 0x70; 0x9b; 0x98; 0xb4; 0x3b; 0x38; 0x52; 0xb3; 0x37; 0x21; 0x61; 0x79; 0xaa; 0x7f; 0xc7])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test4_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xaf; 0xeb; 0xb2; 0xef; 0x54; 0x2e; 0x65; 0x79; 0xc5; 0x0c; 0xad; 0x06; 0xd2; 0xe5; 0x78; 0xf9;
0xf8; 0xdd; 0x68; 0x81; 0xd7; 0xdc; 0x82; 0x4d; 0x26; 0x36; 0x0f; 0xee; 0xbf; 0x18; 0xa4; 0xfa;
0x73; 0xe3; 0x26; 0x11; 0x22; 0x94; 0x8e; 0xfc; 0xfd; 0x49; 0x2e; 0x74; 0xe8; 0x2e; 0x21; 0x89;
0xed; 0x0f; 0xb4; 0x40; 0xd1; 0x87; 0xf3; 0x82; 0x27; 0x0c; 0xb4; 0x55; 0xf2; 0x1d; 0xd1; 0x85])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test5_SHAKE128 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(0ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Nil"
] | [] | false | false | false | false | false | let test5_plaintext_shake128:b: lbuffer uint8 0ul {recallable b} =
| [@@ inline_let ]let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test6_expected_shake128 | val test6_expected_shake128:b: lbuffer uint8 16ul {recallable b} | val test6_expected_shake128:b: lbuffer uint8 16ul {recallable b} | let test6_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xfb; 0xfb; 0xa5; 0xc1; 0xe1; 0x79; 0xdf; 0x14; 0x69; 0xfc; 0xc8; 0x58; 0x8a; 0xe5; 0xd2; 0xcc])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 347,
"start_col": 0,
"start_line": 340
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3
//
let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l
let test3_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79; 0xba;
0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test3_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x41; 0xc0; 0xdb; 0xa2; 0xa9; 0xd6; 0x24; 0x08; 0x49; 0x10; 0x03; 0x76; 0xa8; 0x23; 0x5e; 0x2c;
0x82; 0xe1; 0xb9; 0x99; 0x8a; 0x99; 0x9e; 0x21; 0xdb; 0x32; 0xdd; 0x97; 0x49; 0x6d; 0x33; 0x76])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test3_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x99; 0x1c; 0x66; 0x57; 0x55; 0xeb; 0x3a; 0x4b; 0x6b; 0xbd; 0xfb; 0x75; 0xc7; 0x8a; 0x49; 0x2e;
0x8c; 0x56; 0xa2; 0x2c; 0x5c; 0x4d; 0x7e; 0x42; 0x9b; 0xfd; 0xbc; 0x32; 0xb9; 0xd4; 0xad; 0x5a;
0xa0; 0x4a; 0x1f; 0x07; 0x6e; 0x62; 0xfe; 0xa1; 0x9e; 0xef; 0x51; 0xac; 0xd0; 0x65; 0x7c; 0x22])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test3_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x04; 0xa3; 0x71; 0xe8; 0x4e; 0xcf; 0xb5; 0xb8; 0xb7; 0x7c; 0xb4; 0x86; 0x10; 0xfc; 0xa8; 0x18;
0x2d; 0xd4; 0x57; 0xce; 0x6f; 0x32; 0x6a; 0x0f; 0xd3; 0xd7; 0xec; 0x2f; 0x1e; 0x91; 0x63; 0x6d;
0xee; 0x69; 0x1f; 0xbe; 0x0c; 0x98; 0x53; 0x02; 0xba; 0x1b; 0x0d; 0x8d; 0xc7; 0x8c; 0x08; 0x63;
0x46; 0xb5; 0x33; 0xb4; 0x9c; 0x03; 0x0d; 0x99; 0xa2; 0x7d; 0xaf; 0x11; 0x39; 0xd6; 0xe7; 0x5e])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test4_SHA3
//
let test4_plaintext: b:lbuffer uint8 112ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69;
0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b;
0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d;
0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f;
0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71;
0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73;
0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x75])
in
assert_norm (List.Tot.length l == 112);
createL_mglobal l
let test4_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x54; 0x3e; 0x68; 0x68; 0xe1; 0x66; 0x6c; 0x1a; 0x64; 0x36; 0x30; 0xdf; 0x77; 0x36; 0x7a; 0xe5;
0xa6; 0x2a; 0x85; 0x07; 0x0a; 0x51; 0xc1; 0x4c; 0xbf; 0x66; 0x5c; 0xbc])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test4_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x91; 0x6f; 0x60; 0x61; 0xfe; 0x87; 0x97; 0x41; 0xca; 0x64; 0x69; 0xb4; 0x39; 0x71; 0xdf; 0xdb;
0x28; 0xb1; 0xa3; 0x2d; 0xc3; 0x6c; 0xb3; 0x25; 0x4e; 0x81; 0x2b; 0xe2; 0x7a; 0xad; 0x1d; 0x18])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test4_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x79; 0x40; 0x7d; 0x3b; 0x59; 0x16; 0xb5; 0x9c; 0x3e; 0x30; 0xb0; 0x98; 0x22; 0x97; 0x47; 0x91;
0xc3; 0x13; 0xfb; 0x9e; 0xcc; 0x84; 0x9e; 0x40; 0x6f; 0x23; 0x59; 0x2d; 0x04; 0xf6; 0x25; 0xdc;
0x8c; 0x70; 0x9b; 0x98; 0xb4; 0x3b; 0x38; 0x52; 0xb3; 0x37; 0x21; 0x61; 0x79; 0xaa; 0x7f; 0xc7])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test4_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xaf; 0xeb; 0xb2; 0xef; 0x54; 0x2e; 0x65; 0x79; 0xc5; 0x0c; 0xad; 0x06; 0xd2; 0xe5; 0x78; 0xf9;
0xf8; 0xdd; 0x68; 0x81; 0xd7; 0xdc; 0x82; 0x4d; 0x26; 0x36; 0x0f; 0xee; 0xbf; 0x18; 0xa4; 0xfa;
0x73; 0xe3; 0x26; 0x11; 0x22; 0x94; 0x8e; 0xfc; 0xfd; 0x49; 0x2e; 0x74; 0xe8; 0x2e; 0x21; 0x89;
0xed; 0x0f; 0xb4; 0x40; 0xd1; 0x87; 0xf3; 0x82; 0x27; 0x0c; 0xb4; 0x55; 0xf2; 0x1d; 0xd1; 0x85])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test5_SHAKE128
//
let test5_plaintext_shake128: b:lbuffer uint8 0ul{ recallable b } =
[@ inline_let]
let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test5_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7f; 0x9c; 0x2b; 0xa4; 0xe8; 0x8f; 0x82; 0x7d; 0x61; 0x60; 0x45; 0x50; 0x76; 0x05; 0x85; 0x3e])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test6_SHAKE128
//
let test6_plaintext_shake128: b:lbuffer uint8 14ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x52; 0x97; 0x7e; 0x53; 0x2b; 0xcc; 0xdb; 0x89; 0xdf; 0xef; 0xf7; 0xe9; 0xe4; 0xad]) in
assert_norm (List.Tot.length l == 14);
createL_mglobal l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(16ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test6_expected_shake128:b: lbuffer uint8 16ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0xfb; 0xfb; 0xa5; 0xc1; 0xe1; 0x79; 0xdf; 0x14; 0x69; 0xfc; 0xc8; 0x58; 0x8a; 0xe5; 0xd2;
0xcc
])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test1_expected_sha3_384 | val test1_expected_sha3_384:b: lbuffer uint8 48ul {recallable b} | val test1_expected_sha3_384:b: lbuffer uint8 48ul {recallable b} | let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 123,
"start_col": 0,
"start_line": 114
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(48ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test1_expected_sha3_384:b: lbuffer uint8 48ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24;
0x85; 0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98;
0x3a; 0x2a; 0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58;
0xd5; 0xf0; 0x04
])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l | false |
Vale.AES.X64.GF128_Init.fst | Vale.AES.X64.GF128_Init.va_lemma_Gf128_powers | val va_lemma_Gf128_powers : va_b0:va_code -> va_s0:va_state -> h:poly -> hkeys_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gf128_powers ()) va_s0 /\ va_get_ok va_s0 /\
(pclmulqdq_enabled /\ avx_enabled /\ sse_enabled) /\ Vale.X64.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2
(va_get_mem_heaplet 1 va_s0)) == h))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_get_xmm 6 va_sM == va_get_xmm 6 va_s0 /\ va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0
/\ Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 hkeys_b)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 1 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 1 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 2 /\ Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1
va_sM) == Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_s0) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 3 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 3 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 4 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 4 /\ Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1
va_sM) == Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_s0) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 6 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 5 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 7 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 6 /\ va_state_eq 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 rR12 va_sM (va_update_reg64 rRax va_sM
(va_update_flags va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM
va_s0))))))))))))))) | val va_lemma_Gf128_powers : va_b0:va_code -> va_s0:va_state -> h:poly -> hkeys_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gf128_powers ()) va_s0 /\ va_get_ok va_s0 /\
(pclmulqdq_enabled /\ avx_enabled /\ sse_enabled) /\ Vale.X64.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2
(va_get_mem_heaplet 1 va_s0)) == h))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_get_xmm 6 va_sM == va_get_xmm 6 va_s0 /\ va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0
/\ Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 hkeys_b)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 1 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 1 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 2 /\ Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1
va_sM) == Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_s0) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 3 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 3 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 4 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 4 /\ Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1
va_sM) == Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_s0) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 6 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 5 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 7 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 6 /\ va_state_eq 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 rR12 va_sM (va_update_reg64 rRax va_sM
(va_update_flags va_sM (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM
va_s0))))))))))))))) | let va_lemma_Gf128_powers va_b0 va_s0 h hkeys_b =
let (va_mods:va_mods_t) = [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 rR12; va_Mod_reg64 rRax; va_Mod_flags;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gf128_powers va_mods h hkeys_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gf128_powers ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 131 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 145 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_xmm 6 va_sM == va_get_xmm 6 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 146 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 147 column 61 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 hkeys_b)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 148 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 1) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 149 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 1 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 2) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 151 column 84 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_sM) ==
Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 152 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 3 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 3) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 153 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 4 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 4) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 154 column 84 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_sM) ==
Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 155 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 6 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 5) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 156 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 7 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 6)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([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 rR12; va_Mod_reg64 rRax; va_Mod_flags;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM) | {
"file_name": "obj/Vale.AES.X64.GF128_Init.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 16,
"end_line": 580,
"start_col": 0,
"start_line": 536
} | module Vale.AES.X64.GF128_Init
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.AES_s
open Vale.AES.AES256_helpers
open Vale.AES.X64.AES
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.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.AES.X64.GF128_Mul
open Vale.AES.GHash
open Vale.AES.OptPublic
//-- ShiftKey1_128
val va_code_ShiftKey1_128 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_ShiftKey1_128 () =
(va_Block (va_CCons (va_code_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_CCons
(va_code_ShiftLeft128_1 ()) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5))
(va_CCons (va_code_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 4)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_CNil ())))))))))
val va_codegen_success_ShiftKey1_128 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ShiftKey1_128 () =
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_ShiftLeft128_1 ()) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm
3) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pcmpeqd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3)
255) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4))
(va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_ttrue ()))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ShiftKey1_128 (va_mods:va_mods_t) (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s) in
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 88 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftLeft128_1 h) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 89 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32_mask h1) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 90 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_shift_define_i h 1 128) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 92 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 93 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 94 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_test_high_bit h) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 95 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 96 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_zero ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 97 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_ones ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 100 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 101 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_and_consts ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 102 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_opr128_xmm 3)) (va_QEmpty
(()))))))))))))))))
val va_lemma_ShiftKey1_128 : va_b0:va_code -> va_s0:va_state -> f:poly
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_128 ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127)))
(ensures (fun (va_sM, va_fM) -> 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 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) /\
va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0)))))))
[@"opaque_to_smt"]
let va_lemma_ShiftKey1_128 va_b0 va_s0 f =
let (va_mods:va_mods_t) = [va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok] in
let va_qc = va_qcode_ShiftKey1_128 va_mods f in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftKey1_128 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 68 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
label va_range1
"***** POSTCONDITION NOT MET AT line 85 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h)))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_ShiftKey1_128 (f:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) . let
va_sM = va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_flags
va_x_efl va_s0))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2_s.shift h 1 in let (offset:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) ==> va_k va_sM (())))
val va_wpProof_ShiftKey1_128 : f:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ShiftKey1_128 f va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_ShiftKey1_128 f va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ShiftKey1_128 (va_code_ShiftKey1_128 ()) va_s0 f in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0))))));
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_ShiftKey1_128 (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128 ())) =
(va_QProc (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags])
(va_wp_ShiftKey1_128 f) (va_wpProof_ShiftKey1_128 f))
//--
//-- ShiftKey1_gf128_power
val va_code_ShiftKey1_gf128_power : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_ShiftKey1_gf128_power () =
(va_Block (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm 4)) (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm
5)) (va_CCons (va_code_PinsrdImm (va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12))
(va_CCons (va_code_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_ShiftKey1_128 ()) (va_CNil ()))))))))
val va_codegen_success_ShiftKey1_gf128_power : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ShiftKey1_gf128_power () =
(va_pbool_and (va_codegen_success_ZeroXmm (va_op_xmm_xmm 4)) (va_pbool_and
(va_codegen_success_ZeroXmm (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_PinsrdImm
(va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12))
(va_pbool_and (va_codegen_success_ShiftKey1_128 ()) (va_ttrue ())))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ShiftKey1_gf128_power (va_mods:va_mods_t) (h:poly) (n:nat) : (va_quickCode unit
(va_code_ShiftKey1_gf128_power ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 4)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 120 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 5)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 121 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 123 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12)) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 124 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_high_bit ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 125 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_low_shift_1 ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 127 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_128 gf128_modulus_low_terms) (fun (va_s:va_state) _ -> let
(va_arg16:Prims.nat) = n in let (va_arg15:Vale.Math.Poly2_s.poly) = h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_gf128_power va_arg15 va_arg16) (va_QEmpty (()))))))))))))
val va_lemma_ShiftKey1_gf128_power : va_b0:va_code -> va_s0:va_state -> h:poly -> n:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_gf128_power ()) va_s0 /\ va_get_ok va_s0 /\
(let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
avx_enabled /\ sse_enabled /\ hn == Vale.AES.GHash.g_power h n)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n) /\
va_state_eq 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_reg64 rR12 va_sM (va_update_flags
va_sM (va_update_ok va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_ShiftKey1_gf128_power va_b0 va_s0 h n =
let (va_mods:va_mods_t) = [va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags; va_Mod_ok] in
let va_qc = va_qcode_ShiftKey1_gf128_power va_mods h n in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftKey1_gf128_power ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 105 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ (let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in label va_range1
"***** POSTCONDITION NOT MET AT line 117 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_ShiftKey1_gf128_power (h:poly) (n:nat) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in avx_enabled /\ sse_enabled /\ hn == Vale.AES.GHash.g_power h n) /\
(forall (va_x_efl:Vale.X64.Flags.t) (va_x_r12:nat64) (va_x_xmm1:quad32) (va_x_xmm2:quad32)
(va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) . let va_sM = 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_reg64 rR12 va_x_r12 (va_upd_flags va_x_efl va_s0)))))) in va_get_ok va_sM /\ (let
(hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n) ==>
va_k va_sM (())))
val va_wpProof_ShiftKey1_gf128_power : h:poly -> n:nat -> va_s0:va_state -> va_k:(va_state -> unit
-> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ShiftKey1_gf128_power h n va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftKey1_gf128_power ()) ([va_Mod_xmm
5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_reg64 rR12; va_Mod_flags])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_ShiftKey1_gf128_power h n va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ShiftKey1_gf128_power (va_code_ShiftKey1_gf128_power ()) va_s0 h n
in
va_lemma_upd_update va_sM;
assert (va_state_eq 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_reg64 rR12 va_sM (va_update_flags
va_sM (va_update_ok va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_ShiftKey1_gf128_power (h:poly) (n:nat) : (va_quickCode unit
(va_code_ShiftKey1_gf128_power ())) =
(va_QProc (va_code_ShiftKey1_gf128_power ()) ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_reg64 rR12; va_Mod_flags]) (va_wp_ShiftKey1_gf128_power h n)
(va_wpProof_ShiftKey1_gf128_power h n))
//--
//-- Gf128_powers
val va_code_Gf128_powers : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gf128_powers () =
(va_Block (va_CCons (va_code_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) 32 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128
(va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons (va_code_ShiftKey1_gf128_power ()) (va_CCons
(va_code_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 0 Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 6))
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1))
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 16 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 48 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 64 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 96 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 112 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 0)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRax)) (va_CNil
()))))))))))))))))))))))))))))))))))))))))))))))
val va_codegen_success_Gf128_powers : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gf128_powers () =
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm
1)) (va_pbool_and (va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and
(va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 0 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 1)
(va_op_xmm_xmm 6)) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm
6)) (va_pbool_and (va_codegen_success_Gf128MulRev128 ()) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 16 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 48 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 64 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 96 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 112 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 0)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRax)) (va_ttrue
())))))))))))))))))))))))))))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gf128_powers (va_mods:va_mods_t) (h:poly) (hkeys_b:buffer128) : (va_quickCode unit
(va_code_Gf128_powers ())) =
(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 158 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 159 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 161 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (fun (va_s:va_state) _ -> let (va_arg57:Vale.Math.Poly2_s.poly) = h
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 162 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_1 va_arg57) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 163 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 164 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 165 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 166 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 0 Secret hkeys_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 168 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 169 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 170 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg56:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 171 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg56 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 172 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 173 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 174 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 2) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 175 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 16 Secret hkeys_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 177 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 178 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 179 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg55:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 180 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg55 2) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 181 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 182 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 183 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 184 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 48 Secret hkeys_b 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 186 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 187 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 188 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg54:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 189 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg54 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 190 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 191 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 192 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 193 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 64 Secret hkeys_b 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 195 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 196 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 197 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg53:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 198 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg53 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 199 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 200 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 5) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 202 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 96 Secret hkeys_b 6) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 205 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 206 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg52:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 207 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg52 5) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 208 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 209 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 210 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 6) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 211 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 112 Secret hkeys_b 7) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 213 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 0)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 214 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRax)) (va_QEmpty
(())))))))))))))))))))))))))))))))))))))))))))))))))))))
val va_lemma_Gf128_powers : va_b0:va_code -> va_s0:va_state -> h:poly -> hkeys_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gf128_powers ()) va_s0 /\ va_get_ok va_s0 /\
(pclmulqdq_enabled /\ avx_enabled /\ sse_enabled) /\ Vale.X64.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2
(va_get_mem_heaplet 1 va_s0)) == h))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_get_xmm 6 va_sM == va_get_xmm 6 va_s0 /\ va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0
/\ Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 hkeys_b)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 1 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 1 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 2 /\ Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1
va_sM) == Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_s0) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 3 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 3 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 4 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 4 /\ Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1
va_sM) == Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_s0) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 6 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 5 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 7 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 6 /\ va_state_eq 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 rR12 va_sM (va_update_reg64 rRax va_sM
(va_update_flags va_sM (va_update_mem_heaplet 1 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.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Words.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.GF128_Mul.fsti.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.OptPublic.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES256_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.GF128_Init.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"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.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"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.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.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.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"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.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"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.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.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.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"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 |
va_b0: Vale.X64.Decls.va_code ->
va_s0: Vale.X64.Decls.va_state ->
h: Vale.Math.Poly2_s.poly ->
hkeys_b: Vale.X64.Memory.buffer128
-> Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) | Prims.Ghost | [] | [] | [
"Vale.X64.Decls.va_code",
"Vale.X64.Decls.va_state",
"Vale.Math.Poly2_s.poly",
"Vale.X64.Memory.buffer128",
"Vale.X64.QuickCodes.fuel",
"Prims.unit",
"FStar.Pervasives.Native.Mktuple2",
"Vale.X64.Decls.va_fuel",
"Vale.X64.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_xmm",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR12",
"Vale.X64.Machine_s.rRax",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_mem_heaplet",
"Vale.X64.QuickCode.va_Mod_ok",
"Vale.X64.QuickCode.va_Mod_mem",
"Prims.Nil",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.list",
"Vale.X64.QuickCode.__proj__QProc__item__mods",
"Vale.AES.X64.GF128_Init.va_code_Gf128_powers",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.tuple3",
"Vale.X64.State.vale_state",
"Vale.X64.QuickCodes.va_wp_sound_code_norm",
"Prims.l_and",
"Vale.X64.QuickCodes.label",
"Vale.X64.QuickCodes.va_range1",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.X64.Decls.quad32",
"Vale.X64.Decls.va_get_xmm",
"Vale.Def.Types_s.nat64",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Decls.modifies_mem",
"Vale.X64.Decls.loc_buffer",
"Vale.X64.Memory.vuint128",
"Vale.X64.Decls.va_get_mem_heaplet",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Vale.X64.Decls.buffer128_read",
"Vale.AES.GHash.gf128_power",
"Vale.X64.QuickCode.quickCode",
"Vale.AES.X64.GF128_Init.va_qcode_Gf128_powers"
] | [] | false | false | false | false | false | let va_lemma_Gf128_powers va_b0 va_s0 h hkeys_b =
| let va_mods:va_mods_t =
[
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 rR12; va_Mod_reg64 rRax; va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem
]
in
let va_qc = va_qcode_Gf128_powers va_mods h hkeys_b in
let va_sM, va_fM, va_g =
va_wp_sound_code_norm (va_code_Gf128_powers ())
va_qc
va_s0
(fun va_s0 va_sM va_g ->
let () = va_g in
label va_range1
"***** POSTCONDITION NOT MET AT line 131 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 145 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_xmm 6 va_sM == va_get_xmm 6 va_s0) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 146 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 147 column 61 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 hkeys_b)
(va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM)) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 148 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b
0
(va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 1) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 149 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b
1
(va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 2) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 151 column 84 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_sM) ==
Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_s0)) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 152 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b
3
(va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 3) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 153 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b
4
(va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 4) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 154 column 84 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_sM) ==
Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_s0)) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 155 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b
6
(va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 5) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 156 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b
7
(va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 6))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([
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 rR12; va_Mod_reg64 rRax; va_Mod_flags; va_Mod_mem_heaplet 1;
va_Mod_ok; va_Mod_mem
])
va_sM
va_s0;
(va_sM, va_fM) | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test1_expected_sha3_512 | val test1_expected_sha3_512:b: lbuffer uint8 64ul {recallable b} | val test1_expected_sha3_512:b: lbuffer uint8 64ul {recallable b} | let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 135,
"start_col": 0,
"start_line": 125
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(64ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test1_expected_sha3_512:b: lbuffer uint8 64ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75;
0x6e; 0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c;
0x80; 0xa6; 0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c;
0x3a; 0xc5; 0x58; 0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86;
0x28; 0x1d; 0xcd; 0x26
])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test4_expected_sha3_224 | val test4_expected_sha3_224:b: lbuffer uint8 28ul {recallable b} | val test4_expected_sha3_224:b: lbuffer uint8 28ul {recallable b} | let test4_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x54; 0x3e; 0x68; 0x68; 0xe1; 0x66; 0x6c; 0x1a; 0x64; 0x36; 0x30; 0xdf; 0x77; 0x36; 0x7a; 0xe5;
0xa6; 0x2a; 0x85; 0x07; 0x0a; 0x51; 0xc1; 0x4c; 0xbf; 0x66; 0x5c; 0xbc])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 276,
"start_col": 0,
"start_line": 268
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3
//
let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l
let test3_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79; 0xba;
0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test3_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x41; 0xc0; 0xdb; 0xa2; 0xa9; 0xd6; 0x24; 0x08; 0x49; 0x10; 0x03; 0x76; 0xa8; 0x23; 0x5e; 0x2c;
0x82; 0xe1; 0xb9; 0x99; 0x8a; 0x99; 0x9e; 0x21; 0xdb; 0x32; 0xdd; 0x97; 0x49; 0x6d; 0x33; 0x76])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test3_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x99; 0x1c; 0x66; 0x57; 0x55; 0xeb; 0x3a; 0x4b; 0x6b; 0xbd; 0xfb; 0x75; 0xc7; 0x8a; 0x49; 0x2e;
0x8c; 0x56; 0xa2; 0x2c; 0x5c; 0x4d; 0x7e; 0x42; 0x9b; 0xfd; 0xbc; 0x32; 0xb9; 0xd4; 0xad; 0x5a;
0xa0; 0x4a; 0x1f; 0x07; 0x6e; 0x62; 0xfe; 0xa1; 0x9e; 0xef; 0x51; 0xac; 0xd0; 0x65; 0x7c; 0x22])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test3_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x04; 0xa3; 0x71; 0xe8; 0x4e; 0xcf; 0xb5; 0xb8; 0xb7; 0x7c; 0xb4; 0x86; 0x10; 0xfc; 0xa8; 0x18;
0x2d; 0xd4; 0x57; 0xce; 0x6f; 0x32; 0x6a; 0x0f; 0xd3; 0xd7; 0xec; 0x2f; 0x1e; 0x91; 0x63; 0x6d;
0xee; 0x69; 0x1f; 0xbe; 0x0c; 0x98; 0x53; 0x02; 0xba; 0x1b; 0x0d; 0x8d; 0xc7; 0x8c; 0x08; 0x63;
0x46; 0xb5; 0x33; 0xb4; 0x9c; 0x03; 0x0d; 0x99; 0xa2; 0x7d; 0xaf; 0x11; 0x39; 0xd6; 0xe7; 0x5e])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test4_SHA3
//
let test4_plaintext: b:lbuffer uint8 112ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69;
0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b;
0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d;
0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f;
0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71;
0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73;
0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x75])
in
assert_norm (List.Tot.length l == 112);
createL_mglobal l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(28ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test4_expected_sha3_224:b: lbuffer uint8 28ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0x54; 0x3e; 0x68; 0x68; 0xe1; 0x66; 0x6c; 0x1a; 0x64; 0x36; 0x30; 0xdf; 0x77; 0x36; 0x7a;
0xe5; 0xa6; 0x2a; 0x85; 0x07; 0x0a; 0x51; 0xc1; 0x4c; 0xbf; 0x66; 0x5c; 0xbc
])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test4_expected_sha3_256 | val test4_expected_sha3_256:b: lbuffer uint8 32ul {recallable b} | val test4_expected_sha3_256:b: lbuffer uint8 32ul {recallable b} | let test4_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x91; 0x6f; 0x60; 0x61; 0xfe; 0x87; 0x97; 0x41; 0xca; 0x64; 0x69; 0xb4; 0x39; 0x71; 0xdf; 0xdb;
0x28; 0xb1; 0xa3; 0x2d; 0xc3; 0x6c; 0xb3; 0x25; 0x4e; 0x81; 0x2b; 0xe2; 0x7a; 0xad; 0x1d; 0x18])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 286,
"start_col": 0,
"start_line": 278
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3
//
let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l
let test3_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79; 0xba;
0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test3_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x41; 0xc0; 0xdb; 0xa2; 0xa9; 0xd6; 0x24; 0x08; 0x49; 0x10; 0x03; 0x76; 0xa8; 0x23; 0x5e; 0x2c;
0x82; 0xe1; 0xb9; 0x99; 0x8a; 0x99; 0x9e; 0x21; 0xdb; 0x32; 0xdd; 0x97; 0x49; 0x6d; 0x33; 0x76])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test3_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x99; 0x1c; 0x66; 0x57; 0x55; 0xeb; 0x3a; 0x4b; 0x6b; 0xbd; 0xfb; 0x75; 0xc7; 0x8a; 0x49; 0x2e;
0x8c; 0x56; 0xa2; 0x2c; 0x5c; 0x4d; 0x7e; 0x42; 0x9b; 0xfd; 0xbc; 0x32; 0xb9; 0xd4; 0xad; 0x5a;
0xa0; 0x4a; 0x1f; 0x07; 0x6e; 0x62; 0xfe; 0xa1; 0x9e; 0xef; 0x51; 0xac; 0xd0; 0x65; 0x7c; 0x22])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test3_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x04; 0xa3; 0x71; 0xe8; 0x4e; 0xcf; 0xb5; 0xb8; 0xb7; 0x7c; 0xb4; 0x86; 0x10; 0xfc; 0xa8; 0x18;
0x2d; 0xd4; 0x57; 0xce; 0x6f; 0x32; 0x6a; 0x0f; 0xd3; 0xd7; 0xec; 0x2f; 0x1e; 0x91; 0x63; 0x6d;
0xee; 0x69; 0x1f; 0xbe; 0x0c; 0x98; 0x53; 0x02; 0xba; 0x1b; 0x0d; 0x8d; 0xc7; 0x8c; 0x08; 0x63;
0x46; 0xb5; 0x33; 0xb4; 0x9c; 0x03; 0x0d; 0x99; 0xa2; 0x7d; 0xaf; 0x11; 0x39; 0xd6; 0xe7; 0x5e])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test4_SHA3
//
let test4_plaintext: b:lbuffer uint8 112ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69;
0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b;
0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d;
0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f;
0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71;
0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73;
0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x75])
in
assert_norm (List.Tot.length l == 112);
createL_mglobal l
let test4_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x54; 0x3e; 0x68; 0x68; 0xe1; 0x66; 0x6c; 0x1a; 0x64; 0x36; 0x30; 0xdf; 0x77; 0x36; 0x7a; 0xe5;
0xa6; 0x2a; 0x85; 0x07; 0x0a; 0x51; 0xc1; 0x4c; 0xbf; 0x66; 0x5c; 0xbc])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(32ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test4_expected_sha3_256:b: lbuffer uint8 32ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0x91; 0x6f; 0x60; 0x61; 0xfe; 0x87; 0x97; 0x41; 0xca; 0x64; 0x69; 0xb4; 0x39; 0x71; 0xdf;
0xdb; 0x28; 0xb1; 0xa3; 0x2d; 0xc3; 0x6c; 0xb3; 0x25; 0x4e; 0x81; 0x2b; 0xe2; 0x7a; 0xad;
0x1d; 0x18
])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test2_expected_sha3_224 | val test2_expected_sha3_224:b: lbuffer uint8 28ul {recallable b} | val test2_expected_sha3_224:b: lbuffer uint8 28ul {recallable b} | let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 157,
"start_col": 0,
"start_line": 149
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(28ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test2_expected_sha3_224:b: lbuffer uint8 28ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76;
0x6f; 0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf
])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test4_expected_sha3_384 | val test4_expected_sha3_384:b: lbuffer uint8 48ul {recallable b} | val test4_expected_sha3_384:b: lbuffer uint8 48ul {recallable b} | let test4_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x79; 0x40; 0x7d; 0x3b; 0x59; 0x16; 0xb5; 0x9c; 0x3e; 0x30; 0xb0; 0x98; 0x22; 0x97; 0x47; 0x91;
0xc3; 0x13; 0xfb; 0x9e; 0xcc; 0x84; 0x9e; 0x40; 0x6f; 0x23; 0x59; 0x2d; 0x04; 0xf6; 0x25; 0xdc;
0x8c; 0x70; 0x9b; 0x98; 0xb4; 0x3b; 0x38; 0x52; 0xb3; 0x37; 0x21; 0x61; 0x79; 0xaa; 0x7f; 0xc7])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 297,
"start_col": 0,
"start_line": 288
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3
//
let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l
let test3_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79; 0xba;
0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test3_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x41; 0xc0; 0xdb; 0xa2; 0xa9; 0xd6; 0x24; 0x08; 0x49; 0x10; 0x03; 0x76; 0xa8; 0x23; 0x5e; 0x2c;
0x82; 0xe1; 0xb9; 0x99; 0x8a; 0x99; 0x9e; 0x21; 0xdb; 0x32; 0xdd; 0x97; 0x49; 0x6d; 0x33; 0x76])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test3_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x99; 0x1c; 0x66; 0x57; 0x55; 0xeb; 0x3a; 0x4b; 0x6b; 0xbd; 0xfb; 0x75; 0xc7; 0x8a; 0x49; 0x2e;
0x8c; 0x56; 0xa2; 0x2c; 0x5c; 0x4d; 0x7e; 0x42; 0x9b; 0xfd; 0xbc; 0x32; 0xb9; 0xd4; 0xad; 0x5a;
0xa0; 0x4a; 0x1f; 0x07; 0x6e; 0x62; 0xfe; 0xa1; 0x9e; 0xef; 0x51; 0xac; 0xd0; 0x65; 0x7c; 0x22])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test3_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x04; 0xa3; 0x71; 0xe8; 0x4e; 0xcf; 0xb5; 0xb8; 0xb7; 0x7c; 0xb4; 0x86; 0x10; 0xfc; 0xa8; 0x18;
0x2d; 0xd4; 0x57; 0xce; 0x6f; 0x32; 0x6a; 0x0f; 0xd3; 0xd7; 0xec; 0x2f; 0x1e; 0x91; 0x63; 0x6d;
0xee; 0x69; 0x1f; 0xbe; 0x0c; 0x98; 0x53; 0x02; 0xba; 0x1b; 0x0d; 0x8d; 0xc7; 0x8c; 0x08; 0x63;
0x46; 0xb5; 0x33; 0xb4; 0x9c; 0x03; 0x0d; 0x99; 0xa2; 0x7d; 0xaf; 0x11; 0x39; 0xd6; 0xe7; 0x5e])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test4_SHA3
//
let test4_plaintext: b:lbuffer uint8 112ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69;
0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b;
0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d;
0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f;
0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71;
0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73;
0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x75])
in
assert_norm (List.Tot.length l == 112);
createL_mglobal l
let test4_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x54; 0x3e; 0x68; 0x68; 0xe1; 0x66; 0x6c; 0x1a; 0x64; 0x36; 0x30; 0xdf; 0x77; 0x36; 0x7a; 0xe5;
0xa6; 0x2a; 0x85; 0x07; 0x0a; 0x51; 0xc1; 0x4c; 0xbf; 0x66; 0x5c; 0xbc])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test4_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x91; 0x6f; 0x60; 0x61; 0xfe; 0x87; 0x97; 0x41; 0xca; 0x64; 0x69; 0xb4; 0x39; 0x71; 0xdf; 0xdb;
0x28; 0xb1; 0xa3; 0x2d; 0xc3; 0x6c; 0xb3; 0x25; 0x4e; 0x81; 0x2b; 0xe2; 0x7a; 0xad; 0x1d; 0x18])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(48ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test4_expected_sha3_384:b: lbuffer uint8 48ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0x79; 0x40; 0x7d; 0x3b; 0x59; 0x16; 0xb5; 0x9c; 0x3e; 0x30; 0xb0; 0x98; 0x22; 0x97; 0x47;
0x91; 0xc3; 0x13; 0xfb; 0x9e; 0xcc; 0x84; 0x9e; 0x40; 0x6f; 0x23; 0x59; 0x2d; 0x04; 0xf6;
0x25; 0xdc; 0x8c; 0x70; 0x9b; 0x98; 0xb4; 0x3b; 0x38; 0x52; 0xb3; 0x37; 0x21; 0x61; 0x79;
0xaa; 0x7f; 0xc7
])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test9_plaintext_shake256 | val test9_plaintext_shake256:b: lbuffer uint8 0ul {recallable b} | val test9_plaintext_shake256:b: lbuffer uint8 0ul {recallable b} | let test9_plaintext_shake256: b:lbuffer uint8 0ul{ recallable b } =
[@ inline_let]
let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 405,
"start_col": 0,
"start_line": 401
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3
//
let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l
let test3_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79; 0xba;
0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test3_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x41; 0xc0; 0xdb; 0xa2; 0xa9; 0xd6; 0x24; 0x08; 0x49; 0x10; 0x03; 0x76; 0xa8; 0x23; 0x5e; 0x2c;
0x82; 0xe1; 0xb9; 0x99; 0x8a; 0x99; 0x9e; 0x21; 0xdb; 0x32; 0xdd; 0x97; 0x49; 0x6d; 0x33; 0x76])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test3_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x99; 0x1c; 0x66; 0x57; 0x55; 0xeb; 0x3a; 0x4b; 0x6b; 0xbd; 0xfb; 0x75; 0xc7; 0x8a; 0x49; 0x2e;
0x8c; 0x56; 0xa2; 0x2c; 0x5c; 0x4d; 0x7e; 0x42; 0x9b; 0xfd; 0xbc; 0x32; 0xb9; 0xd4; 0xad; 0x5a;
0xa0; 0x4a; 0x1f; 0x07; 0x6e; 0x62; 0xfe; 0xa1; 0x9e; 0xef; 0x51; 0xac; 0xd0; 0x65; 0x7c; 0x22])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test3_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x04; 0xa3; 0x71; 0xe8; 0x4e; 0xcf; 0xb5; 0xb8; 0xb7; 0x7c; 0xb4; 0x86; 0x10; 0xfc; 0xa8; 0x18;
0x2d; 0xd4; 0x57; 0xce; 0x6f; 0x32; 0x6a; 0x0f; 0xd3; 0xd7; 0xec; 0x2f; 0x1e; 0x91; 0x63; 0x6d;
0xee; 0x69; 0x1f; 0xbe; 0x0c; 0x98; 0x53; 0x02; 0xba; 0x1b; 0x0d; 0x8d; 0xc7; 0x8c; 0x08; 0x63;
0x46; 0xb5; 0x33; 0xb4; 0x9c; 0x03; 0x0d; 0x99; 0xa2; 0x7d; 0xaf; 0x11; 0x39; 0xd6; 0xe7; 0x5e])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test4_SHA3
//
let test4_plaintext: b:lbuffer uint8 112ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69;
0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b;
0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d;
0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f;
0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71;
0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73;
0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x75])
in
assert_norm (List.Tot.length l == 112);
createL_mglobal l
let test4_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x54; 0x3e; 0x68; 0x68; 0xe1; 0x66; 0x6c; 0x1a; 0x64; 0x36; 0x30; 0xdf; 0x77; 0x36; 0x7a; 0xe5;
0xa6; 0x2a; 0x85; 0x07; 0x0a; 0x51; 0xc1; 0x4c; 0xbf; 0x66; 0x5c; 0xbc])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test4_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x91; 0x6f; 0x60; 0x61; 0xfe; 0x87; 0x97; 0x41; 0xca; 0x64; 0x69; 0xb4; 0x39; 0x71; 0xdf; 0xdb;
0x28; 0xb1; 0xa3; 0x2d; 0xc3; 0x6c; 0xb3; 0x25; 0x4e; 0x81; 0x2b; 0xe2; 0x7a; 0xad; 0x1d; 0x18])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test4_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x79; 0x40; 0x7d; 0x3b; 0x59; 0x16; 0xb5; 0x9c; 0x3e; 0x30; 0xb0; 0x98; 0x22; 0x97; 0x47; 0x91;
0xc3; 0x13; 0xfb; 0x9e; 0xcc; 0x84; 0x9e; 0x40; 0x6f; 0x23; 0x59; 0x2d; 0x04; 0xf6; 0x25; 0xdc;
0x8c; 0x70; 0x9b; 0x98; 0xb4; 0x3b; 0x38; 0x52; 0xb3; 0x37; 0x21; 0x61; 0x79; 0xaa; 0x7f; 0xc7])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test4_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xaf; 0xeb; 0xb2; 0xef; 0x54; 0x2e; 0x65; 0x79; 0xc5; 0x0c; 0xad; 0x06; 0xd2; 0xe5; 0x78; 0xf9;
0xf8; 0xdd; 0x68; 0x81; 0xd7; 0xdc; 0x82; 0x4d; 0x26; 0x36; 0x0f; 0xee; 0xbf; 0x18; 0xa4; 0xfa;
0x73; 0xe3; 0x26; 0x11; 0x22; 0x94; 0x8e; 0xfc; 0xfd; 0x49; 0x2e; 0x74; 0xe8; 0x2e; 0x21; 0x89;
0xed; 0x0f; 0xb4; 0x40; 0xd1; 0x87; 0xf3; 0x82; 0x27; 0x0c; 0xb4; 0x55; 0xf2; 0x1d; 0xd1; 0x85])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test5_SHAKE128
//
let test5_plaintext_shake128: b:lbuffer uint8 0ul{ recallable b } =
[@ inline_let]
let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test5_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7f; 0x9c; 0x2b; 0xa4; 0xe8; 0x8f; 0x82; 0x7d; 0x61; 0x60; 0x45; 0x50; 0x76; 0x05; 0x85; 0x3e])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test6_SHAKE128
//
let test6_plaintext_shake128: b:lbuffer uint8 14ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x52; 0x97; 0x7e; 0x53; 0x2b; 0xcc; 0xdb; 0x89; 0xdf; 0xef; 0xf7; 0xe9; 0xe4; 0xad]) in
assert_norm (List.Tot.length l == 14);
createL_mglobal l
let test6_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xfb; 0xfb; 0xa5; 0xc1; 0xe1; 0x79; 0xdf; 0x14; 0x69; 0xfc; 0xc8; 0x58; 0x8a; 0xe5; 0xd2; 0xcc])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test7_SHAKE128
//
let test7_plaintext_shake128: b:lbuffer uint8 34ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x4a; 0x20; 0x6a; 0x5b; 0x8a; 0xa3; 0x58; 0x6c; 0x06; 0x67; 0xa4; 0x00; 0x20; 0xd6; 0x5f; 0xf5;
0x11; 0xd5; 0x2b; 0x73; 0x2e; 0xf7; 0xa0; 0xc5; 0x69; 0xf1; 0xee; 0x68; 0x1a; 0x4f; 0xc3; 0x62;
0x00; 0x65])
in
assert_norm (List.Tot.length l == 34);
createL_mglobal l
let test7_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7b; 0xb4; 0x33; 0x75; 0x2b; 0x98; 0xf9; 0x15; 0xbe; 0x51; 0x82; 0xbc; 0x1f; 0x09; 0x66; 0x48])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test8_SHAKE128
//
let test8_plaintext_shake128: b:lbuffer uint8 83ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x24; 0x69; 0xf1; 0x01; 0xc9; 0xb4; 0x99; 0xa9; 0x30; 0xa9; 0x7e; 0xf1; 0xb3; 0x46; 0x73; 0xec;
0x74; 0x39; 0x3f; 0xd9; 0xfa; 0xf6; 0x58; 0xe3; 0x1f; 0x06; 0xee; 0x0b; 0x29; 0xa2; 0x2b; 0x62;
0x37; 0x80; 0xba; 0x7b; 0xdf; 0xed; 0x86; 0x20; 0x15; 0x1c; 0xc4; 0x44; 0x4e; 0xbe; 0x33; 0x39;
0xe6; 0xd2; 0xa2; 0x23; 0xbf; 0xbf; 0xb4; 0xad; 0x2c; 0xa0; 0xe0; 0xfa; 0x0d; 0xdf; 0xbb; 0xdf;
0x3b; 0x05; 0x7a; 0x4f; 0x26; 0xd0; 0xb2; 0x16; 0xbc; 0x87; 0x63; 0xca; 0x8d; 0x8a; 0x35; 0xff;
0x2d; 0x2d; 0x01])
in
assert_norm (List.Tot.length l == 83);
createL_mglobal l
let test8_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x00; 0xff; 0x5e; 0xf0; 0xcd; 0x7f; 0x8f; 0x90; 0xad; 0x94; 0xb7; 0x97; 0xe9; 0xd4; 0xdd; 0x30])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test9_SHAKE256 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(0ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Nil"
] | [] | false | false | false | false | false | let test9_plaintext_shake256:b: lbuffer uint8 0ul {recallable b} =
| [@@ inline_let ]let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test1_expected_sha3_256 | val test1_expected_sha3_256:b: lbuffer uint8 32ul {recallable b} | val test1_expected_sha3_256:b: lbuffer uint8 32ul {recallable b} | let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 112,
"start_col": 0,
"start_line": 104
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(32ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test1_expected_sha3_256:b: lbuffer uint8 32ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6;
0x62; 0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8;
0x43; 0x4a
])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l | false |
Pulse.Checker.Prover.Substs.fsti | Pulse.Checker.Prover.Substs.contains | val contains : ss: Pulse.Checker.Prover.Substs.ss_t -> x: Pulse.Syntax.Base.var -> Prims.bool | let contains (ss:ss_t) (x:var) = Map.contains (as_map ss) x | {
"file_name": "lib/steel/pulse/Pulse.Checker.Prover.Substs.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 59,
"end_line": 36,
"start_col": 0,
"start_line": 36
} | (*
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.Prover.Substs
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Typing.Env
open Pulse.Typing
module L = FStar.List.Tot
module T = FStar.Tactics
module Env = Pulse.Typing.Env
val ss_t : Type0
val ln_ss_t (s:ss_t) : bool
val as_map (ss:ss_t) : Map.t var term | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Env.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"prims.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Checker.Prover.Substs.fsti"
} | [
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Env",
"short_module": "Env"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Env",
"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": "Pulse.Typing.Env",
"short_module": "Env"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"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.Env",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Prover",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Prover",
"short_module": null
},
{
"abbrev": 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 | ss: Pulse.Checker.Prover.Substs.ss_t -> x: Pulse.Syntax.Base.var -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Pulse.Checker.Prover.Substs.ss_t",
"Pulse.Syntax.Base.var",
"FStar.Map.contains",
"Pulse.Syntax.Base.term",
"Pulse.Checker.Prover.Substs.as_map",
"Prims.bool"
] | [] | false | false | false | true | false | let contains (ss: ss_t) (x: var) =
| Map.contains (as_map ss) x | false |
|
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test3_expected_sha3_256 | val test3_expected_sha3_256:b: lbuffer uint8 32ul {recallable b} | val test3_expected_sha3_256:b: lbuffer uint8 32ul {recallable b} | let test3_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x41; 0xc0; 0xdb; 0xa2; 0xa9; 0xd6; 0x24; 0x08; 0x49; 0x10; 0x03; 0x76; 0xa8; 0x23; 0x5e; 0x2c;
0x82; 0xe1; 0xb9; 0x99; 0x8a; 0x99; 0x9e; 0x21; 0xdb; 0x32; 0xdd; 0x97; 0x49; 0x6d; 0x33; 0x76])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 225,
"start_col": 0,
"start_line": 217
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3
//
let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l
let test3_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79; 0xba;
0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(32ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test3_expected_sha3_256:b: lbuffer uint8 32ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0x41; 0xc0; 0xdb; 0xa2; 0xa9; 0xd6; 0x24; 0x08; 0x49; 0x10; 0x03; 0x76; 0xa8; 0x23; 0x5e;
0x2c; 0x82; 0xe1; 0xb9; 0x99; 0x8a; 0x99; 0x9e; 0x21; 0xdb; 0x32; 0xdd; 0x97; 0x49; 0x6d;
0x33; 0x76
])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l | false |
Pulse.Checker.Prover.Substs.fsti | Pulse.Checker.Prover.Substs.dom | val dom : ss: Pulse.Checker.Prover.Substs.ss_t -> FStar.Set.set Pulse.Syntax.Base.var | let dom (ss:ss_t) = Map.domain (as_map ss) | {
"file_name": "lib/steel/pulse/Pulse.Checker.Prover.Substs.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 42,
"end_line": 35,
"start_col": 0,
"start_line": 35
} | (*
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.Prover.Substs
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Typing.Env
open Pulse.Typing
module L = FStar.List.Tot
module T = FStar.Tactics
module Env = Pulse.Typing.Env
val ss_t : Type0
val ln_ss_t (s:ss_t) : bool
val as_map (ss:ss_t) : Map.t var term | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Env.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"prims.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Checker.Prover.Substs.fsti"
} | [
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Env",
"short_module": "Env"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Env",
"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": "Pulse.Typing.Env",
"short_module": "Env"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"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.Env",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Prover",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Prover",
"short_module": null
},
{
"abbrev": 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 | ss: Pulse.Checker.Prover.Substs.ss_t -> FStar.Set.set Pulse.Syntax.Base.var | Prims.Tot | [
"total"
] | [] | [
"Pulse.Checker.Prover.Substs.ss_t",
"FStar.Map.domain",
"Pulse.Syntax.Base.var",
"Pulse.Syntax.Base.term",
"Pulse.Checker.Prover.Substs.as_map",
"FStar.Set.set"
] | [] | false | false | false | true | false | let dom (ss: ss_t) =
| Map.domain (as_map ss) | false |
|
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test5_expected_shake128 | val test5_expected_shake128:b: lbuffer uint8 16ul {recallable b} | val test5_expected_shake128:b: lbuffer uint8 16ul {recallable b} | let test5_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7f; 0x9c; 0x2b; 0xa4; 0xe8; 0x8f; 0x82; 0x7d; 0x61; 0x60; 0x45; 0x50; 0x76; 0x05; 0x85; 0x3e])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 327,
"start_col": 0,
"start_line": 320
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3
//
let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l
let test3_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79; 0xba;
0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test3_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x41; 0xc0; 0xdb; 0xa2; 0xa9; 0xd6; 0x24; 0x08; 0x49; 0x10; 0x03; 0x76; 0xa8; 0x23; 0x5e; 0x2c;
0x82; 0xe1; 0xb9; 0x99; 0x8a; 0x99; 0x9e; 0x21; 0xdb; 0x32; 0xdd; 0x97; 0x49; 0x6d; 0x33; 0x76])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test3_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x99; 0x1c; 0x66; 0x57; 0x55; 0xeb; 0x3a; 0x4b; 0x6b; 0xbd; 0xfb; 0x75; 0xc7; 0x8a; 0x49; 0x2e;
0x8c; 0x56; 0xa2; 0x2c; 0x5c; 0x4d; 0x7e; 0x42; 0x9b; 0xfd; 0xbc; 0x32; 0xb9; 0xd4; 0xad; 0x5a;
0xa0; 0x4a; 0x1f; 0x07; 0x6e; 0x62; 0xfe; 0xa1; 0x9e; 0xef; 0x51; 0xac; 0xd0; 0x65; 0x7c; 0x22])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test3_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x04; 0xa3; 0x71; 0xe8; 0x4e; 0xcf; 0xb5; 0xb8; 0xb7; 0x7c; 0xb4; 0x86; 0x10; 0xfc; 0xa8; 0x18;
0x2d; 0xd4; 0x57; 0xce; 0x6f; 0x32; 0x6a; 0x0f; 0xd3; 0xd7; 0xec; 0x2f; 0x1e; 0x91; 0x63; 0x6d;
0xee; 0x69; 0x1f; 0xbe; 0x0c; 0x98; 0x53; 0x02; 0xba; 0x1b; 0x0d; 0x8d; 0xc7; 0x8c; 0x08; 0x63;
0x46; 0xb5; 0x33; 0xb4; 0x9c; 0x03; 0x0d; 0x99; 0xa2; 0x7d; 0xaf; 0x11; 0x39; 0xd6; 0xe7; 0x5e])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test4_SHA3
//
let test4_plaintext: b:lbuffer uint8 112ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69;
0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b;
0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d;
0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f;
0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71;
0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73;
0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x75])
in
assert_norm (List.Tot.length l == 112);
createL_mglobal l
let test4_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x54; 0x3e; 0x68; 0x68; 0xe1; 0x66; 0x6c; 0x1a; 0x64; 0x36; 0x30; 0xdf; 0x77; 0x36; 0x7a; 0xe5;
0xa6; 0x2a; 0x85; 0x07; 0x0a; 0x51; 0xc1; 0x4c; 0xbf; 0x66; 0x5c; 0xbc])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test4_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x91; 0x6f; 0x60; 0x61; 0xfe; 0x87; 0x97; 0x41; 0xca; 0x64; 0x69; 0xb4; 0x39; 0x71; 0xdf; 0xdb;
0x28; 0xb1; 0xa3; 0x2d; 0xc3; 0x6c; 0xb3; 0x25; 0x4e; 0x81; 0x2b; 0xe2; 0x7a; 0xad; 0x1d; 0x18])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test4_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x79; 0x40; 0x7d; 0x3b; 0x59; 0x16; 0xb5; 0x9c; 0x3e; 0x30; 0xb0; 0x98; 0x22; 0x97; 0x47; 0x91;
0xc3; 0x13; 0xfb; 0x9e; 0xcc; 0x84; 0x9e; 0x40; 0x6f; 0x23; 0x59; 0x2d; 0x04; 0xf6; 0x25; 0xdc;
0x8c; 0x70; 0x9b; 0x98; 0xb4; 0x3b; 0x38; 0x52; 0xb3; 0x37; 0x21; 0x61; 0x79; 0xaa; 0x7f; 0xc7])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test4_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xaf; 0xeb; 0xb2; 0xef; 0x54; 0x2e; 0x65; 0x79; 0xc5; 0x0c; 0xad; 0x06; 0xd2; 0xe5; 0x78; 0xf9;
0xf8; 0xdd; 0x68; 0x81; 0xd7; 0xdc; 0x82; 0x4d; 0x26; 0x36; 0x0f; 0xee; 0xbf; 0x18; 0xa4; 0xfa;
0x73; 0xe3; 0x26; 0x11; 0x22; 0x94; 0x8e; 0xfc; 0xfd; 0x49; 0x2e; 0x74; 0xe8; 0x2e; 0x21; 0x89;
0xed; 0x0f; 0xb4; 0x40; 0xd1; 0x87; 0xf3; 0x82; 0x27; 0x0c; 0xb4; 0x55; 0xf2; 0x1d; 0xd1; 0x85])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test5_SHAKE128
//
let test5_plaintext_shake128: b:lbuffer uint8 0ul{ recallable b } =
[@ inline_let]
let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(16ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test5_expected_shake128:b: lbuffer uint8 16ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0x7f; 0x9c; 0x2b; 0xa4; 0xe8; 0x8f; 0x82; 0x7d; 0x61; 0x60; 0x45; 0x50; 0x76; 0x05; 0x85;
0x3e
])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test6_plaintext_shake128 | val test6_plaintext_shake128:b: lbuffer uint8 14ul {recallable b} | val test6_plaintext_shake128:b: lbuffer uint8 14ul {recallable b} | let test6_plaintext_shake128: b:lbuffer uint8 14ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x52; 0x97; 0x7e; 0x53; 0x2b; 0xcc; 0xdb; 0x89; 0xdf; 0xef; 0xf7; 0xe9; 0xe4; 0xad]) in
assert_norm (List.Tot.length l == 14);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 338,
"start_col": 0,
"start_line": 332
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3
//
let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l
let test3_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79; 0xba;
0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test3_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x41; 0xc0; 0xdb; 0xa2; 0xa9; 0xd6; 0x24; 0x08; 0x49; 0x10; 0x03; 0x76; 0xa8; 0x23; 0x5e; 0x2c;
0x82; 0xe1; 0xb9; 0x99; 0x8a; 0x99; 0x9e; 0x21; 0xdb; 0x32; 0xdd; 0x97; 0x49; 0x6d; 0x33; 0x76])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test3_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x99; 0x1c; 0x66; 0x57; 0x55; 0xeb; 0x3a; 0x4b; 0x6b; 0xbd; 0xfb; 0x75; 0xc7; 0x8a; 0x49; 0x2e;
0x8c; 0x56; 0xa2; 0x2c; 0x5c; 0x4d; 0x7e; 0x42; 0x9b; 0xfd; 0xbc; 0x32; 0xb9; 0xd4; 0xad; 0x5a;
0xa0; 0x4a; 0x1f; 0x07; 0x6e; 0x62; 0xfe; 0xa1; 0x9e; 0xef; 0x51; 0xac; 0xd0; 0x65; 0x7c; 0x22])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test3_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x04; 0xa3; 0x71; 0xe8; 0x4e; 0xcf; 0xb5; 0xb8; 0xb7; 0x7c; 0xb4; 0x86; 0x10; 0xfc; 0xa8; 0x18;
0x2d; 0xd4; 0x57; 0xce; 0x6f; 0x32; 0x6a; 0x0f; 0xd3; 0xd7; 0xec; 0x2f; 0x1e; 0x91; 0x63; 0x6d;
0xee; 0x69; 0x1f; 0xbe; 0x0c; 0x98; 0x53; 0x02; 0xba; 0x1b; 0x0d; 0x8d; 0xc7; 0x8c; 0x08; 0x63;
0x46; 0xb5; 0x33; 0xb4; 0x9c; 0x03; 0x0d; 0x99; 0xa2; 0x7d; 0xaf; 0x11; 0x39; 0xd6; 0xe7; 0x5e])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test4_SHA3
//
let test4_plaintext: b:lbuffer uint8 112ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69;
0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b;
0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d;
0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f;
0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71;
0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73;
0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x75])
in
assert_norm (List.Tot.length l == 112);
createL_mglobal l
let test4_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x54; 0x3e; 0x68; 0x68; 0xe1; 0x66; 0x6c; 0x1a; 0x64; 0x36; 0x30; 0xdf; 0x77; 0x36; 0x7a; 0xe5;
0xa6; 0x2a; 0x85; 0x07; 0x0a; 0x51; 0xc1; 0x4c; 0xbf; 0x66; 0x5c; 0xbc])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test4_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x91; 0x6f; 0x60; 0x61; 0xfe; 0x87; 0x97; 0x41; 0xca; 0x64; 0x69; 0xb4; 0x39; 0x71; 0xdf; 0xdb;
0x28; 0xb1; 0xa3; 0x2d; 0xc3; 0x6c; 0xb3; 0x25; 0x4e; 0x81; 0x2b; 0xe2; 0x7a; 0xad; 0x1d; 0x18])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test4_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x79; 0x40; 0x7d; 0x3b; 0x59; 0x16; 0xb5; 0x9c; 0x3e; 0x30; 0xb0; 0x98; 0x22; 0x97; 0x47; 0x91;
0xc3; 0x13; 0xfb; 0x9e; 0xcc; 0x84; 0x9e; 0x40; 0x6f; 0x23; 0x59; 0x2d; 0x04; 0xf6; 0x25; 0xdc;
0x8c; 0x70; 0x9b; 0x98; 0xb4; 0x3b; 0x38; 0x52; 0xb3; 0x37; 0x21; 0x61; 0x79; 0xaa; 0x7f; 0xc7])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test4_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xaf; 0xeb; 0xb2; 0xef; 0x54; 0x2e; 0x65; 0x79; 0xc5; 0x0c; 0xad; 0x06; 0xd2; 0xe5; 0x78; 0xf9;
0xf8; 0xdd; 0x68; 0x81; 0xd7; 0xdc; 0x82; 0x4d; 0x26; 0x36; 0x0f; 0xee; 0xbf; 0x18; 0xa4; 0xfa;
0x73; 0xe3; 0x26; 0x11; 0x22; 0x94; 0x8e; 0xfc; 0xfd; 0x49; 0x2e; 0x74; 0xe8; 0x2e; 0x21; 0x89;
0xed; 0x0f; 0xb4; 0x40; 0xd1; 0x87; 0xf3; 0x82; 0x27; 0x0c; 0xb4; 0x55; 0xf2; 0x1d; 0xd1; 0x85])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test5_SHAKE128
//
let test5_plaintext_shake128: b:lbuffer uint8 0ul{ recallable b } =
[@ inline_let]
let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test5_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7f; 0x9c; 0x2b; 0xa4; 0xe8; 0x8f; 0x82; 0x7d; 0x61; 0x60; 0x45; 0x50; 0x76; 0x05; 0x85; 0x3e])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test6_SHAKE128 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(14ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test6_plaintext_shake128:b: lbuffer uint8 14ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[0x52; 0x97; 0x7e; 0x53; 0x2b; 0xcc; 0xdb; 0x89; 0xdf; 0xef; 0xf7; 0xe9; 0xe4; 0xad])
in
assert_norm (List.Tot.length l == 14);
createL_mglobal l | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test2_expected_sha3_512 | val test2_expected_sha3_512:b: lbuffer uint8 64ul {recallable b} | val test2_expected_sha3_512:b: lbuffer uint8 64ul {recallable b} | let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 190,
"start_col": 0,
"start_line": 180
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(64ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test2_expected_sha3_512:b: lbuffer uint8 64ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09;
0x6e; 0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2;
0x71; 0x2e; 0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47;
0xe3; 0x93; 0x40; 0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27;
0x4e; 0xec; 0x53; 0xf0
])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test10_plaintext_shake256 | val test10_plaintext_shake256:b: lbuffer uint8 17ul {recallable b} | val test10_plaintext_shake256:b: lbuffer uint8 17ul {recallable b} | let test10_plaintext_shake256: b:lbuffer uint8 17ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xf9; 0xda; 0x78; 0xc8; 0x90; 0x84; 0x70; 0x40; 0x45; 0x4b; 0xa6; 0x42; 0x98; 0x82; 0xb0; 0x54;
0x09])
in
assert_norm (List.Tot.length l == 17);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 428,
"start_col": 0,
"start_line": 420
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3
//
let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l
let test3_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79; 0xba;
0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test3_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x41; 0xc0; 0xdb; 0xa2; 0xa9; 0xd6; 0x24; 0x08; 0x49; 0x10; 0x03; 0x76; 0xa8; 0x23; 0x5e; 0x2c;
0x82; 0xe1; 0xb9; 0x99; 0x8a; 0x99; 0x9e; 0x21; 0xdb; 0x32; 0xdd; 0x97; 0x49; 0x6d; 0x33; 0x76])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test3_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x99; 0x1c; 0x66; 0x57; 0x55; 0xeb; 0x3a; 0x4b; 0x6b; 0xbd; 0xfb; 0x75; 0xc7; 0x8a; 0x49; 0x2e;
0x8c; 0x56; 0xa2; 0x2c; 0x5c; 0x4d; 0x7e; 0x42; 0x9b; 0xfd; 0xbc; 0x32; 0xb9; 0xd4; 0xad; 0x5a;
0xa0; 0x4a; 0x1f; 0x07; 0x6e; 0x62; 0xfe; 0xa1; 0x9e; 0xef; 0x51; 0xac; 0xd0; 0x65; 0x7c; 0x22])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test3_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x04; 0xa3; 0x71; 0xe8; 0x4e; 0xcf; 0xb5; 0xb8; 0xb7; 0x7c; 0xb4; 0x86; 0x10; 0xfc; 0xa8; 0x18;
0x2d; 0xd4; 0x57; 0xce; 0x6f; 0x32; 0x6a; 0x0f; 0xd3; 0xd7; 0xec; 0x2f; 0x1e; 0x91; 0x63; 0x6d;
0xee; 0x69; 0x1f; 0xbe; 0x0c; 0x98; 0x53; 0x02; 0xba; 0x1b; 0x0d; 0x8d; 0xc7; 0x8c; 0x08; 0x63;
0x46; 0xb5; 0x33; 0xb4; 0x9c; 0x03; 0x0d; 0x99; 0xa2; 0x7d; 0xaf; 0x11; 0x39; 0xd6; 0xe7; 0x5e])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test4_SHA3
//
let test4_plaintext: b:lbuffer uint8 112ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69;
0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b;
0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d;
0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f;
0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71;
0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73;
0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x75])
in
assert_norm (List.Tot.length l == 112);
createL_mglobal l
let test4_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x54; 0x3e; 0x68; 0x68; 0xe1; 0x66; 0x6c; 0x1a; 0x64; 0x36; 0x30; 0xdf; 0x77; 0x36; 0x7a; 0xe5;
0xa6; 0x2a; 0x85; 0x07; 0x0a; 0x51; 0xc1; 0x4c; 0xbf; 0x66; 0x5c; 0xbc])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test4_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x91; 0x6f; 0x60; 0x61; 0xfe; 0x87; 0x97; 0x41; 0xca; 0x64; 0x69; 0xb4; 0x39; 0x71; 0xdf; 0xdb;
0x28; 0xb1; 0xa3; 0x2d; 0xc3; 0x6c; 0xb3; 0x25; 0x4e; 0x81; 0x2b; 0xe2; 0x7a; 0xad; 0x1d; 0x18])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test4_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x79; 0x40; 0x7d; 0x3b; 0x59; 0x16; 0xb5; 0x9c; 0x3e; 0x30; 0xb0; 0x98; 0x22; 0x97; 0x47; 0x91;
0xc3; 0x13; 0xfb; 0x9e; 0xcc; 0x84; 0x9e; 0x40; 0x6f; 0x23; 0x59; 0x2d; 0x04; 0xf6; 0x25; 0xdc;
0x8c; 0x70; 0x9b; 0x98; 0xb4; 0x3b; 0x38; 0x52; 0xb3; 0x37; 0x21; 0x61; 0x79; 0xaa; 0x7f; 0xc7])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test4_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xaf; 0xeb; 0xb2; 0xef; 0x54; 0x2e; 0x65; 0x79; 0xc5; 0x0c; 0xad; 0x06; 0xd2; 0xe5; 0x78; 0xf9;
0xf8; 0xdd; 0x68; 0x81; 0xd7; 0xdc; 0x82; 0x4d; 0x26; 0x36; 0x0f; 0xee; 0xbf; 0x18; 0xa4; 0xfa;
0x73; 0xe3; 0x26; 0x11; 0x22; 0x94; 0x8e; 0xfc; 0xfd; 0x49; 0x2e; 0x74; 0xe8; 0x2e; 0x21; 0x89;
0xed; 0x0f; 0xb4; 0x40; 0xd1; 0x87; 0xf3; 0x82; 0x27; 0x0c; 0xb4; 0x55; 0xf2; 0x1d; 0xd1; 0x85])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test5_SHAKE128
//
let test5_plaintext_shake128: b:lbuffer uint8 0ul{ recallable b } =
[@ inline_let]
let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test5_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7f; 0x9c; 0x2b; 0xa4; 0xe8; 0x8f; 0x82; 0x7d; 0x61; 0x60; 0x45; 0x50; 0x76; 0x05; 0x85; 0x3e])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test6_SHAKE128
//
let test6_plaintext_shake128: b:lbuffer uint8 14ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x52; 0x97; 0x7e; 0x53; 0x2b; 0xcc; 0xdb; 0x89; 0xdf; 0xef; 0xf7; 0xe9; 0xe4; 0xad]) in
assert_norm (List.Tot.length l == 14);
createL_mglobal l
let test6_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xfb; 0xfb; 0xa5; 0xc1; 0xe1; 0x79; 0xdf; 0x14; 0x69; 0xfc; 0xc8; 0x58; 0x8a; 0xe5; 0xd2; 0xcc])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test7_SHAKE128
//
let test7_plaintext_shake128: b:lbuffer uint8 34ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x4a; 0x20; 0x6a; 0x5b; 0x8a; 0xa3; 0x58; 0x6c; 0x06; 0x67; 0xa4; 0x00; 0x20; 0xd6; 0x5f; 0xf5;
0x11; 0xd5; 0x2b; 0x73; 0x2e; 0xf7; 0xa0; 0xc5; 0x69; 0xf1; 0xee; 0x68; 0x1a; 0x4f; 0xc3; 0x62;
0x00; 0x65])
in
assert_norm (List.Tot.length l == 34);
createL_mglobal l
let test7_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7b; 0xb4; 0x33; 0x75; 0x2b; 0x98; 0xf9; 0x15; 0xbe; 0x51; 0x82; 0xbc; 0x1f; 0x09; 0x66; 0x48])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test8_SHAKE128
//
let test8_plaintext_shake128: b:lbuffer uint8 83ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x24; 0x69; 0xf1; 0x01; 0xc9; 0xb4; 0x99; 0xa9; 0x30; 0xa9; 0x7e; 0xf1; 0xb3; 0x46; 0x73; 0xec;
0x74; 0x39; 0x3f; 0xd9; 0xfa; 0xf6; 0x58; 0xe3; 0x1f; 0x06; 0xee; 0x0b; 0x29; 0xa2; 0x2b; 0x62;
0x37; 0x80; 0xba; 0x7b; 0xdf; 0xed; 0x86; 0x20; 0x15; 0x1c; 0xc4; 0x44; 0x4e; 0xbe; 0x33; 0x39;
0xe6; 0xd2; 0xa2; 0x23; 0xbf; 0xbf; 0xb4; 0xad; 0x2c; 0xa0; 0xe0; 0xfa; 0x0d; 0xdf; 0xbb; 0xdf;
0x3b; 0x05; 0x7a; 0x4f; 0x26; 0xd0; 0xb2; 0x16; 0xbc; 0x87; 0x63; 0xca; 0x8d; 0x8a; 0x35; 0xff;
0x2d; 0x2d; 0x01])
in
assert_norm (List.Tot.length l == 83);
createL_mglobal l
let test8_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x00; 0xff; 0x5e; 0xf0; 0xcd; 0x7f; 0x8f; 0x90; 0xad; 0x94; 0xb7; 0x97; 0xe9; 0xd4; 0xdd; 0x30])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test9_SHAKE256
//
let test9_plaintext_shake256: b:lbuffer uint8 0ul{ recallable b } =
[@ inline_let]
let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test9_expected_shake256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x46; 0xb9; 0xdd; 0x2b; 0x0b; 0xa8; 0x8d; 0x13; 0x23; 0x3b; 0x3f; 0xeb; 0x74; 0x3e; 0xeb; 0x24;
0x3f; 0xcd; 0x52; 0xea; 0x62; 0xb8; 0x1b; 0x82; 0xb5; 0x0c; 0x27; 0x64; 0x6e; 0xd5; 0x76; 0x2f])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
//
// Test10_SHAKE256 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(17ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test10_plaintext_shake256:b: lbuffer uint8 17ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0xf9; 0xda; 0x78; 0xc8; 0x90; 0x84; 0x70; 0x40; 0x45; 0x4b; 0xa6; 0x42; 0x98; 0x82; 0xb0;
0x54; 0x09
])
in
assert_norm (List.Tot.length l == 17);
createL_mglobal l | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test2_expected_sha3_384 | val test2_expected_sha3_384:b: lbuffer uint8 48ul {recallable b} | val test2_expected_sha3_384:b: lbuffer uint8 48ul {recallable b} | let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 178,
"start_col": 0,
"start_line": 169
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(48ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test2_expected_sha3_384:b: lbuffer uint8 48ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad;
0x8d; 0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b;
0xe4; 0xb2; 0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28;
0x37; 0x6d; 0x25
])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test10_expected_shake256 | val test10_expected_shake256:b: lbuffer uint8 32ul {recallable b} | val test10_expected_shake256:b: lbuffer uint8 32ul {recallable b} | let test10_expected_shake256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa8; 0x49; 0x83; 0xc9; 0xfe; 0x75; 0xad; 0x0d; 0xe1; 0x9e; 0x2c; 0x84; 0x20; 0xa7; 0xea; 0x85;
0xb2; 0x51; 0x02; 0x19; 0x56; 0x14; 0xdf; 0xa5; 0x34; 0x7d; 0xe6; 0x0a; 0x1c; 0xe1; 0x3b; 0x60])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 438,
"start_col": 0,
"start_line": 430
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3
//
let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l
let test3_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79; 0xba;
0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test3_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x41; 0xc0; 0xdb; 0xa2; 0xa9; 0xd6; 0x24; 0x08; 0x49; 0x10; 0x03; 0x76; 0xa8; 0x23; 0x5e; 0x2c;
0x82; 0xe1; 0xb9; 0x99; 0x8a; 0x99; 0x9e; 0x21; 0xdb; 0x32; 0xdd; 0x97; 0x49; 0x6d; 0x33; 0x76])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test3_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x99; 0x1c; 0x66; 0x57; 0x55; 0xeb; 0x3a; 0x4b; 0x6b; 0xbd; 0xfb; 0x75; 0xc7; 0x8a; 0x49; 0x2e;
0x8c; 0x56; 0xa2; 0x2c; 0x5c; 0x4d; 0x7e; 0x42; 0x9b; 0xfd; 0xbc; 0x32; 0xb9; 0xd4; 0xad; 0x5a;
0xa0; 0x4a; 0x1f; 0x07; 0x6e; 0x62; 0xfe; 0xa1; 0x9e; 0xef; 0x51; 0xac; 0xd0; 0x65; 0x7c; 0x22])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test3_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x04; 0xa3; 0x71; 0xe8; 0x4e; 0xcf; 0xb5; 0xb8; 0xb7; 0x7c; 0xb4; 0x86; 0x10; 0xfc; 0xa8; 0x18;
0x2d; 0xd4; 0x57; 0xce; 0x6f; 0x32; 0x6a; 0x0f; 0xd3; 0xd7; 0xec; 0x2f; 0x1e; 0x91; 0x63; 0x6d;
0xee; 0x69; 0x1f; 0xbe; 0x0c; 0x98; 0x53; 0x02; 0xba; 0x1b; 0x0d; 0x8d; 0xc7; 0x8c; 0x08; 0x63;
0x46; 0xb5; 0x33; 0xb4; 0x9c; 0x03; 0x0d; 0x99; 0xa2; 0x7d; 0xaf; 0x11; 0x39; 0xd6; 0xe7; 0x5e])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test4_SHA3
//
let test4_plaintext: b:lbuffer uint8 112ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69;
0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b;
0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d;
0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f;
0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71;
0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73;
0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x75])
in
assert_norm (List.Tot.length l == 112);
createL_mglobal l
let test4_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x54; 0x3e; 0x68; 0x68; 0xe1; 0x66; 0x6c; 0x1a; 0x64; 0x36; 0x30; 0xdf; 0x77; 0x36; 0x7a; 0xe5;
0xa6; 0x2a; 0x85; 0x07; 0x0a; 0x51; 0xc1; 0x4c; 0xbf; 0x66; 0x5c; 0xbc])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test4_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x91; 0x6f; 0x60; 0x61; 0xfe; 0x87; 0x97; 0x41; 0xca; 0x64; 0x69; 0xb4; 0x39; 0x71; 0xdf; 0xdb;
0x28; 0xb1; 0xa3; 0x2d; 0xc3; 0x6c; 0xb3; 0x25; 0x4e; 0x81; 0x2b; 0xe2; 0x7a; 0xad; 0x1d; 0x18])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test4_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x79; 0x40; 0x7d; 0x3b; 0x59; 0x16; 0xb5; 0x9c; 0x3e; 0x30; 0xb0; 0x98; 0x22; 0x97; 0x47; 0x91;
0xc3; 0x13; 0xfb; 0x9e; 0xcc; 0x84; 0x9e; 0x40; 0x6f; 0x23; 0x59; 0x2d; 0x04; 0xf6; 0x25; 0xdc;
0x8c; 0x70; 0x9b; 0x98; 0xb4; 0x3b; 0x38; 0x52; 0xb3; 0x37; 0x21; 0x61; 0x79; 0xaa; 0x7f; 0xc7])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test4_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xaf; 0xeb; 0xb2; 0xef; 0x54; 0x2e; 0x65; 0x79; 0xc5; 0x0c; 0xad; 0x06; 0xd2; 0xe5; 0x78; 0xf9;
0xf8; 0xdd; 0x68; 0x81; 0xd7; 0xdc; 0x82; 0x4d; 0x26; 0x36; 0x0f; 0xee; 0xbf; 0x18; 0xa4; 0xfa;
0x73; 0xe3; 0x26; 0x11; 0x22; 0x94; 0x8e; 0xfc; 0xfd; 0x49; 0x2e; 0x74; 0xe8; 0x2e; 0x21; 0x89;
0xed; 0x0f; 0xb4; 0x40; 0xd1; 0x87; 0xf3; 0x82; 0x27; 0x0c; 0xb4; 0x55; 0xf2; 0x1d; 0xd1; 0x85])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test5_SHAKE128
//
let test5_plaintext_shake128: b:lbuffer uint8 0ul{ recallable b } =
[@ inline_let]
let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test5_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7f; 0x9c; 0x2b; 0xa4; 0xe8; 0x8f; 0x82; 0x7d; 0x61; 0x60; 0x45; 0x50; 0x76; 0x05; 0x85; 0x3e])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test6_SHAKE128
//
let test6_plaintext_shake128: b:lbuffer uint8 14ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x52; 0x97; 0x7e; 0x53; 0x2b; 0xcc; 0xdb; 0x89; 0xdf; 0xef; 0xf7; 0xe9; 0xe4; 0xad]) in
assert_norm (List.Tot.length l == 14);
createL_mglobal l
let test6_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xfb; 0xfb; 0xa5; 0xc1; 0xe1; 0x79; 0xdf; 0x14; 0x69; 0xfc; 0xc8; 0x58; 0x8a; 0xe5; 0xd2; 0xcc])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test7_SHAKE128
//
let test7_plaintext_shake128: b:lbuffer uint8 34ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x4a; 0x20; 0x6a; 0x5b; 0x8a; 0xa3; 0x58; 0x6c; 0x06; 0x67; 0xa4; 0x00; 0x20; 0xd6; 0x5f; 0xf5;
0x11; 0xd5; 0x2b; 0x73; 0x2e; 0xf7; 0xa0; 0xc5; 0x69; 0xf1; 0xee; 0x68; 0x1a; 0x4f; 0xc3; 0x62;
0x00; 0x65])
in
assert_norm (List.Tot.length l == 34);
createL_mglobal l
let test7_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7b; 0xb4; 0x33; 0x75; 0x2b; 0x98; 0xf9; 0x15; 0xbe; 0x51; 0x82; 0xbc; 0x1f; 0x09; 0x66; 0x48])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test8_SHAKE128
//
let test8_plaintext_shake128: b:lbuffer uint8 83ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x24; 0x69; 0xf1; 0x01; 0xc9; 0xb4; 0x99; 0xa9; 0x30; 0xa9; 0x7e; 0xf1; 0xb3; 0x46; 0x73; 0xec;
0x74; 0x39; 0x3f; 0xd9; 0xfa; 0xf6; 0x58; 0xe3; 0x1f; 0x06; 0xee; 0x0b; 0x29; 0xa2; 0x2b; 0x62;
0x37; 0x80; 0xba; 0x7b; 0xdf; 0xed; 0x86; 0x20; 0x15; 0x1c; 0xc4; 0x44; 0x4e; 0xbe; 0x33; 0x39;
0xe6; 0xd2; 0xa2; 0x23; 0xbf; 0xbf; 0xb4; 0xad; 0x2c; 0xa0; 0xe0; 0xfa; 0x0d; 0xdf; 0xbb; 0xdf;
0x3b; 0x05; 0x7a; 0x4f; 0x26; 0xd0; 0xb2; 0x16; 0xbc; 0x87; 0x63; 0xca; 0x8d; 0x8a; 0x35; 0xff;
0x2d; 0x2d; 0x01])
in
assert_norm (List.Tot.length l == 83);
createL_mglobal l
let test8_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x00; 0xff; 0x5e; 0xf0; 0xcd; 0x7f; 0x8f; 0x90; 0xad; 0x94; 0xb7; 0x97; 0xe9; 0xd4; 0xdd; 0x30])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test9_SHAKE256
//
let test9_plaintext_shake256: b:lbuffer uint8 0ul{ recallable b } =
[@ inline_let]
let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test9_expected_shake256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x46; 0xb9; 0xdd; 0x2b; 0x0b; 0xa8; 0x8d; 0x13; 0x23; 0x3b; 0x3f; 0xeb; 0x74; 0x3e; 0xeb; 0x24;
0x3f; 0xcd; 0x52; 0xea; 0x62; 0xb8; 0x1b; 0x82; 0xb5; 0x0c; 0x27; 0x64; 0x6e; 0xd5; 0x76; 0x2f])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
//
// Test10_SHAKE256
//
let test10_plaintext_shake256: b:lbuffer uint8 17ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xf9; 0xda; 0x78; 0xc8; 0x90; 0x84; 0x70; 0x40; 0x45; 0x4b; 0xa6; 0x42; 0x98; 0x82; 0xb0; 0x54;
0x09])
in
assert_norm (List.Tot.length l == 17);
createL_mglobal l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(32ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test10_expected_shake256:b: lbuffer uint8 32ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0xa8; 0x49; 0x83; 0xc9; 0xfe; 0x75; 0xad; 0x0d; 0xe1; 0x9e; 0x2c; 0x84; 0x20; 0xa7; 0xea;
0x85; 0xb2; 0x51; 0x02; 0x19; 0x56; 0x14; 0xdf; 0xa5; 0x34; 0x7d; 0xe6; 0x0a; 0x1c; 0xe1;
0x3b; 0x60
])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test3_expected_sha3_384 | val test3_expected_sha3_384:b: lbuffer uint8 48ul {recallable b} | val test3_expected_sha3_384:b: lbuffer uint8 48ul {recallable b} | let test3_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x99; 0x1c; 0x66; 0x57; 0x55; 0xeb; 0x3a; 0x4b; 0x6b; 0xbd; 0xfb; 0x75; 0xc7; 0x8a; 0x49; 0x2e;
0x8c; 0x56; 0xa2; 0x2c; 0x5c; 0x4d; 0x7e; 0x42; 0x9b; 0xfd; 0xbc; 0x32; 0xb9; 0xd4; 0xad; 0x5a;
0xa0; 0x4a; 0x1f; 0x07; 0x6e; 0x62; 0xfe; 0xa1; 0x9e; 0xef; 0x51; 0xac; 0xd0; 0x65; 0x7c; 0x22])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 236,
"start_col": 0,
"start_line": 227
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3
//
let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l
let test3_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79; 0xba;
0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test3_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x41; 0xc0; 0xdb; 0xa2; 0xa9; 0xd6; 0x24; 0x08; 0x49; 0x10; 0x03; 0x76; 0xa8; 0x23; 0x5e; 0x2c;
0x82; 0xe1; 0xb9; 0x99; 0x8a; 0x99; 0x9e; 0x21; 0xdb; 0x32; 0xdd; 0x97; 0x49; 0x6d; 0x33; 0x76])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(48ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test3_expected_sha3_384:b: lbuffer uint8 48ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0x99; 0x1c; 0x66; 0x57; 0x55; 0xeb; 0x3a; 0x4b; 0x6b; 0xbd; 0xfb; 0x75; 0xc7; 0x8a; 0x49;
0x2e; 0x8c; 0x56; 0xa2; 0x2c; 0x5c; 0x4d; 0x7e; 0x42; 0x9b; 0xfd; 0xbc; 0x32; 0xb9; 0xd4;
0xad; 0x5a; 0xa0; 0x4a; 0x1f; 0x07; 0x6e; 0x62; 0xfe; 0xa1; 0x9e; 0xef; 0x51; 0xac; 0xd0;
0x65; 0x7c; 0x22
])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test7_plaintext_shake128 | val test7_plaintext_shake128:b: lbuffer uint8 34ul {recallable b} | val test7_plaintext_shake128:b: lbuffer uint8 34ul {recallable b} | let test7_plaintext_shake128: b:lbuffer uint8 34ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x4a; 0x20; 0x6a; 0x5b; 0x8a; 0xa3; 0x58; 0x6c; 0x06; 0x67; 0xa4; 0x00; 0x20; 0xd6; 0x5f; 0xf5;
0x11; 0xd5; 0x2b; 0x73; 0x2e; 0xf7; 0xa0; 0xc5; 0x69; 0xf1; 0xee; 0x68; 0x1a; 0x4f; 0xc3; 0x62;
0x00; 0x65])
in
assert_norm (List.Tot.length l == 34);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 361,
"start_col": 0,
"start_line": 352
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3
//
let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l
let test3_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79; 0xba;
0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test3_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x41; 0xc0; 0xdb; 0xa2; 0xa9; 0xd6; 0x24; 0x08; 0x49; 0x10; 0x03; 0x76; 0xa8; 0x23; 0x5e; 0x2c;
0x82; 0xe1; 0xb9; 0x99; 0x8a; 0x99; 0x9e; 0x21; 0xdb; 0x32; 0xdd; 0x97; 0x49; 0x6d; 0x33; 0x76])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test3_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x99; 0x1c; 0x66; 0x57; 0x55; 0xeb; 0x3a; 0x4b; 0x6b; 0xbd; 0xfb; 0x75; 0xc7; 0x8a; 0x49; 0x2e;
0x8c; 0x56; 0xa2; 0x2c; 0x5c; 0x4d; 0x7e; 0x42; 0x9b; 0xfd; 0xbc; 0x32; 0xb9; 0xd4; 0xad; 0x5a;
0xa0; 0x4a; 0x1f; 0x07; 0x6e; 0x62; 0xfe; 0xa1; 0x9e; 0xef; 0x51; 0xac; 0xd0; 0x65; 0x7c; 0x22])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test3_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x04; 0xa3; 0x71; 0xe8; 0x4e; 0xcf; 0xb5; 0xb8; 0xb7; 0x7c; 0xb4; 0x86; 0x10; 0xfc; 0xa8; 0x18;
0x2d; 0xd4; 0x57; 0xce; 0x6f; 0x32; 0x6a; 0x0f; 0xd3; 0xd7; 0xec; 0x2f; 0x1e; 0x91; 0x63; 0x6d;
0xee; 0x69; 0x1f; 0xbe; 0x0c; 0x98; 0x53; 0x02; 0xba; 0x1b; 0x0d; 0x8d; 0xc7; 0x8c; 0x08; 0x63;
0x46; 0xb5; 0x33; 0xb4; 0x9c; 0x03; 0x0d; 0x99; 0xa2; 0x7d; 0xaf; 0x11; 0x39; 0xd6; 0xe7; 0x5e])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test4_SHA3
//
let test4_plaintext: b:lbuffer uint8 112ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69;
0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b;
0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d;
0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f;
0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71;
0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73;
0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x75])
in
assert_norm (List.Tot.length l == 112);
createL_mglobal l
let test4_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x54; 0x3e; 0x68; 0x68; 0xe1; 0x66; 0x6c; 0x1a; 0x64; 0x36; 0x30; 0xdf; 0x77; 0x36; 0x7a; 0xe5;
0xa6; 0x2a; 0x85; 0x07; 0x0a; 0x51; 0xc1; 0x4c; 0xbf; 0x66; 0x5c; 0xbc])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test4_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x91; 0x6f; 0x60; 0x61; 0xfe; 0x87; 0x97; 0x41; 0xca; 0x64; 0x69; 0xb4; 0x39; 0x71; 0xdf; 0xdb;
0x28; 0xb1; 0xa3; 0x2d; 0xc3; 0x6c; 0xb3; 0x25; 0x4e; 0x81; 0x2b; 0xe2; 0x7a; 0xad; 0x1d; 0x18])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test4_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x79; 0x40; 0x7d; 0x3b; 0x59; 0x16; 0xb5; 0x9c; 0x3e; 0x30; 0xb0; 0x98; 0x22; 0x97; 0x47; 0x91;
0xc3; 0x13; 0xfb; 0x9e; 0xcc; 0x84; 0x9e; 0x40; 0x6f; 0x23; 0x59; 0x2d; 0x04; 0xf6; 0x25; 0xdc;
0x8c; 0x70; 0x9b; 0x98; 0xb4; 0x3b; 0x38; 0x52; 0xb3; 0x37; 0x21; 0x61; 0x79; 0xaa; 0x7f; 0xc7])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test4_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xaf; 0xeb; 0xb2; 0xef; 0x54; 0x2e; 0x65; 0x79; 0xc5; 0x0c; 0xad; 0x06; 0xd2; 0xe5; 0x78; 0xf9;
0xf8; 0xdd; 0x68; 0x81; 0xd7; 0xdc; 0x82; 0x4d; 0x26; 0x36; 0x0f; 0xee; 0xbf; 0x18; 0xa4; 0xfa;
0x73; 0xe3; 0x26; 0x11; 0x22; 0x94; 0x8e; 0xfc; 0xfd; 0x49; 0x2e; 0x74; 0xe8; 0x2e; 0x21; 0x89;
0xed; 0x0f; 0xb4; 0x40; 0xd1; 0x87; 0xf3; 0x82; 0x27; 0x0c; 0xb4; 0x55; 0xf2; 0x1d; 0xd1; 0x85])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test5_SHAKE128
//
let test5_plaintext_shake128: b:lbuffer uint8 0ul{ recallable b } =
[@ inline_let]
let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test5_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7f; 0x9c; 0x2b; 0xa4; 0xe8; 0x8f; 0x82; 0x7d; 0x61; 0x60; 0x45; 0x50; 0x76; 0x05; 0x85; 0x3e])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test6_SHAKE128
//
let test6_plaintext_shake128: b:lbuffer uint8 14ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x52; 0x97; 0x7e; 0x53; 0x2b; 0xcc; 0xdb; 0x89; 0xdf; 0xef; 0xf7; 0xe9; 0xe4; 0xad]) in
assert_norm (List.Tot.length l == 14);
createL_mglobal l
let test6_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xfb; 0xfb; 0xa5; 0xc1; 0xe1; 0x79; 0xdf; 0x14; 0x69; 0xfc; 0xc8; 0x58; 0x8a; 0xe5; 0xd2; 0xcc])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test7_SHAKE128 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(34ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test7_plaintext_shake128:b: lbuffer uint8 34ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0x4a; 0x20; 0x6a; 0x5b; 0x8a; 0xa3; 0x58; 0x6c; 0x06; 0x67; 0xa4; 0x00; 0x20; 0xd6; 0x5f;
0xf5; 0x11; 0xd5; 0x2b; 0x73; 0x2e; 0xf7; 0xa0; 0xc5; 0x69; 0xf1; 0xee; 0x68; 0x1a; 0x4f;
0xc3; 0x62; 0x00; 0x65
])
in
assert_norm (List.Tot.length l == 34);
createL_mglobal l | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test12_expected_shake256 | val test12_expected_shake256:b: lbuffer uint8 32ul {recallable b} | val test12_expected_shake256:b: lbuffer uint8 32ul {recallable b} | let test12_expected_shake256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x64; 0x2f; 0x3f; 0x23; 0x5a; 0xc7; 0xe3; 0xd4; 0x34; 0x06; 0x3b; 0x5f; 0xc9; 0x21; 0x5f; 0xc3;
0xf0; 0xe5; 0x91; 0xe2; 0xe7; 0xfd; 0x17; 0x66; 0x8d; 0x1a; 0x0c; 0x87; 0x46; 0x87; 0x35; 0xc2])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 487,
"start_col": 0,
"start_line": 479
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3
//
let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l
let test3_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79; 0xba;
0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test3_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x41; 0xc0; 0xdb; 0xa2; 0xa9; 0xd6; 0x24; 0x08; 0x49; 0x10; 0x03; 0x76; 0xa8; 0x23; 0x5e; 0x2c;
0x82; 0xe1; 0xb9; 0x99; 0x8a; 0x99; 0x9e; 0x21; 0xdb; 0x32; 0xdd; 0x97; 0x49; 0x6d; 0x33; 0x76])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test3_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x99; 0x1c; 0x66; 0x57; 0x55; 0xeb; 0x3a; 0x4b; 0x6b; 0xbd; 0xfb; 0x75; 0xc7; 0x8a; 0x49; 0x2e;
0x8c; 0x56; 0xa2; 0x2c; 0x5c; 0x4d; 0x7e; 0x42; 0x9b; 0xfd; 0xbc; 0x32; 0xb9; 0xd4; 0xad; 0x5a;
0xa0; 0x4a; 0x1f; 0x07; 0x6e; 0x62; 0xfe; 0xa1; 0x9e; 0xef; 0x51; 0xac; 0xd0; 0x65; 0x7c; 0x22])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test3_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x04; 0xa3; 0x71; 0xe8; 0x4e; 0xcf; 0xb5; 0xb8; 0xb7; 0x7c; 0xb4; 0x86; 0x10; 0xfc; 0xa8; 0x18;
0x2d; 0xd4; 0x57; 0xce; 0x6f; 0x32; 0x6a; 0x0f; 0xd3; 0xd7; 0xec; 0x2f; 0x1e; 0x91; 0x63; 0x6d;
0xee; 0x69; 0x1f; 0xbe; 0x0c; 0x98; 0x53; 0x02; 0xba; 0x1b; 0x0d; 0x8d; 0xc7; 0x8c; 0x08; 0x63;
0x46; 0xb5; 0x33; 0xb4; 0x9c; 0x03; 0x0d; 0x99; 0xa2; 0x7d; 0xaf; 0x11; 0x39; 0xd6; 0xe7; 0x5e])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test4_SHA3
//
let test4_plaintext: b:lbuffer uint8 112ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69;
0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b;
0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d;
0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f;
0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71;
0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73;
0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x75])
in
assert_norm (List.Tot.length l == 112);
createL_mglobal l
let test4_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x54; 0x3e; 0x68; 0x68; 0xe1; 0x66; 0x6c; 0x1a; 0x64; 0x36; 0x30; 0xdf; 0x77; 0x36; 0x7a; 0xe5;
0xa6; 0x2a; 0x85; 0x07; 0x0a; 0x51; 0xc1; 0x4c; 0xbf; 0x66; 0x5c; 0xbc])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test4_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x91; 0x6f; 0x60; 0x61; 0xfe; 0x87; 0x97; 0x41; 0xca; 0x64; 0x69; 0xb4; 0x39; 0x71; 0xdf; 0xdb;
0x28; 0xb1; 0xa3; 0x2d; 0xc3; 0x6c; 0xb3; 0x25; 0x4e; 0x81; 0x2b; 0xe2; 0x7a; 0xad; 0x1d; 0x18])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test4_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x79; 0x40; 0x7d; 0x3b; 0x59; 0x16; 0xb5; 0x9c; 0x3e; 0x30; 0xb0; 0x98; 0x22; 0x97; 0x47; 0x91;
0xc3; 0x13; 0xfb; 0x9e; 0xcc; 0x84; 0x9e; 0x40; 0x6f; 0x23; 0x59; 0x2d; 0x04; 0xf6; 0x25; 0xdc;
0x8c; 0x70; 0x9b; 0x98; 0xb4; 0x3b; 0x38; 0x52; 0xb3; 0x37; 0x21; 0x61; 0x79; 0xaa; 0x7f; 0xc7])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test4_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xaf; 0xeb; 0xb2; 0xef; 0x54; 0x2e; 0x65; 0x79; 0xc5; 0x0c; 0xad; 0x06; 0xd2; 0xe5; 0x78; 0xf9;
0xf8; 0xdd; 0x68; 0x81; 0xd7; 0xdc; 0x82; 0x4d; 0x26; 0x36; 0x0f; 0xee; 0xbf; 0x18; 0xa4; 0xfa;
0x73; 0xe3; 0x26; 0x11; 0x22; 0x94; 0x8e; 0xfc; 0xfd; 0x49; 0x2e; 0x74; 0xe8; 0x2e; 0x21; 0x89;
0xed; 0x0f; 0xb4; 0x40; 0xd1; 0x87; 0xf3; 0x82; 0x27; 0x0c; 0xb4; 0x55; 0xf2; 0x1d; 0xd1; 0x85])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test5_SHAKE128
//
let test5_plaintext_shake128: b:lbuffer uint8 0ul{ recallable b } =
[@ inline_let]
let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test5_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7f; 0x9c; 0x2b; 0xa4; 0xe8; 0x8f; 0x82; 0x7d; 0x61; 0x60; 0x45; 0x50; 0x76; 0x05; 0x85; 0x3e])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test6_SHAKE128
//
let test6_plaintext_shake128: b:lbuffer uint8 14ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x52; 0x97; 0x7e; 0x53; 0x2b; 0xcc; 0xdb; 0x89; 0xdf; 0xef; 0xf7; 0xe9; 0xe4; 0xad]) in
assert_norm (List.Tot.length l == 14);
createL_mglobal l
let test6_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xfb; 0xfb; 0xa5; 0xc1; 0xe1; 0x79; 0xdf; 0x14; 0x69; 0xfc; 0xc8; 0x58; 0x8a; 0xe5; 0xd2; 0xcc])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test7_SHAKE128
//
let test7_plaintext_shake128: b:lbuffer uint8 34ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x4a; 0x20; 0x6a; 0x5b; 0x8a; 0xa3; 0x58; 0x6c; 0x06; 0x67; 0xa4; 0x00; 0x20; 0xd6; 0x5f; 0xf5;
0x11; 0xd5; 0x2b; 0x73; 0x2e; 0xf7; 0xa0; 0xc5; 0x69; 0xf1; 0xee; 0x68; 0x1a; 0x4f; 0xc3; 0x62;
0x00; 0x65])
in
assert_norm (List.Tot.length l == 34);
createL_mglobal l
let test7_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7b; 0xb4; 0x33; 0x75; 0x2b; 0x98; 0xf9; 0x15; 0xbe; 0x51; 0x82; 0xbc; 0x1f; 0x09; 0x66; 0x48])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test8_SHAKE128
//
let test8_plaintext_shake128: b:lbuffer uint8 83ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x24; 0x69; 0xf1; 0x01; 0xc9; 0xb4; 0x99; 0xa9; 0x30; 0xa9; 0x7e; 0xf1; 0xb3; 0x46; 0x73; 0xec;
0x74; 0x39; 0x3f; 0xd9; 0xfa; 0xf6; 0x58; 0xe3; 0x1f; 0x06; 0xee; 0x0b; 0x29; 0xa2; 0x2b; 0x62;
0x37; 0x80; 0xba; 0x7b; 0xdf; 0xed; 0x86; 0x20; 0x15; 0x1c; 0xc4; 0x44; 0x4e; 0xbe; 0x33; 0x39;
0xe6; 0xd2; 0xa2; 0x23; 0xbf; 0xbf; 0xb4; 0xad; 0x2c; 0xa0; 0xe0; 0xfa; 0x0d; 0xdf; 0xbb; 0xdf;
0x3b; 0x05; 0x7a; 0x4f; 0x26; 0xd0; 0xb2; 0x16; 0xbc; 0x87; 0x63; 0xca; 0x8d; 0x8a; 0x35; 0xff;
0x2d; 0x2d; 0x01])
in
assert_norm (List.Tot.length l == 83);
createL_mglobal l
let test8_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x00; 0xff; 0x5e; 0xf0; 0xcd; 0x7f; 0x8f; 0x90; 0xad; 0x94; 0xb7; 0x97; 0xe9; 0xd4; 0xdd; 0x30])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test9_SHAKE256
//
let test9_plaintext_shake256: b:lbuffer uint8 0ul{ recallable b } =
[@ inline_let]
let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test9_expected_shake256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x46; 0xb9; 0xdd; 0x2b; 0x0b; 0xa8; 0x8d; 0x13; 0x23; 0x3b; 0x3f; 0xeb; 0x74; 0x3e; 0xeb; 0x24;
0x3f; 0xcd; 0x52; 0xea; 0x62; 0xb8; 0x1b; 0x82; 0xb5; 0x0c; 0x27; 0x64; 0x6e; 0xd5; 0x76; 0x2f])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
//
// Test10_SHAKE256
//
let test10_plaintext_shake256: b:lbuffer uint8 17ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xf9; 0xda; 0x78; 0xc8; 0x90; 0x84; 0x70; 0x40; 0x45; 0x4b; 0xa6; 0x42; 0x98; 0x82; 0xb0; 0x54;
0x09])
in
assert_norm (List.Tot.length l == 17);
createL_mglobal l
let test10_expected_shake256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa8; 0x49; 0x83; 0xc9; 0xfe; 0x75; 0xad; 0x0d; 0xe1; 0x9e; 0x2c; 0x84; 0x20; 0xa7; 0xea; 0x85;
0xb2; 0x51; 0x02; 0x19; 0x56; 0x14; 0xdf; 0xa5; 0x34; 0x7d; 0xe6; 0x0a; 0x1c; 0xe1; 0x3b; 0x60])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
//
// Test11_SHAKE256
//
let test11_plaintext_shake256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xef; 0x89; 0x6c; 0xdc; 0xb3; 0x63; 0xa6; 0x15; 0x91; 0x78; 0xa1; 0xbb; 0x1c; 0x99; 0x39; 0x46;
0xc5; 0x04; 0x02; 0x09; 0x5c; 0xda; 0xea; 0x4f; 0xd4; 0xd4; 0x19; 0xaa; 0x47; 0x32; 0x1c; 0x88])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test11_expected_shake256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7a; 0xbb; 0xa4; 0xe8; 0xb8; 0xdd; 0x76; 0x6b; 0xba; 0xbe; 0x98; 0xf8; 0xf1; 0x69; 0xcb; 0x62;
0x08; 0x67; 0x4d; 0xe1; 0x9a; 0x51; 0xd7; 0x3c; 0x92; 0xb7; 0xdc; 0x04; 0xa4; 0xb5; 0xee; 0x3d])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
//
// Test12_SHAKE256
//
let test12_plaintext_shake256: b:lbuffer uint8 78ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xde; 0x70; 0x1f; 0x10; 0xad; 0x39; 0x61; 0xb0; 0xda; 0xcc; 0x96; 0x87; 0x3a; 0x3c; 0xd5; 0x58;
0x55; 0x81; 0x88; 0xff; 0x69; 0x6d; 0x85; 0x01; 0xb2; 0xe2; 0x7b; 0x67; 0xe9; 0x41; 0x90; 0xcd;
0x0b; 0x25; 0x48; 0xb6; 0x5b; 0x52; 0xa9; 0x22; 0xaa; 0xe8; 0x9d; 0x63; 0xd6; 0xdd; 0x97; 0x2c;
0x91; 0xa9; 0x79; 0xeb; 0x63; 0x43; 0xb6; 0x58; 0xf2; 0x4d; 0xb3; 0x4e; 0x82; 0x8b; 0x74; 0xdb;
0xb8; 0x9a; 0x74; 0x93; 0xa3; 0xdf; 0xd4; 0x29; 0xfd; 0xbd; 0xb8; 0x40; 0xad; 0x0b])
in
assert_norm (List.Tot.length l == 78);
createL_mglobal l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(32ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test12_expected_shake256:b: lbuffer uint8 32ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0x64; 0x2f; 0x3f; 0x23; 0x5a; 0xc7; 0xe3; 0xd4; 0x34; 0x06; 0x3b; 0x5f; 0xc9; 0x21; 0x5f;
0xc3; 0xf0; 0xe5; 0x91; 0xe2; 0xe7; 0xfd; 0x17; 0x66; 0x8d; 0x1a; 0x0c; 0x87; 0x46; 0x87;
0x35; 0xc2
])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l | false |
CPS.Simple.fst | CPS.Simple.add | val add : list int -> Tot int | val add : list int -> Tot int | let add l = add_cps l (fun x -> x) | {
"file_name": "examples/termination/CPS.Simple.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 34,
"end_line": 32,
"start_col": 0,
"start_line": 32
} | (*
Copyright 2014 Chantal Keller, Microsoft Research and Inria
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.
*)
(* ***********************************************************)
(* * A simple CPS function: adding the elements of a list. ***)
(* ***********************************************************)
(* Standard implementation **)
module CPS.Simple
open FStar.List.Tot
val add_cps : list int -> (int -> Tot 'a) -> Tot 'a
let rec add_cps l k = match l with
| [] -> k 0
| hd::tl -> add_cps tl (fun (r:int) -> k (hd + r)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "CPS.Simple.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "CPS",
"short_module": null
},
{
"abbrev": false,
"full_module": "CPS",
"short_module": null
},
{
"abbrev": 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 Prims.int -> Prims.int | Prims.Tot | [
"total"
] | [] | [
"Prims.list",
"Prims.int",
"CPS.Simple.add_cps"
] | [] | false | false | false | true | false | let add l =
| add_cps l (fun x -> x) | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test7_expected_shake128 | val test7_expected_shake128:b: lbuffer uint8 16ul {recallable b} | val test7_expected_shake128:b: lbuffer uint8 16ul {recallable b} | let test7_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7b; 0xb4; 0x33; 0x75; 0x2b; 0x98; 0xf9; 0x15; 0xbe; 0x51; 0x82; 0xbc; 0x1f; 0x09; 0x66; 0x48])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 370,
"start_col": 0,
"start_line": 363
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3
//
let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l
let test3_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79; 0xba;
0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test3_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x41; 0xc0; 0xdb; 0xa2; 0xa9; 0xd6; 0x24; 0x08; 0x49; 0x10; 0x03; 0x76; 0xa8; 0x23; 0x5e; 0x2c;
0x82; 0xe1; 0xb9; 0x99; 0x8a; 0x99; 0x9e; 0x21; 0xdb; 0x32; 0xdd; 0x97; 0x49; 0x6d; 0x33; 0x76])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test3_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x99; 0x1c; 0x66; 0x57; 0x55; 0xeb; 0x3a; 0x4b; 0x6b; 0xbd; 0xfb; 0x75; 0xc7; 0x8a; 0x49; 0x2e;
0x8c; 0x56; 0xa2; 0x2c; 0x5c; 0x4d; 0x7e; 0x42; 0x9b; 0xfd; 0xbc; 0x32; 0xb9; 0xd4; 0xad; 0x5a;
0xa0; 0x4a; 0x1f; 0x07; 0x6e; 0x62; 0xfe; 0xa1; 0x9e; 0xef; 0x51; 0xac; 0xd0; 0x65; 0x7c; 0x22])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test3_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x04; 0xa3; 0x71; 0xe8; 0x4e; 0xcf; 0xb5; 0xb8; 0xb7; 0x7c; 0xb4; 0x86; 0x10; 0xfc; 0xa8; 0x18;
0x2d; 0xd4; 0x57; 0xce; 0x6f; 0x32; 0x6a; 0x0f; 0xd3; 0xd7; 0xec; 0x2f; 0x1e; 0x91; 0x63; 0x6d;
0xee; 0x69; 0x1f; 0xbe; 0x0c; 0x98; 0x53; 0x02; 0xba; 0x1b; 0x0d; 0x8d; 0xc7; 0x8c; 0x08; 0x63;
0x46; 0xb5; 0x33; 0xb4; 0x9c; 0x03; 0x0d; 0x99; 0xa2; 0x7d; 0xaf; 0x11; 0x39; 0xd6; 0xe7; 0x5e])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test4_SHA3
//
let test4_plaintext: b:lbuffer uint8 112ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69;
0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b;
0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d;
0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f;
0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71;
0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73;
0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x75])
in
assert_norm (List.Tot.length l == 112);
createL_mglobal l
let test4_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x54; 0x3e; 0x68; 0x68; 0xe1; 0x66; 0x6c; 0x1a; 0x64; 0x36; 0x30; 0xdf; 0x77; 0x36; 0x7a; 0xe5;
0xa6; 0x2a; 0x85; 0x07; 0x0a; 0x51; 0xc1; 0x4c; 0xbf; 0x66; 0x5c; 0xbc])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test4_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x91; 0x6f; 0x60; 0x61; 0xfe; 0x87; 0x97; 0x41; 0xca; 0x64; 0x69; 0xb4; 0x39; 0x71; 0xdf; 0xdb;
0x28; 0xb1; 0xa3; 0x2d; 0xc3; 0x6c; 0xb3; 0x25; 0x4e; 0x81; 0x2b; 0xe2; 0x7a; 0xad; 0x1d; 0x18])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test4_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x79; 0x40; 0x7d; 0x3b; 0x59; 0x16; 0xb5; 0x9c; 0x3e; 0x30; 0xb0; 0x98; 0x22; 0x97; 0x47; 0x91;
0xc3; 0x13; 0xfb; 0x9e; 0xcc; 0x84; 0x9e; 0x40; 0x6f; 0x23; 0x59; 0x2d; 0x04; 0xf6; 0x25; 0xdc;
0x8c; 0x70; 0x9b; 0x98; 0xb4; 0x3b; 0x38; 0x52; 0xb3; 0x37; 0x21; 0x61; 0x79; 0xaa; 0x7f; 0xc7])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test4_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xaf; 0xeb; 0xb2; 0xef; 0x54; 0x2e; 0x65; 0x79; 0xc5; 0x0c; 0xad; 0x06; 0xd2; 0xe5; 0x78; 0xf9;
0xf8; 0xdd; 0x68; 0x81; 0xd7; 0xdc; 0x82; 0x4d; 0x26; 0x36; 0x0f; 0xee; 0xbf; 0x18; 0xa4; 0xfa;
0x73; 0xe3; 0x26; 0x11; 0x22; 0x94; 0x8e; 0xfc; 0xfd; 0x49; 0x2e; 0x74; 0xe8; 0x2e; 0x21; 0x89;
0xed; 0x0f; 0xb4; 0x40; 0xd1; 0x87; 0xf3; 0x82; 0x27; 0x0c; 0xb4; 0x55; 0xf2; 0x1d; 0xd1; 0x85])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test5_SHAKE128
//
let test5_plaintext_shake128: b:lbuffer uint8 0ul{ recallable b } =
[@ inline_let]
let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test5_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7f; 0x9c; 0x2b; 0xa4; 0xe8; 0x8f; 0x82; 0x7d; 0x61; 0x60; 0x45; 0x50; 0x76; 0x05; 0x85; 0x3e])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test6_SHAKE128
//
let test6_plaintext_shake128: b:lbuffer uint8 14ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x52; 0x97; 0x7e; 0x53; 0x2b; 0xcc; 0xdb; 0x89; 0xdf; 0xef; 0xf7; 0xe9; 0xe4; 0xad]) in
assert_norm (List.Tot.length l == 14);
createL_mglobal l
let test6_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xfb; 0xfb; 0xa5; 0xc1; 0xe1; 0x79; 0xdf; 0x14; 0x69; 0xfc; 0xc8; 0x58; 0x8a; 0xe5; 0xd2; 0xcc])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test7_SHAKE128
//
let test7_plaintext_shake128: b:lbuffer uint8 34ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x4a; 0x20; 0x6a; 0x5b; 0x8a; 0xa3; 0x58; 0x6c; 0x06; 0x67; 0xa4; 0x00; 0x20; 0xd6; 0x5f; 0xf5;
0x11; 0xd5; 0x2b; 0x73; 0x2e; 0xf7; 0xa0; 0xc5; 0x69; 0xf1; 0xee; 0x68; 0x1a; 0x4f; 0xc3; 0x62;
0x00; 0x65])
in
assert_norm (List.Tot.length l == 34);
createL_mglobal l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(16ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test7_expected_shake128:b: lbuffer uint8 16ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0x7b; 0xb4; 0x33; 0x75; 0x2b; 0x98; 0xf9; 0x15; 0xbe; 0x51; 0x82; 0xbc; 0x1f; 0x09; 0x66;
0x48
])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test9_expected_shake256 | val test9_expected_shake256:b: lbuffer uint8 32ul {recallable b} | val test9_expected_shake256:b: lbuffer uint8 32ul {recallable b} | let test9_expected_shake256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x46; 0xb9; 0xdd; 0x2b; 0x0b; 0xa8; 0x8d; 0x13; 0x23; 0x3b; 0x3f; 0xeb; 0x74; 0x3e; 0xeb; 0x24;
0x3f; 0xcd; 0x52; 0xea; 0x62; 0xb8; 0x1b; 0x82; 0xb5; 0x0c; 0x27; 0x64; 0x6e; 0xd5; 0x76; 0x2f])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 415,
"start_col": 0,
"start_line": 407
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3
//
let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l
let test3_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79; 0xba;
0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test3_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x41; 0xc0; 0xdb; 0xa2; 0xa9; 0xd6; 0x24; 0x08; 0x49; 0x10; 0x03; 0x76; 0xa8; 0x23; 0x5e; 0x2c;
0x82; 0xe1; 0xb9; 0x99; 0x8a; 0x99; 0x9e; 0x21; 0xdb; 0x32; 0xdd; 0x97; 0x49; 0x6d; 0x33; 0x76])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test3_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x99; 0x1c; 0x66; 0x57; 0x55; 0xeb; 0x3a; 0x4b; 0x6b; 0xbd; 0xfb; 0x75; 0xc7; 0x8a; 0x49; 0x2e;
0x8c; 0x56; 0xa2; 0x2c; 0x5c; 0x4d; 0x7e; 0x42; 0x9b; 0xfd; 0xbc; 0x32; 0xb9; 0xd4; 0xad; 0x5a;
0xa0; 0x4a; 0x1f; 0x07; 0x6e; 0x62; 0xfe; 0xa1; 0x9e; 0xef; 0x51; 0xac; 0xd0; 0x65; 0x7c; 0x22])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test3_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x04; 0xa3; 0x71; 0xe8; 0x4e; 0xcf; 0xb5; 0xb8; 0xb7; 0x7c; 0xb4; 0x86; 0x10; 0xfc; 0xa8; 0x18;
0x2d; 0xd4; 0x57; 0xce; 0x6f; 0x32; 0x6a; 0x0f; 0xd3; 0xd7; 0xec; 0x2f; 0x1e; 0x91; 0x63; 0x6d;
0xee; 0x69; 0x1f; 0xbe; 0x0c; 0x98; 0x53; 0x02; 0xba; 0x1b; 0x0d; 0x8d; 0xc7; 0x8c; 0x08; 0x63;
0x46; 0xb5; 0x33; 0xb4; 0x9c; 0x03; 0x0d; 0x99; 0xa2; 0x7d; 0xaf; 0x11; 0x39; 0xd6; 0xe7; 0x5e])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test4_SHA3
//
let test4_plaintext: b:lbuffer uint8 112ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69;
0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b;
0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d;
0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f;
0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71;
0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73;
0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x75])
in
assert_norm (List.Tot.length l == 112);
createL_mglobal l
let test4_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x54; 0x3e; 0x68; 0x68; 0xe1; 0x66; 0x6c; 0x1a; 0x64; 0x36; 0x30; 0xdf; 0x77; 0x36; 0x7a; 0xe5;
0xa6; 0x2a; 0x85; 0x07; 0x0a; 0x51; 0xc1; 0x4c; 0xbf; 0x66; 0x5c; 0xbc])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test4_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x91; 0x6f; 0x60; 0x61; 0xfe; 0x87; 0x97; 0x41; 0xca; 0x64; 0x69; 0xb4; 0x39; 0x71; 0xdf; 0xdb;
0x28; 0xb1; 0xa3; 0x2d; 0xc3; 0x6c; 0xb3; 0x25; 0x4e; 0x81; 0x2b; 0xe2; 0x7a; 0xad; 0x1d; 0x18])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test4_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x79; 0x40; 0x7d; 0x3b; 0x59; 0x16; 0xb5; 0x9c; 0x3e; 0x30; 0xb0; 0x98; 0x22; 0x97; 0x47; 0x91;
0xc3; 0x13; 0xfb; 0x9e; 0xcc; 0x84; 0x9e; 0x40; 0x6f; 0x23; 0x59; 0x2d; 0x04; 0xf6; 0x25; 0xdc;
0x8c; 0x70; 0x9b; 0x98; 0xb4; 0x3b; 0x38; 0x52; 0xb3; 0x37; 0x21; 0x61; 0x79; 0xaa; 0x7f; 0xc7])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test4_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xaf; 0xeb; 0xb2; 0xef; 0x54; 0x2e; 0x65; 0x79; 0xc5; 0x0c; 0xad; 0x06; 0xd2; 0xe5; 0x78; 0xf9;
0xf8; 0xdd; 0x68; 0x81; 0xd7; 0xdc; 0x82; 0x4d; 0x26; 0x36; 0x0f; 0xee; 0xbf; 0x18; 0xa4; 0xfa;
0x73; 0xe3; 0x26; 0x11; 0x22; 0x94; 0x8e; 0xfc; 0xfd; 0x49; 0x2e; 0x74; 0xe8; 0x2e; 0x21; 0x89;
0xed; 0x0f; 0xb4; 0x40; 0xd1; 0x87; 0xf3; 0x82; 0x27; 0x0c; 0xb4; 0x55; 0xf2; 0x1d; 0xd1; 0x85])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test5_SHAKE128
//
let test5_plaintext_shake128: b:lbuffer uint8 0ul{ recallable b } =
[@ inline_let]
let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test5_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7f; 0x9c; 0x2b; 0xa4; 0xe8; 0x8f; 0x82; 0x7d; 0x61; 0x60; 0x45; 0x50; 0x76; 0x05; 0x85; 0x3e])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test6_SHAKE128
//
let test6_plaintext_shake128: b:lbuffer uint8 14ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x52; 0x97; 0x7e; 0x53; 0x2b; 0xcc; 0xdb; 0x89; 0xdf; 0xef; 0xf7; 0xe9; 0xe4; 0xad]) in
assert_norm (List.Tot.length l == 14);
createL_mglobal l
let test6_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xfb; 0xfb; 0xa5; 0xc1; 0xe1; 0x79; 0xdf; 0x14; 0x69; 0xfc; 0xc8; 0x58; 0x8a; 0xe5; 0xd2; 0xcc])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test7_SHAKE128
//
let test7_plaintext_shake128: b:lbuffer uint8 34ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x4a; 0x20; 0x6a; 0x5b; 0x8a; 0xa3; 0x58; 0x6c; 0x06; 0x67; 0xa4; 0x00; 0x20; 0xd6; 0x5f; 0xf5;
0x11; 0xd5; 0x2b; 0x73; 0x2e; 0xf7; 0xa0; 0xc5; 0x69; 0xf1; 0xee; 0x68; 0x1a; 0x4f; 0xc3; 0x62;
0x00; 0x65])
in
assert_norm (List.Tot.length l == 34);
createL_mglobal l
let test7_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7b; 0xb4; 0x33; 0x75; 0x2b; 0x98; 0xf9; 0x15; 0xbe; 0x51; 0x82; 0xbc; 0x1f; 0x09; 0x66; 0x48])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test8_SHAKE128
//
let test8_plaintext_shake128: b:lbuffer uint8 83ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x24; 0x69; 0xf1; 0x01; 0xc9; 0xb4; 0x99; 0xa9; 0x30; 0xa9; 0x7e; 0xf1; 0xb3; 0x46; 0x73; 0xec;
0x74; 0x39; 0x3f; 0xd9; 0xfa; 0xf6; 0x58; 0xe3; 0x1f; 0x06; 0xee; 0x0b; 0x29; 0xa2; 0x2b; 0x62;
0x37; 0x80; 0xba; 0x7b; 0xdf; 0xed; 0x86; 0x20; 0x15; 0x1c; 0xc4; 0x44; 0x4e; 0xbe; 0x33; 0x39;
0xe6; 0xd2; 0xa2; 0x23; 0xbf; 0xbf; 0xb4; 0xad; 0x2c; 0xa0; 0xe0; 0xfa; 0x0d; 0xdf; 0xbb; 0xdf;
0x3b; 0x05; 0x7a; 0x4f; 0x26; 0xd0; 0xb2; 0x16; 0xbc; 0x87; 0x63; 0xca; 0x8d; 0x8a; 0x35; 0xff;
0x2d; 0x2d; 0x01])
in
assert_norm (List.Tot.length l == 83);
createL_mglobal l
let test8_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x00; 0xff; 0x5e; 0xf0; 0xcd; 0x7f; 0x8f; 0x90; 0xad; 0x94; 0xb7; 0x97; 0xe9; 0xd4; 0xdd; 0x30])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test9_SHAKE256
//
let test9_plaintext_shake256: b:lbuffer uint8 0ul{ recallable b } =
[@ inline_let]
let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(32ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test9_expected_shake256:b: lbuffer uint8 32ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0x46; 0xb9; 0xdd; 0x2b; 0x0b; 0xa8; 0x8d; 0x13; 0x23; 0x3b; 0x3f; 0xeb; 0x74; 0x3e; 0xeb;
0x24; 0x3f; 0xcd; 0x52; 0xea; 0x62; 0xb8; 0x1b; 0x82; 0xb5; 0x0c; 0x27; 0x64; 0x6e; 0xd5;
0x76; 0x2f
])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l | false |
Vale.AES.X64.GF128_Init.fst | Vale.AES.X64.GF128_Init.va_lemma_Keyhash_init | val va_lemma_Keyhash_init : va_b0:va_code -> va_s0:va_state -> win:bool -> alg:algorithm ->
key:(seq nat32) -> roundkeys_b:buffer128 -> hkeys_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Keyhash_init win alg) va_s0 /\ va_get_ok va_s0 /\ (let
(round_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else
va_get_reg64 rRdi va_s0) in let (hkey_ptr:(va_int_range 0 18446744073709551615)) = (if win then
va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in Vale.X64.Memory.is_initial_heap
(va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (aesni_enabled /\ pclmulqdq_enabled /\
avx_enabled /\ sse_enabled) /\ (alg = AES_128 \/ alg = AES_256) /\
Vale.X64.Decls.buffers_disjoint128 roundkeys_b hkeys_b /\ Vale.AES.AES_s.is_aes_key_LE alg key
/\ Vale.X64.Decls.buffer128_as_seq (va_get_mem va_s0) roundkeys_b ==
Vale.AES.AES_s.key_to_round_keys_LE alg key /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem
va_s0) round_ptr roundkeys_b (Vale.AES.AES_common_s.nr alg + 1) (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem va_s0) hkey_ptr hkeys_b 8
(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 /\
(let (round_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0
else va_get_reg64 rRdi va_s0) in let (hkey_ptr:(va_int_range 0 18446744073709551615)) = (if win
then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in Vale.X64.Decls.modifies_buffer128
hkeys_b (va_get_mem va_s0) (va_get_mem va_sM) /\ Vale.AES.OptPublic.hkeys_reqs_pub
(Vale.X64.Decls.s128 (va_get_mem va_sM) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.AES_s.aes_encrypt_LE alg key (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0
0))) /\ va_get_xmm 6 va_sM == va_get_xmm 6 va_s0 /\ va_get_reg64 rR12 va_sM == va_get_reg64
rR12 va_s0) /\ va_state_eq va_sM (va_update_flags 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_mem_layout va_sM (va_update_mem_heaplet 1 va_sM
(va_update_reg64 rR12 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRdx va_sM
(va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0))))))))))))))))))) | val va_lemma_Keyhash_init : va_b0:va_code -> va_s0:va_state -> win:bool -> alg:algorithm ->
key:(seq nat32) -> roundkeys_b:buffer128 -> hkeys_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Keyhash_init win alg) va_s0 /\ va_get_ok va_s0 /\ (let
(round_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else
va_get_reg64 rRdi va_s0) in let (hkey_ptr:(va_int_range 0 18446744073709551615)) = (if win then
va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in Vale.X64.Memory.is_initial_heap
(va_get_mem_layout va_s0) (va_get_mem va_s0) /\ (aesni_enabled /\ pclmulqdq_enabled /\
avx_enabled /\ sse_enabled) /\ (alg = AES_128 \/ alg = AES_256) /\
Vale.X64.Decls.buffers_disjoint128 roundkeys_b hkeys_b /\ Vale.AES.AES_s.is_aes_key_LE alg key
/\ Vale.X64.Decls.buffer128_as_seq (va_get_mem va_s0) roundkeys_b ==
Vale.AES.AES_s.key_to_round_keys_LE alg key /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem
va_s0) round_ptr roundkeys_b (Vale.AES.AES_common_s.nr alg + 1) (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem va_s0) hkey_ptr hkeys_b 8
(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 /\
(let (round_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0
else va_get_reg64 rRdi va_s0) in let (hkey_ptr:(va_int_range 0 18446744073709551615)) = (if win
then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in Vale.X64.Decls.modifies_buffer128
hkeys_b (va_get_mem va_s0) (va_get_mem va_sM) /\ Vale.AES.OptPublic.hkeys_reqs_pub
(Vale.X64.Decls.s128 (va_get_mem va_sM) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.AES_s.aes_encrypt_LE alg key (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0
0))) /\ va_get_xmm 6 va_sM == va_get_xmm 6 va_s0 /\ va_get_reg64 rR12 va_sM == va_get_reg64
rR12 va_s0) /\ va_state_eq va_sM (va_update_flags 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_mem_layout va_sM (va_update_mem_heaplet 1 va_sM
(va_update_reg64 rR12 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRdx va_sM
(va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0))))))))))))))))))) | let va_lemma_Keyhash_init va_b0 va_s0 win alg key roundkeys_b hkeys_b =
let (va_mods:va_mods_t) = [va_Mod_flags; 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_mem_layout; va_Mod_mem_heaplet 1; va_Mod_reg64
rR12; va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok;
va_Mod_mem] in
let va_qc = va_qcode_Keyhash_init va_mods win alg key roundkeys_b hkeys_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Keyhash_init win alg) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 219 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ (let (round_ptr:(va_int_range 0 18446744073709551615)) = va_if win (fun _
-> va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (hkey_ptr:(va_int_range 0
18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64
rRsi va_s0) in label va_range1
"***** POSTCONDITION NOT MET AT line 246 column 51 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.X64.Decls.modifies_buffer128 hkeys_b (va_get_mem va_s0) (va_get_mem va_sM)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 247 column 111 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.AES.OptPublic.hkeys_reqs_pub (Vale.X64.Decls.s128 (va_get_mem va_sM) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.AES_s.aes_encrypt_LE alg key
(Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0)))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 249 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_xmm 6 va_sM == va_get_xmm 6 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 250 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; 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_mem_layout; va_Mod_mem_heaplet 1; va_Mod_reg64
rR12; va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok;
va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM) | {
"file_name": "obj/Vale.AES.X64.GF128_Init.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 16,
"end_line": 779,
"start_col": 0,
"start_line": 750
} | module Vale.AES.X64.GF128_Init
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.AES_s
open Vale.AES.AES256_helpers
open Vale.AES.X64.AES
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.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.AES.X64.GF128_Mul
open Vale.AES.GHash
open Vale.AES.OptPublic
//-- ShiftKey1_128
val va_code_ShiftKey1_128 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_ShiftKey1_128 () =
(va_Block (va_CCons (va_code_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_CCons
(va_code_ShiftLeft128_1 ()) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5))
(va_CCons (va_code_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 4)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_CNil ())))))))))
val va_codegen_success_ShiftKey1_128 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ShiftKey1_128 () =
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_ShiftLeft128_1 ()) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm
3) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pcmpeqd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3)
255) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4))
(va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_ttrue ()))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ShiftKey1_128 (va_mods:va_mods_t) (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s) in
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 88 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftLeft128_1 h) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 89 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32_mask h1) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 90 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_shift_define_i h 1 128) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 92 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 93 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 94 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_test_high_bit h) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 95 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 96 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_zero ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 97 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_ones ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 100 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 101 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_and_consts ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 102 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_opr128_xmm 3)) (va_QEmpty
(()))))))))))))))))
val va_lemma_ShiftKey1_128 : va_b0:va_code -> va_s0:va_state -> f:poly
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_128 ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127)))
(ensures (fun (va_sM, va_fM) -> 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 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) /\
va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0)))))))
[@"opaque_to_smt"]
let va_lemma_ShiftKey1_128 va_b0 va_s0 f =
let (va_mods:va_mods_t) = [va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok] in
let va_qc = va_qcode_ShiftKey1_128 va_mods f in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftKey1_128 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 68 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
label va_range1
"***** POSTCONDITION NOT MET AT line 85 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h)))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_ShiftKey1_128 (f:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) . let
va_sM = va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_flags
va_x_efl va_s0))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2_s.shift h 1 in let (offset:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) ==> va_k va_sM (())))
val va_wpProof_ShiftKey1_128 : f:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ShiftKey1_128 f va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_ShiftKey1_128 f va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ShiftKey1_128 (va_code_ShiftKey1_128 ()) va_s0 f in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0))))));
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_ShiftKey1_128 (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128 ())) =
(va_QProc (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags])
(va_wp_ShiftKey1_128 f) (va_wpProof_ShiftKey1_128 f))
//--
//-- ShiftKey1_gf128_power
val va_code_ShiftKey1_gf128_power : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_ShiftKey1_gf128_power () =
(va_Block (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm 4)) (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm
5)) (va_CCons (va_code_PinsrdImm (va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12))
(va_CCons (va_code_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_ShiftKey1_128 ()) (va_CNil ()))))))))
val va_codegen_success_ShiftKey1_gf128_power : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ShiftKey1_gf128_power () =
(va_pbool_and (va_codegen_success_ZeroXmm (va_op_xmm_xmm 4)) (va_pbool_and
(va_codegen_success_ZeroXmm (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_PinsrdImm
(va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12))
(va_pbool_and (va_codegen_success_ShiftKey1_128 ()) (va_ttrue ())))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ShiftKey1_gf128_power (va_mods:va_mods_t) (h:poly) (n:nat) : (va_quickCode unit
(va_code_ShiftKey1_gf128_power ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 4)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 120 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 5)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 121 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 123 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12)) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 124 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_high_bit ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 125 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_low_shift_1 ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 127 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_128 gf128_modulus_low_terms) (fun (va_s:va_state) _ -> let
(va_arg16:Prims.nat) = n in let (va_arg15:Vale.Math.Poly2_s.poly) = h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_gf128_power va_arg15 va_arg16) (va_QEmpty (()))))))))))))
val va_lemma_ShiftKey1_gf128_power : va_b0:va_code -> va_s0:va_state -> h:poly -> n:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_gf128_power ()) va_s0 /\ va_get_ok va_s0 /\
(let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
avx_enabled /\ sse_enabled /\ hn == Vale.AES.GHash.g_power h n)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n) /\
va_state_eq 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_reg64 rR12 va_sM (va_update_flags
va_sM (va_update_ok va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_ShiftKey1_gf128_power va_b0 va_s0 h n =
let (va_mods:va_mods_t) = [va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags; va_Mod_ok] in
let va_qc = va_qcode_ShiftKey1_gf128_power va_mods h n in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftKey1_gf128_power ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 105 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ (let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in label va_range1
"***** POSTCONDITION NOT MET AT line 117 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_ShiftKey1_gf128_power (h:poly) (n:nat) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in avx_enabled /\ sse_enabled /\ hn == Vale.AES.GHash.g_power h n) /\
(forall (va_x_efl:Vale.X64.Flags.t) (va_x_r12:nat64) (va_x_xmm1:quad32) (va_x_xmm2:quad32)
(va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) . let va_sM = 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_reg64 rR12 va_x_r12 (va_upd_flags va_x_efl va_s0)))))) in va_get_ok va_sM /\ (let
(hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n) ==>
va_k va_sM (())))
val va_wpProof_ShiftKey1_gf128_power : h:poly -> n:nat -> va_s0:va_state -> va_k:(va_state -> unit
-> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ShiftKey1_gf128_power h n va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftKey1_gf128_power ()) ([va_Mod_xmm
5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_reg64 rR12; va_Mod_flags])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_ShiftKey1_gf128_power h n va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ShiftKey1_gf128_power (va_code_ShiftKey1_gf128_power ()) va_s0 h n
in
va_lemma_upd_update va_sM;
assert (va_state_eq 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_reg64 rR12 va_sM (va_update_flags
va_sM (va_update_ok va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_ShiftKey1_gf128_power (h:poly) (n:nat) : (va_quickCode unit
(va_code_ShiftKey1_gf128_power ())) =
(va_QProc (va_code_ShiftKey1_gf128_power ()) ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_reg64 rR12; va_Mod_flags]) (va_wp_ShiftKey1_gf128_power h n)
(va_wpProof_ShiftKey1_gf128_power h n))
//--
//-- Gf128_powers
val va_code_Gf128_powers : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gf128_powers () =
(va_Block (va_CCons (va_code_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) 32 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128
(va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons (va_code_ShiftKey1_gf128_power ()) (va_CCons
(va_code_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 0 Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 6))
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1))
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 16 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 48 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 64 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 96 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 112 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 0)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRax)) (va_CNil
()))))))))))))))))))))))))))))))))))))))))))))))
val va_codegen_success_Gf128_powers : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gf128_powers () =
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm
1)) (va_pbool_and (va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and
(va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 0 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 1)
(va_op_xmm_xmm 6)) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm
6)) (va_pbool_and (va_codegen_success_Gf128MulRev128 ()) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 16 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 48 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 64 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 96 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 112 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 0)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRax)) (va_ttrue
())))))))))))))))))))))))))))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gf128_powers (va_mods:va_mods_t) (h:poly) (hkeys_b:buffer128) : (va_quickCode unit
(va_code_Gf128_powers ())) =
(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 158 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 159 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 161 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (fun (va_s:va_state) _ -> let (va_arg57:Vale.Math.Poly2_s.poly) = h
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 162 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_1 va_arg57) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 163 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 164 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 165 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 166 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 0 Secret hkeys_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 168 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 169 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 170 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg56:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 171 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg56 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 172 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 173 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 174 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 2) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 175 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 16 Secret hkeys_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 177 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 178 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 179 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg55:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 180 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg55 2) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 181 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 182 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 183 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 184 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 48 Secret hkeys_b 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 186 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 187 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 188 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg54:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 189 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg54 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 190 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 191 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 192 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 193 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 64 Secret hkeys_b 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 195 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 196 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 197 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg53:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 198 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg53 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 199 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 200 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 5) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 202 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 96 Secret hkeys_b 6) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 205 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 206 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg52:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 207 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg52 5) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 208 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 209 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 210 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 6) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 211 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 112 Secret hkeys_b 7) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 213 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 0)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 214 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRax)) (va_QEmpty
(())))))))))))))))))))))))))))))))))))))))))))))))))))))
val va_lemma_Gf128_powers : va_b0:va_code -> va_s0:va_state -> h:poly -> hkeys_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gf128_powers ()) va_s0 /\ va_get_ok va_s0 /\
(pclmulqdq_enabled /\ avx_enabled /\ sse_enabled) /\ Vale.X64.Decls.validDstAddrs128
(va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2
(va_get_mem_heaplet 1 va_s0)) == h))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_get_xmm 6 va_sM == va_get_xmm 6 va_s0 /\ va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0
/\ Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 hkeys_b)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 1 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 1 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 2 /\ Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1
va_sM) == Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_s0) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 3 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 3 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 4 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 4 /\ Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1
va_sM) == Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_s0) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 6 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 5 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 7 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 6 /\ va_state_eq 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 rR12 va_sM (va_update_reg64 rRax va_sM
(va_update_flags 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_Gf128_powers va_b0 va_s0 h hkeys_b =
let (va_mods:va_mods_t) = [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 rR12; va_Mod_reg64 rRax; va_Mod_flags;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gf128_powers va_mods h hkeys_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gf128_powers ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 131 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 145 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_xmm 6 va_sM == va_get_xmm 6 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 146 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 147 column 61 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 hkeys_b)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 148 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 1) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 149 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 1 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 2) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 151 column 84 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_sM) ==
Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 152 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 3 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 3) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 153 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 4 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 4) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 154 column 84 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_sM) ==
Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 155 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 6 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 5) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 156 column 74 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 7 (va_get_mem_heaplet
1 va_sM)) == Vale.AES.GHash.gf128_power h 6)) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([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 rR12; va_Mod_reg64 rRax; va_Mod_flags;
va_Mod_mem_heaplet 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Gf128_powers (h:poly) (hkeys_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (pclmulqdq_enabled /\ avx_enabled /\ sse_enabled) /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) hkeys_b
8 (va_get_mem_layout va_s0) Secret /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_s0)) == h /\ (forall
(va_x_mem:vale_heap) (va_x_heap1:vale_heap) (va_x_efl:Vale.X64.Flags.t) (va_x_rax:nat64)
(va_x_r12: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) . let va_sM = 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 rR12 va_x_r12 (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_mem va_x_mem
va_s0))))))))))) in va_get_ok va_sM /\ va_get_xmm 6 va_sM == va_get_xmm 6 va_s0 /\ va_get_reg64
rR12 va_sM == va_get_reg64 rR12 va_s0 /\ Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer
#Vale.X64.Memory.vuint128 hkeys_b) (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 0 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 1 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 1 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 2 /\ Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1
va_sM) == Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 1 va_s0) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 3 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 3 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 4 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 4 /\ Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1
va_sM) == Vale.X64.Decls.buffer128_read hkeys_b 5 (va_get_mem_heaplet 1 va_s0) /\
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 6 (va_get_mem_heaplet 1
va_sM)) == Vale.AES.GHash.gf128_power h 5 /\ Vale.Math.Poly2.Bits_s.of_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 7 (va_get_mem_heaplet 1 va_sM)) ==
Vale.AES.GHash.gf128_power h 6 ==> va_k va_sM (())))
val va_wpProof_Gf128_powers : h:poly -> hkeys_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_Gf128_powers h hkeys_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gf128_powers ()) ([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 rR12; va_Mod_reg64 rRax; va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_mem]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Gf128_powers h hkeys_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Gf128_powers (va_code_Gf128_powers ()) va_s0 h hkeys_b in
va_lemma_upd_update va_sM;
assert (va_state_eq 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 rR12 va_sM (va_update_reg64 rRax va_sM (va_update_flags 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_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 rR12; va_Mod_reg64 rRax; va_Mod_flags;
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_Gf128_powers (h:poly) (hkeys_b:buffer128) : (va_quickCode unit (va_code_Gf128_powers
())) =
(va_QProc (va_code_Gf128_powers ()) ([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 rR12; va_Mod_reg64 rRax; va_Mod_flags;
va_Mod_mem_heaplet 1; va_Mod_mem]) (va_wp_Gf128_powers h hkeys_b) (va_wpProof_Gf128_powers h
hkeys_b))
//--
//-- Keyhash_init
[@ "opaque_to_smt" va_qattr]
let va_code_Keyhash_init win alg =
(va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_InitPshufbMask (va_op_xmm_xmm
4) (va_op_reg_opr64_reg64 rR8)) (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm 0)) (va_CCons (if win
then va_Block (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRdx) (va_op_xmm_xmm 0) 80 Secret) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx)) (va_CNil ()))) else va_Block (va_CCons
(va_code_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRsi)
(va_op_xmm_xmm 0) 80 Secret) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR8)
(va_op_opr64_reg64 rRdi)) (va_CNil ())))) (va_CCons (va_code_AESEncryptBlock alg) (va_CCons
(va_code_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 4)) (va_CCons (if win then va_Block (va_CCons
(va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRdx)) (va_CNil ())) else
va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRsi))
(va_CNil ()))) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 0) 32 Secret) (va_CCons (va_code_Gf128_powers ())
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil
())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Keyhash_init win alg =
(va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and
(va_codegen_success_InitPshufbMask (va_op_xmm_xmm 4) (va_op_reg_opr64_reg64 rR8)) (va_pbool_and
(va_codegen_success_ZeroXmm (va_op_xmm_xmm 0)) (va_pbool_and (if win then va_pbool_and
(va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdx)
(va_op_xmm_xmm 0) 80 Secret) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64
rR8) (va_op_opr64_reg64 rRcx)) (va_ttrue ())) else va_pbool_and
(va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRsi)
(va_op_xmm_xmm 0) 80 Secret) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64
rR8) (va_op_opr64_reg64 rRdi)) (va_ttrue ()))) (va_pbool_and
(va_codegen_success_AESEncryptBlock alg) (va_pbool_and (va_codegen_success_Pshufb
(va_op_xmm_xmm 0) (va_op_xmm_xmm 4)) (va_pbool_and (if win then va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRdx)) (va_ttrue ())
else va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64
rRsi)) (va_ttrue ())) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 0) 32 Secret)
(va_pbool_and (va_codegen_success_Gf128_powers ()) (va_pbool_and
(va_codegen_success_DestroyHeaplets ()) (va_ttrue ())))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Keyhash_init (va_mods:va_mods_t) (win:bool) (alg:algorithm) (key:(seq nat32))
(roundkeys_b:buffer128) (hkeys_b:buffer128) : (va_quickCode unit (va_code_Keyhash_init win alg)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(round_ptr:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s)
(fun _ -> va_get_reg64 rRdi va_s) in let (hkey_ptr:(va_int_range 0 18446744073709551615)) =
va_if win (fun _ -> va_get_reg64 rRdx va_s) (fun _ -> va_get_reg64 rRsi va_s) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 252 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_CreateHeaplets ([declare_buffer128 roundkeys_b 0 Secret Immutable; declare_buffer128
hkeys_b 1 Secret Mutable])) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 256 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_InitPshufbMask (va_op_xmm_xmm 4) (va_op_reg_opr64_reg64 rR8)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 257 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 0)) (fun (va_s:va_state) _ -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 258 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 260 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdx)
(va_op_xmm_xmm 0) 80 Secret hkeys_b 5) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 261 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx)) (va_QEmpty (())))))
(qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 265 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRsi)
(va_op_xmm_xmm 0) 80 Secret hkeys_b 5) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 266 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRdi)) (va_QEmpty (())))))) (fun
(va_s:va_state) va_g -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 268 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_AESEncryptBlock alg (va_get_xmm 0 va_s) key (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 0 va_s) roundkeys_b) roundkeys_b) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 269 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 4)) (fun (va_s:va_state) _ -> va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 270 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 272 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRdx)) (va_QEmpty (()))))
(qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 276 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRsi)) (va_QEmpty (()))))) (fun
(va_s:va_state) va_g -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 278 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 0) 32 Secret hkeys_b 2) (fun (va_s:va_state) _ -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 280 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128_powers (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 0 va_s)) hkeys_b) (fun
(va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 282 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
((fun (alg_10639:Vale.AES.AES_common_s.algorithm) (key_10640:(FStar.Seq.Base.seq
Vale.Def.Types_s.nat32)) (input_LE_10641:Vale.Def.Types_s.quad32) ->
Vale.AES.AES_s.is_aes_key_LE alg_10639 key_10640) alg key (Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 0)) (fun _ -> let (va_arg27:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.AES_s.aes_encrypt_LE alg key
(Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0)) in let (va_arg26:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s) hkeys_b in va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 282 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_hkeys_reqs_pub_priv va_arg26 va_arg27) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 284 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))))))))))) | {
"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.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Words.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.GF128_Mul.fsti.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.OptPublic.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES256_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.GF128_Init.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"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.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"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.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.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.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"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 |
va_b0: Vale.X64.Decls.va_code ->
va_s0: Vale.X64.Decls.va_state ->
win: Prims.bool ->
alg: Vale.AES.AES_common_s.algorithm ->
key: FStar.Seq.Base.seq Vale.X64.Memory.nat32 ->
roundkeys_b: Vale.X64.Memory.buffer128 ->
hkeys_b: Vale.X64.Memory.buffer128
-> Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) | Prims.Ghost | [] | [] | [
"Vale.X64.Decls.va_code",
"Vale.X64.Decls.va_state",
"Prims.bool",
"Vale.AES.AES_common_s.algorithm",
"FStar.Seq.Base.seq",
"Vale.X64.Memory.nat32",
"Vale.X64.Memory.buffer128",
"Vale.X64.QuickCodes.fuel",
"Prims.unit",
"FStar.Pervasives.Native.Mktuple2",
"Vale.X64.Decls.va_fuel",
"Vale.X64.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_xmm",
"Vale.X64.QuickCode.va_Mod_mem_layout",
"Vale.X64.QuickCode.va_Mod_mem_heaplet",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR12",
"Vale.X64.Machine_s.rR8",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRax",
"Vale.X64.QuickCode.va_Mod_ok",
"Vale.X64.QuickCode.va_Mod_mem",
"Prims.Nil",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.list",
"Vale.X64.QuickCode.__proj__QProc__item__mods",
"Vale.AES.X64.GF128_Init.va_code_Keyhash_init",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.tuple3",
"Vale.X64.State.vale_state",
"Vale.X64.QuickCodes.va_wp_sound_code_norm",
"Prims.l_and",
"Vale.X64.QuickCodes.label",
"Vale.X64.QuickCodes.va_range1",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.X64.Decls.modifies_buffer128",
"Vale.X64.Decls.va_get_mem",
"Vale.AES.OptPublic.hkeys_reqs_pub",
"Vale.X64.Decls.s128",
"Vale.Def.Types_s.reverse_bytes_quad32",
"Vale.AES.AES_s.aes_encrypt_LE",
"Vale.Def.Words_s.Mkfour",
"Vale.Def.Types_s.nat32",
"Vale.X64.Decls.quad32",
"Vale.X64.Decls.va_get_xmm",
"Vale.Def.Types_s.nat64",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Decls.va_int_range",
"Vale.X64.Decls.va_if",
"Prims.l_not",
"Vale.X64.Machine_s.rRsi",
"Vale.X64.Machine_s.rRdi",
"Vale.X64.QuickCode.quickCode",
"Vale.AES.X64.GF128_Init.va_qcode_Keyhash_init"
] | [] | false | false | false | false | false | let va_lemma_Keyhash_init va_b0 va_s0 win alg key roundkeys_b hkeys_b =
| let va_mods:va_mods_t =
[
va_Mod_flags; 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_mem_layout; va_Mod_mem_heaplet 1; va_Mod_reg64 rR12; va_Mod_reg64 rR8;
va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem
]
in
let va_qc = va_qcode_Keyhash_init va_mods win alg key roundkeys_b hkeys_b in
let va_sM, va_fM, va_g =
va_wp_sound_code_norm (va_code_Keyhash_init win alg)
va_qc
va_s0
(fun va_s0 va_sM va_g ->
let () = va_g in
label va_range1
"***** POSTCONDITION NOT MET AT line 219 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\
(let round_ptr:(va_int_range 0 18446744073709551615) =
va_if win (fun _ -> va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0)
in
let hkey_ptr:(va_int_range 0 18446744073709551615) =
va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0)
in
label va_range1
"***** POSTCONDITION NOT MET AT line 246 column 51 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.X64.Decls.modifies_buffer128 hkeys_b (va_get_mem va_s0) (va_get_mem va_sM)) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 247 column 111 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.AES.OptPublic.hkeys_reqs_pub (Vale.X64.Decls.s128 (va_get_mem va_sM) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.AES_s.aes_encrypt_LE alg
key
(Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0)))) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 249 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_xmm 6 va_sM == va_get_xmm 6 va_s0) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 250 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0)))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([
va_Mod_flags; 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_mem_layout; va_Mod_mem_heaplet 1; va_Mod_reg64 rR12;
va_Mod_reg64 rR8; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok;
va_Mod_mem
])
va_sM
va_s0;
(va_sM, va_fM) | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test3_expected_sha3_512 | val test3_expected_sha3_512:b: lbuffer uint8 64ul {recallable b} | val test3_expected_sha3_512:b: lbuffer uint8 64ul {recallable b} | let test3_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x04; 0xa3; 0x71; 0xe8; 0x4e; 0xcf; 0xb5; 0xb8; 0xb7; 0x7c; 0xb4; 0x86; 0x10; 0xfc; 0xa8; 0x18;
0x2d; 0xd4; 0x57; 0xce; 0x6f; 0x32; 0x6a; 0x0f; 0xd3; 0xd7; 0xec; 0x2f; 0x1e; 0x91; 0x63; 0x6d;
0xee; 0x69; 0x1f; 0xbe; 0x0c; 0x98; 0x53; 0x02; 0xba; 0x1b; 0x0d; 0x8d; 0xc7; 0x8c; 0x08; 0x63;
0x46; 0xb5; 0x33; 0xb4; 0x9c; 0x03; 0x0d; 0x99; 0xa2; 0x7d; 0xaf; 0x11; 0x39; 0xd6; 0xe7; 0x5e])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 248,
"start_col": 0,
"start_line": 238
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3
//
let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l
let test3_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79; 0xba;
0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test3_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x41; 0xc0; 0xdb; 0xa2; 0xa9; 0xd6; 0x24; 0x08; 0x49; 0x10; 0x03; 0x76; 0xa8; 0x23; 0x5e; 0x2c;
0x82; 0xe1; 0xb9; 0x99; 0x8a; 0x99; 0x9e; 0x21; 0xdb; 0x32; 0xdd; 0x97; 0x49; 0x6d; 0x33; 0x76])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test3_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x99; 0x1c; 0x66; 0x57; 0x55; 0xeb; 0x3a; 0x4b; 0x6b; 0xbd; 0xfb; 0x75; 0xc7; 0x8a; 0x49; 0x2e;
0x8c; 0x56; 0xa2; 0x2c; 0x5c; 0x4d; 0x7e; 0x42; 0x9b; 0xfd; 0xbc; 0x32; 0xb9; 0xd4; 0xad; 0x5a;
0xa0; 0x4a; 0x1f; 0x07; 0x6e; 0x62; 0xfe; 0xa1; 0x9e; 0xef; 0x51; 0xac; 0xd0; 0x65; 0x7c; 0x22])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(64ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test3_expected_sha3_512:b: lbuffer uint8 64ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0x04; 0xa3; 0x71; 0xe8; 0x4e; 0xcf; 0xb5; 0xb8; 0xb7; 0x7c; 0xb4; 0x86; 0x10; 0xfc; 0xa8;
0x18; 0x2d; 0xd4; 0x57; 0xce; 0x6f; 0x32; 0x6a; 0x0f; 0xd3; 0xd7; 0xec; 0x2f; 0x1e; 0x91;
0x63; 0x6d; 0xee; 0x69; 0x1f; 0xbe; 0x0c; 0x98; 0x53; 0x02; 0xba; 0x1b; 0x0d; 0x8d; 0xc7;
0x8c; 0x08; 0x63; 0x46; 0xb5; 0x33; 0xb4; 0x9c; 0x03; 0x0d; 0x99; 0xa2; 0x7d; 0xaf; 0x11;
0x39; 0xd6; 0xe7; 0x5e
])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l | false |
Steel.ST.C.Types.UserStruct.fsti | Steel.ST.C.Types.UserStruct.set_def | val set_def (#t: eqtype) (s: FStar.Set.set t) (x: t) : Tot bool | val set_def (#t: eqtype) (s: FStar.Set.set t) (x: t) : Tot bool | let set_def
(#t: eqtype)
(s: FStar.Set.set t)
(x: t)
: Tot bool
= FStar.Set.mem x s | {
"file_name": "lib/steel/c/Steel.ST.C.Types.UserStruct.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 19,
"end_line": 16,
"start_col": 0,
"start_line": 11
} | module Steel.ST.C.Types.UserStruct
open Steel.ST.Util
open Steel.ST.C.Types.Struct.Aux
module Set = FStar.Set
(* This library allows the user to define their own struct type, with
a constructor from field values, and a destructor to field values for
each field. This may be necessary for recursive structs *) | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"Steel.ST.C.Types.Struct.Aux.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Steel.ST.C.Types.UserStruct.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Set",
"short_module": "Set"
},
{
"abbrev": false,
"full_module": "Steel.ST.C.Types.Struct.Aux",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.C.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.C.Types",
"short_module": null
},
{
"abbrev": 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 | s: FStar.Set.set t -> x: t -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Prims.eqtype",
"FStar.Set.set",
"FStar.Set.mem",
"Prims.bool"
] | [] | false | false | false | false | false | let set_def (#t: eqtype) (s: FStar.Set.set t) (x: t) : Tot bool =
| FStar.Set.mem x s | false |
Steel.ST.C.Types.UserStruct.fsti | Steel.ST.C.Types.UserStruct.nonempty_set | val nonempty_set : t: Prims.eqtype -> Type0 | let nonempty_set (t: eqtype) =
(s: Set.set t { exists x . set_def s x == true }) | {
"file_name": "lib/steel/c/Steel.ST.C.Types.UserStruct.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 51,
"end_line": 20,
"start_col": 0,
"start_line": 19
} | module Steel.ST.C.Types.UserStruct
open Steel.ST.Util
open Steel.ST.C.Types.Struct.Aux
module Set = FStar.Set
(* This library allows the user to define their own struct type, with
a constructor from field values, and a destructor to field values for
each field. This may be necessary for recursive structs *)
let set_def
(#t: eqtype)
(s: FStar.Set.set t)
(x: t)
: Tot bool
= FStar.Set.mem x s | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"Steel.ST.C.Types.Struct.Aux.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Steel.ST.C.Types.UserStruct.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Set",
"short_module": "Set"
},
{
"abbrev": false,
"full_module": "Steel.ST.C.Types.Struct.Aux",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.C.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.C.Types",
"short_module": null
},
{
"abbrev": 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: Prims.eqtype -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Prims.eqtype",
"FStar.Set.set",
"Prims.l_Exists",
"Prims.eq2",
"Prims.bool",
"Steel.ST.C.Types.UserStruct.set_def"
] | [] | false | false | false | true | true | let nonempty_set (t: eqtype) =
| (s: Set.set t {exists x. set_def s x == true}) | false |
|
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test8_expected_shake128 | val test8_expected_shake128:b: lbuffer uint8 16ul {recallable b} | val test8_expected_shake128:b: lbuffer uint8 16ul {recallable b} | let test8_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x00; 0xff; 0x5e; 0xf0; 0xcd; 0x7f; 0x8f; 0x90; 0xad; 0x94; 0xb7; 0x97; 0xe9; 0xd4; 0xdd; 0x30])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 396,
"start_col": 0,
"start_line": 389
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3
//
let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l
let test3_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79; 0xba;
0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test3_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x41; 0xc0; 0xdb; 0xa2; 0xa9; 0xd6; 0x24; 0x08; 0x49; 0x10; 0x03; 0x76; 0xa8; 0x23; 0x5e; 0x2c;
0x82; 0xe1; 0xb9; 0x99; 0x8a; 0x99; 0x9e; 0x21; 0xdb; 0x32; 0xdd; 0x97; 0x49; 0x6d; 0x33; 0x76])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test3_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x99; 0x1c; 0x66; 0x57; 0x55; 0xeb; 0x3a; 0x4b; 0x6b; 0xbd; 0xfb; 0x75; 0xc7; 0x8a; 0x49; 0x2e;
0x8c; 0x56; 0xa2; 0x2c; 0x5c; 0x4d; 0x7e; 0x42; 0x9b; 0xfd; 0xbc; 0x32; 0xb9; 0xd4; 0xad; 0x5a;
0xa0; 0x4a; 0x1f; 0x07; 0x6e; 0x62; 0xfe; 0xa1; 0x9e; 0xef; 0x51; 0xac; 0xd0; 0x65; 0x7c; 0x22])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test3_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x04; 0xa3; 0x71; 0xe8; 0x4e; 0xcf; 0xb5; 0xb8; 0xb7; 0x7c; 0xb4; 0x86; 0x10; 0xfc; 0xa8; 0x18;
0x2d; 0xd4; 0x57; 0xce; 0x6f; 0x32; 0x6a; 0x0f; 0xd3; 0xd7; 0xec; 0x2f; 0x1e; 0x91; 0x63; 0x6d;
0xee; 0x69; 0x1f; 0xbe; 0x0c; 0x98; 0x53; 0x02; 0xba; 0x1b; 0x0d; 0x8d; 0xc7; 0x8c; 0x08; 0x63;
0x46; 0xb5; 0x33; 0xb4; 0x9c; 0x03; 0x0d; 0x99; 0xa2; 0x7d; 0xaf; 0x11; 0x39; 0xd6; 0xe7; 0x5e])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test4_SHA3
//
let test4_plaintext: b:lbuffer uint8 112ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69;
0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b;
0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d;
0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f;
0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71;
0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73;
0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x75])
in
assert_norm (List.Tot.length l == 112);
createL_mglobal l
let test4_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x54; 0x3e; 0x68; 0x68; 0xe1; 0x66; 0x6c; 0x1a; 0x64; 0x36; 0x30; 0xdf; 0x77; 0x36; 0x7a; 0xe5;
0xa6; 0x2a; 0x85; 0x07; 0x0a; 0x51; 0xc1; 0x4c; 0xbf; 0x66; 0x5c; 0xbc])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test4_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x91; 0x6f; 0x60; 0x61; 0xfe; 0x87; 0x97; 0x41; 0xca; 0x64; 0x69; 0xb4; 0x39; 0x71; 0xdf; 0xdb;
0x28; 0xb1; 0xa3; 0x2d; 0xc3; 0x6c; 0xb3; 0x25; 0x4e; 0x81; 0x2b; 0xe2; 0x7a; 0xad; 0x1d; 0x18])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test4_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x79; 0x40; 0x7d; 0x3b; 0x59; 0x16; 0xb5; 0x9c; 0x3e; 0x30; 0xb0; 0x98; 0x22; 0x97; 0x47; 0x91;
0xc3; 0x13; 0xfb; 0x9e; 0xcc; 0x84; 0x9e; 0x40; 0x6f; 0x23; 0x59; 0x2d; 0x04; 0xf6; 0x25; 0xdc;
0x8c; 0x70; 0x9b; 0x98; 0xb4; 0x3b; 0x38; 0x52; 0xb3; 0x37; 0x21; 0x61; 0x79; 0xaa; 0x7f; 0xc7])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test4_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xaf; 0xeb; 0xb2; 0xef; 0x54; 0x2e; 0x65; 0x79; 0xc5; 0x0c; 0xad; 0x06; 0xd2; 0xe5; 0x78; 0xf9;
0xf8; 0xdd; 0x68; 0x81; 0xd7; 0xdc; 0x82; 0x4d; 0x26; 0x36; 0x0f; 0xee; 0xbf; 0x18; 0xa4; 0xfa;
0x73; 0xe3; 0x26; 0x11; 0x22; 0x94; 0x8e; 0xfc; 0xfd; 0x49; 0x2e; 0x74; 0xe8; 0x2e; 0x21; 0x89;
0xed; 0x0f; 0xb4; 0x40; 0xd1; 0x87; 0xf3; 0x82; 0x27; 0x0c; 0xb4; 0x55; 0xf2; 0x1d; 0xd1; 0x85])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test5_SHAKE128
//
let test5_plaintext_shake128: b:lbuffer uint8 0ul{ recallable b } =
[@ inline_let]
let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test5_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7f; 0x9c; 0x2b; 0xa4; 0xe8; 0x8f; 0x82; 0x7d; 0x61; 0x60; 0x45; 0x50; 0x76; 0x05; 0x85; 0x3e])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test6_SHAKE128
//
let test6_plaintext_shake128: b:lbuffer uint8 14ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x52; 0x97; 0x7e; 0x53; 0x2b; 0xcc; 0xdb; 0x89; 0xdf; 0xef; 0xf7; 0xe9; 0xe4; 0xad]) in
assert_norm (List.Tot.length l == 14);
createL_mglobal l
let test6_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xfb; 0xfb; 0xa5; 0xc1; 0xe1; 0x79; 0xdf; 0x14; 0x69; 0xfc; 0xc8; 0x58; 0x8a; 0xe5; 0xd2; 0xcc])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test7_SHAKE128
//
let test7_plaintext_shake128: b:lbuffer uint8 34ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x4a; 0x20; 0x6a; 0x5b; 0x8a; 0xa3; 0x58; 0x6c; 0x06; 0x67; 0xa4; 0x00; 0x20; 0xd6; 0x5f; 0xf5;
0x11; 0xd5; 0x2b; 0x73; 0x2e; 0xf7; 0xa0; 0xc5; 0x69; 0xf1; 0xee; 0x68; 0x1a; 0x4f; 0xc3; 0x62;
0x00; 0x65])
in
assert_norm (List.Tot.length l == 34);
createL_mglobal l
let test7_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7b; 0xb4; 0x33; 0x75; 0x2b; 0x98; 0xf9; 0x15; 0xbe; 0x51; 0x82; 0xbc; 0x1f; 0x09; 0x66; 0x48])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test8_SHAKE128
//
let test8_plaintext_shake128: b:lbuffer uint8 83ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x24; 0x69; 0xf1; 0x01; 0xc9; 0xb4; 0x99; 0xa9; 0x30; 0xa9; 0x7e; 0xf1; 0xb3; 0x46; 0x73; 0xec;
0x74; 0x39; 0x3f; 0xd9; 0xfa; 0xf6; 0x58; 0xe3; 0x1f; 0x06; 0xee; 0x0b; 0x29; 0xa2; 0x2b; 0x62;
0x37; 0x80; 0xba; 0x7b; 0xdf; 0xed; 0x86; 0x20; 0x15; 0x1c; 0xc4; 0x44; 0x4e; 0xbe; 0x33; 0x39;
0xe6; 0xd2; 0xa2; 0x23; 0xbf; 0xbf; 0xb4; 0xad; 0x2c; 0xa0; 0xe0; 0xfa; 0x0d; 0xdf; 0xbb; 0xdf;
0x3b; 0x05; 0x7a; 0x4f; 0x26; 0xd0; 0xb2; 0x16; 0xbc; 0x87; 0x63; 0xca; 0x8d; 0x8a; 0x35; 0xff;
0x2d; 0x2d; 0x01])
in
assert_norm (List.Tot.length l == 83);
createL_mglobal l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(16ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test8_expected_shake128:b: lbuffer uint8 16ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0x00; 0xff; 0x5e; 0xf0; 0xcd; 0x7f; 0x8f; 0x90; 0xad; 0x94; 0xb7; 0x97; 0xe9; 0xd4; 0xdd;
0x30
])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l | false |
Pulse.Checker.Prover.Substs.fsti | Pulse.Checker.Prover.Substs.well_typed_nt_substs | val well_typed_nt_substs (g uvs: env) (nts: nt_substs) (effect_labels: list T.tot_or_ghost)
: Tot Type0 (decreases L.length nts) | val well_typed_nt_substs (g uvs: env) (nts: nt_substs) (effect_labels: list T.tot_or_ghost)
: Tot Type0 (decreases L.length nts) | let rec well_typed_nt_substs
(g:env)
(uvs:env)
(nts:nt_substs)
(effect_labels:list T.tot_or_ghost)
: Tot Type0 (decreases L.length nts) =
match bindings uvs, nts, effect_labels with
| [], [], [] -> True
| _::_, (NT x e)::nts_rest, eff::effect_labels_rest ->
let y, ty, rest_uvs = remove_binding uvs in
x == y /\
typing g e eff ty /\
well_typed_nt_substs g (subst_env rest_uvs [ NT x e ]) nts_rest effect_labels_rest
| _, _, _ -> False | {
"file_name": "lib/steel/pulse/Pulse.Checker.Prover.Substs.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 20,
"end_line": 137,
"start_col": 0,
"start_line": 123
} | (*
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.Prover.Substs
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Typing.Env
open Pulse.Typing
module L = FStar.List.Tot
module T = FStar.Tactics
module Env = Pulse.Typing.Env
val ss_t : Type0
val ln_ss_t (s:ss_t) : bool
val as_map (ss:ss_t) : Map.t var term
let dom (ss:ss_t) = Map.domain (as_map ss)
let contains (ss:ss_t) (x:var) = Map.contains (as_map ss) x
let sel (ss:ss_t) (x:var { contains ss x }) = Map.sel (as_map ss) x
val empty : ss_t
val push (ss:ss_t) (x:var { ~ (contains ss x) }) (t:term) : ss_t
val push_ss (ss1:ss_t) (ss2:ss_t { Set.disjoint (dom ss1) (dom ss2) }) : ss_t
val check_disjoint (ss1 ss2:ss_t) : b:bool { b ==> Set.disjoint (dom ss1) (dom ss2) }
val diff (ss1 ss2:ss_t) : ss:ss_t { Set.disjoint (dom ss) (dom ss2) }
val push_as_map (ss1 ss2:ss_t)
: Lemma (requires Set.disjoint (dom ss1) (dom ss2))
(ensures as_map (push_ss ss1 ss2) == Map.concat (as_map ss1) (as_map ss2))
[SMTPat (as_map (push_ss ss1 ss2))]
val ss_term (t:term) (ss:ss_t) : term
val ss_st_term (t:st_term) (ss:ss_t) : st_term
val ss_st_comp (s:st_comp) (ss:ss_t) : st_comp
val ss_comp (c:comp) (ss:ss_t) : comp
val ss_binder (b:binder) (ss:ss_t) : binder
val ss_env (g:env) (ss:ss_t)
: g':env { fstar_env g' == fstar_env g /\
Env.dom g' == Env.dom g }
val ss_st_comp_commutes (s:st_comp) (ss:ss_t)
: Lemma (ensures
ss_st_comp s ss ==
{ s with res = ss_term s.res ss;
pre = ss_term s.pre ss;
post = ss_term s.post ss; }) // no shifting required
[SMTPat (ss_st_comp s ss)]
val ss_comp_commutes (c:comp) (ss:ss_t)
: Lemma (ensures
(let r = ss_comp c ss in
(C_Tot? c ==> r == C_Tot (ss_term (comp_res c) ss)) /\
(C_ST? c ==> r == C_ST (ss_st_comp (st_comp_of_comp c) ss)) /\
(C_STAtomic? c ==> r == C_STAtomic (ss_term (comp_inames c) ss)
(C_STAtomic?.obs c)
(ss_st_comp (st_comp_of_comp c) ss)) /\
(C_STGhost? c ==> r == C_STGhost (ss_st_comp (st_comp_of_comp c) ss))))
[SMTPat (ss_comp c ss)]
type nt_substs = l:list subst_elt { forall elt. L.memP elt l ==> NT? elt }
let nt_subst_term (t:term) (ss:nt_substs) : term =
L.fold_left (fun t elt -> subst_term t [elt]) t ss
let nt_subst_binder (b:binder) (ss:nt_substs) : binder =
L.fold_left (fun b elt -> subst_binder b [elt]) b ss
let nt_subst_st_term (t:st_term) (ss:nt_substs) : st_term =
L.fold_left (fun t elt -> subst_st_term t [elt]) t ss
let nt_subst_st_comp (s:st_comp) (ss:nt_substs) : st_comp =
L.fold_left (fun s elt -> subst_st_comp s [elt]) s ss
let nt_subst_comp (c:comp) (ss:nt_substs) : comp =
L.fold_left (fun c elt -> subst_comp c [elt]) c ss
let nt_subst_env (g:env) (ss:nt_substs) : g':env { Env.dom g' == Env.dom g /\
Env.fstar_env g' == Env.fstar_env g } =
let g' = L.fold_left (fun g elt -> subst_env g [elt]) g ss in
assume (Env.dom g' == Env.dom g /\ Env.fstar_env g' == Env.fstar_env g);
g'
val nt_substs_st_comp_commutes (s:st_comp) (nts:nt_substs)
: Lemma (ensures
nt_subst_st_comp s nts ==
{ s with res = nt_subst_term s.res nts;
pre = nt_subst_term s.pre nts;
post = nt_subst_term s.post nts; }) // no shifting required
[SMTPat (nt_subst_st_comp s nts)]
val nt_subst_comp_commutes (c:comp) (nts:nt_substs)
: Lemma (ensures
(let r = nt_subst_comp c nts in
(C_Tot? c ==> r == C_Tot (nt_subst_term (comp_res c) nts)) /\
(C_ST? c ==> r == C_ST (nt_subst_st_comp (st_comp_of_comp c) nts)) /\
(C_STAtomic? c ==> r == C_STAtomic (nt_subst_term (comp_inames c) nts)
(C_STAtomic?.obs c)
(nt_subst_st_comp (st_comp_of_comp c) nts)) /\
(C_STGhost? c ==> r == C_STGhost (nt_subst_st_comp (st_comp_of_comp c) nts))))
[SMTPat (nt_subst_comp c nts)] | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Env.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"prims.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Map.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Checker.Prover.Substs.fsti"
} | [
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Env",
"short_module": "Env"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Env",
"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": "Pulse.Typing.Env",
"short_module": "Env"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"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.Env",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Prover",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Prover",
"short_module": null
},
{
"abbrev": 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 ->
uvs: Pulse.Typing.Env.env ->
nts: Pulse.Checker.Prover.Substs.nt_substs ->
effect_labels: Prims.list FStar.Stubs.TypeChecker.Core.tot_or_ghost
-> Prims.Tot Type0 | Prims.Tot | [
"total",
""
] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Checker.Prover.Substs.nt_substs",
"Prims.list",
"FStar.Stubs.TypeChecker.Core.tot_or_ghost",
"FStar.Pervasives.Native.Mktuple3",
"Pulse.Typing.Env.binding",
"Pulse.Syntax.Naming.subst_elt",
"Pulse.Typing.Env.bindings",
"Prims.l_True",
"Pulse.Syntax.Base.var",
"Pulse.Syntax.Base.term",
"Pulse.Syntax.Base.typ",
"Prims.l_and",
"Prims.eq2",
"Pulse.Typing.typing",
"Pulse.Checker.Prover.Substs.well_typed_nt_substs",
"Pulse.Typing.Env.subst_env",
"Prims.Cons",
"Pulse.Syntax.Naming.NT",
"Prims.Nil",
"FStar.Pervasives.Native.tuple3",
"Pulse.Typing.Env.remove_binding",
"Prims.l_False"
] | [
"recursion"
] | false | false | false | true | true | let rec well_typed_nt_substs (g uvs: env) (nts: nt_substs) (effect_labels: list T.tot_or_ghost)
: Tot Type0 (decreases L.length nts) =
| match bindings uvs, nts, effect_labels with
| [], [], [] -> True
| _ :: _, NT x e :: nts_rest, eff :: effect_labels_rest ->
let y, ty, rest_uvs = remove_binding uvs in
x == y /\ typing g e eff ty /\
well_typed_nt_substs g (subst_env rest_uvs [NT x e]) nts_rest effect_labels_rest
| _, _, _ -> False | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test4_expected_sha3_512 | val test4_expected_sha3_512:b: lbuffer uint8 64ul {recallable b} | val test4_expected_sha3_512:b: lbuffer uint8 64ul {recallable b} | let test4_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xaf; 0xeb; 0xb2; 0xef; 0x54; 0x2e; 0x65; 0x79; 0xc5; 0x0c; 0xad; 0x06; 0xd2; 0xe5; 0x78; 0xf9;
0xf8; 0xdd; 0x68; 0x81; 0xd7; 0xdc; 0x82; 0x4d; 0x26; 0x36; 0x0f; 0xee; 0xbf; 0x18; 0xa4; 0xfa;
0x73; 0xe3; 0x26; 0x11; 0x22; 0x94; 0x8e; 0xfc; 0xfd; 0x49; 0x2e; 0x74; 0xe8; 0x2e; 0x21; 0x89;
0xed; 0x0f; 0xb4; 0x40; 0xd1; 0x87; 0xf3; 0x82; 0x27; 0x0c; 0xb4; 0x55; 0xf2; 0x1d; 0xd1; 0x85])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 309,
"start_col": 0,
"start_line": 299
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3
//
let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l
let test3_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79; 0xba;
0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test3_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x41; 0xc0; 0xdb; 0xa2; 0xa9; 0xd6; 0x24; 0x08; 0x49; 0x10; 0x03; 0x76; 0xa8; 0x23; 0x5e; 0x2c;
0x82; 0xe1; 0xb9; 0x99; 0x8a; 0x99; 0x9e; 0x21; 0xdb; 0x32; 0xdd; 0x97; 0x49; 0x6d; 0x33; 0x76])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test3_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x99; 0x1c; 0x66; 0x57; 0x55; 0xeb; 0x3a; 0x4b; 0x6b; 0xbd; 0xfb; 0x75; 0xc7; 0x8a; 0x49; 0x2e;
0x8c; 0x56; 0xa2; 0x2c; 0x5c; 0x4d; 0x7e; 0x42; 0x9b; 0xfd; 0xbc; 0x32; 0xb9; 0xd4; 0xad; 0x5a;
0xa0; 0x4a; 0x1f; 0x07; 0x6e; 0x62; 0xfe; 0xa1; 0x9e; 0xef; 0x51; 0xac; 0xd0; 0x65; 0x7c; 0x22])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test3_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x04; 0xa3; 0x71; 0xe8; 0x4e; 0xcf; 0xb5; 0xb8; 0xb7; 0x7c; 0xb4; 0x86; 0x10; 0xfc; 0xa8; 0x18;
0x2d; 0xd4; 0x57; 0xce; 0x6f; 0x32; 0x6a; 0x0f; 0xd3; 0xd7; 0xec; 0x2f; 0x1e; 0x91; 0x63; 0x6d;
0xee; 0x69; 0x1f; 0xbe; 0x0c; 0x98; 0x53; 0x02; 0xba; 0x1b; 0x0d; 0x8d; 0xc7; 0x8c; 0x08; 0x63;
0x46; 0xb5; 0x33; 0xb4; 0x9c; 0x03; 0x0d; 0x99; 0xa2; 0x7d; 0xaf; 0x11; 0x39; 0xd6; 0xe7; 0x5e])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test4_SHA3
//
let test4_plaintext: b:lbuffer uint8 112ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69;
0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b;
0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d;
0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f;
0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71;
0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73;
0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x75])
in
assert_norm (List.Tot.length l == 112);
createL_mglobal l
let test4_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x54; 0x3e; 0x68; 0x68; 0xe1; 0x66; 0x6c; 0x1a; 0x64; 0x36; 0x30; 0xdf; 0x77; 0x36; 0x7a; 0xe5;
0xa6; 0x2a; 0x85; 0x07; 0x0a; 0x51; 0xc1; 0x4c; 0xbf; 0x66; 0x5c; 0xbc])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test4_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x91; 0x6f; 0x60; 0x61; 0xfe; 0x87; 0x97; 0x41; 0xca; 0x64; 0x69; 0xb4; 0x39; 0x71; 0xdf; 0xdb;
0x28; 0xb1; 0xa3; 0x2d; 0xc3; 0x6c; 0xb3; 0x25; 0x4e; 0x81; 0x2b; 0xe2; 0x7a; 0xad; 0x1d; 0x18])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test4_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x79; 0x40; 0x7d; 0x3b; 0x59; 0x16; 0xb5; 0x9c; 0x3e; 0x30; 0xb0; 0x98; 0x22; 0x97; 0x47; 0x91;
0xc3; 0x13; 0xfb; 0x9e; 0xcc; 0x84; 0x9e; 0x40; 0x6f; 0x23; 0x59; 0x2d; 0x04; 0xf6; 0x25; 0xdc;
0x8c; 0x70; 0x9b; 0x98; 0xb4; 0x3b; 0x38; 0x52; 0xb3; 0x37; 0x21; 0x61; 0x79; 0xaa; 0x7f; 0xc7])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(64ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test4_expected_sha3_512:b: lbuffer uint8 64ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0xaf; 0xeb; 0xb2; 0xef; 0x54; 0x2e; 0x65; 0x79; 0xc5; 0x0c; 0xad; 0x06; 0xd2; 0xe5; 0x78;
0xf9; 0xf8; 0xdd; 0x68; 0x81; 0xd7; 0xdc; 0x82; 0x4d; 0x26; 0x36; 0x0f; 0xee; 0xbf; 0x18;
0xa4; 0xfa; 0x73; 0xe3; 0x26; 0x11; 0x22; 0x94; 0x8e; 0xfc; 0xfd; 0x49; 0x2e; 0x74; 0xe8;
0x2e; 0x21; 0x89; 0xed; 0x0f; 0xb4; 0x40; 0xd1; 0x87; 0xf3; 0x82; 0x27; 0x0c; 0xb4; 0x55;
0xf2; 0x1d; 0xd1; 0x85
])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l | false |
Steel.ST.C.Types.UserStruct.fsti | Steel.ST.C.Types.UserStruct.field_t | val field_t (s: Set.set string) : Tot eqtype | val field_t (s: Set.set string) : Tot eqtype | let field_t (s: Set.set string) : Tot eqtype =
(f: string { Set.mem f s }) | {
"file_name": "lib/steel/c/Steel.ST.C.Types.UserStruct.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 29,
"end_line": 33,
"start_col": 0,
"start_line": 32
} | module Steel.ST.C.Types.UserStruct
open Steel.ST.Util
open Steel.ST.C.Types.Struct.Aux
module Set = FStar.Set
(* This library allows the user to define their own struct type, with
a constructor from field values, and a destructor to field values for
each field. This may be necessary for recursive structs *)
let set_def
(#t: eqtype)
(s: FStar.Set.set t)
(x: t)
: Tot bool
= FStar.Set.mem x s
noextract
let nonempty_set (t: eqtype) =
(s: Set.set t { exists x . set_def s x == true })
noextract
let set_snoc // for associativity reasons
(#t: eqtype) (q: FStar.Set.set t) (a: t) : Pure (nonempty_set t)
(requires True)
(ensures (fun s ->
(forall (x: t). {:pattern FStar.Set.mem x s} FStar.Set.mem x s == (x = a || FStar.Set.mem x q))
))
= q `FStar.Set.union` FStar.Set.singleton a | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"Steel.ST.C.Types.Struct.Aux.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Steel.ST.C.Types.UserStruct.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Set",
"short_module": "Set"
},
{
"abbrev": false,
"full_module": "Steel.ST.C.Types.Struct.Aux",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.C.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.C.Types",
"short_module": null
},
{
"abbrev": 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 | s: FStar.Set.set Prims.string -> Prims.eqtype | Prims.Tot | [
"total"
] | [] | [
"FStar.Set.set",
"Prims.string",
"Prims.b2t",
"FStar.Set.mem",
"Prims.eqtype"
] | [] | false | false | false | true | false | let field_t (s: Set.set string) : Tot eqtype =
| (f: string{Set.mem f s}) | false |
Lib.Sequence.fsti | Lib.Sequence.seq | val seq : a: Type0 -> Type0 | let seq (a:Type0) = Seq.seq a | {
"file_name": "lib/Lib.Sequence.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 29,
"end_line": 15,
"start_col": 0,
"start_line": 15
} | module Lib.Sequence
open FStar.Mul
open Lib.IntTypes
#set-options "--z3rlimit 30 --max_fuel 0 --max_ifuel 0 --using_facts_from '-* +Prims +FStar.Math.Lemmas +FStar.Seq +Lib.IntTypes +Lib.Sequence'"
/// Variable length Sequences, derived from FStar.Seq
(* This is the type of unbounded sequences.
Use this only when dealing with, say, user input whose length is unbounded.
As far as possible use the API for bounded sequences defined later in this file.*) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Lib.Sequence.fsti"
} | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type0 -> Type0 | Prims.Tot | [
"total"
] | [] | [
"FStar.Seq.Base.seq"
] | [] | false | false | false | true | true | let seq (a: Type0) =
| Seq.seq a | false |
|
Vale.AES.X64.GF128_Init.fst | Vale.AES.X64.GF128_Init.va_qcode_Gf128_powers | val va_qcode_Gf128_powers (va_mods: va_mods_t) (h: poly) (hkeys_b: buffer128)
: (va_quickCode unit (va_code_Gf128_powers ())) | val va_qcode_Gf128_powers (va_mods: va_mods_t) (h: poly) (hkeys_b: buffer128)
: (va_quickCode unit (va_code_Gf128_powers ())) | let va_qcode_Gf128_powers (va_mods:va_mods_t) (h:poly) (hkeys_b:buffer128) : (va_quickCode unit
(va_code_Gf128_powers ())) =
(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 158 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 159 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 161 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (fun (va_s:va_state) _ -> let (va_arg57:Vale.Math.Poly2_s.poly) = h
in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 162 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_1 va_arg57) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 163 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 164 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 165 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 166 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 0 Secret hkeys_b 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 168 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 169 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 170 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg56:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 171 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg56 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 172 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 173 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 174 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 2) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 175 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 16 Secret hkeys_b 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 177 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 178 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 179 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg55:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 180 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg55 2) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 181 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 182 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 183 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 184 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 48 Secret hkeys_b 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 186 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 187 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 188 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg54:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 189 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg54 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 190 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 191 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 192 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 193 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 64 Secret hkeys_b 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 195 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 196 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 197 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg53:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 198 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg53 4) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 199 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 200 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 5) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 202 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 96 Secret hkeys_b 6) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 205 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret hkeys_b 2) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 206 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ()) (fun (va_s:va_state) _ -> let (va_arg52:Vale.Math.Poly2_s.poly) =
h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 207 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_g_power_n va_arg52 5) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 208 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 209 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 210 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 6) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 211 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 112 Secret hkeys_b 7) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 213 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 0)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 214 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRax)) (va_QEmpty
(()))))))))))))))))))))))))))))))))))))))))))))))))))))) | {
"file_name": "obj/Vale.AES.X64.GF128_Init.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 60,
"end_line": 503,
"start_col": 0,
"start_line": 383
} | module Vale.AES.X64.GF128_Init
open Vale.Def.Words_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.Math.Poly2_s
open Vale.Math.Poly2
open Vale.Math.Poly2.Bits_s
open Vale.Math.Poly2.Bits
open Vale.Math.Poly2.Lemmas
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.AES_s
open Vale.AES.AES256_helpers
open Vale.AES.X64.AES
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.X64.CPU_Features_s
open Vale.AES.X64.PolyOps
open Vale.AES.X64.GF128_Mul
open Vale.AES.GHash
open Vale.AES.OptPublic
//-- ShiftKey1_128
val va_code_ShiftKey1_128 : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_ShiftKey1_128 () =
(va_Block (va_CCons (va_code_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_CCons
(va_code_ShiftLeft128_1 ()) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5))
(va_CCons (va_code_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_CCons (va_code_Pshufd
(va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (va_CCons (va_code_PolyAnd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 4)) (va_CCons (va_code_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_CNil ())))))))))
val va_codegen_success_ShiftKey1_128 : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ShiftKey1_128 () =
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_pbool_and
(va_codegen_success_ShiftLeft128_1 ()) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm
3) (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pcmpeqd (va_op_xmm_xmm 3)
(va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3)
255) (va_pbool_and (va_codegen_success_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4))
(va_pbool_and (va_codegen_success_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_opr128_xmm 3)) (va_ttrue ()))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ShiftKey1_128 (va_mods:va_mods_t) (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128
())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s) in
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 87 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 3)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 88 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftLeft128_1 h) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 89 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Bits.lemma_of_to_quad32_mask h1) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 90 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.lemma_shift_define_i h 1 128) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 92 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 93 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pcmpeqd (va_op_xmm_xmm 3) (va_op_xmm_xmm 5)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 94 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_test_high_bit h) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 95 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Pshufd (va_op_xmm_xmm 3) (va_op_xmm_xmm 3) 255) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 96 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_zero ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 97 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Words.lemma_quad32_ones ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 100 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PolyAnd (va_op_xmm_xmm 3) (va_op_xmm_xmm 4)) (fun (va_s:va_state) _ -> va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 101 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.Math.Poly2.Lemmas.lemma_and_consts ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 102 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_VPolyAdd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_opr128_xmm 3)) (va_QEmpty
(()))))))))))))))))
val va_lemma_ShiftKey1_128 : va_b0:va_code -> va_s0:va_state -> f:poly
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_128 ()) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127)))
(ensures (fun (va_sM, va_fM) -> 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 (va_get_xmm 3 va_s0) in let
(h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) /\
va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0)))))))
[@"opaque_to_smt"]
let va_lemma_ShiftKey1_128 va_b0 va_s0 f =
let (va_mods:va_mods_t) = [va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok] in
let va_qc = va_qcode_ShiftKey1_128 va_mods f in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftKey1_128 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 68 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
label va_range1
"***** POSTCONDITION NOT MET AT line 85 column 50 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h)))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_ShiftKey1_128 (f:poly) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2_s.shift h 1 in let
(offset:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in
avx_enabled /\ sse_enabled /\ Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 5 va_s0) ==
Vale.Math.Poly2_s.monomial 127 /\ offset == Vale.Math.Poly2_s.reverse (Vale.Math.Poly2_s.shift
(Vale.Math.Poly2_s.add (Vale.Math.Poly2_s.monomial 128) f) (-1)) 127) /\ (forall
(va_x_efl:Vale.X64.Flags.t) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) . let
va_sM = va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_flags
va_x_efl va_s0))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in let (h1:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2_s.shift h 1 in let (offset:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0) in Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 1 va_sM) == Vale.AES.GF128.shift_key_1 128 f h) ==> va_k va_sM (())))
val va_wpProof_ShiftKey1_128 : f:poly -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ShiftKey1_128 f va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_ShiftKey1_128 f va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ShiftKey1_128 (va_code_ShiftKey1_128 ()) va_s0 f in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM
(va_update_flags va_sM (va_update_ok va_sM va_s0))))));
va_lemma_norm_mods ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_ShiftKey1_128 (f:poly) : (va_quickCode unit (va_code_ShiftKey1_128 ())) =
(va_QProc (va_code_ShiftKey1_128 ()) ([va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_flags])
(va_wp_ShiftKey1_128 f) (va_wpProof_ShiftKey1_128 f))
//--
//-- ShiftKey1_gf128_power
val va_code_ShiftKey1_gf128_power : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_ShiftKey1_gf128_power () =
(va_Block (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm 4)) (va_CCons (va_code_ZeroXmm (va_op_xmm_xmm
5)) (va_CCons (va_code_PinsrdImm (va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12))
(va_CCons (va_code_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_ShiftKey1_128 ()) (va_CNil ()))))))))
val va_codegen_success_ShiftKey1_gf128_power : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_ShiftKey1_gf128_power () =
(va_pbool_and (va_codegen_success_ZeroXmm (va_op_xmm_xmm 4)) (va_pbool_and
(va_codegen_success_ZeroXmm (va_op_xmm_xmm 5)) (va_pbool_and (va_codegen_success_PinsrdImm
(va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12))
(va_pbool_and (va_codegen_success_ShiftKey1_128 ()) (va_ttrue ())))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_ShiftKey1_gf128_power (va_mods:va_mods_t) (h:poly) (n:nat) : (va_quickCode unit
(va_code_ShiftKey1_gf128_power ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s) in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 119 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 4)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 120 column 12 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ZeroXmm (va_op_xmm_xmm 5)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 121 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 4) 3254779904 3 (va_op_reg_opr64_reg64 rR12)) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 122 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 4) 1 0 (va_op_reg_opr64_reg64 rR12)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 123 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_PinsrdImm (va_op_xmm_xmm 5) 2147483648 3 (va_op_reg_opr64_reg64 rR12)) (fun
(va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 124 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_high_bit ()) (va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 125 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GF128.lemma_gf128_low_shift_1 ()) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 127 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_128 gf128_modulus_low_terms) (fun (va_s:va_state) _ -> let
(va_arg16:Prims.nat) = n in let (va_arg15:Vale.Math.Poly2_s.poly) = h in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 128 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_gf128_power va_arg15 va_arg16) (va_QEmpty (()))))))))))))
val va_lemma_ShiftKey1_gf128_power : va_b0:va_code -> va_s0:va_state -> h:poly -> n:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_ShiftKey1_gf128_power ()) va_s0 /\ va_get_ok va_s0 /\
(let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
avx_enabled /\ sse_enabled /\ hn == Vale.AES.GHash.g_power h n)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n) /\
va_state_eq 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_reg64 rR12 va_sM (va_update_flags
va_sM (va_update_ok va_sM va_s0))))))))))
[@"opaque_to_smt"]
let va_lemma_ShiftKey1_gf128_power va_b0 va_s0 h n =
let (va_mods:va_mods_t) = [va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags; va_Mod_ok] in
let va_qc = va_qcode_ShiftKey1_gf128_power va_mods h n in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_ShiftKey1_gf128_power ()) va_qc va_s0
(fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 105 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_get_ok va_sM) /\ (let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in label va_range1
"***** POSTCONDITION NOT MET AT line 117 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_ShiftKey1_gf128_power (h:poly) (n:nat) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 3 va_s0) in avx_enabled /\ sse_enabled /\ hn == Vale.AES.GHash.g_power h n) /\
(forall (va_x_efl:Vale.X64.Flags.t) (va_x_r12:nat64) (va_x_xmm1:quad32) (va_x_xmm2:quad32)
(va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) . let va_sM = 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_reg64 rR12 va_x_r12 (va_upd_flags va_x_efl va_s0)))))) in va_get_ok va_sM /\ (let
(hn:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 3 va_s0) in
Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 1 va_sM) == Vale.AES.GHash.gf128_power h n) ==>
va_k va_sM (())))
val va_wpProof_ShiftKey1_gf128_power : h:poly -> n:nat -> va_s0:va_state -> va_k:(va_state -> unit
-> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_ShiftKey1_gf128_power h n va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ShiftKey1_gf128_power ()) ([va_Mod_xmm
5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_reg64 rR12; va_Mod_flags])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_ShiftKey1_gf128_power h n va_s0 va_k =
let (va_sM, va_f0) = va_lemma_ShiftKey1_gf128_power (va_code_ShiftKey1_gf128_power ()) va_s0 h n
in
va_lemma_upd_update va_sM;
assert (va_state_eq 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_reg64 rR12 va_sM (va_update_flags
va_sM (va_update_ok va_sM va_s0)))))))));
va_lemma_norm_mods ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_reg64 rR12; va_Mod_flags]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_ShiftKey1_gf128_power (h:poly) (n:nat) : (va_quickCode unit
(va_code_ShiftKey1_gf128_power ())) =
(va_QProc (va_code_ShiftKey1_gf128_power ()) ([va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3;
va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_reg64 rR12; va_Mod_flags]) (va_wp_ShiftKey1_gf128_power h n)
(va_wpProof_ShiftKey1_gf128_power h n))
//--
//-- Gf128_powers
val va_code_Gf128_powers : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gf128_powers () =
(va_Block (va_CCons (va_code_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_CCons (va_code_Load128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rRcx) 32 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128
(va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons (va_code_ShiftKey1_gf128_power ()) (va_CCons
(va_code_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 0 Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 6))
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1))
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 16 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 48 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 64 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 96 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rRcx) 32 Secret) (va_CCons (va_code_Gf128MulRev128 ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_CCons
(va_code_ShiftKey1_gf128_power ()) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 112 Secret)
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 0)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRax)) (va_CNil
()))))))))))))))))))))))))))))))))))))))))))))))
val va_codegen_success_Gf128_powers : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gf128_powers () =
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm
6) (va_op_xmm_xmm 1)) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm
1)) (va_pbool_and (va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and
(va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1) 0 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 1)
(va_op_xmm_xmm 6)) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm
6)) (va_pbool_and (va_codegen_success_Gf128MulRev128 ()) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 16 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 48 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 64 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 96 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)) (va_pbool_and
(va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 1) (va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx) 32 Secret) (va_pbool_and (va_codegen_success_Gf128MulRev128 ())
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1)) (va_pbool_and
(va_codegen_success_ShiftKey1_gf128_power ()) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_xmm_xmm 1) 112 Secret)
(va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 0)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRax)) (va_ttrue
()))))))))))))))))))))))))))))))))))))))))))))) | {
"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.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Words.fsti.checked",
"Vale.Math.Poly2.Lemmas.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Math.Poly2.Bits.fsti.checked",
"Vale.Math.Poly2.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.GF128_Mul.fsti.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.OptPublic.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_common_s.fst.checked",
"Vale.AES.AES256_helpers.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.GF128_Init.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"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.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"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.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.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.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"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.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES256_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"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.Lemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.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.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"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 |
va_mods: Vale.X64.QuickCode.va_mods_t ->
h: Vale.Math.Poly2_s.poly ->
hkeys_b: Vale.X64.Memory.buffer128
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.AES.X64.GF128_Init.va_code_Gf128_powers ()) | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCode.va_mods_t",
"Vale.Math.Poly2_s.poly",
"Vale.X64.Memory.buffer128",
"Vale.X64.QuickCodes.qblock",
"Prims.unit",
"Prims.Cons",
"Vale.X64.Decls.va_code",
"Vale.X64.InsVector.va_code_Mov128",
"Vale.X64.Decls.va_op_xmm_xmm",
"Vale.X64.InsBasic.va_code_Mov64",
"Vale.X64.Decls.va_op_dst_opr64_reg64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.Decls.va_op_opr64_reg64",
"Vale.X64.Machine_s.rR12",
"Vale.X64.InsVector.va_code_Load128_buffer",
"Vale.X64.Decls.va_op_heaplet_mem_heaplet",
"Vale.X64.Decls.va_op_reg_opr64_reg64",
"Vale.X64.Machine_s.rRcx",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.AES.X64.GF128_Init.va_code_ShiftKey1_gf128_power",
"Vale.X64.InsVector.va_code_Store128_buffer",
"Vale.AES.X64.GF128_Mul.va_code_Gf128MulRev128",
"Prims.Nil",
"Vale.X64.Machine_s.precode",
"Vale.X64.Decls.ins",
"Vale.X64.Decls.ocmp",
"Vale.X64.Decls.va_state",
"Vale.X64.QuickCodes.va_QSeq",
"Vale.X64.QuickCodes.va_range1",
"Vale.X64.InsVector.va_quick_Mov128",
"Vale.X64.InsBasic.va_quick_Mov64",
"Vale.X64.QuickCodes.va_QBind",
"Vale.X64.InsVector.va_quick_Load128_buffer",
"Vale.X64.QuickCodes.va_qPURE",
"Prims.pure_post",
"Prims.l_and",
"Prims.l_True",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.eq2",
"Vale.AES.GHash.g_power",
"Vale.AES.GHash.lemma_g_power_1",
"Vale.AES.X64.GF128_Init.va_quick_ShiftKey1_gf128_power",
"Vale.X64.InsVector.va_quick_Store128_buffer",
"Vale.AES.X64.GF128_Mul.va_quick_Gf128MulRev128",
"Prims.op_Addition",
"Vale.AES.GF128.op_Star_Tilde",
"Vale.AES.GHash.lemma_g_power_n",
"Vale.X64.QuickCodes.va_QEmpty",
"Vale.X64.QuickCodes.quickCodes",
"Vale.X64.State.vale_state",
"Vale.X64.QuickCode.va_quickCode",
"Vale.AES.X64.GF128_Init.va_code_Gf128_powers"
] | [] | false | false | false | false | false | let va_qcode_Gf128_powers (va_mods: va_mods_t) (h: poly) (hkeys_b: buffer128)
: (va_quickCode unit (va_code_Gf128_powers ())) =
| (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 158 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 6))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 159 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rR12))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 161 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rRcx)
32
Secret
hkeys_b
2)
(fun (va_s: va_state) _ ->
let va_arg57:Vale.Math.Poly2_s.poly = h in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 162 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_: unit) -> Vale.AES.GHash.lemma_g_power_1 va_arg57)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 163 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6) (va_op_xmm_xmm 1))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 164 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3) (va_op_xmm_xmm 1))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 165 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power h 1)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 166 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRcx)
(va_op_xmm_xmm 1)
0
Secret
hkeys_b
0)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 168 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 1) (va_op_xmm_xmm 6))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 169 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 2) (va_op_xmm_xmm 6)
)
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 170 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128 ())
(fun (va_s: va_state) _ ->
let va_arg56:Vale.Math.Poly2_s.poly = h in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 171 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun (_: unit) ->
Vale.AES.GHash.lemma_g_power_n va_arg56
1)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 172 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 6)
(va_op_xmm_xmm 1))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 173 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 3)
(va_op_xmm_xmm 1))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 174 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_ShiftKey1_gf128_power
h
2)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 175 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Store128_buffer (
va_op_heaplet_mem_heaplet
1)
(va_op_reg_opr64_reg64
rRcx)
(va_op_xmm_xmm 1)
16
Secret
hkeys_b
1)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 177 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm
2)
(va_op_xmm_xmm 6))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 178 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Load128_buffer
(va_op_heaplet_mem_heaplet
1)
(va_op_xmm_xmm
1)
(va_op_reg_opr64_reg64
rRcx)
32
Secret
hkeys_b
2)
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 179 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Gf128MulRev128
())
(fun
(va_s:
va_state
)
_
->
let
va_arg55:Vale.Math.Poly2_s.poly
=
h
in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 180 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(fun
(_:
unit
)
->
Vale.AES.GHash.lemma_g_power_n
va_arg55
2)
(va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 181 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(va_quick_Mov128
(
va_op_xmm_xmm
6
)
(
va_op_xmm_xmm
1
)
)
(va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 182 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
va_quick_Mov128
(
va_op_xmm_xmm
3
)
(
va_op_xmm_xmm
1
)
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 183 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
va_quick_ShiftKey1_gf128_power
h
3
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 184 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
va_quick_Store128_buffer
(
va_op_heaplet_mem_heaplet
1
)
(
va_op_reg_opr64_reg64
rRcx
)
(
va_op_xmm_xmm
1
)
48
Secret
hkeys_b
3
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 186 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
va_quick_Mov128
(
va_op_xmm_xmm
2
)
(
va_op_xmm_xmm
6
)
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 187 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
va_quick_Load128_buffer
(
va_op_heaplet_mem_heaplet
1
)
(
va_op_xmm_xmm
1
)
(
va_op_reg_opr64_reg64
rRcx
)
32
Secret
hkeys_b
2
)
(
va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 188 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
va_quick_Gf128MulRev128
()
)
(
fun
(
va_s:
va_state
)
_
->
let
va_arg54:Vale.Math.Poly2_s.poly
=
h
in
va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 189 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
fun
(
_:
unit
)
->
Vale.AES.GHash.lemma_g_power_n
va_arg54
3
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 190 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
va_quick_Mov128
(
va_op_xmm_xmm
6
)
(
va_op_xmm_xmm
1
)
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 191 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
va_quick_Mov128
(
va_op_xmm_xmm
3
)
(
va_op_xmm_xmm
1
)
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 192 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
va_quick_ShiftKey1_gf128_power
h
4
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 193 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
va_quick_Store128_buffer
(
va_op_heaplet_mem_heaplet
1
)
(
va_op_reg_opr64_reg64
rRcx
)
(
va_op_xmm_xmm
1
)
64
Secret
hkeys_b
4
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 195 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
va_quick_Mov128
(
va_op_xmm_xmm
2
)
(
va_op_xmm_xmm
6
)
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 196 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
va_quick_Load128_buffer
(
va_op_heaplet_mem_heaplet
1
)
(
va_op_xmm_xmm
1
)
(
va_op_reg_opr64_reg64
rRcx
)
32
Secret
hkeys_b
2
)
(
va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 197 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
va_quick_Gf128MulRev128
()
)
(
fun
(
va_s:
va_state
)
_
->
let
va_arg53:Vale.Math.Poly2_s.poly
=
h
in
va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 198 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
fun
(
_:
unit
)
->
Vale.AES.GHash.lemma_g_power_n
va_arg53
4
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 199 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
va_quick_Mov128
(
va_op_xmm_xmm
6
)
(
va_op_xmm_xmm
1
)
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 200 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
va_quick_Mov128
(
va_op_xmm_xmm
3
)
(
va_op_xmm_xmm
1
)
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
va_quick_ShiftKey1_gf128_power
h
5
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 202 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
va_quick_Store128_buffer
(
va_op_heaplet_mem_heaplet
1
)
(
va_op_reg_opr64_reg64
rRcx
)
(
va_op_xmm_xmm
1
)
96
Secret
hkeys_b
6
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 204 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
va_quick_Mov128
(
va_op_xmm_xmm
2
)
(
va_op_xmm_xmm
6
)
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 205 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
va_quick_Load128_buffer
(
va_op_heaplet_mem_heaplet
1
)
(
va_op_xmm_xmm
1
)
(
va_op_reg_opr64_reg64
rRcx
)
32
Secret
hkeys_b
2
)
(
va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 206 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
va_quick_Gf128MulRev128
()
)
(
fun
(
va_s:
va_state
)
_
->
let
va_arg52:Vale.Math.Poly2_s.poly
=
h
in
va_qPURE
va_range1
"***** PRECONDITION NOT MET AT line 207 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
fun
(
_:
unit
)
->
Vale.AES.GHash.lemma_g_power_n
va_arg52
5
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 208 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
va_quick_Mov128
(
va_op_xmm_xmm
6
)
(
va_op_xmm_xmm
1
)
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 209 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
va_quick_Mov128
(
va_op_xmm_xmm
3
)
(
va_op_xmm_xmm
1
)
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 210 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
va_quick_ShiftKey1_gf128_power
h
6
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 211 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
va_quick_Store128_buffer
(
va_op_heaplet_mem_heaplet
1
)
(
va_op_reg_opr64_reg64
rRcx
)
(
va_op_xmm_xmm
1
)
112
Secret
hkeys_b
7
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 213 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
va_quick_Mov128
(
va_op_xmm_xmm
6
)
(
va_op_xmm_xmm
0
)
)
(
va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 214 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GF128_Init.vaf *****"
(
va_quick_Mov64
(
va_op_dst_opr64_reg64
rR12
)
(
va_op_opr64_reg64
rRax
)
)
(
va_QEmpty
(
()
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
))
))))))))))))))
))))))) | false |
Lib.Sequence.fsti | Lib.Sequence.lseq | val lseq : a: Type0 -> len: Lib.IntTypes.size_nat -> Type0 | let lseq (a:Type0) (len:size_nat) = s:seq a{Seq.length s == len} | {
"file_name": "lib/Lib.Sequence.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 64,
"end_line": 27,
"start_col": 0,
"start_line": 27
} | module Lib.Sequence
open FStar.Mul
open Lib.IntTypes
#set-options "--z3rlimit 30 --max_fuel 0 --max_ifuel 0 --using_facts_from '-* +Prims +FStar.Math.Lemmas +FStar.Seq +Lib.IntTypes +Lib.Sequence'"
/// Variable length Sequences, derived from FStar.Seq
(* This is the type of unbounded sequences.
Use this only when dealing with, say, user input whose length is unbounded.
As far as possible use the API for bounded sequences defined later in this file.*)
(** Definition of a Sequence *)
let seq (a:Type0) = Seq.seq a
(** Length of a Sequence *)
let length (#a:Type0) (s:seq a) : nat = Seq.length s
/// Fixed length Sequences
(* This is the type of bounded sequences.
Use this as much as possible.
It adds additional length checks that you'd have to prove in the implementation otherwise *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Lib.Sequence.fsti"
} | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type0 -> len: Lib.IntTypes.size_nat -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Lib.IntTypes.size_nat",
"Lib.Sequence.seq",
"Prims.eq2",
"Prims.nat",
"FStar.Seq.Base.length"
] | [] | false | false | false | true | true | let lseq (a: Type0) (len: size_nat) =
| s: seq a {Seq.length s == len} | false |
|
Lib.Sequence.fsti | Lib.Sequence.length | val length (#a: Type0) (s: seq a) : nat | val length (#a: Type0) (s: seq a) : nat | let length (#a:Type0) (s:seq a) : nat = Seq.length s | {
"file_name": "lib/Lib.Sequence.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 52,
"end_line": 18,
"start_col": 0,
"start_line": 18
} | module Lib.Sequence
open FStar.Mul
open Lib.IntTypes
#set-options "--z3rlimit 30 --max_fuel 0 --max_ifuel 0 --using_facts_from '-* +Prims +FStar.Math.Lemmas +FStar.Seq +Lib.IntTypes +Lib.Sequence'"
/// Variable length Sequences, derived from FStar.Seq
(* This is the type of unbounded sequences.
Use this only when dealing with, say, user input whose length is unbounded.
As far as possible use the API for bounded sequences defined later in this file.*)
(** Definition of a Sequence *)
let seq (a:Type0) = Seq.seq a | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Lib.Sequence.fsti"
} | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | s: Lib.Sequence.seq a -> Prims.nat | Prims.Tot | [
"total"
] | [] | [
"Lib.Sequence.seq",
"FStar.Seq.Base.length",
"Prims.nat"
] | [] | false | false | false | true | false | let length (#a: Type0) (s: seq a) : nat =
| Seq.length s | false |
LowParse.Low.FLData.fst | LowParse.Low.FLData.clens_fldata_strong | val clens_fldata_strong (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: nat)
: Tot (clens (parse_fldata_strong_t s sz) t) | val clens_fldata_strong (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: nat)
: Tot (clens (parse_fldata_strong_t s sz) t) | let clens_fldata_strong
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(sz: nat)
: Tot (clens (parse_fldata_strong_t s sz) t)
= {
clens_cond = (fun _ -> True);
clens_get = (fun (x: parse_fldata_strong_t s sz) -> (x <: t));
} | {
"file_name": "src/lowparse/LowParse.Low.FLData.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 1,
"end_line": 278,
"start_col": 0,
"start_line": 268
} | module LowParse.Low.FLData
include LowParse.Low.Combinators
include LowParse.Spec.FLData
module B = LowStar.Buffer
module U32 = FStar.UInt32
module HST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module Cast = FStar.Int.Cast
module U64 = FStar.UInt64
let valid_fldata_gen
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(sz: nat)
#rrel #rel
(input: slice rrel rel)
(pos: U32.t)
(h: HS.mem)
: Lemma
(requires (
U32.v pos + sz < 4294967296 /\
valid_exact p h input pos (pos `U32.add` U32.uint_to_t sz)
))
(ensures (
U32.v pos + sz < 4294967296 /\ (
let pos' = pos `U32.add` U32.uint_to_t sz in
valid_content_pos (parse_fldata p sz) h input pos (contents_exact p h input pos pos') pos'
)))
= valid_facts (parse_fldata p sz) h input pos;
let pos' = pos `U32.add` U32.uint_to_t sz in
let input' = { base = input.base; len = pos'; } in
valid_facts p h input' pos;
valid_exact_equiv p h input pos pos';
contents_exact_eq p h input pos pos'
let valid_fldata_gen_elim
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(sz: nat)
#rrel #rel
(input: slice rrel rel)
(pos: U32.t)
(h: HS.mem)
: Lemma
(requires (
valid (parse_fldata p sz) h input pos
))
(ensures (
U32.v pos + sz < 4294967296 /\ (
let pos' = pos `U32.add` U32.uint_to_t sz in
valid_exact p h input pos (pos `U32.add` U32.uint_to_t sz) /\
valid_content_pos (parse_fldata p sz) h input pos (contents_exact p h input pos pos') pos'
)))
= valid_facts (parse_fldata p sz) h input pos;
let pos' = pos `U32.add` U32.uint_to_t sz in
let input' = { base = input.base; len = pos'; } in
valid_facts p h input' pos;
valid_exact_equiv p h input pos pos';
contents_exact_eq p h input pos pos'
inline_for_extraction
let validate_fldata_gen
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(v: validator p)
(sz: nat)
(sz32: U32.t { U32.v sz32 == sz } )
: Tot (validator (parse_fldata p sz))
= fun #rrel #rel input pos ->
let h = HST.get () in
[@inline_let] let _ = valid_facts (parse_fldata p sz) h input (uint64_to_uint32 pos) in
if (Cast.uint32_to_uint64 input.len `U64.sub` pos) `U64.lt` Cast.uint32_to_uint64 sz32
then validator_error_not_enough_data
else
[@inline_let] let input' = { base = input.base; len = uint64_to_uint32 pos `U32.add` sz32; } in
[@inline_let] let _ = valid_facts p h input' (uint64_to_uint32 pos) in
let pos' = v input' pos in
if is_error pos'
then
if pos' = validator_error_not_enough_data
then validator_error_generic (* the size was fixed ahead of time, so if the parser runs out of data, then that size was wrong in the first place. *)
else pos' // error propagation
else
if pos' `U64.sub` pos <> Cast.uint32_to_uint64 sz32
then validator_error_generic
else pos'
inline_for_extraction
let validate_fldata_consumes_all
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(v: validator p)
(sz: nat)
(sz32: U32.t { U32.v sz32 == sz } )
(sq: squash (k.parser_kind_subkind == Some ParserConsumesAll))
: Tot (validator (parse_fldata p sz))
= fun #rrel #rel input pos ->
let h = HST.get () in
[@inline_let] let _ =
valid_facts (parse_fldata p sz) h input (uint64_to_uint32 pos);
parse_fldata_consumes_all_correct p sz (bytes_of_slice_from h input (uint64_to_uint32 pos))
in
if (Cast.uint32_to_uint64 input.len `U64.sub` pos) `U64.lt` Cast.uint32_to_uint64 sz32
then validator_error_not_enough_data
else
[@inline_let] let input' = { base = input.base; len = uint64_to_uint32 pos `U32.add` sz32; } in
[@inline_let] let _ = valid_facts p h input' (uint64_to_uint32 pos) in
let pos' = v input' pos in
if is_error pos'
then
if pos' = validator_error_not_enough_data
then validator_error_generic (* the size was fixed ahead of time, so if the parser runs out of data, then that size was wrong in the first place. *)
else pos' // error propagation
else pos'
inline_for_extraction
let validate_fldata
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(v: validator p)
(sz: nat)
(sz32: U32.t { U32.v sz32 == sz } )
: Tot (validator (parse_fldata p sz))
= if k.parser_kind_subkind = Some ParserConsumesAll
then validate_fldata_consumes_all v sz sz32 ()
else validate_fldata_gen v sz sz32
let valid_fldata_strong_gen
(#k: parser_kind)
(#t: Type0)
(#p: parser k t)
(s: serializer p)
(sz: nat)
#rrel #rel
(input: slice rrel rel)
(pos: U32.t)
(h: HS.mem)
: Lemma
(requires (
U32.v pos + sz < 4294967296 /\
valid_exact p h input pos (pos `U32.add` U32.uint_to_t sz)
))
(ensures (
U32.v pos + sz < 4294967296 /\
valid_exact p h input pos (pos `U32.add` U32.uint_to_t sz) /\ (
let pos' = pos `U32.add` U32.uint_to_t sz in
let x = contents_exact p h input pos pos' in
Seq.length (serialize s x) == sz /\
valid_content_pos (parse_fldata_strong s sz) h input pos x pos'
)))
= valid_facts (parse_fldata_strong s sz) h input pos;
let pos' = pos `U32.add` U32.uint_to_t sz in
let input' = { base = input.base; len = pos'; } in
valid_facts p h input' pos;
valid_exact_equiv p h input pos pos';
contents_exact_eq p h input pos pos'
let valid_fldata_strong_gen_elim
(#k: parser_kind)
(#t: Type0)
(#p: parser k t)
(s: serializer p)
(sz: nat)
#rrel #rel
(input: slice rrel rel)
(pos: U32.t)
(h: HS.mem)
: Lemma
(requires (
valid (parse_fldata_strong s sz) h input pos
))
(ensures (
U32.v pos + sz < 4294967296 /\ (
let pos' = pos `U32.add` U32.uint_to_t sz in
valid_exact p h input pos (pos `U32.add` U32.uint_to_t sz) /\ (
let x = contents_exact p h input pos pos' in
Seq.length (serialize s x) == sz /\
valid_content_pos (parse_fldata_strong s sz) h input pos x pos'
))))
= valid_facts (parse_fldata_strong s sz) h input pos;
let pos' = pos `U32.add` U32.uint_to_t sz in
let input' = { base = input.base; len = pos'; } in
valid_facts p h input' pos;
valid_exact_equiv p h input pos pos';
contents_exact_eq p h input pos pos'
inline_for_extraction
let validate_fldata_strong
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(v: validator p)
(sz: nat)
(sz32: U32.t { U32.v sz32 == sz } )
: Tot (validator (parse_fldata_strong s sz))
= fun #rrel #rel input pos ->
let h = HST.get () in
[@inline_let] let _ = valid_facts (parse_fldata p sz) h input (uint64_to_uint32 pos) in
[@inline_let] let _ = valid_facts (parse_fldata_strong s sz) h input (uint64_to_uint32 pos) in
validate_fldata v sz sz32 input pos
inline_for_extraction
let jump_fldata
(#k: parser_kind)
(#t: Type)
(p: parser k t)
(sz: nat)
(sz32: U32.t { U32.v sz32 == sz } )
: Tot (jumper (parse_fldata p sz))
= jump_constant_size (parse_fldata p sz) sz32 ()
inline_for_extraction
let jump_fldata_strong
(#k: parser_kind)
(#t: Type)
(#p: parser k t)
(s: serializer p)
(sz: nat)
(sz32: U32.t { U32.v sz32 == sz } )
: Tot (jumper (parse_fldata_strong s sz))
= jump_constant_size (parse_fldata_strong s sz) sz32 ()
let gaccessor_fldata'
(#k: parser_kind)
(#t: Type)
(p: parser k t { k.parser_kind_subkind == Some ParserStrong } )
(sz: nat)
: Tot (gaccessor' (parse_fldata p sz) p (clens_id _))
= fun (input: bytes) -> (
let _ = match parse (parse_fldata p sz) input with
| None -> ()
| Some (_, consumed) ->
if consumed = sz
then parse_strong_prefix p (Seq.slice input 0 sz) input
else ()
in
0
)
let gaccessor_fldata
(#k: parser_kind)
(#t: Type)
(p: parser k t { k.parser_kind_subkind == Some ParserStrong } )
(sz: nat)
: Tot (gaccessor (parse_fldata p sz) p (clens_id _))
= gaccessor_prop_equiv (parse_fldata p sz) p (clens_id _) (gaccessor_fldata' p sz);
gaccessor_fldata' p sz
inline_for_extraction
let accessor_fldata
(#k: parser_kind)
(#t: Type)
(p: parser k t { k.parser_kind_subkind == Some ParserStrong } )
(sz: nat)
: Tot (accessor (gaccessor_fldata p sz))
= fun #rrel #rel input pos ->
let h = HST.get () in
[@inline_let] let _ = slice_access_eq h (gaccessor_fldata p sz) input pos in
pos | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"LowParse.Spec.FLData.fst.checked",
"LowParse.Low.Combinators.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Int.Cast.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "LowParse.Low.FLData.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.FLData",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Low.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Low",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Low",
"short_module": null
},
{
"abbrev": 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 | s: LowParse.Spec.Base.serializer p -> sz: Prims.nat
-> LowParse.Low.Base.Spec.clens (LowParse.Spec.FLData.parse_fldata_strong_t s sz) t | Prims.Tot | [
"total"
] | [] | [
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.Spec.Base.serializer",
"Prims.nat",
"LowParse.Low.Base.Spec.Mkclens",
"LowParse.Spec.FLData.parse_fldata_strong_t",
"Prims.l_True",
"LowParse.Low.Base.Spec.clens"
] | [] | false | false | false | false | false | let clens_fldata_strong (#k: parser_kind) (#t: Type) (#p: parser k t) (s: serializer p) (sz: nat)
: Tot (clens (parse_fldata_strong_t s sz) t) =
| { clens_cond = (fun _ -> True); clens_get = (fun (x: parse_fldata_strong_t s sz) -> (x <: t)) } | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test11_plaintext_shake256 | val test11_plaintext_shake256:b: lbuffer uint8 32ul {recallable b} | val test11_plaintext_shake256:b: lbuffer uint8 32ul {recallable b} | let test11_plaintext_shake256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xef; 0x89; 0x6c; 0xdc; 0xb3; 0x63; 0xa6; 0x15; 0x91; 0x78; 0xa1; 0xbb; 0x1c; 0x99; 0x39; 0x46;
0xc5; 0x04; 0x02; 0x09; 0x5c; 0xda; 0xea; 0x4f; 0xd4; 0xd4; 0x19; 0xaa; 0x47; 0x32; 0x1c; 0x88])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 451,
"start_col": 0,
"start_line": 443
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3
//
let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l
let test3_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79; 0xba;
0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test3_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x41; 0xc0; 0xdb; 0xa2; 0xa9; 0xd6; 0x24; 0x08; 0x49; 0x10; 0x03; 0x76; 0xa8; 0x23; 0x5e; 0x2c;
0x82; 0xe1; 0xb9; 0x99; 0x8a; 0x99; 0x9e; 0x21; 0xdb; 0x32; 0xdd; 0x97; 0x49; 0x6d; 0x33; 0x76])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test3_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x99; 0x1c; 0x66; 0x57; 0x55; 0xeb; 0x3a; 0x4b; 0x6b; 0xbd; 0xfb; 0x75; 0xc7; 0x8a; 0x49; 0x2e;
0x8c; 0x56; 0xa2; 0x2c; 0x5c; 0x4d; 0x7e; 0x42; 0x9b; 0xfd; 0xbc; 0x32; 0xb9; 0xd4; 0xad; 0x5a;
0xa0; 0x4a; 0x1f; 0x07; 0x6e; 0x62; 0xfe; 0xa1; 0x9e; 0xef; 0x51; 0xac; 0xd0; 0x65; 0x7c; 0x22])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test3_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x04; 0xa3; 0x71; 0xe8; 0x4e; 0xcf; 0xb5; 0xb8; 0xb7; 0x7c; 0xb4; 0x86; 0x10; 0xfc; 0xa8; 0x18;
0x2d; 0xd4; 0x57; 0xce; 0x6f; 0x32; 0x6a; 0x0f; 0xd3; 0xd7; 0xec; 0x2f; 0x1e; 0x91; 0x63; 0x6d;
0xee; 0x69; 0x1f; 0xbe; 0x0c; 0x98; 0x53; 0x02; 0xba; 0x1b; 0x0d; 0x8d; 0xc7; 0x8c; 0x08; 0x63;
0x46; 0xb5; 0x33; 0xb4; 0x9c; 0x03; 0x0d; 0x99; 0xa2; 0x7d; 0xaf; 0x11; 0x39; 0xd6; 0xe7; 0x5e])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test4_SHA3
//
let test4_plaintext: b:lbuffer uint8 112ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69;
0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b;
0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d;
0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f;
0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71;
0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73;
0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x75])
in
assert_norm (List.Tot.length l == 112);
createL_mglobal l
let test4_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x54; 0x3e; 0x68; 0x68; 0xe1; 0x66; 0x6c; 0x1a; 0x64; 0x36; 0x30; 0xdf; 0x77; 0x36; 0x7a; 0xe5;
0xa6; 0x2a; 0x85; 0x07; 0x0a; 0x51; 0xc1; 0x4c; 0xbf; 0x66; 0x5c; 0xbc])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test4_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x91; 0x6f; 0x60; 0x61; 0xfe; 0x87; 0x97; 0x41; 0xca; 0x64; 0x69; 0xb4; 0x39; 0x71; 0xdf; 0xdb;
0x28; 0xb1; 0xa3; 0x2d; 0xc3; 0x6c; 0xb3; 0x25; 0x4e; 0x81; 0x2b; 0xe2; 0x7a; 0xad; 0x1d; 0x18])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test4_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x79; 0x40; 0x7d; 0x3b; 0x59; 0x16; 0xb5; 0x9c; 0x3e; 0x30; 0xb0; 0x98; 0x22; 0x97; 0x47; 0x91;
0xc3; 0x13; 0xfb; 0x9e; 0xcc; 0x84; 0x9e; 0x40; 0x6f; 0x23; 0x59; 0x2d; 0x04; 0xf6; 0x25; 0xdc;
0x8c; 0x70; 0x9b; 0x98; 0xb4; 0x3b; 0x38; 0x52; 0xb3; 0x37; 0x21; 0x61; 0x79; 0xaa; 0x7f; 0xc7])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test4_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xaf; 0xeb; 0xb2; 0xef; 0x54; 0x2e; 0x65; 0x79; 0xc5; 0x0c; 0xad; 0x06; 0xd2; 0xe5; 0x78; 0xf9;
0xf8; 0xdd; 0x68; 0x81; 0xd7; 0xdc; 0x82; 0x4d; 0x26; 0x36; 0x0f; 0xee; 0xbf; 0x18; 0xa4; 0xfa;
0x73; 0xe3; 0x26; 0x11; 0x22; 0x94; 0x8e; 0xfc; 0xfd; 0x49; 0x2e; 0x74; 0xe8; 0x2e; 0x21; 0x89;
0xed; 0x0f; 0xb4; 0x40; 0xd1; 0x87; 0xf3; 0x82; 0x27; 0x0c; 0xb4; 0x55; 0xf2; 0x1d; 0xd1; 0x85])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test5_SHAKE128
//
let test5_plaintext_shake128: b:lbuffer uint8 0ul{ recallable b } =
[@ inline_let]
let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test5_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7f; 0x9c; 0x2b; 0xa4; 0xe8; 0x8f; 0x82; 0x7d; 0x61; 0x60; 0x45; 0x50; 0x76; 0x05; 0x85; 0x3e])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test6_SHAKE128
//
let test6_plaintext_shake128: b:lbuffer uint8 14ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x52; 0x97; 0x7e; 0x53; 0x2b; 0xcc; 0xdb; 0x89; 0xdf; 0xef; 0xf7; 0xe9; 0xe4; 0xad]) in
assert_norm (List.Tot.length l == 14);
createL_mglobal l
let test6_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xfb; 0xfb; 0xa5; 0xc1; 0xe1; 0x79; 0xdf; 0x14; 0x69; 0xfc; 0xc8; 0x58; 0x8a; 0xe5; 0xd2; 0xcc])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test7_SHAKE128
//
let test7_plaintext_shake128: b:lbuffer uint8 34ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x4a; 0x20; 0x6a; 0x5b; 0x8a; 0xa3; 0x58; 0x6c; 0x06; 0x67; 0xa4; 0x00; 0x20; 0xd6; 0x5f; 0xf5;
0x11; 0xd5; 0x2b; 0x73; 0x2e; 0xf7; 0xa0; 0xc5; 0x69; 0xf1; 0xee; 0x68; 0x1a; 0x4f; 0xc3; 0x62;
0x00; 0x65])
in
assert_norm (List.Tot.length l == 34);
createL_mglobal l
let test7_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7b; 0xb4; 0x33; 0x75; 0x2b; 0x98; 0xf9; 0x15; 0xbe; 0x51; 0x82; 0xbc; 0x1f; 0x09; 0x66; 0x48])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test8_SHAKE128
//
let test8_plaintext_shake128: b:lbuffer uint8 83ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x24; 0x69; 0xf1; 0x01; 0xc9; 0xb4; 0x99; 0xa9; 0x30; 0xa9; 0x7e; 0xf1; 0xb3; 0x46; 0x73; 0xec;
0x74; 0x39; 0x3f; 0xd9; 0xfa; 0xf6; 0x58; 0xe3; 0x1f; 0x06; 0xee; 0x0b; 0x29; 0xa2; 0x2b; 0x62;
0x37; 0x80; 0xba; 0x7b; 0xdf; 0xed; 0x86; 0x20; 0x15; 0x1c; 0xc4; 0x44; 0x4e; 0xbe; 0x33; 0x39;
0xe6; 0xd2; 0xa2; 0x23; 0xbf; 0xbf; 0xb4; 0xad; 0x2c; 0xa0; 0xe0; 0xfa; 0x0d; 0xdf; 0xbb; 0xdf;
0x3b; 0x05; 0x7a; 0x4f; 0x26; 0xd0; 0xb2; 0x16; 0xbc; 0x87; 0x63; 0xca; 0x8d; 0x8a; 0x35; 0xff;
0x2d; 0x2d; 0x01])
in
assert_norm (List.Tot.length l == 83);
createL_mglobal l
let test8_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x00; 0xff; 0x5e; 0xf0; 0xcd; 0x7f; 0x8f; 0x90; 0xad; 0x94; 0xb7; 0x97; 0xe9; 0xd4; 0xdd; 0x30])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test9_SHAKE256
//
let test9_plaintext_shake256: b:lbuffer uint8 0ul{ recallable b } =
[@ inline_let]
let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test9_expected_shake256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x46; 0xb9; 0xdd; 0x2b; 0x0b; 0xa8; 0x8d; 0x13; 0x23; 0x3b; 0x3f; 0xeb; 0x74; 0x3e; 0xeb; 0x24;
0x3f; 0xcd; 0x52; 0xea; 0x62; 0xb8; 0x1b; 0x82; 0xb5; 0x0c; 0x27; 0x64; 0x6e; 0xd5; 0x76; 0x2f])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
//
// Test10_SHAKE256
//
let test10_plaintext_shake256: b:lbuffer uint8 17ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xf9; 0xda; 0x78; 0xc8; 0x90; 0x84; 0x70; 0x40; 0x45; 0x4b; 0xa6; 0x42; 0x98; 0x82; 0xb0; 0x54;
0x09])
in
assert_norm (List.Tot.length l == 17);
createL_mglobal l
let test10_expected_shake256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa8; 0x49; 0x83; 0xc9; 0xfe; 0x75; 0xad; 0x0d; 0xe1; 0x9e; 0x2c; 0x84; 0x20; 0xa7; 0xea; 0x85;
0xb2; 0x51; 0x02; 0x19; 0x56; 0x14; 0xdf; 0xa5; 0x34; 0x7d; 0xe6; 0x0a; 0x1c; 0xe1; 0x3b; 0x60])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
//
// Test11_SHAKE256 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(32ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test11_plaintext_shake256:b: lbuffer uint8 32ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0xef; 0x89; 0x6c; 0xdc; 0xb3; 0x63; 0xa6; 0x15; 0x91; 0x78; 0xa1; 0xbb; 0x1c; 0x99; 0x39;
0x46; 0xc5; 0x04; 0x02; 0x09; 0x5c; 0xda; 0xea; 0x4f; 0xd4; 0xd4; 0x19; 0xaa; 0x47; 0x32;
0x1c; 0x88
])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l | false |
Steel.ST.C.Types.UserStruct.fsti | Steel.ST.C.Types.UserStruct.set | val set (#t: Type) (sd: struct_def t) (x: t) (f: field_t sd.fields) (v: sd.field_desc.fd_type f)
: Tot t | val set (#t: Type) (sd: struct_def t) (x: t) (f: field_t sd.fields) (v: sd.field_desc.fd_type f)
: Tot t | let set (#t: Type) (sd: struct_def t) (x: t) (f: field_t sd.fields) (v: sd.field_desc.fd_type f) : Tot t =
sd.mk (set_aux sd x f v) | {
"file_name": "lib/steel/c/Steel.ST.C.Types.UserStruct.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 26,
"end_line": 61,
"start_col": 0,
"start_line": 60
} | module Steel.ST.C.Types.UserStruct
open Steel.ST.Util
open Steel.ST.C.Types.Struct.Aux
module Set = FStar.Set
(* This library allows the user to define their own struct type, with
a constructor from field values, and a destructor to field values for
each field. This may be necessary for recursive structs *)
let set_def
(#t: eqtype)
(s: FStar.Set.set t)
(x: t)
: Tot bool
= FStar.Set.mem x s
noextract
let nonempty_set (t: eqtype) =
(s: Set.set t { exists x . set_def s x == true })
noextract
let set_snoc // for associativity reasons
(#t: eqtype) (q: FStar.Set.set t) (a: t) : Pure (nonempty_set t)
(requires True)
(ensures (fun s ->
(forall (x: t). {:pattern FStar.Set.mem x s} FStar.Set.mem x s == (x = a || FStar.Set.mem x q))
))
= q `FStar.Set.union` FStar.Set.singleton a
[@@noextract_to "krml"]
let field_t (s: Set.set string) : Tot eqtype =
(f: string { Set.mem f s })
[@@noextract_to "krml"; norm_field_attr]
inline_for_extraction // for field_desc.fd_type
noeq
type struct_def (t: Type) = {
fields: Set.set string;
field_desc: field_description_gen_t (field_t fields);
mk: ((f: field_t fields) -> Tot (field_desc.fd_type f)) -> Tot t;
get: (t -> (f: field_t fields) -> Tot (field_desc.fd_type f));
get_mk: (phi: ((f: field_t fields) -> Tot (field_desc.fd_type f))) -> (f: field_t fields) -> Lemma
(get (mk phi) f == phi f);
extensionality: (x1: t) -> (x2: t) -> ((f: field_t fields) -> Lemma (get x1 f == get x2 f)) -> Lemma (x1 == x2);
}
let nonempty_set_nonempty_type (x: string) (s: Set.set string) : Lemma
(requires (x `Set.mem` s))
(ensures (exists (x: field_t s) . True))
= Classical.exists_intro (fun (_: field_t s) -> True) x
[@@noextract_to "krml"]
let set_aux
(#t: Type) (sd: struct_def t) (x: t) (f: field_t sd.fields) (v: sd.field_desc.fd_type f) (f': field_t sd.fields)
: Tot (sd.field_desc.fd_type f')
= if f = f' then v else sd.get x f' | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"Steel.ST.C.Types.Struct.Aux.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Steel.ST.C.Types.UserStruct.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Set",
"short_module": "Set"
},
{
"abbrev": false,
"full_module": "Steel.ST.C.Types.Struct.Aux",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.C.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.C.Types",
"short_module": null
},
{
"abbrev": 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 |
sd: Steel.ST.C.Types.UserStruct.struct_def t ->
x: t ->
f: Steel.ST.C.Types.UserStruct.field_t (Mkstruct_def?.fields sd) ->
v: Mkfield_description_gen_t?.fd_type (Mkstruct_def?.field_desc sd) f
-> t | Prims.Tot | [
"total"
] | [] | [
"Steel.ST.C.Types.UserStruct.struct_def",
"Steel.ST.C.Types.UserStruct.field_t",
"Steel.ST.C.Types.UserStruct.__proj__Mkstruct_def__item__fields",
"Steel.ST.C.Types.Struct.Aux.__proj__Mkfield_description_gen_t__item__fd_type",
"Steel.ST.C.Types.UserStruct.__proj__Mkstruct_def__item__field_desc",
"Steel.ST.C.Types.UserStruct.__proj__Mkstruct_def__item__mk",
"Steel.ST.C.Types.UserStruct.set_aux"
] | [] | false | false | false | false | false | let set (#t: Type) (sd: struct_def t) (x: t) (f: field_t sd.fields) (v: sd.field_desc.fd_type f)
: Tot t =
| sd.mk (set_aux sd x f v) | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test11_expected_shake256 | val test11_expected_shake256:b: lbuffer uint8 32ul {recallable b} | val test11_expected_shake256:b: lbuffer uint8 32ul {recallable b} | let test11_expected_shake256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7a; 0xbb; 0xa4; 0xe8; 0xb8; 0xdd; 0x76; 0x6b; 0xba; 0xbe; 0x98; 0xf8; 0xf1; 0x69; 0xcb; 0x62;
0x08; 0x67; 0x4d; 0xe1; 0x9a; 0x51; 0xd7; 0x3c; 0x92; 0xb7; 0xdc; 0x04; 0xa4; 0xb5; 0xee; 0x3d])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 461,
"start_col": 0,
"start_line": 453
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3
//
let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l
let test3_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79; 0xba;
0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test3_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x41; 0xc0; 0xdb; 0xa2; 0xa9; 0xd6; 0x24; 0x08; 0x49; 0x10; 0x03; 0x76; 0xa8; 0x23; 0x5e; 0x2c;
0x82; 0xe1; 0xb9; 0x99; 0x8a; 0x99; 0x9e; 0x21; 0xdb; 0x32; 0xdd; 0x97; 0x49; 0x6d; 0x33; 0x76])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test3_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x99; 0x1c; 0x66; 0x57; 0x55; 0xeb; 0x3a; 0x4b; 0x6b; 0xbd; 0xfb; 0x75; 0xc7; 0x8a; 0x49; 0x2e;
0x8c; 0x56; 0xa2; 0x2c; 0x5c; 0x4d; 0x7e; 0x42; 0x9b; 0xfd; 0xbc; 0x32; 0xb9; 0xd4; 0xad; 0x5a;
0xa0; 0x4a; 0x1f; 0x07; 0x6e; 0x62; 0xfe; 0xa1; 0x9e; 0xef; 0x51; 0xac; 0xd0; 0x65; 0x7c; 0x22])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test3_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x04; 0xa3; 0x71; 0xe8; 0x4e; 0xcf; 0xb5; 0xb8; 0xb7; 0x7c; 0xb4; 0x86; 0x10; 0xfc; 0xa8; 0x18;
0x2d; 0xd4; 0x57; 0xce; 0x6f; 0x32; 0x6a; 0x0f; 0xd3; 0xd7; 0xec; 0x2f; 0x1e; 0x91; 0x63; 0x6d;
0xee; 0x69; 0x1f; 0xbe; 0x0c; 0x98; 0x53; 0x02; 0xba; 0x1b; 0x0d; 0x8d; 0xc7; 0x8c; 0x08; 0x63;
0x46; 0xb5; 0x33; 0xb4; 0x9c; 0x03; 0x0d; 0x99; 0xa2; 0x7d; 0xaf; 0x11; 0x39; 0xd6; 0xe7; 0x5e])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test4_SHA3
//
let test4_plaintext: b:lbuffer uint8 112ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69;
0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b;
0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d;
0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f;
0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71;
0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73;
0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x75])
in
assert_norm (List.Tot.length l == 112);
createL_mglobal l
let test4_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x54; 0x3e; 0x68; 0x68; 0xe1; 0x66; 0x6c; 0x1a; 0x64; 0x36; 0x30; 0xdf; 0x77; 0x36; 0x7a; 0xe5;
0xa6; 0x2a; 0x85; 0x07; 0x0a; 0x51; 0xc1; 0x4c; 0xbf; 0x66; 0x5c; 0xbc])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test4_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x91; 0x6f; 0x60; 0x61; 0xfe; 0x87; 0x97; 0x41; 0xca; 0x64; 0x69; 0xb4; 0x39; 0x71; 0xdf; 0xdb;
0x28; 0xb1; 0xa3; 0x2d; 0xc3; 0x6c; 0xb3; 0x25; 0x4e; 0x81; 0x2b; 0xe2; 0x7a; 0xad; 0x1d; 0x18])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test4_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x79; 0x40; 0x7d; 0x3b; 0x59; 0x16; 0xb5; 0x9c; 0x3e; 0x30; 0xb0; 0x98; 0x22; 0x97; 0x47; 0x91;
0xc3; 0x13; 0xfb; 0x9e; 0xcc; 0x84; 0x9e; 0x40; 0x6f; 0x23; 0x59; 0x2d; 0x04; 0xf6; 0x25; 0xdc;
0x8c; 0x70; 0x9b; 0x98; 0xb4; 0x3b; 0x38; 0x52; 0xb3; 0x37; 0x21; 0x61; 0x79; 0xaa; 0x7f; 0xc7])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test4_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xaf; 0xeb; 0xb2; 0xef; 0x54; 0x2e; 0x65; 0x79; 0xc5; 0x0c; 0xad; 0x06; 0xd2; 0xe5; 0x78; 0xf9;
0xf8; 0xdd; 0x68; 0x81; 0xd7; 0xdc; 0x82; 0x4d; 0x26; 0x36; 0x0f; 0xee; 0xbf; 0x18; 0xa4; 0xfa;
0x73; 0xe3; 0x26; 0x11; 0x22; 0x94; 0x8e; 0xfc; 0xfd; 0x49; 0x2e; 0x74; 0xe8; 0x2e; 0x21; 0x89;
0xed; 0x0f; 0xb4; 0x40; 0xd1; 0x87; 0xf3; 0x82; 0x27; 0x0c; 0xb4; 0x55; 0xf2; 0x1d; 0xd1; 0x85])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test5_SHAKE128
//
let test5_plaintext_shake128: b:lbuffer uint8 0ul{ recallable b } =
[@ inline_let]
let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test5_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7f; 0x9c; 0x2b; 0xa4; 0xe8; 0x8f; 0x82; 0x7d; 0x61; 0x60; 0x45; 0x50; 0x76; 0x05; 0x85; 0x3e])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test6_SHAKE128
//
let test6_plaintext_shake128: b:lbuffer uint8 14ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x52; 0x97; 0x7e; 0x53; 0x2b; 0xcc; 0xdb; 0x89; 0xdf; 0xef; 0xf7; 0xe9; 0xe4; 0xad]) in
assert_norm (List.Tot.length l == 14);
createL_mglobal l
let test6_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xfb; 0xfb; 0xa5; 0xc1; 0xe1; 0x79; 0xdf; 0x14; 0x69; 0xfc; 0xc8; 0x58; 0x8a; 0xe5; 0xd2; 0xcc])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test7_SHAKE128
//
let test7_plaintext_shake128: b:lbuffer uint8 34ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x4a; 0x20; 0x6a; 0x5b; 0x8a; 0xa3; 0x58; 0x6c; 0x06; 0x67; 0xa4; 0x00; 0x20; 0xd6; 0x5f; 0xf5;
0x11; 0xd5; 0x2b; 0x73; 0x2e; 0xf7; 0xa0; 0xc5; 0x69; 0xf1; 0xee; 0x68; 0x1a; 0x4f; 0xc3; 0x62;
0x00; 0x65])
in
assert_norm (List.Tot.length l == 34);
createL_mglobal l
let test7_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7b; 0xb4; 0x33; 0x75; 0x2b; 0x98; 0xf9; 0x15; 0xbe; 0x51; 0x82; 0xbc; 0x1f; 0x09; 0x66; 0x48])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test8_SHAKE128
//
let test8_plaintext_shake128: b:lbuffer uint8 83ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x24; 0x69; 0xf1; 0x01; 0xc9; 0xb4; 0x99; 0xa9; 0x30; 0xa9; 0x7e; 0xf1; 0xb3; 0x46; 0x73; 0xec;
0x74; 0x39; 0x3f; 0xd9; 0xfa; 0xf6; 0x58; 0xe3; 0x1f; 0x06; 0xee; 0x0b; 0x29; 0xa2; 0x2b; 0x62;
0x37; 0x80; 0xba; 0x7b; 0xdf; 0xed; 0x86; 0x20; 0x15; 0x1c; 0xc4; 0x44; 0x4e; 0xbe; 0x33; 0x39;
0xe6; 0xd2; 0xa2; 0x23; 0xbf; 0xbf; 0xb4; 0xad; 0x2c; 0xa0; 0xe0; 0xfa; 0x0d; 0xdf; 0xbb; 0xdf;
0x3b; 0x05; 0x7a; 0x4f; 0x26; 0xd0; 0xb2; 0x16; 0xbc; 0x87; 0x63; 0xca; 0x8d; 0x8a; 0x35; 0xff;
0x2d; 0x2d; 0x01])
in
assert_norm (List.Tot.length l == 83);
createL_mglobal l
let test8_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x00; 0xff; 0x5e; 0xf0; 0xcd; 0x7f; 0x8f; 0x90; 0xad; 0x94; 0xb7; 0x97; 0xe9; 0xd4; 0xdd; 0x30])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test9_SHAKE256
//
let test9_plaintext_shake256: b:lbuffer uint8 0ul{ recallable b } =
[@ inline_let]
let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test9_expected_shake256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x46; 0xb9; 0xdd; 0x2b; 0x0b; 0xa8; 0x8d; 0x13; 0x23; 0x3b; 0x3f; 0xeb; 0x74; 0x3e; 0xeb; 0x24;
0x3f; 0xcd; 0x52; 0xea; 0x62; 0xb8; 0x1b; 0x82; 0xb5; 0x0c; 0x27; 0x64; 0x6e; 0xd5; 0x76; 0x2f])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
//
// Test10_SHAKE256
//
let test10_plaintext_shake256: b:lbuffer uint8 17ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xf9; 0xda; 0x78; 0xc8; 0x90; 0x84; 0x70; 0x40; 0x45; 0x4b; 0xa6; 0x42; 0x98; 0x82; 0xb0; 0x54;
0x09])
in
assert_norm (List.Tot.length l == 17);
createL_mglobal l
let test10_expected_shake256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa8; 0x49; 0x83; 0xc9; 0xfe; 0x75; 0xad; 0x0d; 0xe1; 0x9e; 0x2c; 0x84; 0x20; 0xa7; 0xea; 0x85;
0xb2; 0x51; 0x02; 0x19; 0x56; 0x14; 0xdf; 0xa5; 0x34; 0x7d; 0xe6; 0x0a; 0x1c; 0xe1; 0x3b; 0x60])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
//
// Test11_SHAKE256
//
let test11_plaintext_shake256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xef; 0x89; 0x6c; 0xdc; 0xb3; 0x63; 0xa6; 0x15; 0x91; 0x78; 0xa1; 0xbb; 0x1c; 0x99; 0x39; 0x46;
0xc5; 0x04; 0x02; 0x09; 0x5c; 0xda; 0xea; 0x4f; 0xd4; 0xd4; 0x19; 0xaa; 0x47; 0x32; 0x1c; 0x88])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(32ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test11_expected_shake256:b: lbuffer uint8 32ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0x7a; 0xbb; 0xa4; 0xe8; 0xb8; 0xdd; 0x76; 0x6b; 0xba; 0xbe; 0x98; 0xf8; 0xf1; 0x69; 0xcb;
0x62; 0x08; 0x67; 0x4d; 0xe1; 0x9a; 0x51; 0xd7; 0x3c; 0x92; 0xb7; 0xdc; 0x04; 0xa4; 0xb5;
0xee; 0x3d
])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l | false |
CPS.Simple.fst | CPS.Simple.add_cps | val add_cps : list int -> (int -> Tot 'a) -> Tot 'a | val add_cps : list int -> (int -> Tot 'a) -> Tot 'a | let rec add_cps l k = match l with
| [] -> k 0
| hd::tl -> add_cps tl (fun (r:int) -> k (hd + r)) | {
"file_name": "examples/termination/CPS.Simple.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 52,
"end_line": 29,
"start_col": 0,
"start_line": 27
} | (*
Copyright 2014 Chantal Keller, Microsoft Research and Inria
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.
*)
(* ***********************************************************)
(* * A simple CPS function: adding the elements of a list. ***)
(* ***********************************************************)
(* Standard implementation **)
module CPS.Simple
open FStar.List.Tot | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "CPS.Simple.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "CPS",
"short_module": null
},
{
"abbrev": false,
"full_module": "CPS",
"short_module": null
},
{
"abbrev": 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 Prims.int -> k: (_: Prims.int -> 'a) -> 'a | Prims.Tot | [
"total"
] | [] | [
"Prims.list",
"Prims.int",
"CPS.Simple.add_cps",
"Prims.op_Addition"
] | [
"recursion"
] | false | false | false | true | false | let rec add_cps l k =
| match l with
| [] -> k 0
| hd :: tl -> add_cps tl (fun (r: int) -> k (hd + r)) | false |
Lib.Sequence.fsti | Lib.Sequence.to_seq | val to_seq (#a: Type0) (#len: size_nat) (l: lseq a len) : seq a | val to_seq (#a: Type0) (#len: size_nat) (l: lseq a len) : seq a | let to_seq (#a:Type0) (#len:size_nat) (l:lseq a len) : seq a = l | {
"file_name": "lib/Lib.Sequence.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 64,
"end_line": 28,
"start_col": 0,
"start_line": 28
} | module Lib.Sequence
open FStar.Mul
open Lib.IntTypes
#set-options "--z3rlimit 30 --max_fuel 0 --max_ifuel 0 --using_facts_from '-* +Prims +FStar.Math.Lemmas +FStar.Seq +Lib.IntTypes +Lib.Sequence'"
/// Variable length Sequences, derived from FStar.Seq
(* This is the type of unbounded sequences.
Use this only when dealing with, say, user input whose length is unbounded.
As far as possible use the API for bounded sequences defined later in this file.*)
(** Definition of a Sequence *)
let seq (a:Type0) = Seq.seq a
(** Length of a Sequence *)
let length (#a:Type0) (s:seq a) : nat = Seq.length s
/// Fixed length Sequences
(* This is the type of bounded sequences.
Use this as much as possible.
It adds additional length checks that you'd have to prove in the implementation otherwise *)
(** Definition of a fixed-length Sequence *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Lib.Sequence.fsti"
} | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | l: Lib.Sequence.lseq a len -> Lib.Sequence.seq a | Prims.Tot | [
"total"
] | [] | [
"Lib.IntTypes.size_nat",
"Lib.Sequence.lseq",
"Lib.Sequence.seq"
] | [] | false | false | false | false | false | let to_seq (#a: Type0) (#len: size_nat) (l: lseq a len) : seq a =
| l | false |
Lib.Sequence.fsti | Lib.Sequence.op_String_Access | val op_String_Access : s: Lib.Sequence.lseq a len -> i: (n: Prims.nat{n <= Prims.pow2 32 - 1}){i < len}
-> r: a{r == FStar.Seq.Base.index (Lib.Sequence.to_seq s) i} | let op_String_Access #a #len = index #a #len | {
"file_name": "lib/Lib.Sequence.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 44,
"end_line": 115,
"start_col": 0,
"start_line": 115
} | module Lib.Sequence
open FStar.Mul
open Lib.IntTypes
#set-options "--z3rlimit 30 --max_fuel 0 --max_ifuel 0 --using_facts_from '-* +Prims +FStar.Math.Lemmas +FStar.Seq +Lib.IntTypes +Lib.Sequence'"
/// Variable length Sequences, derived from FStar.Seq
(* This is the type of unbounded sequences.
Use this only when dealing with, say, user input whose length is unbounded.
As far as possible use the API for bounded sequences defined later in this file.*)
(** Definition of a Sequence *)
let seq (a:Type0) = Seq.seq a
(** Length of a Sequence *)
let length (#a:Type0) (s:seq a) : nat = Seq.length s
/// Fixed length Sequences
(* This is the type of bounded sequences.
Use this as much as possible.
It adds additional length checks that you'd have to prove in the implementation otherwise *)
(** Definition of a fixed-length Sequence *)
let lseq (a:Type0) (len:size_nat) = s:seq a{Seq.length s == len}
let to_seq (#a:Type0) (#len:size_nat) (l:lseq a len) : seq a = l
let to_lseq (#a:Type0) (s:seq a{length s <= max_size_t}) : l:lseq a (length s){l == s} = s
(* If you want to prove your code with an abstract lseq use the following: *)
// val lseq: a:Type0 -> len:size_nat -> Type0
// val to_seq: #a:Type0 -> #len:size_nat -> lseq a len -> s:seq a{length s == len}
// val to_lseq: #a:Type0 -> s:seq a{length s <= max_size_t} -> lseq a (length s)
val index:
#a:Type
-> #len:size_nat
-> s:lseq a len
-> i:size_nat{i < len} ->
Tot (r:a{r == Seq.index (to_seq s) i})
(** Creation of a fixed-length Sequence from an initial value *)
val create:
#a:Type
-> len:size_nat
-> init:a ->
Tot (s:lseq a len{to_seq s == Seq.create len init /\ (forall (i:nat).
{:pattern (index s i)} i < len ==> index s i == init)})
(** Concatenate sequences: use with care, may make implementation hard to verify *)
val concat:
#a:Type
-> #len0:size_nat
-> #len1:size_nat{len0 + len1 <= max_size_t}
-> s0:lseq a len0
-> s1:lseq a len1 ->
Tot (s2:lseq a (len0 + len1){to_seq s2 == Seq.append (to_seq s0) (to_seq s1)})
let ( @| ) #a #len0 #len1 s0 s1 = concat #a #len0 #len1 s0 s1
(** Conversion of a Sequence to a list *)
val to_list:
#a:Type
-> s:seq a ->
Tot (l:list a{List.Tot.length l = length s /\ l == Seq.seq_to_list s})
(** Creation of a fixed-length Sequence from a list of values *)
val of_list:
#a:Type
-> l:list a{List.Tot.length l <= max_size_t} ->
Tot (s:lseq a (List.Tot.length l){to_seq s == Seq.seq_of_list l})
val of_list_index:
#a:Type
-> l:list a{List.Tot.length l <= max_size_t}
-> i:nat{i < List.Tot.length l} ->
Lemma (index (of_list l) i == List.Tot.index l i)
[SMTPat (index (of_list l) i)]
val equal (#a:Type) (#len:size_nat) (s1:lseq a len) (s2:lseq a len) : Type0
val eq_intro: #a:Type -> #len:size_nat -> s1:lseq a len -> s2:lseq a len ->
Lemma
(requires forall i. {:pattern index s1 i; index s2 i} index s1 i == index s2 i)
(ensures equal s1 s2)
[SMTPat (equal s1 s2)]
val eq_elim: #a:Type -> #len:size_nat -> s1:lseq a len -> s2:lseq a len ->
Lemma
(requires equal s1 s2)
(ensures s1 == s2)
[SMTPat (equal s1 s2)]
(* Alias for creation from a list *)
unfold let createL #a l = of_list #a l
(** Updating an element of a fixed-length Sequence *)
val upd:
#a:Type
-> #len:size_nat
-> s:lseq a len
-> n:size_nat{n < len}
-> x:a ->
Tot (o:lseq a len{to_seq o == Seq.upd (to_seq s) n x /\ index o n == x /\ (forall (i:size_nat).
{:pattern (index s i)} (i < len /\ i <> n) ==> index o i == index s i)})
(** Membership of an element to a fixed-length Sequence *)
val member: #a:eqtype -> #len: size_nat -> a -> lseq a len -> Tot bool
(** Operator for accessing an element of a fixed-length Sequence *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Lib.Sequence.fsti"
} | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | s: Lib.Sequence.lseq a len -> i: (n: Prims.nat{n <= Prims.pow2 32 - 1}){i < len}
-> r: a{r == FStar.Seq.Base.index (Lib.Sequence.to_seq s) i} | Prims.Tot | [
"total"
] | [] | [
"Lib.IntTypes.size_nat",
"Lib.Sequence.index",
"Lib.Sequence.lseq",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Subtraction",
"Prims.pow2",
"Prims.op_LessThan",
"Prims.eq2",
"FStar.Seq.Base.index",
"Lib.Sequence.to_seq"
] | [] | false | false | false | false | false | let ( .[] ) #a #len =
| index #a #len | false |
|
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test4_plaintext | val test4_plaintext:b: lbuffer uint8 112ul {recallable b} | val test4_plaintext:b: lbuffer uint8 112ul {recallable b} | let test4_plaintext: b:lbuffer uint8 112ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69;
0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b;
0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d;
0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f;
0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71;
0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73;
0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x75])
in
assert_norm (List.Tot.length l == 112);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 266,
"start_col": 0,
"start_line": 253
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3
//
let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l
let test3_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79; 0xba;
0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test3_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x41; 0xc0; 0xdb; 0xa2; 0xa9; 0xd6; 0x24; 0x08; 0x49; 0x10; 0x03; 0x76; 0xa8; 0x23; 0x5e; 0x2c;
0x82; 0xe1; 0xb9; 0x99; 0x8a; 0x99; 0x9e; 0x21; 0xdb; 0x32; 0xdd; 0x97; 0x49; 0x6d; 0x33; 0x76])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test3_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x99; 0x1c; 0x66; 0x57; 0x55; 0xeb; 0x3a; 0x4b; 0x6b; 0xbd; 0xfb; 0x75; 0xc7; 0x8a; 0x49; 0x2e;
0x8c; 0x56; 0xa2; 0x2c; 0x5c; 0x4d; 0x7e; 0x42; 0x9b; 0xfd; 0xbc; 0x32; 0xb9; 0xd4; 0xad; 0x5a;
0xa0; 0x4a; 0x1f; 0x07; 0x6e; 0x62; 0xfe; 0xa1; 0x9e; 0xef; 0x51; 0xac; 0xd0; 0x65; 0x7c; 0x22])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test3_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x04; 0xa3; 0x71; 0xe8; 0x4e; 0xcf; 0xb5; 0xb8; 0xb7; 0x7c; 0xb4; 0x86; 0x10; 0xfc; 0xa8; 0x18;
0x2d; 0xd4; 0x57; 0xce; 0x6f; 0x32; 0x6a; 0x0f; 0xd3; 0xd7; 0xec; 0x2f; 0x1e; 0x91; 0x63; 0x6d;
0xee; 0x69; 0x1f; 0xbe; 0x0c; 0x98; 0x53; 0x02; 0xba; 0x1b; 0x0d; 0x8d; 0xc7; 0x8c; 0x08; 0x63;
0x46; 0xb5; 0x33; 0xb4; 0x9c; 0x03; 0x0d; 0x99; 0xa2; 0x7d; 0xaf; 0x11; 0x39; 0xd6; 0xe7; 0x5e])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test4_SHA3 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(112ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test4_plaintext:b: lbuffer uint8 112ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0x61; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68;
0x69; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69;
0x6a; 0x6b; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x66; 0x67; 0x68; 0x69; 0x6a;
0x6b; 0x6c; 0x6d; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x68; 0x69; 0x6a; 0x6b;
0x6c; 0x6d; 0x6e; 0x6f; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x6a; 0x6b; 0x6c;
0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x6c; 0x6d;
0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x6e;
0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x75
])
in
assert_norm (List.Tot.length l == 112);
createL_mglobal l | false |
Lib.Sequence.fsti | Lib.Sequence.op_String_Assignment | val op_String_Assignment : s: Lib.Sequence.lseq a len -> n: (n: Prims.nat{n <= Prims.pow2 32 - 1}){n < len} -> x: a
-> o:
Lib.Sequence.lseq a len
{ Lib.Sequence.to_seq o == FStar.Seq.Base.upd (Lib.Sequence.to_seq s) n x /\
Lib.Sequence.index o n == x /\
(forall (i: n: Prims.nat{n <= Prims.pow2 32 - 1}). {:pattern Lib.Sequence.index s i}
i < len /\ i <> n ==> Lib.Sequence.index o i == Lib.Sequence.index s i) } | let op_String_Assignment #a #len = upd #a #len | {
"file_name": "lib/Lib.Sequence.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 46,
"end_line": 119,
"start_col": 0,
"start_line": 119
} | module Lib.Sequence
open FStar.Mul
open Lib.IntTypes
#set-options "--z3rlimit 30 --max_fuel 0 --max_ifuel 0 --using_facts_from '-* +Prims +FStar.Math.Lemmas +FStar.Seq +Lib.IntTypes +Lib.Sequence'"
/// Variable length Sequences, derived from FStar.Seq
(* This is the type of unbounded sequences.
Use this only when dealing with, say, user input whose length is unbounded.
As far as possible use the API for bounded sequences defined later in this file.*)
(** Definition of a Sequence *)
let seq (a:Type0) = Seq.seq a
(** Length of a Sequence *)
let length (#a:Type0) (s:seq a) : nat = Seq.length s
/// Fixed length Sequences
(* This is the type of bounded sequences.
Use this as much as possible.
It adds additional length checks that you'd have to prove in the implementation otherwise *)
(** Definition of a fixed-length Sequence *)
let lseq (a:Type0) (len:size_nat) = s:seq a{Seq.length s == len}
let to_seq (#a:Type0) (#len:size_nat) (l:lseq a len) : seq a = l
let to_lseq (#a:Type0) (s:seq a{length s <= max_size_t}) : l:lseq a (length s){l == s} = s
(* If you want to prove your code with an abstract lseq use the following: *)
// val lseq: a:Type0 -> len:size_nat -> Type0
// val to_seq: #a:Type0 -> #len:size_nat -> lseq a len -> s:seq a{length s == len}
// val to_lseq: #a:Type0 -> s:seq a{length s <= max_size_t} -> lseq a (length s)
val index:
#a:Type
-> #len:size_nat
-> s:lseq a len
-> i:size_nat{i < len} ->
Tot (r:a{r == Seq.index (to_seq s) i})
(** Creation of a fixed-length Sequence from an initial value *)
val create:
#a:Type
-> len:size_nat
-> init:a ->
Tot (s:lseq a len{to_seq s == Seq.create len init /\ (forall (i:nat).
{:pattern (index s i)} i < len ==> index s i == init)})
(** Concatenate sequences: use with care, may make implementation hard to verify *)
val concat:
#a:Type
-> #len0:size_nat
-> #len1:size_nat{len0 + len1 <= max_size_t}
-> s0:lseq a len0
-> s1:lseq a len1 ->
Tot (s2:lseq a (len0 + len1){to_seq s2 == Seq.append (to_seq s0) (to_seq s1)})
let ( @| ) #a #len0 #len1 s0 s1 = concat #a #len0 #len1 s0 s1
(** Conversion of a Sequence to a list *)
val to_list:
#a:Type
-> s:seq a ->
Tot (l:list a{List.Tot.length l = length s /\ l == Seq.seq_to_list s})
(** Creation of a fixed-length Sequence from a list of values *)
val of_list:
#a:Type
-> l:list a{List.Tot.length l <= max_size_t} ->
Tot (s:lseq a (List.Tot.length l){to_seq s == Seq.seq_of_list l})
val of_list_index:
#a:Type
-> l:list a{List.Tot.length l <= max_size_t}
-> i:nat{i < List.Tot.length l} ->
Lemma (index (of_list l) i == List.Tot.index l i)
[SMTPat (index (of_list l) i)]
val equal (#a:Type) (#len:size_nat) (s1:lseq a len) (s2:lseq a len) : Type0
val eq_intro: #a:Type -> #len:size_nat -> s1:lseq a len -> s2:lseq a len ->
Lemma
(requires forall i. {:pattern index s1 i; index s2 i} index s1 i == index s2 i)
(ensures equal s1 s2)
[SMTPat (equal s1 s2)]
val eq_elim: #a:Type -> #len:size_nat -> s1:lseq a len -> s2:lseq a len ->
Lemma
(requires equal s1 s2)
(ensures s1 == s2)
[SMTPat (equal s1 s2)]
(* Alias for creation from a list *)
unfold let createL #a l = of_list #a l
(** Updating an element of a fixed-length Sequence *)
val upd:
#a:Type
-> #len:size_nat
-> s:lseq a len
-> n:size_nat{n < len}
-> x:a ->
Tot (o:lseq a len{to_seq o == Seq.upd (to_seq s) n x /\ index o n == x /\ (forall (i:size_nat).
{:pattern (index s i)} (i < len /\ i <> n) ==> index o i == index s i)})
(** Membership of an element to a fixed-length Sequence *)
val member: #a:eqtype -> #len: size_nat -> a -> lseq a len -> Tot bool
(** Operator for accessing an element of a fixed-length Sequence *)
unfold
let op_String_Access #a #len = index #a #len
(** Operator for updating an element of a fixed-length Sequence *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Lib.Sequence.fsti"
} | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | s: Lib.Sequence.lseq a len -> n: (n: Prims.nat{n <= Prims.pow2 32 - 1}){n < len} -> x: a
-> o:
Lib.Sequence.lseq a len
{ Lib.Sequence.to_seq o == FStar.Seq.Base.upd (Lib.Sequence.to_seq s) n x /\
Lib.Sequence.index o n == x /\
(forall (i: n: Prims.nat{n <= Prims.pow2 32 - 1}). {:pattern Lib.Sequence.index s i}
i < len /\ i <> n ==> Lib.Sequence.index o i == Lib.Sequence.index s i) } | Prims.Tot | [
"total"
] | [] | [
"Lib.IntTypes.size_nat",
"Lib.Sequence.upd",
"Lib.Sequence.lseq",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Subtraction",
"Prims.pow2",
"Prims.op_LessThan",
"Prims.l_and",
"Prims.eq2",
"FStar.Seq.Base.seq",
"Lib.Sequence.to_seq",
"FStar.Seq.Base.upd",
"Lib.Sequence.index",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.op_disEquality",
"Prims.l_or",
"FStar.Seq.Base.index"
] | [] | false | false | false | false | false | let ( .[]<- ) #a #len =
| upd #a #len | false |
|
Lib.Sequence.fsti | Lib.Sequence.createL | val createL : l: Prims.list a {FStar.List.Tot.Base.length l <= Lib.IntTypes.max_size_t}
-> s:
Lib.Sequence.lseq a (FStar.List.Tot.Base.length l)
{Lib.Sequence.to_seq s == FStar.Seq.Base.seq_of_list l} | let createL #a l = of_list #a l | {
"file_name": "lib/Lib.Sequence.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 38,
"end_line": 98,
"start_col": 7,
"start_line": 98
} | module Lib.Sequence
open FStar.Mul
open Lib.IntTypes
#set-options "--z3rlimit 30 --max_fuel 0 --max_ifuel 0 --using_facts_from '-* +Prims +FStar.Math.Lemmas +FStar.Seq +Lib.IntTypes +Lib.Sequence'"
/// Variable length Sequences, derived from FStar.Seq
(* This is the type of unbounded sequences.
Use this only when dealing with, say, user input whose length is unbounded.
As far as possible use the API for bounded sequences defined later in this file.*)
(** Definition of a Sequence *)
let seq (a:Type0) = Seq.seq a
(** Length of a Sequence *)
let length (#a:Type0) (s:seq a) : nat = Seq.length s
/// Fixed length Sequences
(* This is the type of bounded sequences.
Use this as much as possible.
It adds additional length checks that you'd have to prove in the implementation otherwise *)
(** Definition of a fixed-length Sequence *)
let lseq (a:Type0) (len:size_nat) = s:seq a{Seq.length s == len}
let to_seq (#a:Type0) (#len:size_nat) (l:lseq a len) : seq a = l
let to_lseq (#a:Type0) (s:seq a{length s <= max_size_t}) : l:lseq a (length s){l == s} = s
(* If you want to prove your code with an abstract lseq use the following: *)
// val lseq: a:Type0 -> len:size_nat -> Type0
// val to_seq: #a:Type0 -> #len:size_nat -> lseq a len -> s:seq a{length s == len}
// val to_lseq: #a:Type0 -> s:seq a{length s <= max_size_t} -> lseq a (length s)
val index:
#a:Type
-> #len:size_nat
-> s:lseq a len
-> i:size_nat{i < len} ->
Tot (r:a{r == Seq.index (to_seq s) i})
(** Creation of a fixed-length Sequence from an initial value *)
val create:
#a:Type
-> len:size_nat
-> init:a ->
Tot (s:lseq a len{to_seq s == Seq.create len init /\ (forall (i:nat).
{:pattern (index s i)} i < len ==> index s i == init)})
(** Concatenate sequences: use with care, may make implementation hard to verify *)
val concat:
#a:Type
-> #len0:size_nat
-> #len1:size_nat{len0 + len1 <= max_size_t}
-> s0:lseq a len0
-> s1:lseq a len1 ->
Tot (s2:lseq a (len0 + len1){to_seq s2 == Seq.append (to_seq s0) (to_seq s1)})
let ( @| ) #a #len0 #len1 s0 s1 = concat #a #len0 #len1 s0 s1
(** Conversion of a Sequence to a list *)
val to_list:
#a:Type
-> s:seq a ->
Tot (l:list a{List.Tot.length l = length s /\ l == Seq.seq_to_list s})
(** Creation of a fixed-length Sequence from a list of values *)
val of_list:
#a:Type
-> l:list a{List.Tot.length l <= max_size_t} ->
Tot (s:lseq a (List.Tot.length l){to_seq s == Seq.seq_of_list l})
val of_list_index:
#a:Type
-> l:list a{List.Tot.length l <= max_size_t}
-> i:nat{i < List.Tot.length l} ->
Lemma (index (of_list l) i == List.Tot.index l i)
[SMTPat (index (of_list l) i)]
val equal (#a:Type) (#len:size_nat) (s1:lseq a len) (s2:lseq a len) : Type0
val eq_intro: #a:Type -> #len:size_nat -> s1:lseq a len -> s2:lseq a len ->
Lemma
(requires forall i. {:pattern index s1 i; index s2 i} index s1 i == index s2 i)
(ensures equal s1 s2)
[SMTPat (equal s1 s2)]
val eq_elim: #a:Type -> #len:size_nat -> s1:lseq a len -> s2:lseq a len ->
Lemma
(requires equal s1 s2)
(ensures s1 == s2)
[SMTPat (equal s1 s2)] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Lib.Sequence.fsti"
} | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | l: Prims.list a {FStar.List.Tot.Base.length l <= Lib.IntTypes.max_size_t}
-> s:
Lib.Sequence.lseq a (FStar.List.Tot.Base.length l)
{Lib.Sequence.to_seq s == FStar.Seq.Base.seq_of_list l} | Prims.Tot | [
"total"
] | [] | [
"Prims.list",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.List.Tot.Base.length",
"Lib.IntTypes.max_size_t",
"Lib.Sequence.of_list",
"Lib.Sequence.lseq",
"Prims.eq2",
"FStar.Seq.Base.seq",
"Lib.Sequence.to_seq",
"FStar.Seq.Base.seq_of_list"
] | [] | false | false | false | false | false | let createL #a l =
| of_list #a l | false |
|
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test8_plaintext_shake128 | val test8_plaintext_shake128:b: lbuffer uint8 83ul {recallable b} | val test8_plaintext_shake128:b: lbuffer uint8 83ul {recallable b} | let test8_plaintext_shake128: b:lbuffer uint8 83ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x24; 0x69; 0xf1; 0x01; 0xc9; 0xb4; 0x99; 0xa9; 0x30; 0xa9; 0x7e; 0xf1; 0xb3; 0x46; 0x73; 0xec;
0x74; 0x39; 0x3f; 0xd9; 0xfa; 0xf6; 0x58; 0xe3; 0x1f; 0x06; 0xee; 0x0b; 0x29; 0xa2; 0x2b; 0x62;
0x37; 0x80; 0xba; 0x7b; 0xdf; 0xed; 0x86; 0x20; 0x15; 0x1c; 0xc4; 0x44; 0x4e; 0xbe; 0x33; 0x39;
0xe6; 0xd2; 0xa2; 0x23; 0xbf; 0xbf; 0xb4; 0xad; 0x2c; 0xa0; 0xe0; 0xfa; 0x0d; 0xdf; 0xbb; 0xdf;
0x3b; 0x05; 0x7a; 0x4f; 0x26; 0xd0; 0xb2; 0x16; 0xbc; 0x87; 0x63; 0xca; 0x8d; 0x8a; 0x35; 0xff;
0x2d; 0x2d; 0x01])
in
assert_norm (List.Tot.length l == 83);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 387,
"start_col": 0,
"start_line": 375
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3
//
let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l
let test3_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79; 0xba;
0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test3_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x41; 0xc0; 0xdb; 0xa2; 0xa9; 0xd6; 0x24; 0x08; 0x49; 0x10; 0x03; 0x76; 0xa8; 0x23; 0x5e; 0x2c;
0x82; 0xe1; 0xb9; 0x99; 0x8a; 0x99; 0x9e; 0x21; 0xdb; 0x32; 0xdd; 0x97; 0x49; 0x6d; 0x33; 0x76])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test3_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x99; 0x1c; 0x66; 0x57; 0x55; 0xeb; 0x3a; 0x4b; 0x6b; 0xbd; 0xfb; 0x75; 0xc7; 0x8a; 0x49; 0x2e;
0x8c; 0x56; 0xa2; 0x2c; 0x5c; 0x4d; 0x7e; 0x42; 0x9b; 0xfd; 0xbc; 0x32; 0xb9; 0xd4; 0xad; 0x5a;
0xa0; 0x4a; 0x1f; 0x07; 0x6e; 0x62; 0xfe; 0xa1; 0x9e; 0xef; 0x51; 0xac; 0xd0; 0x65; 0x7c; 0x22])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test3_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x04; 0xa3; 0x71; 0xe8; 0x4e; 0xcf; 0xb5; 0xb8; 0xb7; 0x7c; 0xb4; 0x86; 0x10; 0xfc; 0xa8; 0x18;
0x2d; 0xd4; 0x57; 0xce; 0x6f; 0x32; 0x6a; 0x0f; 0xd3; 0xd7; 0xec; 0x2f; 0x1e; 0x91; 0x63; 0x6d;
0xee; 0x69; 0x1f; 0xbe; 0x0c; 0x98; 0x53; 0x02; 0xba; 0x1b; 0x0d; 0x8d; 0xc7; 0x8c; 0x08; 0x63;
0x46; 0xb5; 0x33; 0xb4; 0x9c; 0x03; 0x0d; 0x99; 0xa2; 0x7d; 0xaf; 0x11; 0x39; 0xd6; 0xe7; 0x5e])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test4_SHA3
//
let test4_plaintext: b:lbuffer uint8 112ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69;
0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b;
0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d;
0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f;
0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71;
0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73;
0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x75])
in
assert_norm (List.Tot.length l == 112);
createL_mglobal l
let test4_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x54; 0x3e; 0x68; 0x68; 0xe1; 0x66; 0x6c; 0x1a; 0x64; 0x36; 0x30; 0xdf; 0x77; 0x36; 0x7a; 0xe5;
0xa6; 0x2a; 0x85; 0x07; 0x0a; 0x51; 0xc1; 0x4c; 0xbf; 0x66; 0x5c; 0xbc])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test4_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x91; 0x6f; 0x60; 0x61; 0xfe; 0x87; 0x97; 0x41; 0xca; 0x64; 0x69; 0xb4; 0x39; 0x71; 0xdf; 0xdb;
0x28; 0xb1; 0xa3; 0x2d; 0xc3; 0x6c; 0xb3; 0x25; 0x4e; 0x81; 0x2b; 0xe2; 0x7a; 0xad; 0x1d; 0x18])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test4_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x79; 0x40; 0x7d; 0x3b; 0x59; 0x16; 0xb5; 0x9c; 0x3e; 0x30; 0xb0; 0x98; 0x22; 0x97; 0x47; 0x91;
0xc3; 0x13; 0xfb; 0x9e; 0xcc; 0x84; 0x9e; 0x40; 0x6f; 0x23; 0x59; 0x2d; 0x04; 0xf6; 0x25; 0xdc;
0x8c; 0x70; 0x9b; 0x98; 0xb4; 0x3b; 0x38; 0x52; 0xb3; 0x37; 0x21; 0x61; 0x79; 0xaa; 0x7f; 0xc7])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test4_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xaf; 0xeb; 0xb2; 0xef; 0x54; 0x2e; 0x65; 0x79; 0xc5; 0x0c; 0xad; 0x06; 0xd2; 0xe5; 0x78; 0xf9;
0xf8; 0xdd; 0x68; 0x81; 0xd7; 0xdc; 0x82; 0x4d; 0x26; 0x36; 0x0f; 0xee; 0xbf; 0x18; 0xa4; 0xfa;
0x73; 0xe3; 0x26; 0x11; 0x22; 0x94; 0x8e; 0xfc; 0xfd; 0x49; 0x2e; 0x74; 0xe8; 0x2e; 0x21; 0x89;
0xed; 0x0f; 0xb4; 0x40; 0xd1; 0x87; 0xf3; 0x82; 0x27; 0x0c; 0xb4; 0x55; 0xf2; 0x1d; 0xd1; 0x85])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test5_SHAKE128
//
let test5_plaintext_shake128: b:lbuffer uint8 0ul{ recallable b } =
[@ inline_let]
let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test5_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7f; 0x9c; 0x2b; 0xa4; 0xe8; 0x8f; 0x82; 0x7d; 0x61; 0x60; 0x45; 0x50; 0x76; 0x05; 0x85; 0x3e])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test6_SHAKE128
//
let test6_plaintext_shake128: b:lbuffer uint8 14ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x52; 0x97; 0x7e; 0x53; 0x2b; 0xcc; 0xdb; 0x89; 0xdf; 0xef; 0xf7; 0xe9; 0xe4; 0xad]) in
assert_norm (List.Tot.length l == 14);
createL_mglobal l
let test6_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xfb; 0xfb; 0xa5; 0xc1; 0xe1; 0x79; 0xdf; 0x14; 0x69; 0xfc; 0xc8; 0x58; 0x8a; 0xe5; 0xd2; 0xcc])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test7_SHAKE128
//
let test7_plaintext_shake128: b:lbuffer uint8 34ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x4a; 0x20; 0x6a; 0x5b; 0x8a; 0xa3; 0x58; 0x6c; 0x06; 0x67; 0xa4; 0x00; 0x20; 0xd6; 0x5f; 0xf5;
0x11; 0xd5; 0x2b; 0x73; 0x2e; 0xf7; 0xa0; 0xc5; 0x69; 0xf1; 0xee; 0x68; 0x1a; 0x4f; 0xc3; 0x62;
0x00; 0x65])
in
assert_norm (List.Tot.length l == 34);
createL_mglobal l
let test7_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7b; 0xb4; 0x33; 0x75; 0x2b; 0x98; 0xf9; 0x15; 0xbe; 0x51; 0x82; 0xbc; 0x1f; 0x09; 0x66; 0x48])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test8_SHAKE128 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(83ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test8_plaintext_shake128:b: lbuffer uint8 83ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0x24; 0x69; 0xf1; 0x01; 0xc9; 0xb4; 0x99; 0xa9; 0x30; 0xa9; 0x7e; 0xf1; 0xb3; 0x46; 0x73;
0xec; 0x74; 0x39; 0x3f; 0xd9; 0xfa; 0xf6; 0x58; 0xe3; 0x1f; 0x06; 0xee; 0x0b; 0x29; 0xa2;
0x2b; 0x62; 0x37; 0x80; 0xba; 0x7b; 0xdf; 0xed; 0x86; 0x20; 0x15; 0x1c; 0xc4; 0x44; 0x4e;
0xbe; 0x33; 0x39; 0xe6; 0xd2; 0xa2; 0x23; 0xbf; 0xbf; 0xb4; 0xad; 0x2c; 0xa0; 0xe0; 0xfa;
0x0d; 0xdf; 0xbb; 0xdf; 0x3b; 0x05; 0x7a; 0x4f; 0x26; 0xd0; 0xb2; 0x16; 0xbc; 0x87; 0x63;
0xca; 0x8d; 0x8a; 0x35; 0xff; 0x2d; 0x2d; 0x01
])
in
assert_norm (List.Tot.length l == 83);
createL_mglobal l | false |
Lib.Sequence.fsti | Lib.Sequence.map_blocks_a | val map_blocks_a : a: Type0 -> bs: Lib.IntTypes.size_nat -> max: Prims.nat -> i: Prims.nat{i <= max} -> Type0 | let map_blocks_a (a:Type) (bs:size_nat) (max:nat) (i:nat{i <= max}) = s:seq a{length s == i * bs} | {
"file_name": "lib/Lib.Sequence.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 97,
"end_line": 378,
"start_col": 0,
"start_line": 378
} | module Lib.Sequence
open FStar.Mul
open Lib.IntTypes
#set-options "--z3rlimit 30 --max_fuel 0 --max_ifuel 0 --using_facts_from '-* +Prims +FStar.Math.Lemmas +FStar.Seq +Lib.IntTypes +Lib.Sequence'"
/// Variable length Sequences, derived from FStar.Seq
(* This is the type of unbounded sequences.
Use this only when dealing with, say, user input whose length is unbounded.
As far as possible use the API for bounded sequences defined later in this file.*)
(** Definition of a Sequence *)
let seq (a:Type0) = Seq.seq a
(** Length of a Sequence *)
let length (#a:Type0) (s:seq a) : nat = Seq.length s
/// Fixed length Sequences
(* This is the type of bounded sequences.
Use this as much as possible.
It adds additional length checks that you'd have to prove in the implementation otherwise *)
(** Definition of a fixed-length Sequence *)
let lseq (a:Type0) (len:size_nat) = s:seq a{Seq.length s == len}
let to_seq (#a:Type0) (#len:size_nat) (l:lseq a len) : seq a = l
let to_lseq (#a:Type0) (s:seq a{length s <= max_size_t}) : l:lseq a (length s){l == s} = s
(* If you want to prove your code with an abstract lseq use the following: *)
// val lseq: a:Type0 -> len:size_nat -> Type0
// val to_seq: #a:Type0 -> #len:size_nat -> lseq a len -> s:seq a{length s == len}
// val to_lseq: #a:Type0 -> s:seq a{length s <= max_size_t} -> lseq a (length s)
val index:
#a:Type
-> #len:size_nat
-> s:lseq a len
-> i:size_nat{i < len} ->
Tot (r:a{r == Seq.index (to_seq s) i})
(** Creation of a fixed-length Sequence from an initial value *)
val create:
#a:Type
-> len:size_nat
-> init:a ->
Tot (s:lseq a len{to_seq s == Seq.create len init /\ (forall (i:nat).
{:pattern (index s i)} i < len ==> index s i == init)})
(** Concatenate sequences: use with care, may make implementation hard to verify *)
val concat:
#a:Type
-> #len0:size_nat
-> #len1:size_nat{len0 + len1 <= max_size_t}
-> s0:lseq a len0
-> s1:lseq a len1 ->
Tot (s2:lseq a (len0 + len1){to_seq s2 == Seq.append (to_seq s0) (to_seq s1)})
let ( @| ) #a #len0 #len1 s0 s1 = concat #a #len0 #len1 s0 s1
(** Conversion of a Sequence to a list *)
val to_list:
#a:Type
-> s:seq a ->
Tot (l:list a{List.Tot.length l = length s /\ l == Seq.seq_to_list s})
(** Creation of a fixed-length Sequence from a list of values *)
val of_list:
#a:Type
-> l:list a{List.Tot.length l <= max_size_t} ->
Tot (s:lseq a (List.Tot.length l){to_seq s == Seq.seq_of_list l})
val of_list_index:
#a:Type
-> l:list a{List.Tot.length l <= max_size_t}
-> i:nat{i < List.Tot.length l} ->
Lemma (index (of_list l) i == List.Tot.index l i)
[SMTPat (index (of_list l) i)]
val equal (#a:Type) (#len:size_nat) (s1:lseq a len) (s2:lseq a len) : Type0
val eq_intro: #a:Type -> #len:size_nat -> s1:lseq a len -> s2:lseq a len ->
Lemma
(requires forall i. {:pattern index s1 i; index s2 i} index s1 i == index s2 i)
(ensures equal s1 s2)
[SMTPat (equal s1 s2)]
val eq_elim: #a:Type -> #len:size_nat -> s1:lseq a len -> s2:lseq a len ->
Lemma
(requires equal s1 s2)
(ensures s1 == s2)
[SMTPat (equal s1 s2)]
(* Alias for creation from a list *)
unfold let createL #a l = of_list #a l
(** Updating an element of a fixed-length Sequence *)
val upd:
#a:Type
-> #len:size_nat
-> s:lseq a len
-> n:size_nat{n < len}
-> x:a ->
Tot (o:lseq a len{to_seq o == Seq.upd (to_seq s) n x /\ index o n == x /\ (forall (i:size_nat).
{:pattern (index s i)} (i < len /\ i <> n) ==> index o i == index s i)})
(** Membership of an element to a fixed-length Sequence *)
val member: #a:eqtype -> #len: size_nat -> a -> lseq a len -> Tot bool
(** Operator for accessing an element of a fixed-length Sequence *)
unfold
let op_String_Access #a #len = index #a #len
(** Operator for updating an element of a fixed-length Sequence *)
unfold
let op_String_Assignment #a #len = upd #a #len
(** Selecting a subset of a fixed-length Sequence *)
val sub:
#a:Type
-> #len:size_nat
-> s1:lseq a len
-> start:size_nat
-> n:size_nat{start + n <= len} ->
Tot (s2:lseq a n{to_seq s2 == Seq.slice (to_seq s1) start (start + n) /\
(forall (k:nat{k < n}). {:pattern (index s2 k)} index s2 k == index s1 (start + k))})
(** Selecting a subset of a fixed-length Sequence *)
let slice
(#a:Type)
(#len:size_nat)
(s1:lseq a len)
(start:size_nat)
(fin:size_nat{start <= fin /\ fin <= len})
=
sub #a s1 start (fin - start)
(** Updating a sub-Sequence from another fixed-length Sequence *)
val update_sub:
#a:Type
-> #len:size_nat
-> i:lseq a len
-> start:size_nat
-> n:size_nat{start + n <= len}
-> x:lseq a n ->
Tot (o:lseq a len{sub o start n == x /\
(forall (k:nat{(0 <= k /\ k < start) \/ (start + n <= k /\ k < len)}).
{:pattern (index o k)} index o k == index i k)})
(** Lemma regarding updating a sub-Sequence with another Sequence *)
val lemma_update_sub:
#a:Type
-> #len:size_nat
-> dst:lseq a len
-> start:size_nat
-> n:size_nat{start + n <= len}
-> src:lseq a n
-> res:lseq a len ->
Lemma
(requires
sub res 0 start == sub dst 0 start /\
sub res start n == src /\
sub res (start + n) (len - start - n) ==
sub dst (start + n) (len - start - n))
(ensures
res == update_sub dst start n src)
val lemma_concat2:
#a:Type0
-> len0:size_nat
-> s0:lseq a len0
-> len1:size_nat{len0 + len1 <= max_size_t}
-> s1:lseq a len1
-> s:lseq a (len0 + len1) ->
Lemma
(requires
sub s 0 len0 == s0 /\
sub s len0 len1 == s1)
(ensures s == concat s0 s1)
val lemma_concat3:
#a:Type0
-> len0:size_nat
-> s0:lseq a len0
-> len1:size_nat{len0 + len1 <= max_size_t}
-> s1:lseq a len1
-> len2:size_nat{len0 + len1 + len2 <= max_size_t}
-> s2:lseq a len2
-> s:lseq a (len0 + len1 + len2) ->
Lemma
(requires
sub s 0 len0 == s0 /\
sub s len0 len1 == s1 /\
sub s (len0 + len1) len2 == s2)
(ensures s == concat (concat s0 s1) s2)
(** Updating a sub-Sequence from another fixed-length Sequence *)
let update_slice
(#a:Type)
(#len:size_nat)
(i:lseq a len)
(start:size_nat)
(fin:size_nat{start <= fin /\ fin <= len})
(upd:lseq a (fin - start))
=
update_sub #a i start (fin - start) upd
(** Creation of a fixed-length Sequence from an initialization function *)
val createi: #a:Type
-> len:size_nat
-> init:(i:nat{i < len} -> a) ->
Tot (s:lseq a len{(forall (i:nat).
{:pattern (index s i)} i < len ==> index s i == init i)})
(** Mapi function for fixed-length Sequences *)
val mapi:#a:Type -> #b:Type -> #len:size_nat
-> f:(i:nat{i < len} -> a -> Tot b)
-> s1:lseq a len ->
Tot (s2:lseq b len{(forall (i:nat).
{:pattern (index s2 i)} i < len ==> index s2 i == f i s1.[i])})
(** Map function for fixed-length Sequences *)
val map:#a:Type -> #b:Type -> #len:size_nat
-> f:(a -> Tot b)
-> s1:lseq a len ->
Tot (s2:lseq b len{(forall (i:nat).
{:pattern (index s2 i)} i < len ==> index s2 i == f s1.[i])})
(** Map2i function for fixed-length Sequences *)
val map2i:#a:Type -> #b:Type -> #c:Type -> #len:size_nat
-> f:(i:nat{i < len} -> a -> b -> Tot c)
-> s1:lseq a len
-> s2:lseq b len ->
Tot (s3:lseq c len{(forall (i:nat).
{:pattern (index s3 i)} i < len ==> index s3 i == f i s1.[i] s2.[i])})
(** Map2 function for fixed-length Sequences *)
val map2:#a:Type -> #b:Type -> #c:Type -> #len:size_nat
-> f:(a -> b -> Tot c)
-> s1:lseq a len
-> s2:lseq b len ->
Tot (s3:lseq c len{(forall (i:nat).
{:pattern (index s3 i)} i < len ==> index s3 i == f s1.[i] s2.[i])})
(** Forall function for fixed-length Sequences *)
val for_all:#a:Type -> #len:size_nat -> (a -> Tot bool) -> lseq a len -> bool
(** Forall2 function for fixed-length Sequences *)
val for_all2:#a:Type -> #b:Type -> #len:size_nat
-> (a -> b -> Tot bool)
-> s1:lseq a len
-> s2:lseq b len ->
Tot bool
val repeati_blocks:
#a:Type0
-> #b:Type0
-> blocksize:size_pos
-> inp:seq a
-> f:(i:nat{i < length inp / blocksize} -> lseq a blocksize -> b -> b)
-> l:(i:nat{i == length inp / blocksize} -> len:size_nat{len == length inp % blocksize} -> s:lseq a len -> b -> b)
-> init:b ->
Tot b
let repeat_blocks_f
(#a:Type0)
(#b:Type0)
(bs:size_nat{bs > 0})
(inp:seq a)
(f:(lseq a bs -> b -> b))
(nb:nat{nb == length inp / bs})
(i:nat{i < nb})
(acc:b) : b
=
assert ((i+1) * bs <= nb * bs);
let block = Seq.slice inp (i * bs) (i * bs + bs) in
f block acc
val repeat_blocks:
#a:Type0
-> #b:Type0
-> #c:Type0
-> blocksize:size_pos
-> inp:seq a
-> f:(lseq a blocksize -> b -> b)
-> l:(len:nat{len < blocksize} -> s:lseq a len -> b -> c)
-> init:b ->
Tot c
val lemma_repeat_blocks:
#a:Type0
-> #b:Type0
-> #c:Type0
-> bs:size_pos
-> inp:seq a
-> f:(lseq a bs -> b -> b)
-> l:(len:nat{len < bs} -> s:lseq a len -> b -> c)
-> init:b ->
Lemma (
let len = length inp in
let nb = len / bs in
let rem = len % bs in
let acc = Lib.LoopCombinators.repeati nb (repeat_blocks_f bs inp f nb) init in
let last = Seq.slice inp (nb * bs) len in
let acc = l rem last acc in
repeat_blocks #a #b bs inp f l init == acc)
val repeat_blocks_multi:
#a:Type0
-> #b:Type0
-> blocksize:size_pos
-> inp:seq a{length inp % blocksize = 0}
-> f:(lseq a blocksize -> b -> b)
-> init:b ->
Tot b
val lemma_repeat_blocks_multi:
#a:Type0
-> #b:Type0
-> bs:size_pos
-> inp:seq a{length inp % bs = 0}
-> f:(lseq a bs -> b -> b)
-> init:b ->
Lemma (
let len = length inp in
let nb = len / bs in
repeat_blocks_multi #a #b bs inp f init ==
Lib.LoopCombinators.repeati nb (repeat_blocks_f bs inp f nb) init)
(** Generates `n` blocks of length `len` by iteratively applying a function with an accumulator *)
val generate_blocks:
#t:Type0
-> len:size_nat
-> max:nat
-> n:nat{n <= max}
-> a:(i:nat{i <= max} -> Type)
-> f:(i:nat{i < max} -> a i -> a (i + 1) & s:seq t{length s == len})
-> init:a 0 ->
Tot (a n & s:seq t{length s == n * len})
(** Generates `n` blocks of length `len` by iteratively applying a function without an accumulator *)
val generate_blocks_simple:
#a:Type0
-> blocksize:size_pos
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> lseq a blocksize) ->
Tot (s:seq a{length s == n * blocksize})
(** The following functions allow us to bridge between unbounded and bounded sequences *)
val div_interval: b:pos -> n:int -> i:int -> Lemma
(requires n * b <= i /\ i < (n + 1) * b)
(ensures i / b = n)
val mod_interval_lt: b:pos -> n:int -> i:int -> j:int -> Lemma
(requires n * b <= i /\ i < j /\ j < (n + 1) * b)
(ensures i % b < j % b)
val div_mul_lt: b:pos -> a:int -> n:int -> Lemma
(requires a < n * b)
(ensures a / b < n)
val mod_div_lt: b:pos -> i:int -> j:int -> Lemma
(requires (j / b) * b <= i /\ i < j)
(ensures i % b < j % b)
val div_mul_l: a:int -> b:int -> c:pos -> d:pos -> Lemma
(requires a / d = b / d)
(ensures a / (c * d) = b / (c * d)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Lib.Sequence.fsti"
} | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type0 -> bs: Lib.IntTypes.size_nat -> max: Prims.nat -> i: Prims.nat{i <= max} -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Lib.IntTypes.size_nat",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Lib.Sequence.seq",
"Prims.eq2",
"Prims.int",
"Lib.Sequence.length",
"FStar.Mul.op_Star"
] | [] | false | false | false | false | true | let map_blocks_a (a: Type) (bs: size_nat) (max: nat) (i: nat{i <= max}) =
| s: seq a {length s == i * bs} | false |
|
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.test12_plaintext_shake256 | val test12_plaintext_shake256:b: lbuffer uint8 78ul {recallable b} | val test12_plaintext_shake256:b: lbuffer uint8 78ul {recallable b} | let test12_plaintext_shake256: b:lbuffer uint8 78ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xde; 0x70; 0x1f; 0x10; 0xad; 0x39; 0x61; 0xb0; 0xda; 0xcc; 0x96; 0x87; 0x3a; 0x3c; 0xd5; 0x58;
0x55; 0x81; 0x88; 0xff; 0x69; 0x6d; 0x85; 0x01; 0xb2; 0xe2; 0x7b; 0x67; 0xe9; 0x41; 0x90; 0xcd;
0x0b; 0x25; 0x48; 0xb6; 0x5b; 0x52; 0xa9; 0x22; 0xaa; 0xe8; 0x9d; 0x63; 0xd6; 0xdd; 0x97; 0x2c;
0x91; 0xa9; 0x79; 0xeb; 0x63; 0x43; 0xb6; 0x58; 0xf2; 0x4d; 0xb3; 0x4e; 0x82; 0x8b; 0x74; 0xdb;
0xb8; 0x9a; 0x74; 0x93; 0xa3; 0xdf; 0xd4; 0x29; 0xfd; 0xbd; 0xb8; 0x40; 0xad; 0x0b])
in
assert_norm (List.Tot.length l == 78);
createL_mglobal l | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 477,
"start_col": 0,
"start_line": 466
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3
//
let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l
let test3_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79; 0xba;
0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test3_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x41; 0xc0; 0xdb; 0xa2; 0xa9; 0xd6; 0x24; 0x08; 0x49; 0x10; 0x03; 0x76; 0xa8; 0x23; 0x5e; 0x2c;
0x82; 0xe1; 0xb9; 0x99; 0x8a; 0x99; 0x9e; 0x21; 0xdb; 0x32; 0xdd; 0x97; 0x49; 0x6d; 0x33; 0x76])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test3_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x99; 0x1c; 0x66; 0x57; 0x55; 0xeb; 0x3a; 0x4b; 0x6b; 0xbd; 0xfb; 0x75; 0xc7; 0x8a; 0x49; 0x2e;
0x8c; 0x56; 0xa2; 0x2c; 0x5c; 0x4d; 0x7e; 0x42; 0x9b; 0xfd; 0xbc; 0x32; 0xb9; 0xd4; 0xad; 0x5a;
0xa0; 0x4a; 0x1f; 0x07; 0x6e; 0x62; 0xfe; 0xa1; 0x9e; 0xef; 0x51; 0xac; 0xd0; 0x65; 0x7c; 0x22])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test3_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x04; 0xa3; 0x71; 0xe8; 0x4e; 0xcf; 0xb5; 0xb8; 0xb7; 0x7c; 0xb4; 0x86; 0x10; 0xfc; 0xa8; 0x18;
0x2d; 0xd4; 0x57; 0xce; 0x6f; 0x32; 0x6a; 0x0f; 0xd3; 0xd7; 0xec; 0x2f; 0x1e; 0x91; 0x63; 0x6d;
0xee; 0x69; 0x1f; 0xbe; 0x0c; 0x98; 0x53; 0x02; 0xba; 0x1b; 0x0d; 0x8d; 0xc7; 0x8c; 0x08; 0x63;
0x46; 0xb5; 0x33; 0xb4; 0x9c; 0x03; 0x0d; 0x99; 0xa2; 0x7d; 0xaf; 0x11; 0x39; 0xd6; 0xe7; 0x5e])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test4_SHA3
//
let test4_plaintext: b:lbuffer uint8 112ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69;
0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b;
0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d;
0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f;
0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71;
0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73;
0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x75])
in
assert_norm (List.Tot.length l == 112);
createL_mglobal l
let test4_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x54; 0x3e; 0x68; 0x68; 0xe1; 0x66; 0x6c; 0x1a; 0x64; 0x36; 0x30; 0xdf; 0x77; 0x36; 0x7a; 0xe5;
0xa6; 0x2a; 0x85; 0x07; 0x0a; 0x51; 0xc1; 0x4c; 0xbf; 0x66; 0x5c; 0xbc])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test4_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x91; 0x6f; 0x60; 0x61; 0xfe; 0x87; 0x97; 0x41; 0xca; 0x64; 0x69; 0xb4; 0x39; 0x71; 0xdf; 0xdb;
0x28; 0xb1; 0xa3; 0x2d; 0xc3; 0x6c; 0xb3; 0x25; 0x4e; 0x81; 0x2b; 0xe2; 0x7a; 0xad; 0x1d; 0x18])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test4_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x79; 0x40; 0x7d; 0x3b; 0x59; 0x16; 0xb5; 0x9c; 0x3e; 0x30; 0xb0; 0x98; 0x22; 0x97; 0x47; 0x91;
0xc3; 0x13; 0xfb; 0x9e; 0xcc; 0x84; 0x9e; 0x40; 0x6f; 0x23; 0x59; 0x2d; 0x04; 0xf6; 0x25; 0xdc;
0x8c; 0x70; 0x9b; 0x98; 0xb4; 0x3b; 0x38; 0x52; 0xb3; 0x37; 0x21; 0x61; 0x79; 0xaa; 0x7f; 0xc7])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test4_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xaf; 0xeb; 0xb2; 0xef; 0x54; 0x2e; 0x65; 0x79; 0xc5; 0x0c; 0xad; 0x06; 0xd2; 0xe5; 0x78; 0xf9;
0xf8; 0xdd; 0x68; 0x81; 0xd7; 0xdc; 0x82; 0x4d; 0x26; 0x36; 0x0f; 0xee; 0xbf; 0x18; 0xa4; 0xfa;
0x73; 0xe3; 0x26; 0x11; 0x22; 0x94; 0x8e; 0xfc; 0xfd; 0x49; 0x2e; 0x74; 0xe8; 0x2e; 0x21; 0x89;
0xed; 0x0f; 0xb4; 0x40; 0xd1; 0x87; 0xf3; 0x82; 0x27; 0x0c; 0xb4; 0x55; 0xf2; 0x1d; 0xd1; 0x85])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test5_SHAKE128
//
let test5_plaintext_shake128: b:lbuffer uint8 0ul{ recallable b } =
[@ inline_let]
let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test5_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7f; 0x9c; 0x2b; 0xa4; 0xe8; 0x8f; 0x82; 0x7d; 0x61; 0x60; 0x45; 0x50; 0x76; 0x05; 0x85; 0x3e])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test6_SHAKE128
//
let test6_plaintext_shake128: b:lbuffer uint8 14ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x52; 0x97; 0x7e; 0x53; 0x2b; 0xcc; 0xdb; 0x89; 0xdf; 0xef; 0xf7; 0xe9; 0xe4; 0xad]) in
assert_norm (List.Tot.length l == 14);
createL_mglobal l
let test6_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xfb; 0xfb; 0xa5; 0xc1; 0xe1; 0x79; 0xdf; 0x14; 0x69; 0xfc; 0xc8; 0x58; 0x8a; 0xe5; 0xd2; 0xcc])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test7_SHAKE128
//
let test7_plaintext_shake128: b:lbuffer uint8 34ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x4a; 0x20; 0x6a; 0x5b; 0x8a; 0xa3; 0x58; 0x6c; 0x06; 0x67; 0xa4; 0x00; 0x20; 0xd6; 0x5f; 0xf5;
0x11; 0xd5; 0x2b; 0x73; 0x2e; 0xf7; 0xa0; 0xc5; 0x69; 0xf1; 0xee; 0x68; 0x1a; 0x4f; 0xc3; 0x62;
0x00; 0x65])
in
assert_norm (List.Tot.length l == 34);
createL_mglobal l
let test7_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7b; 0xb4; 0x33; 0x75; 0x2b; 0x98; 0xf9; 0x15; 0xbe; 0x51; 0x82; 0xbc; 0x1f; 0x09; 0x66; 0x48])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test8_SHAKE128
//
let test8_plaintext_shake128: b:lbuffer uint8 83ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x24; 0x69; 0xf1; 0x01; 0xc9; 0xb4; 0x99; 0xa9; 0x30; 0xa9; 0x7e; 0xf1; 0xb3; 0x46; 0x73; 0xec;
0x74; 0x39; 0x3f; 0xd9; 0xfa; 0xf6; 0x58; 0xe3; 0x1f; 0x06; 0xee; 0x0b; 0x29; 0xa2; 0x2b; 0x62;
0x37; 0x80; 0xba; 0x7b; 0xdf; 0xed; 0x86; 0x20; 0x15; 0x1c; 0xc4; 0x44; 0x4e; 0xbe; 0x33; 0x39;
0xe6; 0xd2; 0xa2; 0x23; 0xbf; 0xbf; 0xb4; 0xad; 0x2c; 0xa0; 0xe0; 0xfa; 0x0d; 0xdf; 0xbb; 0xdf;
0x3b; 0x05; 0x7a; 0x4f; 0x26; 0xd0; 0xb2; 0x16; 0xbc; 0x87; 0x63; 0xca; 0x8d; 0x8a; 0x35; 0xff;
0x2d; 0x2d; 0x01])
in
assert_norm (List.Tot.length l == 83);
createL_mglobal l
let test8_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x00; 0xff; 0x5e; 0xf0; 0xcd; 0x7f; 0x8f; 0x90; 0xad; 0x94; 0xb7; 0x97; 0xe9; 0xd4; 0xdd; 0x30])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test9_SHAKE256
//
let test9_plaintext_shake256: b:lbuffer uint8 0ul{ recallable b } =
[@ inline_let]
let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test9_expected_shake256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x46; 0xb9; 0xdd; 0x2b; 0x0b; 0xa8; 0x8d; 0x13; 0x23; 0x3b; 0x3f; 0xeb; 0x74; 0x3e; 0xeb; 0x24;
0x3f; 0xcd; 0x52; 0xea; 0x62; 0xb8; 0x1b; 0x82; 0xb5; 0x0c; 0x27; 0x64; 0x6e; 0xd5; 0x76; 0x2f])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
//
// Test10_SHAKE256
//
let test10_plaintext_shake256: b:lbuffer uint8 17ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xf9; 0xda; 0x78; 0xc8; 0x90; 0x84; 0x70; 0x40; 0x45; 0x4b; 0xa6; 0x42; 0x98; 0x82; 0xb0; 0x54;
0x09])
in
assert_norm (List.Tot.length l == 17);
createL_mglobal l
let test10_expected_shake256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa8; 0x49; 0x83; 0xc9; 0xfe; 0x75; 0xad; 0x0d; 0xe1; 0x9e; 0x2c; 0x84; 0x20; 0xa7; 0xea; 0x85;
0xb2; 0x51; 0x02; 0x19; 0x56; 0x14; 0xdf; 0xa5; 0x34; 0x7d; 0xe6; 0x0a; 0x1c; 0xe1; 0x3b; 0x60])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
//
// Test11_SHAKE256
//
let test11_plaintext_shake256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xef; 0x89; 0x6c; 0xdc; 0xb3; 0x63; 0xa6; 0x15; 0x91; 0x78; 0xa1; 0xbb; 0x1c; 0x99; 0x39; 0x46;
0xc5; 0x04; 0x02; 0x09; 0x5c; 0xda; 0xea; 0x4f; 0xd4; 0xd4; 0x19; 0xaa; 0x47; 0x32; 0x1c; 0x88])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test11_expected_shake256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7a; 0xbb; 0xa4; 0xe8; 0xb8; 0xdd; 0x76; 0x6b; 0xba; 0xbe; 0x98; 0xf8; 0xf1; 0x69; 0xcb; 0x62;
0x08; 0x67; 0x4d; 0xe1; 0x9a; 0x51; 0xd7; 0x3c; 0x92; 0xb7; 0xdc; 0x04; 0xa4; 0xb5; 0xee; 0x3d])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
//
// Test12_SHAKE256 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | b:
Lib.Buffer.lbuffer_t Lib.Buffer.MUT
(Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC)
(78ul <: FStar.UInt32.t) {Lib.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"Lib.Buffer.createL_mglobal",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.buffer",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.recallable",
"Prims.list",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.map",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Hacl.Test.SHA3.u8",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | false | false | let test12_plaintext_shake256:b: lbuffer uint8 78ul {recallable b} =
| [@@ inline_let ]let l:list uint8 =
normalize_term (List.Tot.map u8
[
0xde; 0x70; 0x1f; 0x10; 0xad; 0x39; 0x61; 0xb0; 0xda; 0xcc; 0x96; 0x87; 0x3a; 0x3c; 0xd5;
0x58; 0x55; 0x81; 0x88; 0xff; 0x69; 0x6d; 0x85; 0x01; 0xb2; 0xe2; 0x7b; 0x67; 0xe9; 0x41;
0x90; 0xcd; 0x0b; 0x25; 0x48; 0xb6; 0x5b; 0x52; 0xa9; 0x22; 0xaa; 0xe8; 0x9d; 0x63; 0xd6;
0xdd; 0x97; 0x2c; 0x91; 0xa9; 0x79; 0xeb; 0x63; 0x43; 0xb6; 0x58; 0xf2; 0x4d; 0xb3; 0x4e;
0x82; 0x8b; 0x74; 0xdb; 0xb8; 0x9a; 0x74; 0x93; 0xa3; 0xdf; 0xd4; 0x29; 0xfd; 0xbd; 0xb8;
0x40; 0xad; 0x0b
])
in
assert_norm (List.Tot.length l == 78);
createL_mglobal l | false |
Hacl.Test.SHA3.fst | Hacl.Test.SHA3.main | val main: unit -> St C.exit_code | val main: unit -> St C.exit_code | let main () =
C.String.print (C.String.of_literal "\nTEST 1. SHA3\n");
recall test1_expected_sha3_224;
recall test1_expected_sha3_256;
recall test1_expected_sha3_384;
recall test1_expected_sha3_512;
recall test1_plaintext;
test_sha3 0ul
test1_plaintext
test1_expected_sha3_224
test1_expected_sha3_256
test1_expected_sha3_384
test1_expected_sha3_512;
C.String.print (C.String.of_literal "\nTEST 2. SHA3\n");
recall test2_expected_sha3_224;
recall test2_expected_sha3_256;
recall test2_expected_sha3_384;
recall test2_expected_sha3_512;
recall test2_plaintext;
test_sha3 3ul
test2_plaintext
test2_expected_sha3_224
test2_expected_sha3_256
test2_expected_sha3_384
test2_expected_sha3_512;
C.String.print (C.String.of_literal "\nTEST 3. SHA3\n");
recall test3_expected_sha3_224;
recall test3_expected_sha3_256;
recall test3_expected_sha3_384;
recall test3_expected_sha3_512;
recall test3_plaintext;
test_sha3 56ul
test3_plaintext
test3_expected_sha3_224
test3_expected_sha3_256
test3_expected_sha3_384
test3_expected_sha3_512;
C.String.print (C.String.of_literal "\nTEST 4. SHA3\n");
recall test4_expected_sha3_224;
recall test4_expected_sha3_256;
recall test4_expected_sha3_384;
recall test4_expected_sha3_512;
recall test4_plaintext;
test_sha3 112ul
test4_plaintext
test4_expected_sha3_224
test4_expected_sha3_256
test4_expected_sha3_384
test4_expected_sha3_512;
C.String.print (C.String.of_literal "\nTEST 5. SHAKE128\n");
recall test5_plaintext_shake128;
recall test5_expected_shake128;
test_shake128
0ul test5_plaintext_shake128
16ul test5_expected_shake128;
C.String.print (C.String.of_literal "\nTEST 6. SHAKE128\n");
recall test6_plaintext_shake128;
recall test6_expected_shake128;
test_shake128
14ul test6_plaintext_shake128
16ul test6_expected_shake128;
C.String.print (C.String.of_literal "\nTEST 7. SHAKE128\n");
recall test7_plaintext_shake128;
recall test7_expected_shake128;
test_shake128
34ul test7_plaintext_shake128
16ul test7_expected_shake128;
C.String.print (C.String.of_literal "\nTEST 8. SHAKE128\n");
recall test8_plaintext_shake128;
recall test8_expected_shake128;
test_shake128
83ul test8_plaintext_shake128
16ul test8_expected_shake128;
C.String.print (C.String.of_literal "\nTEST 9. SHAKE256\n");
recall test9_plaintext_shake256;
recall test9_expected_shake256;
test_shake256
0ul test9_plaintext_shake256
32ul test9_expected_shake256;
C.String.print (C.String.of_literal "\nTEST 10. SHAKE256\n");
recall test10_plaintext_shake256;
recall test10_expected_shake256;
test_shake256
17ul test10_plaintext_shake256
32ul test10_expected_shake256;
C.String.print (C.String.of_literal "\nTEST 11. SHAKE256\n");
recall test11_plaintext_shake256;
recall test11_expected_shake256;
test_shake256
32ul test11_plaintext_shake256
32ul test11_expected_shake256;
C.String.print (C.String.of_literal "\nTEST 12. SHAKE256\n");
recall test12_plaintext_shake256;
recall test12_expected_shake256;
test_shake256
78ul test12_plaintext_shake256
32ul test12_expected_shake256;
C.EXIT_SUCCESS | {
"file_name": "code/tests/Hacl.Test.SHA3.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 16,
"end_line": 600,
"start_col": 0,
"start_line": 491
} | module Hacl.Test.SHA3
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.PrintBuffer
open Hacl.SHA3
#reset-options "--z3rlimit 100 --fuel 0 --ifuel 0"
val test_sha3:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> expected224:lbuffer uint8 28ul
-> expected256:lbuffer uint8 32ul
-> expected384:lbuffer uint8 48ul
-> expected512:lbuffer uint8 64ul
-> Stack unit
(requires fun h ->
live h msg /\ live h expected224 /\ live h expected256 /\
live h expected384 /\ live h expected512)
(ensures fun h0 r h1 -> True)
let test_sha3 msg_len msg expected224 expected256 expected384 expected512 =
push_frame();
let test224 = create 28ul (u8 0) in
let test256 = create 32ul (u8 0) in
let test384 = create 48ul (u8 0) in
let test512 = create 64ul (u8 0) in
sha3_224 test224 msg msg_len;
sha3_256 test256 msg msg_len;
sha3_384 test384 msg msg_len;
sha3_512 test512 msg msg_len;
if not (result_compare_display 28ul (to_const test224) (to_const expected224)) then C.exit 255l;
if not (result_compare_display 32ul (to_const test256) (to_const expected256)) then C.exit 255l;
if not (result_compare_display 48ul (to_const test384) (to_const expected384)) then C.exit 255l;
if not (result_compare_display 64ul (to_const test512) (to_const expected512)) then C.exit 255l;
pop_frame()
val test_shake128:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake128 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake128_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
val test_shake256:
msg_len:size_t
-> msg:lbuffer uint8 msg_len
-> out_len:size_t{v out_len > 0}
-> expected:lbuffer uint8 out_len
-> Stack unit
(requires fun h -> live h msg /\ live h expected)
(ensures fun h0 r h1 -> modifies0 h0 h1)
let test_shake256 msg_len msg out_len expected =
push_frame ();
let test = create out_len (u8 0) in
shake256_hacl msg_len msg out_len test;
if not (result_compare_display out_len (to_const test) (to_const expected)) then C.exit 255l;
pop_frame ()
inline_for_extraction noextract
val u8: n:nat{n < 0x100} -> uint8
let u8 n = u8 n
//
// Test1_SHA3
//
let test1_plaintext: b:lbuffer uint8 0ul{ recallable b } =
let open Lib.RawIntTypes in
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test1_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x6b; 0x4e; 0x03; 0x42; 0x36; 0x67; 0xdb; 0xb7; 0x3b; 0x6e; 0x15; 0x45; 0x4f; 0x0e; 0xb1; 0xab;
0xd4; 0x59; 0x7f; 0x9a; 0x1b; 0x07; 0x8e; 0x3f; 0x5b; 0x5a; 0x6b; 0xc7])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test1_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa7; 0xff; 0xc6; 0xf8; 0xbf; 0x1e; 0xd7; 0x66; 0x51; 0xc1; 0x47; 0x56; 0xa0; 0x61; 0xd6; 0x62;
0xf5; 0x80; 0xff; 0x4d; 0xe4; 0x3b; 0x49; 0xfa; 0x82; 0xd8; 0x0a; 0x4b; 0x80; 0xf8; 0x43; 0x4a])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test1_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x0c; 0x63; 0xa7; 0x5b; 0x84; 0x5e; 0x4f; 0x7d; 0x01; 0x10; 0x7d; 0x85; 0x2e; 0x4c; 0x24; 0x85;
0xc5; 0x1a; 0x50; 0xaa; 0xaa; 0x94; 0xfc; 0x61; 0x99; 0x5e; 0x71; 0xbb; 0xee; 0x98; 0x3a; 0x2a;
0xc3; 0x71; 0x38; 0x31; 0x26; 0x4a; 0xdb; 0x47; 0xfb; 0x6b; 0xd1; 0xe0; 0x58; 0xd5; 0xf0; 0x04])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test1_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa6; 0x9f; 0x73; 0xcc; 0xa2; 0x3a; 0x9a; 0xc5; 0xc8; 0xb5; 0x67; 0xdc; 0x18; 0x5a; 0x75; 0x6e;
0x97; 0xc9; 0x82; 0x16; 0x4f; 0xe2; 0x58; 0x59; 0xe0; 0xd1; 0xdc; 0xc1; 0x47; 0x5c; 0x80; 0xa6;
0x15; 0xb2; 0x12; 0x3a; 0xf1; 0xf5; 0xf9; 0x4c; 0x11; 0xe3; 0xe9; 0x40; 0x2c; 0x3a; 0xc5; 0x58;
0xf5; 0x00; 0x19; 0x9d; 0x95; 0xb6; 0xd3; 0xe3; 0x01; 0x75; 0x85; 0x86; 0x28; 0x1d; 0xcd; 0x26])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test2_SHA3
//
let test2_plaintext: b:lbuffer uint8 3ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63])
in
assert_norm (List.Tot.length l == 3);
createL_mglobal l
let test2_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xe6; 0x42; 0x82; 0x4c; 0x3f; 0x8c; 0xf2; 0x4a; 0xd0; 0x92; 0x34; 0xee; 0x7d; 0x3c; 0x76; 0x6f;
0xc9; 0xa3; 0xa5; 0x16; 0x8d; 0x0c; 0x94; 0xad; 0x73; 0xb4; 0x6f; 0xdf])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test2_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x3a; 0x98; 0x5d; 0xa7; 0x4f; 0xe2; 0x25; 0xb2; 0x04; 0x5c; 0x17; 0x2d; 0x6b; 0xd3; 0x90; 0xbd;
0x85; 0x5f; 0x08; 0x6e; 0x3e; 0x9d; 0x52; 0x5b; 0x46; 0xbf; 0xe2; 0x45; 0x11; 0x43; 0x15; 0x32])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test2_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xec; 0x01; 0x49; 0x82; 0x88; 0x51; 0x6f; 0xc9; 0x26; 0x45; 0x9f; 0x58; 0xe2; 0xc6; 0xad; 0x8d;
0xf9; 0xb4; 0x73; 0xcb; 0x0f; 0xc0; 0x8c; 0x25; 0x96; 0xda; 0x7c; 0xf0; 0xe4; 0x9b; 0xe4; 0xb2;
0x98; 0xd8; 0x8c; 0xea; 0x92; 0x7a; 0xc7; 0xf5; 0x39; 0xf1; 0xed; 0xf2; 0x28; 0x37; 0x6d; 0x25])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test2_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xb7; 0x51; 0x85; 0x0b; 0x1a; 0x57; 0x16; 0x8a; 0x56; 0x93; 0xcd; 0x92; 0x4b; 0x6b; 0x09; 0x6e;
0x08; 0xf6; 0x21; 0x82; 0x74; 0x44; 0xf7; 0x0d; 0x88; 0x4f; 0x5d; 0x02; 0x40; 0xd2; 0x71; 0x2e;
0x10; 0xe1; 0x16; 0xe9; 0x19; 0x2a; 0xf3; 0xc9; 0x1a; 0x7e; 0xc5; 0x76; 0x47; 0xe3; 0x93; 0x40;
0x57; 0x34; 0x0b; 0x4c; 0xf4; 0x08; 0xd5; 0xa5; 0x65; 0x92; 0xf8; 0x27; 0x4e; 0xec; 0x53; 0xf0])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test3_SHA3
//
let test3_plaintext: b:lbuffer uint8 56ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x62; 0x63; 0x64; 0x65; 0x63; 0x64; 0x65; 0x66; 0x64; 0x65; 0x66; 0x67;
0x65; 0x66; 0x67; 0x68; 0x66; 0x67; 0x68; 0x69; 0x67; 0x68; 0x69; 0x6a; 0x68; 0x69; 0x6a; 0x6b;
0x69; 0x6a; 0x6b; 0x6c; 0x6a; 0x6b; 0x6c; 0x6d; 0x6b; 0x6c; 0x6d; 0x6e; 0x6c; 0x6d; 0x6e; 0x6f;
0x6d; 0x6e; 0x6f; 0x70; 0x6e; 0x6f; 0x70; 0x71])
in
assert_norm (List.Tot.length l == 56);
createL_mglobal l
let test3_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x8a; 0x24; 0x10; 0x8b; 0x15; 0x4a; 0xda; 0x21; 0xc9; 0xfd; 0x55; 0x74; 0x49; 0x44; 0x79; 0xba;
0x5c; 0x7e; 0x7a; 0xb7; 0x6e; 0xf2; 0x64; 0xea; 0xd0; 0xfc; 0xce; 0x33])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test3_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x41; 0xc0; 0xdb; 0xa2; 0xa9; 0xd6; 0x24; 0x08; 0x49; 0x10; 0x03; 0x76; 0xa8; 0x23; 0x5e; 0x2c;
0x82; 0xe1; 0xb9; 0x99; 0x8a; 0x99; 0x9e; 0x21; 0xdb; 0x32; 0xdd; 0x97; 0x49; 0x6d; 0x33; 0x76])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test3_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x99; 0x1c; 0x66; 0x57; 0x55; 0xeb; 0x3a; 0x4b; 0x6b; 0xbd; 0xfb; 0x75; 0xc7; 0x8a; 0x49; 0x2e;
0x8c; 0x56; 0xa2; 0x2c; 0x5c; 0x4d; 0x7e; 0x42; 0x9b; 0xfd; 0xbc; 0x32; 0xb9; 0xd4; 0xad; 0x5a;
0xa0; 0x4a; 0x1f; 0x07; 0x6e; 0x62; 0xfe; 0xa1; 0x9e; 0xef; 0x51; 0xac; 0xd0; 0x65; 0x7c; 0x22])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test3_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x04; 0xa3; 0x71; 0xe8; 0x4e; 0xcf; 0xb5; 0xb8; 0xb7; 0x7c; 0xb4; 0x86; 0x10; 0xfc; 0xa8; 0x18;
0x2d; 0xd4; 0x57; 0xce; 0x6f; 0x32; 0x6a; 0x0f; 0xd3; 0xd7; 0xec; 0x2f; 0x1e; 0x91; 0x63; 0x6d;
0xee; 0x69; 0x1f; 0xbe; 0x0c; 0x98; 0x53; 0x02; 0xba; 0x1b; 0x0d; 0x8d; 0xc7; 0x8c; 0x08; 0x63;
0x46; 0xb5; 0x33; 0xb4; 0x9c; 0x03; 0x0d; 0x99; 0xa2; 0x7d; 0xaf; 0x11; 0x39; 0xd6; 0xe7; 0x5e])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test4_SHA3
//
let test4_plaintext: b:lbuffer uint8 112ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x61; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x62; 0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69;
0x63; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x64; 0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b;
0x65; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x66; 0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d;
0x67; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x68; 0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f;
0x69; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x6a; 0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71;
0x6b; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x6c; 0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73;
0x6d; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x6e; 0x6f; 0x70; 0x71; 0x72; 0x73; 0x74; 0x75])
in
assert_norm (List.Tot.length l == 112);
createL_mglobal l
let test4_expected_sha3_224: b:lbuffer uint8 28ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x54; 0x3e; 0x68; 0x68; 0xe1; 0x66; 0x6c; 0x1a; 0x64; 0x36; 0x30; 0xdf; 0x77; 0x36; 0x7a; 0xe5;
0xa6; 0x2a; 0x85; 0x07; 0x0a; 0x51; 0xc1; 0x4c; 0xbf; 0x66; 0x5c; 0xbc])
in
assert_norm (List.Tot.length l == 28);
createL_mglobal l
let test4_expected_sha3_256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x91; 0x6f; 0x60; 0x61; 0xfe; 0x87; 0x97; 0x41; 0xca; 0x64; 0x69; 0xb4; 0x39; 0x71; 0xdf; 0xdb;
0x28; 0xb1; 0xa3; 0x2d; 0xc3; 0x6c; 0xb3; 0x25; 0x4e; 0x81; 0x2b; 0xe2; 0x7a; 0xad; 0x1d; 0x18])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test4_expected_sha3_384: b:lbuffer uint8 48ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x79; 0x40; 0x7d; 0x3b; 0x59; 0x16; 0xb5; 0x9c; 0x3e; 0x30; 0xb0; 0x98; 0x22; 0x97; 0x47; 0x91;
0xc3; 0x13; 0xfb; 0x9e; 0xcc; 0x84; 0x9e; 0x40; 0x6f; 0x23; 0x59; 0x2d; 0x04; 0xf6; 0x25; 0xdc;
0x8c; 0x70; 0x9b; 0x98; 0xb4; 0x3b; 0x38; 0x52; 0xb3; 0x37; 0x21; 0x61; 0x79; 0xaa; 0x7f; 0xc7])
in
assert_norm (List.Tot.length l == 48);
createL_mglobal l
let test4_expected_sha3_512: b:lbuffer uint8 64ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xaf; 0xeb; 0xb2; 0xef; 0x54; 0x2e; 0x65; 0x79; 0xc5; 0x0c; 0xad; 0x06; 0xd2; 0xe5; 0x78; 0xf9;
0xf8; 0xdd; 0x68; 0x81; 0xd7; 0xdc; 0x82; 0x4d; 0x26; 0x36; 0x0f; 0xee; 0xbf; 0x18; 0xa4; 0xfa;
0x73; 0xe3; 0x26; 0x11; 0x22; 0x94; 0x8e; 0xfc; 0xfd; 0x49; 0x2e; 0x74; 0xe8; 0x2e; 0x21; 0x89;
0xed; 0x0f; 0xb4; 0x40; 0xd1; 0x87; 0xf3; 0x82; 0x27; 0x0c; 0xb4; 0x55; 0xf2; 0x1d; 0xd1; 0x85])
in
assert_norm (List.Tot.length l == 64);
createL_mglobal l
//
// Test5_SHAKE128
//
let test5_plaintext_shake128: b:lbuffer uint8 0ul{ recallable b } =
[@ inline_let]
let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test5_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7f; 0x9c; 0x2b; 0xa4; 0xe8; 0x8f; 0x82; 0x7d; 0x61; 0x60; 0x45; 0x50; 0x76; 0x05; 0x85; 0x3e])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test6_SHAKE128
//
let test6_plaintext_shake128: b:lbuffer uint8 14ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x52; 0x97; 0x7e; 0x53; 0x2b; 0xcc; 0xdb; 0x89; 0xdf; 0xef; 0xf7; 0xe9; 0xe4; 0xad]) in
assert_norm (List.Tot.length l == 14);
createL_mglobal l
let test6_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xfb; 0xfb; 0xa5; 0xc1; 0xe1; 0x79; 0xdf; 0x14; 0x69; 0xfc; 0xc8; 0x58; 0x8a; 0xe5; 0xd2; 0xcc])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test7_SHAKE128
//
let test7_plaintext_shake128: b:lbuffer uint8 34ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x4a; 0x20; 0x6a; 0x5b; 0x8a; 0xa3; 0x58; 0x6c; 0x06; 0x67; 0xa4; 0x00; 0x20; 0xd6; 0x5f; 0xf5;
0x11; 0xd5; 0x2b; 0x73; 0x2e; 0xf7; 0xa0; 0xc5; 0x69; 0xf1; 0xee; 0x68; 0x1a; 0x4f; 0xc3; 0x62;
0x00; 0x65])
in
assert_norm (List.Tot.length l == 34);
createL_mglobal l
let test7_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7b; 0xb4; 0x33; 0x75; 0x2b; 0x98; 0xf9; 0x15; 0xbe; 0x51; 0x82; 0xbc; 0x1f; 0x09; 0x66; 0x48])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test8_SHAKE128
//
let test8_plaintext_shake128: b:lbuffer uint8 83ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x24; 0x69; 0xf1; 0x01; 0xc9; 0xb4; 0x99; 0xa9; 0x30; 0xa9; 0x7e; 0xf1; 0xb3; 0x46; 0x73; 0xec;
0x74; 0x39; 0x3f; 0xd9; 0xfa; 0xf6; 0x58; 0xe3; 0x1f; 0x06; 0xee; 0x0b; 0x29; 0xa2; 0x2b; 0x62;
0x37; 0x80; 0xba; 0x7b; 0xdf; 0xed; 0x86; 0x20; 0x15; 0x1c; 0xc4; 0x44; 0x4e; 0xbe; 0x33; 0x39;
0xe6; 0xd2; 0xa2; 0x23; 0xbf; 0xbf; 0xb4; 0xad; 0x2c; 0xa0; 0xe0; 0xfa; 0x0d; 0xdf; 0xbb; 0xdf;
0x3b; 0x05; 0x7a; 0x4f; 0x26; 0xd0; 0xb2; 0x16; 0xbc; 0x87; 0x63; 0xca; 0x8d; 0x8a; 0x35; 0xff;
0x2d; 0x2d; 0x01])
in
assert_norm (List.Tot.length l == 83);
createL_mglobal l
let test8_expected_shake128: b:lbuffer uint8 16ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x00; 0xff; 0x5e; 0xf0; 0xcd; 0x7f; 0x8f; 0x90; 0xad; 0x94; 0xb7; 0x97; 0xe9; 0xd4; 0xdd; 0x30])
in
assert_norm (List.Tot.length l == 16);
createL_mglobal l
//
// Test9_SHAKE256
//
let test9_plaintext_shake256: b:lbuffer uint8 0ul{ recallable b } =
[@ inline_let]
let l:list uint8 = normalize_term (List.Tot.map u8 []) in
assert_norm (List.Tot.length l == 0);
createL_mglobal l
let test9_expected_shake256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x46; 0xb9; 0xdd; 0x2b; 0x0b; 0xa8; 0x8d; 0x13; 0x23; 0x3b; 0x3f; 0xeb; 0x74; 0x3e; 0xeb; 0x24;
0x3f; 0xcd; 0x52; 0xea; 0x62; 0xb8; 0x1b; 0x82; 0xb5; 0x0c; 0x27; 0x64; 0x6e; 0xd5; 0x76; 0x2f])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
//
// Test10_SHAKE256
//
let test10_plaintext_shake256: b:lbuffer uint8 17ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xf9; 0xda; 0x78; 0xc8; 0x90; 0x84; 0x70; 0x40; 0x45; 0x4b; 0xa6; 0x42; 0x98; 0x82; 0xb0; 0x54;
0x09])
in
assert_norm (List.Tot.length l == 17);
createL_mglobal l
let test10_expected_shake256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xa8; 0x49; 0x83; 0xc9; 0xfe; 0x75; 0xad; 0x0d; 0xe1; 0x9e; 0x2c; 0x84; 0x20; 0xa7; 0xea; 0x85;
0xb2; 0x51; 0x02; 0x19; 0x56; 0x14; 0xdf; 0xa5; 0x34; 0x7d; 0xe6; 0x0a; 0x1c; 0xe1; 0x3b; 0x60])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
//
// Test11_SHAKE256
//
let test11_plaintext_shake256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xef; 0x89; 0x6c; 0xdc; 0xb3; 0x63; 0xa6; 0x15; 0x91; 0x78; 0xa1; 0xbb; 0x1c; 0x99; 0x39; 0x46;
0xc5; 0x04; 0x02; 0x09; 0x5c; 0xda; 0xea; 0x4f; 0xd4; 0xd4; 0x19; 0xaa; 0x47; 0x32; 0x1c; 0x88])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
let test11_expected_shake256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x7a; 0xbb; 0xa4; 0xe8; 0xb8; 0xdd; 0x76; 0x6b; 0xba; 0xbe; 0x98; 0xf8; 0xf1; 0x69; 0xcb; 0x62;
0x08; 0x67; 0x4d; 0xe1; 0x9a; 0x51; 0xd7; 0x3c; 0x92; 0xb7; 0xdc; 0x04; 0xa4; 0xb5; 0xee; 0x3d])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l
//
// Test12_SHAKE256
//
let test12_plaintext_shake256: b:lbuffer uint8 78ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0xde; 0x70; 0x1f; 0x10; 0xad; 0x39; 0x61; 0xb0; 0xda; 0xcc; 0x96; 0x87; 0x3a; 0x3c; 0xd5; 0x58;
0x55; 0x81; 0x88; 0xff; 0x69; 0x6d; 0x85; 0x01; 0xb2; 0xe2; 0x7b; 0x67; 0xe9; 0x41; 0x90; 0xcd;
0x0b; 0x25; 0x48; 0xb6; 0x5b; 0x52; 0xa9; 0x22; 0xaa; 0xe8; 0x9d; 0x63; 0xd6; 0xdd; 0x97; 0x2c;
0x91; 0xa9; 0x79; 0xeb; 0x63; 0x43; 0xb6; 0x58; 0xf2; 0x4d; 0xb3; 0x4e; 0x82; 0x8b; 0x74; 0xdb;
0xb8; 0x9a; 0x74; 0x93; 0xa3; 0xdf; 0xd4; 0x29; 0xfd; 0xbd; 0xb8; 0x40; 0xad; 0x0b])
in
assert_norm (List.Tot.length l == 78);
createL_mglobal l
let test12_expected_shake256: b:lbuffer uint8 32ul{ recallable b } =
[@ inline_let]
let l:list uint8 =
normalize_term (List.Tot.map u8
[0x64; 0x2f; 0x3f; 0x23; 0x5a; 0xc7; 0xe3; 0xd4; 0x34; 0x06; 0x3b; 0x5f; 0xc9; 0x21; 0x5f; 0xc3;
0xf0; 0xe5; 0x91; 0xe2; 0xe7; 0xfd; 0x17; 0x66; 0x8d; 0x1a; 0x0c; 0x87; 0x46; 0x87; 0x35; 0xc2])
in
assert_norm (List.Tot.length l == 32);
createL_mglobal l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintBuffer.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.SHA3.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int32.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"C.String.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Test.SHA3.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.SHA3",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.PrintBuffer",
"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": "Hacl.Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Test",
"short_module": null
},
{
"abbrev": 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 | _: Prims.unit -> FStar.HyperStack.ST.St C.exit_code | FStar.HyperStack.ST.St | [] | [] | [
"Prims.unit",
"C.EXIT_SUCCESS",
"C.exit_code",
"Hacl.Test.SHA3.test_shake256",
"FStar.UInt32.__uint_to_t",
"Hacl.Test.SHA3.test12_plaintext_shake256",
"Hacl.Test.SHA3.test12_expected_shake256",
"Lib.Buffer.recall",
"Lib.Buffer.MUT",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"FStar.UInt32.uint_to_t",
"C.String.print",
"C.String.of_literal",
"Hacl.Test.SHA3.test11_plaintext_shake256",
"Hacl.Test.SHA3.test11_expected_shake256",
"Hacl.Test.SHA3.test10_plaintext_shake256",
"Hacl.Test.SHA3.test10_expected_shake256",
"Hacl.Test.SHA3.test9_plaintext_shake256",
"Hacl.Test.SHA3.test9_expected_shake256",
"Hacl.Test.SHA3.test_shake128",
"Hacl.Test.SHA3.test8_plaintext_shake128",
"Hacl.Test.SHA3.test8_expected_shake128",
"Hacl.Test.SHA3.test7_plaintext_shake128",
"Hacl.Test.SHA3.test7_expected_shake128",
"Hacl.Test.SHA3.test6_plaintext_shake128",
"Hacl.Test.SHA3.test6_expected_shake128",
"Hacl.Test.SHA3.test5_plaintext_shake128",
"Hacl.Test.SHA3.test5_expected_shake128",
"Hacl.Test.SHA3.test_sha3",
"Hacl.Test.SHA3.test4_plaintext",
"Hacl.Test.SHA3.test4_expected_sha3_224",
"Hacl.Test.SHA3.test4_expected_sha3_256",
"Hacl.Test.SHA3.test4_expected_sha3_384",
"Hacl.Test.SHA3.test4_expected_sha3_512",
"Hacl.Test.SHA3.test3_plaintext",
"Hacl.Test.SHA3.test3_expected_sha3_224",
"Hacl.Test.SHA3.test3_expected_sha3_256",
"Hacl.Test.SHA3.test3_expected_sha3_384",
"Hacl.Test.SHA3.test3_expected_sha3_512",
"Hacl.Test.SHA3.test2_plaintext",
"Hacl.Test.SHA3.test2_expected_sha3_224",
"Hacl.Test.SHA3.test2_expected_sha3_256",
"Hacl.Test.SHA3.test2_expected_sha3_384",
"Hacl.Test.SHA3.test2_expected_sha3_512",
"Hacl.Test.SHA3.test1_plaintext",
"Hacl.Test.SHA3.test1_expected_sha3_224",
"Hacl.Test.SHA3.test1_expected_sha3_256",
"Hacl.Test.SHA3.test1_expected_sha3_384",
"Hacl.Test.SHA3.test1_expected_sha3_512"
] | [] | false | true | false | false | false | let main () =
| C.String.print (C.String.of_literal "\nTEST 1. SHA3\n");
recall test1_expected_sha3_224;
recall test1_expected_sha3_256;
recall test1_expected_sha3_384;
recall test1_expected_sha3_512;
recall test1_plaintext;
test_sha3 0ul
test1_plaintext
test1_expected_sha3_224
test1_expected_sha3_256
test1_expected_sha3_384
test1_expected_sha3_512;
C.String.print (C.String.of_literal "\nTEST 2. SHA3\n");
recall test2_expected_sha3_224;
recall test2_expected_sha3_256;
recall test2_expected_sha3_384;
recall test2_expected_sha3_512;
recall test2_plaintext;
test_sha3 3ul
test2_plaintext
test2_expected_sha3_224
test2_expected_sha3_256
test2_expected_sha3_384
test2_expected_sha3_512;
C.String.print (C.String.of_literal "\nTEST 3. SHA3\n");
recall test3_expected_sha3_224;
recall test3_expected_sha3_256;
recall test3_expected_sha3_384;
recall test3_expected_sha3_512;
recall test3_plaintext;
test_sha3 56ul
test3_plaintext
test3_expected_sha3_224
test3_expected_sha3_256
test3_expected_sha3_384
test3_expected_sha3_512;
C.String.print (C.String.of_literal "\nTEST 4. SHA3\n");
recall test4_expected_sha3_224;
recall test4_expected_sha3_256;
recall test4_expected_sha3_384;
recall test4_expected_sha3_512;
recall test4_plaintext;
test_sha3 112ul
test4_plaintext
test4_expected_sha3_224
test4_expected_sha3_256
test4_expected_sha3_384
test4_expected_sha3_512;
C.String.print (C.String.of_literal "\nTEST 5. SHAKE128\n");
recall test5_plaintext_shake128;
recall test5_expected_shake128;
test_shake128 0ul test5_plaintext_shake128 16ul test5_expected_shake128;
C.String.print (C.String.of_literal "\nTEST 6. SHAKE128\n");
recall test6_plaintext_shake128;
recall test6_expected_shake128;
test_shake128 14ul test6_plaintext_shake128 16ul test6_expected_shake128;
C.String.print (C.String.of_literal "\nTEST 7. SHAKE128\n");
recall test7_plaintext_shake128;
recall test7_expected_shake128;
test_shake128 34ul test7_plaintext_shake128 16ul test7_expected_shake128;
C.String.print (C.String.of_literal "\nTEST 8. SHAKE128\n");
recall test8_plaintext_shake128;
recall test8_expected_shake128;
test_shake128 83ul test8_plaintext_shake128 16ul test8_expected_shake128;
C.String.print (C.String.of_literal "\nTEST 9. SHAKE256\n");
recall test9_plaintext_shake256;
recall test9_expected_shake256;
test_shake256 0ul test9_plaintext_shake256 32ul test9_expected_shake256;
C.String.print (C.String.of_literal "\nTEST 10. SHAKE256\n");
recall test10_plaintext_shake256;
recall test10_expected_shake256;
test_shake256 17ul test10_plaintext_shake256 32ul test10_expected_shake256;
C.String.print (C.String.of_literal "\nTEST 11. SHAKE256\n");
recall test11_plaintext_shake256;
recall test11_expected_shake256;
test_shake256 32ul test11_plaintext_shake256 32ul test11_expected_shake256;
C.String.print (C.String.of_literal "\nTEST 12. SHAKE256\n");
recall test12_plaintext_shake256;
recall test12_expected_shake256;
test_shake256 78ul test12_plaintext_shake256 32ul test12_expected_shake256;
C.EXIT_SUCCESS | false |
Lib.Sequence.fsti | Lib.Sequence.block | val block : len: Prims.nat -> blocksize: Lib.IntTypes.size_pos -> Type0 | let block (len:nat) (blocksize:size_pos) = i:nat{i < len / blocksize} | {
"file_name": "lib/Lib.Sequence.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 69,
"end_line": 433,
"start_col": 0,
"start_line": 433
} | module Lib.Sequence
open FStar.Mul
open Lib.IntTypes
#set-options "--z3rlimit 30 --max_fuel 0 --max_ifuel 0 --using_facts_from '-* +Prims +FStar.Math.Lemmas +FStar.Seq +Lib.IntTypes +Lib.Sequence'"
/// Variable length Sequences, derived from FStar.Seq
(* This is the type of unbounded sequences.
Use this only when dealing with, say, user input whose length is unbounded.
As far as possible use the API for bounded sequences defined later in this file.*)
(** Definition of a Sequence *)
let seq (a:Type0) = Seq.seq a
(** Length of a Sequence *)
let length (#a:Type0) (s:seq a) : nat = Seq.length s
/// Fixed length Sequences
(* This is the type of bounded sequences.
Use this as much as possible.
It adds additional length checks that you'd have to prove in the implementation otherwise *)
(** Definition of a fixed-length Sequence *)
let lseq (a:Type0) (len:size_nat) = s:seq a{Seq.length s == len}
let to_seq (#a:Type0) (#len:size_nat) (l:lseq a len) : seq a = l
let to_lseq (#a:Type0) (s:seq a{length s <= max_size_t}) : l:lseq a (length s){l == s} = s
(* If you want to prove your code with an abstract lseq use the following: *)
// val lseq: a:Type0 -> len:size_nat -> Type0
// val to_seq: #a:Type0 -> #len:size_nat -> lseq a len -> s:seq a{length s == len}
// val to_lseq: #a:Type0 -> s:seq a{length s <= max_size_t} -> lseq a (length s)
val index:
#a:Type
-> #len:size_nat
-> s:lseq a len
-> i:size_nat{i < len} ->
Tot (r:a{r == Seq.index (to_seq s) i})
(** Creation of a fixed-length Sequence from an initial value *)
val create:
#a:Type
-> len:size_nat
-> init:a ->
Tot (s:lseq a len{to_seq s == Seq.create len init /\ (forall (i:nat).
{:pattern (index s i)} i < len ==> index s i == init)})
(** Concatenate sequences: use with care, may make implementation hard to verify *)
val concat:
#a:Type
-> #len0:size_nat
-> #len1:size_nat{len0 + len1 <= max_size_t}
-> s0:lseq a len0
-> s1:lseq a len1 ->
Tot (s2:lseq a (len0 + len1){to_seq s2 == Seq.append (to_seq s0) (to_seq s1)})
let ( @| ) #a #len0 #len1 s0 s1 = concat #a #len0 #len1 s0 s1
(** Conversion of a Sequence to a list *)
val to_list:
#a:Type
-> s:seq a ->
Tot (l:list a{List.Tot.length l = length s /\ l == Seq.seq_to_list s})
(** Creation of a fixed-length Sequence from a list of values *)
val of_list:
#a:Type
-> l:list a{List.Tot.length l <= max_size_t} ->
Tot (s:lseq a (List.Tot.length l){to_seq s == Seq.seq_of_list l})
val of_list_index:
#a:Type
-> l:list a{List.Tot.length l <= max_size_t}
-> i:nat{i < List.Tot.length l} ->
Lemma (index (of_list l) i == List.Tot.index l i)
[SMTPat (index (of_list l) i)]
val equal (#a:Type) (#len:size_nat) (s1:lseq a len) (s2:lseq a len) : Type0
val eq_intro: #a:Type -> #len:size_nat -> s1:lseq a len -> s2:lseq a len ->
Lemma
(requires forall i. {:pattern index s1 i; index s2 i} index s1 i == index s2 i)
(ensures equal s1 s2)
[SMTPat (equal s1 s2)]
val eq_elim: #a:Type -> #len:size_nat -> s1:lseq a len -> s2:lseq a len ->
Lemma
(requires equal s1 s2)
(ensures s1 == s2)
[SMTPat (equal s1 s2)]
(* Alias for creation from a list *)
unfold let createL #a l = of_list #a l
(** Updating an element of a fixed-length Sequence *)
val upd:
#a:Type
-> #len:size_nat
-> s:lseq a len
-> n:size_nat{n < len}
-> x:a ->
Tot (o:lseq a len{to_seq o == Seq.upd (to_seq s) n x /\ index o n == x /\ (forall (i:size_nat).
{:pattern (index s i)} (i < len /\ i <> n) ==> index o i == index s i)})
(** Membership of an element to a fixed-length Sequence *)
val member: #a:eqtype -> #len: size_nat -> a -> lseq a len -> Tot bool
(** Operator for accessing an element of a fixed-length Sequence *)
unfold
let op_String_Access #a #len = index #a #len
(** Operator for updating an element of a fixed-length Sequence *)
unfold
let op_String_Assignment #a #len = upd #a #len
(** Selecting a subset of a fixed-length Sequence *)
val sub:
#a:Type
-> #len:size_nat
-> s1:lseq a len
-> start:size_nat
-> n:size_nat{start + n <= len} ->
Tot (s2:lseq a n{to_seq s2 == Seq.slice (to_seq s1) start (start + n) /\
(forall (k:nat{k < n}). {:pattern (index s2 k)} index s2 k == index s1 (start + k))})
(** Selecting a subset of a fixed-length Sequence *)
let slice
(#a:Type)
(#len:size_nat)
(s1:lseq a len)
(start:size_nat)
(fin:size_nat{start <= fin /\ fin <= len})
=
sub #a s1 start (fin - start)
(** Updating a sub-Sequence from another fixed-length Sequence *)
val update_sub:
#a:Type
-> #len:size_nat
-> i:lseq a len
-> start:size_nat
-> n:size_nat{start + n <= len}
-> x:lseq a n ->
Tot (o:lseq a len{sub o start n == x /\
(forall (k:nat{(0 <= k /\ k < start) \/ (start + n <= k /\ k < len)}).
{:pattern (index o k)} index o k == index i k)})
(** Lemma regarding updating a sub-Sequence with another Sequence *)
val lemma_update_sub:
#a:Type
-> #len:size_nat
-> dst:lseq a len
-> start:size_nat
-> n:size_nat{start + n <= len}
-> src:lseq a n
-> res:lseq a len ->
Lemma
(requires
sub res 0 start == sub dst 0 start /\
sub res start n == src /\
sub res (start + n) (len - start - n) ==
sub dst (start + n) (len - start - n))
(ensures
res == update_sub dst start n src)
val lemma_concat2:
#a:Type0
-> len0:size_nat
-> s0:lseq a len0
-> len1:size_nat{len0 + len1 <= max_size_t}
-> s1:lseq a len1
-> s:lseq a (len0 + len1) ->
Lemma
(requires
sub s 0 len0 == s0 /\
sub s len0 len1 == s1)
(ensures s == concat s0 s1)
val lemma_concat3:
#a:Type0
-> len0:size_nat
-> s0:lseq a len0
-> len1:size_nat{len0 + len1 <= max_size_t}
-> s1:lseq a len1
-> len2:size_nat{len0 + len1 + len2 <= max_size_t}
-> s2:lseq a len2
-> s:lseq a (len0 + len1 + len2) ->
Lemma
(requires
sub s 0 len0 == s0 /\
sub s len0 len1 == s1 /\
sub s (len0 + len1) len2 == s2)
(ensures s == concat (concat s0 s1) s2)
(** Updating a sub-Sequence from another fixed-length Sequence *)
let update_slice
(#a:Type)
(#len:size_nat)
(i:lseq a len)
(start:size_nat)
(fin:size_nat{start <= fin /\ fin <= len})
(upd:lseq a (fin - start))
=
update_sub #a i start (fin - start) upd
(** Creation of a fixed-length Sequence from an initialization function *)
val createi: #a:Type
-> len:size_nat
-> init:(i:nat{i < len} -> a) ->
Tot (s:lseq a len{(forall (i:nat).
{:pattern (index s i)} i < len ==> index s i == init i)})
(** Mapi function for fixed-length Sequences *)
val mapi:#a:Type -> #b:Type -> #len:size_nat
-> f:(i:nat{i < len} -> a -> Tot b)
-> s1:lseq a len ->
Tot (s2:lseq b len{(forall (i:nat).
{:pattern (index s2 i)} i < len ==> index s2 i == f i s1.[i])})
(** Map function for fixed-length Sequences *)
val map:#a:Type -> #b:Type -> #len:size_nat
-> f:(a -> Tot b)
-> s1:lseq a len ->
Tot (s2:lseq b len{(forall (i:nat).
{:pattern (index s2 i)} i < len ==> index s2 i == f s1.[i])})
(** Map2i function for fixed-length Sequences *)
val map2i:#a:Type -> #b:Type -> #c:Type -> #len:size_nat
-> f:(i:nat{i < len} -> a -> b -> Tot c)
-> s1:lseq a len
-> s2:lseq b len ->
Tot (s3:lseq c len{(forall (i:nat).
{:pattern (index s3 i)} i < len ==> index s3 i == f i s1.[i] s2.[i])})
(** Map2 function for fixed-length Sequences *)
val map2:#a:Type -> #b:Type -> #c:Type -> #len:size_nat
-> f:(a -> b -> Tot c)
-> s1:lseq a len
-> s2:lseq b len ->
Tot (s3:lseq c len{(forall (i:nat).
{:pattern (index s3 i)} i < len ==> index s3 i == f s1.[i] s2.[i])})
(** Forall function for fixed-length Sequences *)
val for_all:#a:Type -> #len:size_nat -> (a -> Tot bool) -> lseq a len -> bool
(** Forall2 function for fixed-length Sequences *)
val for_all2:#a:Type -> #b:Type -> #len:size_nat
-> (a -> b -> Tot bool)
-> s1:lseq a len
-> s2:lseq b len ->
Tot bool
val repeati_blocks:
#a:Type0
-> #b:Type0
-> blocksize:size_pos
-> inp:seq a
-> f:(i:nat{i < length inp / blocksize} -> lseq a blocksize -> b -> b)
-> l:(i:nat{i == length inp / blocksize} -> len:size_nat{len == length inp % blocksize} -> s:lseq a len -> b -> b)
-> init:b ->
Tot b
let repeat_blocks_f
(#a:Type0)
(#b:Type0)
(bs:size_nat{bs > 0})
(inp:seq a)
(f:(lseq a bs -> b -> b))
(nb:nat{nb == length inp / bs})
(i:nat{i < nb})
(acc:b) : b
=
assert ((i+1) * bs <= nb * bs);
let block = Seq.slice inp (i * bs) (i * bs + bs) in
f block acc
val repeat_blocks:
#a:Type0
-> #b:Type0
-> #c:Type0
-> blocksize:size_pos
-> inp:seq a
-> f:(lseq a blocksize -> b -> b)
-> l:(len:nat{len < blocksize} -> s:lseq a len -> b -> c)
-> init:b ->
Tot c
val lemma_repeat_blocks:
#a:Type0
-> #b:Type0
-> #c:Type0
-> bs:size_pos
-> inp:seq a
-> f:(lseq a bs -> b -> b)
-> l:(len:nat{len < bs} -> s:lseq a len -> b -> c)
-> init:b ->
Lemma (
let len = length inp in
let nb = len / bs in
let rem = len % bs in
let acc = Lib.LoopCombinators.repeati nb (repeat_blocks_f bs inp f nb) init in
let last = Seq.slice inp (nb * bs) len in
let acc = l rem last acc in
repeat_blocks #a #b bs inp f l init == acc)
val repeat_blocks_multi:
#a:Type0
-> #b:Type0
-> blocksize:size_pos
-> inp:seq a{length inp % blocksize = 0}
-> f:(lseq a blocksize -> b -> b)
-> init:b ->
Tot b
val lemma_repeat_blocks_multi:
#a:Type0
-> #b:Type0
-> bs:size_pos
-> inp:seq a{length inp % bs = 0}
-> f:(lseq a bs -> b -> b)
-> init:b ->
Lemma (
let len = length inp in
let nb = len / bs in
repeat_blocks_multi #a #b bs inp f init ==
Lib.LoopCombinators.repeati nb (repeat_blocks_f bs inp f nb) init)
(** Generates `n` blocks of length `len` by iteratively applying a function with an accumulator *)
val generate_blocks:
#t:Type0
-> len:size_nat
-> max:nat
-> n:nat{n <= max}
-> a:(i:nat{i <= max} -> Type)
-> f:(i:nat{i < max} -> a i -> a (i + 1) & s:seq t{length s == len})
-> init:a 0 ->
Tot (a n & s:seq t{length s == n * len})
(** Generates `n` blocks of length `len` by iteratively applying a function without an accumulator *)
val generate_blocks_simple:
#a:Type0
-> blocksize:size_pos
-> max:nat
-> n:nat{n <= max}
-> f:(i:nat{i < max} -> lseq a blocksize) ->
Tot (s:seq a{length s == n * blocksize})
(** The following functions allow us to bridge between unbounded and bounded sequences *)
val div_interval: b:pos -> n:int -> i:int -> Lemma
(requires n * b <= i /\ i < (n + 1) * b)
(ensures i / b = n)
val mod_interval_lt: b:pos -> n:int -> i:int -> j:int -> Lemma
(requires n * b <= i /\ i < j /\ j < (n + 1) * b)
(ensures i % b < j % b)
val div_mul_lt: b:pos -> a:int -> n:int -> Lemma
(requires a < n * b)
(ensures a / b < n)
val mod_div_lt: b:pos -> i:int -> j:int -> Lemma
(requires (j / b) * b <= i /\ i < j)
(ensures i % b < j % b)
val div_mul_l: a:int -> b:int -> c:pos -> d:pos -> Lemma
(requires a / d = b / d)
(ensures a / (c * d) = b / (c * d))
let map_blocks_a (a:Type) (bs:size_nat) (max:nat) (i:nat{i <= max}) = s:seq a{length s == i * bs}
let map_blocks_f
(#a:Type)
(bs:size_nat{bs > 0})
(max:nat)
(inp:seq a{length inp == max * bs})
(f:(i:nat{i < max} -> lseq a bs -> lseq a bs))
(i:nat{i < max})
(acc:map_blocks_a a bs max i) : map_blocks_a a bs max (i + 1)
=
Math.Lemmas.lemma_mult_le_right bs (i+1) max;
let block = Seq.slice inp (i*bs) ((i+1)*bs) in
Seq.append acc (f i block)
val map_blocks_multi:
#a:Type0
-> blocksize:size_pos
-> max:nat
-> n:nat{n <= max}
-> inp:seq a{length inp == max * blocksize}
-> f:(i:nat{i < max} -> lseq a blocksize -> lseq a blocksize) ->
Tot (out:seq a {length out == n * blocksize})
val lemma_map_blocks_multi:
#a:Type0
-> blocksize:size_pos
-> max:nat
-> n:nat{n <= max}
-> inp:seq a{length inp == max * blocksize}
-> f:(i:nat{i < max} -> lseq a blocksize -> lseq a blocksize)
-> Lemma
(map_blocks_multi #a blocksize max n inp f ==
LoopCombinators.repeat_gen n (map_blocks_a a blocksize max) (map_blocks_f #a blocksize max inp f) Seq.empty)
#restart-solver
val index_map_blocks_multi:
#a:Type0
-> bs:size_pos
-> max:pos
-> n:pos{n <= max}
-> inp:seq a{length inp == max * bs}
-> f:(i:nat{i < max} -> lseq a bs -> lseq a bs)
-> i:nat{i < n * bs}
-> Lemma (
div_mul_lt bs i n;
let j = i / bs in
let block: lseq a bs = Seq.slice inp (j * bs) ((j + 1) * bs) in
Seq.index (map_blocks_multi bs max n inp f) i == Seq.index (f j block) (i % bs))
(* A full block index *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Lib.Sequence.fsti"
} | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | len: Prims.nat -> blocksize: Lib.IntTypes.size_pos -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Lib.IntTypes.size_pos",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.op_Division"
] | [] | false | false | false | true | true | let block (len: nat) (blocksize: size_pos) =
| i: nat{i < len / blocksize} | false |
|
Lib.Sequence.fsti | Lib.Sequence.to_lseq | val to_lseq (#a: Type0) (s: seq a {length s <= max_size_t}) : l: lseq a (length s) {l == s} | val to_lseq (#a: Type0) (s: seq a {length s <= max_size_t}) : l: lseq a (length s) {l == s} | let to_lseq (#a:Type0) (s:seq a{length s <= max_size_t}) : l:lseq a (length s){l == s} = s | {
"file_name": "lib/Lib.Sequence.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 90,
"end_line": 29,
"start_col": 0,
"start_line": 29
} | module Lib.Sequence
open FStar.Mul
open Lib.IntTypes
#set-options "--z3rlimit 30 --max_fuel 0 --max_ifuel 0 --using_facts_from '-* +Prims +FStar.Math.Lemmas +FStar.Seq +Lib.IntTypes +Lib.Sequence'"
/// Variable length Sequences, derived from FStar.Seq
(* This is the type of unbounded sequences.
Use this only when dealing with, say, user input whose length is unbounded.
As far as possible use the API for bounded sequences defined later in this file.*)
(** Definition of a Sequence *)
let seq (a:Type0) = Seq.seq a
(** Length of a Sequence *)
let length (#a:Type0) (s:seq a) : nat = Seq.length s
/// Fixed length Sequences
(* This is the type of bounded sequences.
Use this as much as possible.
It adds additional length checks that you'd have to prove in the implementation otherwise *)
(** Definition of a fixed-length Sequence *)
let lseq (a:Type0) (len:size_nat) = s:seq a{Seq.length s == len} | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Lib.Sequence.fsti"
} | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | s: Lib.Sequence.seq a {Lib.Sequence.length s <= Lib.IntTypes.max_size_t}
-> l: Lib.Sequence.lseq a (Lib.Sequence.length s) {l == s} | Prims.Tot | [
"total"
] | [] | [
"Lib.Sequence.seq",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Lib.Sequence.length",
"Lib.IntTypes.max_size_t",
"Lib.Sequence.lseq",
"Prims.eq2",
"Prims.l_or",
"Prims.nat",
"FStar.Seq.Base.length"
] | [] | false | false | false | false | false | let to_lseq (#a: Type0) (s: seq a {length s <= max_size_t}) : l: lseq a (length s) {l == s} =
| s | false |
Lib.Sequence.fsti | Lib.Sequence.update_slice | val update_slice : i: Lib.Sequence.lseq a len ->
start: Lib.IntTypes.size_nat ->
fin: Lib.IntTypes.size_nat{start <= fin /\ fin <= len} ->
upd: Lib.Sequence.lseq a (fin - start)
-> o:
Lib.Sequence.lseq a len
{ Lib.Sequence.sub o start (fin - start) == upd /\
(forall (k: Prims.nat{0 <= k /\ k < start \/ start + (fin - start) <= k /\ k < len}).
{:pattern Lib.Sequence.index o k}
Lib.Sequence.index o k == Lib.Sequence.index i k) } | let update_slice
(#a:Type)
(#len:size_nat)
(i:lseq a len)
(start:size_nat)
(fin:size_nat{start <= fin /\ fin <= len})
(upd:lseq a (fin - start))
=
update_sub #a i start (fin - start) upd | {
"file_name": "lib/Lib.Sequence.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 41,
"end_line": 209,
"start_col": 0,
"start_line": 201
} | module Lib.Sequence
open FStar.Mul
open Lib.IntTypes
#set-options "--z3rlimit 30 --max_fuel 0 --max_ifuel 0 --using_facts_from '-* +Prims +FStar.Math.Lemmas +FStar.Seq +Lib.IntTypes +Lib.Sequence'"
/// Variable length Sequences, derived from FStar.Seq
(* This is the type of unbounded sequences.
Use this only when dealing with, say, user input whose length is unbounded.
As far as possible use the API for bounded sequences defined later in this file.*)
(** Definition of a Sequence *)
let seq (a:Type0) = Seq.seq a
(** Length of a Sequence *)
let length (#a:Type0) (s:seq a) : nat = Seq.length s
/// Fixed length Sequences
(* This is the type of bounded sequences.
Use this as much as possible.
It adds additional length checks that you'd have to prove in the implementation otherwise *)
(** Definition of a fixed-length Sequence *)
let lseq (a:Type0) (len:size_nat) = s:seq a{Seq.length s == len}
let to_seq (#a:Type0) (#len:size_nat) (l:lseq a len) : seq a = l
let to_lseq (#a:Type0) (s:seq a{length s <= max_size_t}) : l:lseq a (length s){l == s} = s
(* If you want to prove your code with an abstract lseq use the following: *)
// val lseq: a:Type0 -> len:size_nat -> Type0
// val to_seq: #a:Type0 -> #len:size_nat -> lseq a len -> s:seq a{length s == len}
// val to_lseq: #a:Type0 -> s:seq a{length s <= max_size_t} -> lseq a (length s)
val index:
#a:Type
-> #len:size_nat
-> s:lseq a len
-> i:size_nat{i < len} ->
Tot (r:a{r == Seq.index (to_seq s) i})
(** Creation of a fixed-length Sequence from an initial value *)
val create:
#a:Type
-> len:size_nat
-> init:a ->
Tot (s:lseq a len{to_seq s == Seq.create len init /\ (forall (i:nat).
{:pattern (index s i)} i < len ==> index s i == init)})
(** Concatenate sequences: use with care, may make implementation hard to verify *)
val concat:
#a:Type
-> #len0:size_nat
-> #len1:size_nat{len0 + len1 <= max_size_t}
-> s0:lseq a len0
-> s1:lseq a len1 ->
Tot (s2:lseq a (len0 + len1){to_seq s2 == Seq.append (to_seq s0) (to_seq s1)})
let ( @| ) #a #len0 #len1 s0 s1 = concat #a #len0 #len1 s0 s1
(** Conversion of a Sequence to a list *)
val to_list:
#a:Type
-> s:seq a ->
Tot (l:list a{List.Tot.length l = length s /\ l == Seq.seq_to_list s})
(** Creation of a fixed-length Sequence from a list of values *)
val of_list:
#a:Type
-> l:list a{List.Tot.length l <= max_size_t} ->
Tot (s:lseq a (List.Tot.length l){to_seq s == Seq.seq_of_list l})
val of_list_index:
#a:Type
-> l:list a{List.Tot.length l <= max_size_t}
-> i:nat{i < List.Tot.length l} ->
Lemma (index (of_list l) i == List.Tot.index l i)
[SMTPat (index (of_list l) i)]
val equal (#a:Type) (#len:size_nat) (s1:lseq a len) (s2:lseq a len) : Type0
val eq_intro: #a:Type -> #len:size_nat -> s1:lseq a len -> s2:lseq a len ->
Lemma
(requires forall i. {:pattern index s1 i; index s2 i} index s1 i == index s2 i)
(ensures equal s1 s2)
[SMTPat (equal s1 s2)]
val eq_elim: #a:Type -> #len:size_nat -> s1:lseq a len -> s2:lseq a len ->
Lemma
(requires equal s1 s2)
(ensures s1 == s2)
[SMTPat (equal s1 s2)]
(* Alias for creation from a list *)
unfold let createL #a l = of_list #a l
(** Updating an element of a fixed-length Sequence *)
val upd:
#a:Type
-> #len:size_nat
-> s:lseq a len
-> n:size_nat{n < len}
-> x:a ->
Tot (o:lseq a len{to_seq o == Seq.upd (to_seq s) n x /\ index o n == x /\ (forall (i:size_nat).
{:pattern (index s i)} (i < len /\ i <> n) ==> index o i == index s i)})
(** Membership of an element to a fixed-length Sequence *)
val member: #a:eqtype -> #len: size_nat -> a -> lseq a len -> Tot bool
(** Operator for accessing an element of a fixed-length Sequence *)
unfold
let op_String_Access #a #len = index #a #len
(** Operator for updating an element of a fixed-length Sequence *)
unfold
let op_String_Assignment #a #len = upd #a #len
(** Selecting a subset of a fixed-length Sequence *)
val sub:
#a:Type
-> #len:size_nat
-> s1:lseq a len
-> start:size_nat
-> n:size_nat{start + n <= len} ->
Tot (s2:lseq a n{to_seq s2 == Seq.slice (to_seq s1) start (start + n) /\
(forall (k:nat{k < n}). {:pattern (index s2 k)} index s2 k == index s1 (start + k))})
(** Selecting a subset of a fixed-length Sequence *)
let slice
(#a:Type)
(#len:size_nat)
(s1:lseq a len)
(start:size_nat)
(fin:size_nat{start <= fin /\ fin <= len})
=
sub #a s1 start (fin - start)
(** Updating a sub-Sequence from another fixed-length Sequence *)
val update_sub:
#a:Type
-> #len:size_nat
-> i:lseq a len
-> start:size_nat
-> n:size_nat{start + n <= len}
-> x:lseq a n ->
Tot (o:lseq a len{sub o start n == x /\
(forall (k:nat{(0 <= k /\ k < start) \/ (start + n <= k /\ k < len)}).
{:pattern (index o k)} index o k == index i k)})
(** Lemma regarding updating a sub-Sequence with another Sequence *)
val lemma_update_sub:
#a:Type
-> #len:size_nat
-> dst:lseq a len
-> start:size_nat
-> n:size_nat{start + n <= len}
-> src:lseq a n
-> res:lseq a len ->
Lemma
(requires
sub res 0 start == sub dst 0 start /\
sub res start n == src /\
sub res (start + n) (len - start - n) ==
sub dst (start + n) (len - start - n))
(ensures
res == update_sub dst start n src)
val lemma_concat2:
#a:Type0
-> len0:size_nat
-> s0:lseq a len0
-> len1:size_nat{len0 + len1 <= max_size_t}
-> s1:lseq a len1
-> s:lseq a (len0 + len1) ->
Lemma
(requires
sub s 0 len0 == s0 /\
sub s len0 len1 == s1)
(ensures s == concat s0 s1)
val lemma_concat3:
#a:Type0
-> len0:size_nat
-> s0:lseq a len0
-> len1:size_nat{len0 + len1 <= max_size_t}
-> s1:lseq a len1
-> len2:size_nat{len0 + len1 + len2 <= max_size_t}
-> s2:lseq a len2
-> s:lseq a (len0 + len1 + len2) ->
Lemma
(requires
sub s 0 len0 == s0 /\
sub s len0 len1 == s1 /\
sub s (len0 + len1) len2 == s2)
(ensures s == concat (concat s0 s1) s2) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Lib.Sequence.fsti"
} | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
i: Lib.Sequence.lseq a len ->
start: Lib.IntTypes.size_nat ->
fin: Lib.IntTypes.size_nat{start <= fin /\ fin <= len} ->
upd: Lib.Sequence.lseq a (fin - start)
-> o:
Lib.Sequence.lseq a len
{ Lib.Sequence.sub o start (fin - start) == upd /\
(forall (k: Prims.nat{0 <= k /\ k < start \/ start + (fin - start) <= k /\ k < len}).
{:pattern Lib.Sequence.index o k}
Lib.Sequence.index o k == Lib.Sequence.index i k) } | Prims.Tot | [
"total"
] | [] | [
"Lib.IntTypes.size_nat",
"Lib.Sequence.lseq",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Subtraction",
"Lib.Sequence.update_sub",
"Prims.eq2",
"Lib.Sequence.sub",
"Prims.l_Forall",
"Prims.nat",
"Prims.l_or",
"Prims.op_LessThan",
"Prims.op_Addition",
"FStar.Seq.Base.index",
"Lib.Sequence.to_seq",
"Lib.Sequence.index"
] | [] | false | false | false | false | false | let update_slice
(#a: Type)
(#len: size_nat)
(i: lseq a len)
(start: size_nat)
(fin: size_nat{start <= fin /\ fin <= len})
(upd: lseq a (fin - start))
=
| update_sub #a i start (fin - start) upd | false |
|
Target.fst | Target.has_output_types | val has_output_types (ds:list decl) : bool | val has_output_types (ds:list decl) : bool | let has_output_types (ds:list decl) : bool =
List.Tot.existsb (fun (d, _) -> Output_type? d) ds | {
"file_name": "src/3d/Target.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 52,
"end_line": 84,
"start_col": 0,
"start_line": 83
} | (*
Copyright 2019 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 Target
(* The abstract syntax for the code produced by 3d *)
open FStar.All
module A = Ast
open Binding
let lookup (s:subst) (i:A.ident) : option expr =
List.Tot.assoc i.v s
let rec subst_expr (s:subst) (e:expr)
: expr
= match fst e with
| Constant _ -> e
| Identifier i -> (
match lookup s i with
| Some e' -> e'
| None -> e
)
| App hd args -> (
App hd (subst_exprs s args), snd e
)
| Record tn fields -> (
Record tn (subst_fields s fields), snd e
)
and subst_exprs s es =
match es with
| [] -> []
| e::es -> subst_expr s e :: subst_exprs s es
and subst_fields s fs =
match fs with
| [] -> []
| (i, e)::fs -> (i, subst_expr s e)::subst_fields s fs
let rec expr_eq e1 e2 =
match fst e1, fst e2 with
| Constant c1, Constant c2 -> c1=c2
| Identifier i1, Identifier i2 -> A.(i1.v = i2.v)
| App hd1 args1, App hd2 args2 -> hd1 = hd2 && exprs_eq args1 args2
| Record t1 fields1, Record t2 fields2 -> A.(t1.v = t2.v) && fields_eq fields1 fields2
| _ -> false
and exprs_eq es1 es2 =
match es1, es2 with
| [], [] -> true
| e1::es1, e2::es2 -> expr_eq e1 e2 && exprs_eq es1 es2
| _ -> false
and fields_eq fs1 fs2 =
match fs1, fs2 with
| [], [] -> true
| (i1, e1)::fs1, (i2, e2)::fs2 ->
A.(i1.v = i2.v)
&& fields_eq fs1 fs2
| _ -> false
let rec parser_kind_eq k k' =
match k.pk_kind, k'.pk_kind with
| PK_return, PK_return -> true
| PK_impos, PK_impos -> true
| PK_list, PK_list -> true
| PK_t_at_most, PK_t_at_most -> true
| PK_t_exact, PK_t_exact -> true
| PK_base hd1, PK_base hd2 -> A.(hd1.v = hd2.v)
| PK_filter k, PK_filter k' -> parser_kind_eq k k'
| PK_and_then k1 k2, PK_and_then k1' k2'
| PK_glb k1 k2, PK_glb k1' k2' ->
parser_kind_eq k1 k1'
&& parser_kind_eq k2 k2'
| _ -> false | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Options.fsti.checked",
"Hashtable.fsti.checked",
"HashingOptions.fst.checked",
"FStar.String.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Char.fsti.checked",
"FStar.All.fst.checked",
"Binding.fsti.checked",
"Ast.fst.checked"
],
"interface_file": true,
"source_file": "Target.fst"
} | [
{
"abbrev": false,
"full_module": "Binding",
"short_module": null
},
{
"abbrev": true,
"full_module": "Ast",
"short_module": "A"
},
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "Binding",
"short_module": null
},
{
"abbrev": true,
"full_module": "Ast",
"short_module": "A"
},
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": 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 | ds: Prims.list Target.decl -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Prims.list",
"Target.decl",
"FStar.List.Tot.Base.existsb",
"FStar.Pervasives.Native.tuple2",
"Target.decl'",
"Target.decl_attributes",
"Target.uu___is_Output_type",
"Prims.bool"
] | [] | false | false | false | true | false | let has_output_types (ds: list decl) : bool =
| List.Tot.existsb (fun (d, _) -> Output_type? d) ds | false |
Steel.ST.C.Types.UserStruct.fsti | Steel.ST.C.Types.UserStruct.set_aux | val set_aux
(#t: Type)
(sd: struct_def t)
(x: t)
(f: field_t sd.fields)
(v: sd.field_desc.fd_type f)
(f': field_t sd.fields)
: Tot (sd.field_desc.fd_type f') | val set_aux
(#t: Type)
(sd: struct_def t)
(x: t)
(f: field_t sd.fields)
(v: sd.field_desc.fd_type f)
(f': field_t sd.fields)
: Tot (sd.field_desc.fd_type f') | let set_aux
(#t: Type) (sd: struct_def t) (x: t) (f: field_t sd.fields) (v: sd.field_desc.fd_type f) (f': field_t sd.fields)
: Tot (sd.field_desc.fd_type f')
= if f = f' then v else sd.get x f' | {
"file_name": "lib/steel/c/Steel.ST.C.Types.UserStruct.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 35,
"end_line": 57,
"start_col": 0,
"start_line": 54
} | module Steel.ST.C.Types.UserStruct
open Steel.ST.Util
open Steel.ST.C.Types.Struct.Aux
module Set = FStar.Set
(* This library allows the user to define their own struct type, with
a constructor from field values, and a destructor to field values for
each field. This may be necessary for recursive structs *)
let set_def
(#t: eqtype)
(s: FStar.Set.set t)
(x: t)
: Tot bool
= FStar.Set.mem x s
noextract
let nonempty_set (t: eqtype) =
(s: Set.set t { exists x . set_def s x == true })
noextract
let set_snoc // for associativity reasons
(#t: eqtype) (q: FStar.Set.set t) (a: t) : Pure (nonempty_set t)
(requires True)
(ensures (fun s ->
(forall (x: t). {:pattern FStar.Set.mem x s} FStar.Set.mem x s == (x = a || FStar.Set.mem x q))
))
= q `FStar.Set.union` FStar.Set.singleton a
[@@noextract_to "krml"]
let field_t (s: Set.set string) : Tot eqtype =
(f: string { Set.mem f s })
[@@noextract_to "krml"; norm_field_attr]
inline_for_extraction // for field_desc.fd_type
noeq
type struct_def (t: Type) = {
fields: Set.set string;
field_desc: field_description_gen_t (field_t fields);
mk: ((f: field_t fields) -> Tot (field_desc.fd_type f)) -> Tot t;
get: (t -> (f: field_t fields) -> Tot (field_desc.fd_type f));
get_mk: (phi: ((f: field_t fields) -> Tot (field_desc.fd_type f))) -> (f: field_t fields) -> Lemma
(get (mk phi) f == phi f);
extensionality: (x1: t) -> (x2: t) -> ((f: field_t fields) -> Lemma (get x1 f == get x2 f)) -> Lemma (x1 == x2);
}
let nonempty_set_nonempty_type (x: string) (s: Set.set string) : Lemma
(requires (x `Set.mem` s))
(ensures (exists (x: field_t s) . True))
= Classical.exists_intro (fun (_: field_t s) -> True) x | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"Steel.ST.C.Types.Struct.Aux.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "Steel.ST.C.Types.UserStruct.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Set",
"short_module": "Set"
},
{
"abbrev": false,
"full_module": "Steel.ST.C.Types.Struct.Aux",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.C.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.C.Types",
"short_module": null
},
{
"abbrev": 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 |
sd: Steel.ST.C.Types.UserStruct.struct_def t ->
x: t ->
f: Steel.ST.C.Types.UserStruct.field_t (Mkstruct_def?.fields sd) ->
v: Mkfield_description_gen_t?.fd_type (Mkstruct_def?.field_desc sd) f ->
f': Steel.ST.C.Types.UserStruct.field_t (Mkstruct_def?.fields sd)
-> Mkfield_description_gen_t?.fd_type (Mkstruct_def?.field_desc sd) f' | Prims.Tot | [
"total"
] | [] | [
"Steel.ST.C.Types.UserStruct.struct_def",
"Steel.ST.C.Types.UserStruct.field_t",
"Steel.ST.C.Types.UserStruct.__proj__Mkstruct_def__item__fields",
"Steel.ST.C.Types.Struct.Aux.__proj__Mkfield_description_gen_t__item__fd_type",
"Steel.ST.C.Types.UserStruct.__proj__Mkstruct_def__item__field_desc",
"Prims.op_Equality",
"Prims.bool",
"Steel.ST.C.Types.UserStruct.__proj__Mkstruct_def__item__get"
] | [] | false | false | false | false | false | let set_aux
(#t: Type)
(sd: struct_def t)
(x: t)
(f: field_t sd.fields)
(v: sd.field_desc.fd_type f)
(f': field_t sd.fields)
: Tot (sd.field_desc.fd_type f') =
| if f = f' then v else sd.get x f' | false |
Target.fst | Target.has_extern_probes | val has_extern_probes (ds:list decl) : bool | val has_extern_probes (ds:list decl) : bool | let has_extern_probes (ds:list decl) : bool =
List.Tot.existsb (fun (d, _) -> Extern_probe? d) ds | {
"file_name": "src/3d/Target.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 53,
"end_line": 96,
"start_col": 0,
"start_line": 95
} | (*
Copyright 2019 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 Target
(* The abstract syntax for the code produced by 3d *)
open FStar.All
module A = Ast
open Binding
let lookup (s:subst) (i:A.ident) : option expr =
List.Tot.assoc i.v s
let rec subst_expr (s:subst) (e:expr)
: expr
= match fst e with
| Constant _ -> e
| Identifier i -> (
match lookup s i with
| Some e' -> e'
| None -> e
)
| App hd args -> (
App hd (subst_exprs s args), snd e
)
| Record tn fields -> (
Record tn (subst_fields s fields), snd e
)
and subst_exprs s es =
match es with
| [] -> []
| e::es -> subst_expr s e :: subst_exprs s es
and subst_fields s fs =
match fs with
| [] -> []
| (i, e)::fs -> (i, subst_expr s e)::subst_fields s fs
let rec expr_eq e1 e2 =
match fst e1, fst e2 with
| Constant c1, Constant c2 -> c1=c2
| Identifier i1, Identifier i2 -> A.(i1.v = i2.v)
| App hd1 args1, App hd2 args2 -> hd1 = hd2 && exprs_eq args1 args2
| Record t1 fields1, Record t2 fields2 -> A.(t1.v = t2.v) && fields_eq fields1 fields2
| _ -> false
and exprs_eq es1 es2 =
match es1, es2 with
| [], [] -> true
| e1::es1, e2::es2 -> expr_eq e1 e2 && exprs_eq es1 es2
| _ -> false
and fields_eq fs1 fs2 =
match fs1, fs2 with
| [], [] -> true
| (i1, e1)::fs1, (i2, e2)::fs2 ->
A.(i1.v = i2.v)
&& fields_eq fs1 fs2
| _ -> false
let rec parser_kind_eq k k' =
match k.pk_kind, k'.pk_kind with
| PK_return, PK_return -> true
| PK_impos, PK_impos -> true
| PK_list, PK_list -> true
| PK_t_at_most, PK_t_at_most -> true
| PK_t_exact, PK_t_exact -> true
| PK_base hd1, PK_base hd2 -> A.(hd1.v = hd2.v)
| PK_filter k, PK_filter k' -> parser_kind_eq k k'
| PK_and_then k1 k2, PK_and_then k1' k2'
| PK_glb k1 k2, PK_glb k1' k2' ->
parser_kind_eq k1 k1'
&& parser_kind_eq k2 k2'
| _ -> false
let has_output_types (ds:list decl) : bool =
List.Tot.existsb (fun (d, _) -> Output_type? d) ds
let has_output_type_exprs (ds:list decl) : bool =
List.Tot.existsb (fun (d, _) -> Output_type_expr? d) ds
let has_extern_types (ds:list decl) : bool =
List.Tot.existsb (fun (d, _) -> Extern_type? d) ds
let has_extern_functions (ds:list decl) : bool =
List.Tot.existsb (fun (d, _) -> Extern_fn? d) ds | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Options.fsti.checked",
"Hashtable.fsti.checked",
"HashingOptions.fst.checked",
"FStar.String.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Char.fsti.checked",
"FStar.All.fst.checked",
"Binding.fsti.checked",
"Ast.fst.checked"
],
"interface_file": true,
"source_file": "Target.fst"
} | [
{
"abbrev": false,
"full_module": "Binding",
"short_module": null
},
{
"abbrev": true,
"full_module": "Ast",
"short_module": "A"
},
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "Binding",
"short_module": null
},
{
"abbrev": true,
"full_module": "Ast",
"short_module": "A"
},
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": 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 | ds: Prims.list Target.decl -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Prims.list",
"Target.decl",
"FStar.List.Tot.Base.existsb",
"FStar.Pervasives.Native.tuple2",
"Target.decl'",
"Target.decl_attributes",
"Target.uu___is_Extern_probe",
"Prims.bool"
] | [] | false | false | false | true | false | let has_extern_probes (ds: list decl) : bool =
| List.Tot.existsb (fun (d, _) -> Extern_probe? d) ds | false |
Target.fst | Target.has_extern_functions | val has_extern_functions (ds:list decl) : bool | val has_extern_functions (ds:list decl) : bool | let has_extern_functions (ds:list decl) : bool =
List.Tot.existsb (fun (d, _) -> Extern_fn? d) ds | {
"file_name": "src/3d/Target.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 50,
"end_line": 93,
"start_col": 0,
"start_line": 92
} | (*
Copyright 2019 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 Target
(* The abstract syntax for the code produced by 3d *)
open FStar.All
module A = Ast
open Binding
let lookup (s:subst) (i:A.ident) : option expr =
List.Tot.assoc i.v s
let rec subst_expr (s:subst) (e:expr)
: expr
= match fst e with
| Constant _ -> e
| Identifier i -> (
match lookup s i with
| Some e' -> e'
| None -> e
)
| App hd args -> (
App hd (subst_exprs s args), snd e
)
| Record tn fields -> (
Record tn (subst_fields s fields), snd e
)
and subst_exprs s es =
match es with
| [] -> []
| e::es -> subst_expr s e :: subst_exprs s es
and subst_fields s fs =
match fs with
| [] -> []
| (i, e)::fs -> (i, subst_expr s e)::subst_fields s fs
let rec expr_eq e1 e2 =
match fst e1, fst e2 with
| Constant c1, Constant c2 -> c1=c2
| Identifier i1, Identifier i2 -> A.(i1.v = i2.v)
| App hd1 args1, App hd2 args2 -> hd1 = hd2 && exprs_eq args1 args2
| Record t1 fields1, Record t2 fields2 -> A.(t1.v = t2.v) && fields_eq fields1 fields2
| _ -> false
and exprs_eq es1 es2 =
match es1, es2 with
| [], [] -> true
| e1::es1, e2::es2 -> expr_eq e1 e2 && exprs_eq es1 es2
| _ -> false
and fields_eq fs1 fs2 =
match fs1, fs2 with
| [], [] -> true
| (i1, e1)::fs1, (i2, e2)::fs2 ->
A.(i1.v = i2.v)
&& fields_eq fs1 fs2
| _ -> false
let rec parser_kind_eq k k' =
match k.pk_kind, k'.pk_kind with
| PK_return, PK_return -> true
| PK_impos, PK_impos -> true
| PK_list, PK_list -> true
| PK_t_at_most, PK_t_at_most -> true
| PK_t_exact, PK_t_exact -> true
| PK_base hd1, PK_base hd2 -> A.(hd1.v = hd2.v)
| PK_filter k, PK_filter k' -> parser_kind_eq k k'
| PK_and_then k1 k2, PK_and_then k1' k2'
| PK_glb k1 k2, PK_glb k1' k2' ->
parser_kind_eq k1 k1'
&& parser_kind_eq k2 k2'
| _ -> false
let has_output_types (ds:list decl) : bool =
List.Tot.existsb (fun (d, _) -> Output_type? d) ds
let has_output_type_exprs (ds:list decl) : bool =
List.Tot.existsb (fun (d, _) -> Output_type_expr? d) ds
let has_extern_types (ds:list decl) : bool =
List.Tot.existsb (fun (d, _) -> Extern_type? d) ds | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Options.fsti.checked",
"Hashtable.fsti.checked",
"HashingOptions.fst.checked",
"FStar.String.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Char.fsti.checked",
"FStar.All.fst.checked",
"Binding.fsti.checked",
"Ast.fst.checked"
],
"interface_file": true,
"source_file": "Target.fst"
} | [
{
"abbrev": false,
"full_module": "Binding",
"short_module": null
},
{
"abbrev": true,
"full_module": "Ast",
"short_module": "A"
},
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "Binding",
"short_module": null
},
{
"abbrev": true,
"full_module": "Ast",
"short_module": "A"
},
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": 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 | ds: Prims.list Target.decl -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Prims.list",
"Target.decl",
"FStar.List.Tot.Base.existsb",
"FStar.Pervasives.Native.tuple2",
"Target.decl'",
"Target.decl_attributes",
"Target.uu___is_Extern_fn",
"Prims.bool"
] | [] | false | false | false | true | false | let has_extern_functions (ds: list decl) : bool =
| List.Tot.existsb (fun (d, _) -> Extern_fn? d) ds | false |
Target.fst | Target.error_handler_name | val error_handler_name : Ast.with_meta_t Ast.ident' | let error_handler_name =
let open A in
let id' = {
modul_name = None;
name = "handle_error";
} in
let id = with_range id' dummy_range in
id | {
"file_name": "src/3d/Target.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 4,
"end_line": 120,
"start_col": 0,
"start_line": 113
} | (*
Copyright 2019 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 Target
(* The abstract syntax for the code produced by 3d *)
open FStar.All
module A = Ast
open Binding
let lookup (s:subst) (i:A.ident) : option expr =
List.Tot.assoc i.v s
let rec subst_expr (s:subst) (e:expr)
: expr
= match fst e with
| Constant _ -> e
| Identifier i -> (
match lookup s i with
| Some e' -> e'
| None -> e
)
| App hd args -> (
App hd (subst_exprs s args), snd e
)
| Record tn fields -> (
Record tn (subst_fields s fields), snd e
)
and subst_exprs s es =
match es with
| [] -> []
| e::es -> subst_expr s e :: subst_exprs s es
and subst_fields s fs =
match fs with
| [] -> []
| (i, e)::fs -> (i, subst_expr s e)::subst_fields s fs
let rec expr_eq e1 e2 =
match fst e1, fst e2 with
| Constant c1, Constant c2 -> c1=c2
| Identifier i1, Identifier i2 -> A.(i1.v = i2.v)
| App hd1 args1, App hd2 args2 -> hd1 = hd2 && exprs_eq args1 args2
| Record t1 fields1, Record t2 fields2 -> A.(t1.v = t2.v) && fields_eq fields1 fields2
| _ -> false
and exprs_eq es1 es2 =
match es1, es2 with
| [], [] -> true
| e1::es1, e2::es2 -> expr_eq e1 e2 && exprs_eq es1 es2
| _ -> false
and fields_eq fs1 fs2 =
match fs1, fs2 with
| [], [] -> true
| (i1, e1)::fs1, (i2, e2)::fs2 ->
A.(i1.v = i2.v)
&& fields_eq fs1 fs2
| _ -> false
let rec parser_kind_eq k k' =
match k.pk_kind, k'.pk_kind with
| PK_return, PK_return -> true
| PK_impos, PK_impos -> true
| PK_list, PK_list -> true
| PK_t_at_most, PK_t_at_most -> true
| PK_t_exact, PK_t_exact -> true
| PK_base hd1, PK_base hd2 -> A.(hd1.v = hd2.v)
| PK_filter k, PK_filter k' -> parser_kind_eq k k'
| PK_and_then k1 k2, PK_and_then k1' k2'
| PK_glb k1 k2, PK_glb k1' k2' ->
parser_kind_eq k1 k1'
&& parser_kind_eq k2 k2'
| _ -> false
let has_output_types (ds:list decl) : bool =
List.Tot.existsb (fun (d, _) -> Output_type? d) ds
let has_output_type_exprs (ds:list decl) : bool =
List.Tot.existsb (fun (d, _) -> Output_type_expr? d) ds
let has_extern_types (ds:list decl) : bool =
List.Tot.existsb (fun (d, _) -> Extern_type? d) ds
let has_extern_functions (ds:list decl) : bool =
List.Tot.existsb (fun (d, _) -> Extern_fn? d) ds
let has_extern_probes (ds:list decl) : bool =
List.Tot.existsb (fun (d, _) -> Extern_probe? d) ds
let has_external_api (ds:list decl) : bool =
has_output_type_exprs ds
|| has_extern_types ds
|| has_extern_functions ds
|| has_extern_probes ds
// Some constants
let default_attrs = {
is_hoisted = false;
is_if_def = false;
is_exported = false;
should_inline = false;
comments = []
} | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Options.fsti.checked",
"Hashtable.fsti.checked",
"HashingOptions.fst.checked",
"FStar.String.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Char.fsti.checked",
"FStar.All.fst.checked",
"Binding.fsti.checked",
"Ast.fst.checked"
],
"interface_file": true,
"source_file": "Target.fst"
} | [
{
"abbrev": false,
"full_module": "Binding",
"short_module": null
},
{
"abbrev": true,
"full_module": "Ast",
"short_module": "A"
},
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "Binding",
"short_module": null
},
{
"abbrev": true,
"full_module": "Ast",
"short_module": "A"
},
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": 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 | Ast.with_meta_t Ast.ident' | Prims.Tot | [
"total"
] | [] | [
"Ast.with_meta_t",
"Ast.ident'",
"Ast.with_range",
"Ast.dummy_range",
"Ast.Mkident'",
"FStar.Pervasives.Native.None",
"Prims.string"
] | [] | false | false | false | true | false | let error_handler_name =
| let open A in
let id' = { modul_name = None; name = "handle_error" } in
let id = with_range id' dummy_range in
id | false |
|
Lib.Sequence.fsti | Lib.Sequence.slice | val slice : s1: Lib.Sequence.lseq a len ->
start: Lib.IntTypes.size_nat ->
fin: Lib.IntTypes.size_nat{start <= fin /\ fin <= len}
-> s2:
Lib.Sequence.lseq a (fin - start)
{ Lib.Sequence.to_seq s2 ==
FStar.Seq.Base.slice (Lib.Sequence.to_seq s1) start (start + (fin - start)) /\
(forall (k: Prims.nat{k < fin - start}). {:pattern Lib.Sequence.index s2 k}
Lib.Sequence.index s2 k == Lib.Sequence.index s1 (start + k)) } | let slice
(#a:Type)
(#len:size_nat)
(s1:lseq a len)
(start:size_nat)
(fin:size_nat{start <= fin /\ fin <= len})
=
sub #a s1 start (fin - start) | {
"file_name": "lib/Lib.Sequence.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 31,
"end_line": 139,
"start_col": 0,
"start_line": 132
} | module Lib.Sequence
open FStar.Mul
open Lib.IntTypes
#set-options "--z3rlimit 30 --max_fuel 0 --max_ifuel 0 --using_facts_from '-* +Prims +FStar.Math.Lemmas +FStar.Seq +Lib.IntTypes +Lib.Sequence'"
/// Variable length Sequences, derived from FStar.Seq
(* This is the type of unbounded sequences.
Use this only when dealing with, say, user input whose length is unbounded.
As far as possible use the API for bounded sequences defined later in this file.*)
(** Definition of a Sequence *)
let seq (a:Type0) = Seq.seq a
(** Length of a Sequence *)
let length (#a:Type0) (s:seq a) : nat = Seq.length s
/// Fixed length Sequences
(* This is the type of bounded sequences.
Use this as much as possible.
It adds additional length checks that you'd have to prove in the implementation otherwise *)
(** Definition of a fixed-length Sequence *)
let lseq (a:Type0) (len:size_nat) = s:seq a{Seq.length s == len}
let to_seq (#a:Type0) (#len:size_nat) (l:lseq a len) : seq a = l
let to_lseq (#a:Type0) (s:seq a{length s <= max_size_t}) : l:lseq a (length s){l == s} = s
(* If you want to prove your code with an abstract lseq use the following: *)
// val lseq: a:Type0 -> len:size_nat -> Type0
// val to_seq: #a:Type0 -> #len:size_nat -> lseq a len -> s:seq a{length s == len}
// val to_lseq: #a:Type0 -> s:seq a{length s <= max_size_t} -> lseq a (length s)
val index:
#a:Type
-> #len:size_nat
-> s:lseq a len
-> i:size_nat{i < len} ->
Tot (r:a{r == Seq.index (to_seq s) i})
(** Creation of a fixed-length Sequence from an initial value *)
val create:
#a:Type
-> len:size_nat
-> init:a ->
Tot (s:lseq a len{to_seq s == Seq.create len init /\ (forall (i:nat).
{:pattern (index s i)} i < len ==> index s i == init)})
(** Concatenate sequences: use with care, may make implementation hard to verify *)
val concat:
#a:Type
-> #len0:size_nat
-> #len1:size_nat{len0 + len1 <= max_size_t}
-> s0:lseq a len0
-> s1:lseq a len1 ->
Tot (s2:lseq a (len0 + len1){to_seq s2 == Seq.append (to_seq s0) (to_seq s1)})
let ( @| ) #a #len0 #len1 s0 s1 = concat #a #len0 #len1 s0 s1
(** Conversion of a Sequence to a list *)
val to_list:
#a:Type
-> s:seq a ->
Tot (l:list a{List.Tot.length l = length s /\ l == Seq.seq_to_list s})
(** Creation of a fixed-length Sequence from a list of values *)
val of_list:
#a:Type
-> l:list a{List.Tot.length l <= max_size_t} ->
Tot (s:lseq a (List.Tot.length l){to_seq s == Seq.seq_of_list l})
val of_list_index:
#a:Type
-> l:list a{List.Tot.length l <= max_size_t}
-> i:nat{i < List.Tot.length l} ->
Lemma (index (of_list l) i == List.Tot.index l i)
[SMTPat (index (of_list l) i)]
val equal (#a:Type) (#len:size_nat) (s1:lseq a len) (s2:lseq a len) : Type0
val eq_intro: #a:Type -> #len:size_nat -> s1:lseq a len -> s2:lseq a len ->
Lemma
(requires forall i. {:pattern index s1 i; index s2 i} index s1 i == index s2 i)
(ensures equal s1 s2)
[SMTPat (equal s1 s2)]
val eq_elim: #a:Type -> #len:size_nat -> s1:lseq a len -> s2:lseq a len ->
Lemma
(requires equal s1 s2)
(ensures s1 == s2)
[SMTPat (equal s1 s2)]
(* Alias for creation from a list *)
unfold let createL #a l = of_list #a l
(** Updating an element of a fixed-length Sequence *)
val upd:
#a:Type
-> #len:size_nat
-> s:lseq a len
-> n:size_nat{n < len}
-> x:a ->
Tot (o:lseq a len{to_seq o == Seq.upd (to_seq s) n x /\ index o n == x /\ (forall (i:size_nat).
{:pattern (index s i)} (i < len /\ i <> n) ==> index o i == index s i)})
(** Membership of an element to a fixed-length Sequence *)
val member: #a:eqtype -> #len: size_nat -> a -> lseq a len -> Tot bool
(** Operator for accessing an element of a fixed-length Sequence *)
unfold
let op_String_Access #a #len = index #a #len
(** Operator for updating an element of a fixed-length Sequence *)
unfold
let op_String_Assignment #a #len = upd #a #len
(** Selecting a subset of a fixed-length Sequence *)
val sub:
#a:Type
-> #len:size_nat
-> s1:lseq a len
-> start:size_nat
-> n:size_nat{start + n <= len} ->
Tot (s2:lseq a n{to_seq s2 == Seq.slice (to_seq s1) start (start + n) /\
(forall (k:nat{k < n}). {:pattern (index s2 k)} index s2 k == index s1 (start + k))}) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Lib.Sequence.fsti"
} | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
s1: Lib.Sequence.lseq a len ->
start: Lib.IntTypes.size_nat ->
fin: Lib.IntTypes.size_nat{start <= fin /\ fin <= len}
-> s2:
Lib.Sequence.lseq a (fin - start)
{ Lib.Sequence.to_seq s2 ==
FStar.Seq.Base.slice (Lib.Sequence.to_seq s1) start (start + (fin - start)) /\
(forall (k: Prims.nat{k < fin - start}). {:pattern Lib.Sequence.index s2 k}
Lib.Sequence.index s2 k == Lib.Sequence.index s1 (start + k)) } | Prims.Tot | [
"total"
] | [] | [
"Lib.IntTypes.size_nat",
"Lib.Sequence.lseq",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Lib.Sequence.sub",
"Prims.op_Subtraction",
"Prims.eq2",
"FStar.Seq.Base.seq",
"Lib.Sequence.to_seq",
"FStar.Seq.Base.slice",
"Prims.op_Addition",
"Prims.l_Forall",
"Prims.nat",
"Prims.op_LessThan",
"Prims.l_or",
"FStar.Seq.Base.index",
"Lib.Sequence.index"
] | [] | false | false | false | false | false | let slice
(#a: Type)
(#len: size_nat)
(s1: lseq a len)
(start: size_nat)
(fin: size_nat{start <= fin /\ fin <= len})
=
| sub #a s1 start (fin - start) | false |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.