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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Vale.AES.X64.AESopt.fsti | Vale.AES.X64.AESopt.map2_six_of | val map2_six_of (#a #b #c: Type0) (x: six_of a) (y: six_of b) (f: (a -> b -> GTot c))
: GTot (six_of c) | val map2_six_of (#a #b #c: Type0) (x: six_of a) (y: six_of b) (f: (a -> b -> GTot c))
: GTot (six_of c) | let map2_six_of (#a #b #c:Type0) (x:six_of a) (y:six_of b) (f:a -> b -> GTot c) : GTot (six_of c) =
let (x0, x1, x2, x3, x4, x5) = x in
let (y0, y1, y2, y3, y4, y5) = y in
(f x0 y0, f x1 y1, f x2 y2, f x3 y3, f x4 y4, f x5 y5) | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 56,
"end_line": 73,
"start_col": 7,
"start_line": 70
} | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let aes_reqs0
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ pclmulqdq_enabled /\ avx_enabled /\
alg = AES_128 /\
//(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
buffer128_as_seq heap0 keys_b == round_keys
let aes_reqs_offset
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ avx_enabled /\ pclmulqdq_enabled /\
(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
s128 heap0 keys_b == round_keys
let six_of (a:Type0) = a & a & a & a & a & a
let quad32_6 = six_of quad32
unfold let make_six_of (#a:Type0) (f:(n:nat{n < 6}) -> GTot a) : GTot (six_of a) =
(f 0, f 1, f 2, f 3, f 4, f 5)
unfold let map_six_of (#a #b:Type0) (x:six_of a) (f:a -> GTot b) : GTot (six_of b) =
let (x0, x1, x2, x3, x4, x5) = x in | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Transformers.Transform.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESGCM_expected_code.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "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 |
x: Vale.AES.X64.AESopt.six_of a ->
y: Vale.AES.X64.AESopt.six_of b ->
f: (_: a -> _: b -> Prims.GTot c)
-> Prims.GTot (Vale.AES.X64.AESopt.six_of c) | Prims.GTot | [
"sometrivial"
] | [] | [
"Vale.AES.X64.AESopt.six_of",
"FStar.Pervasives.Native.Mktuple6"
] | [] | false | false | false | false | false | let map2_six_of (#a #b #c: Type0) (x: six_of a) (y: six_of b) (f: (a -> b -> GTot c))
: GTot (six_of c) =
| let x0, x1, x2, x3, x4, x5 = x in
let y0, y1, y2, y3, y4, y5 = y in
(f x0 y0, f x1 y1, f x2 y2, f x3 y3, f x4 y4, f x5 y5) | false |
Printers.fst | Printers.mk_printer_fun | val mk_printer_fun (dom: term) : Tac term | val mk_printer_fun (dom: term) : Tac term | let mk_printer_fun (dom : term) : Tac term =
set_guard_policy SMT;
let e = top_env () in
(* Recursive binding *)
let ff = fresh_namedv_named "ff_rec" in
let ffty = mk_printer_type dom in
let fftm = pack (Tv_Var ff) in
let x = fresh_binder_named "v" dom in
let xt_ns = match inspect dom with
| Tv_FVar fv -> (inspect_fv fv)
| _ -> fail "not a qname type?"
in
let se = match lookup_typ e xt_ns with
| None -> fail "Type not found..?"
| Some se -> se
in
match inspect_sigelt se with
| Sg_Let _ -> fail "cannot create printer for let"
| Sg_Inductive {params=bs; typ=y; ctors} ->
let br1 ctor : Tac branch =
let (name, t) = ctor in
let pn = String.concat "." name in
let t_args, _ = collect_arr t in
let bv_ty_pats = TU.map (fun ti -> let bv = fresh_namedv_named "a" in ((bv, ti), (Pat_Var {v=bv; sort=seal ti}, false))) t_args in
let bvs, pats = List.Tot.split bv_ty_pats in
let head = pack (Tv_Const (C_String pn)) in
let bod = mk_concat (mk_stringlit " ") (head :: TU.map (mk_print_bv xt_ns fftm) bvs) in
let bod = match t_args with | [] -> bod | _ -> paren bod in
(Pat_Cons {head=pack_fv name; univs=None; subpats=pats}, bod)
in
let branches = TU.map br1 ctors in
let xi = fresh_binder_named "v_inner" dom in
// Generate the match on the internal argument
let m = pack (Tv_Match (pack (Tv_Var (binder_to_namedv xi))) None branches) in
(* debug ("m = " ^ term_to_string m); *)
// Wrap it into an internal function
let f = pack (Tv_Abs xi m) in
(* debug ("f = " ^ term_to_string f); *)
// Wrap it in a let rec; basically:
// let rec ff = fun t -> match t with { .... } in ff x
let ff_bnd : binder = { namedv_to_simple_binder ff with sort = ffty } in
let xtm = pack (Tv_Var (binder_to_namedv x)) in
let b = pack (Tv_Let true [] ff_bnd f (mk_e_app fftm [xtm])) in
(* print ("b = " ^ term_to_string b); *)
// Wrap it in a lambda taking the initial argument
let tm = pack (Tv_Abs x b) in
(* debug ("tm = " ^ term_to_string tm); *)
tm
| _ -> fail "type not found?" | {
"file_name": "examples/tactics/Printers.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 33,
"end_line": 112,
"start_col": 0,
"start_line": 57
} | (*
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 Printers
open FStar.List.Tot
(* TODO: This is pretty much a blast-to-the-past of Meta-F*, we can do
* much better now. *)
open FStar.Tactics.V2
module TD = FStar.Tactics.V2.Derived
module TU = FStar.Tactics.Util
let print_Prims_string : string -> Tot string = fun s -> "\"" ^ s ^ "\""
let print_Prims_int : int -> Tot string = string_of_int
let mk_concat (sep : term) (ts : list term) : Tac term =
mk_e_app (pack (Tv_FVar (pack_fv ["FStar"; "String"; "concat"]))) [sep; mk_list ts]
let mk_flatten ts = mk_concat (`"") ts
let paren (e : term) : Tac term =
mk_flatten [mk_stringlit "("; e; mk_stringlit ")"]
let mk_print_bv (self : name) (f : term) (bvty : namedv & typ) : Tac term =
let bv, ty = bvty in
(* debug ("self = " ^ String.concat "." self ^ "\n>>>>>> f = : " ^ term_to_string f); *)
let mk n = pack (Tv_FVar (pack_fv n)) in
match inspect ty with
| Tv_FVar fv ->
if inspect_fv fv = self
then mk_e_app f [pack (Tv_Var bv)]
else let f = mk (cur_module () @ ["print_" ^ (String.concat "_" (inspect_fv fv))]) in
mk_e_app f [pack (Tv_Var bv)]
| _ ->
mk_stringlit "?"
let mk_printer_type (t : term) : Tac term =
let b = fresh_binder_named "arg" t in
let str = pack (Tv_FVar (pack_fv string_lid)) in
let c = pack_comp (C_Total str) in
pack (Tv_Arrow b c)
(* This tactics generates the entire let rec at once and | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.Derived.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Util.fst.checked",
"FStar.String.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Printers.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.Util",
"short_module": "TU"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2.Derived",
"short_module": "TD"
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": 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 | dom: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac FStar.Tactics.NamedView.term | FStar.Tactics.Effect.Tac | [] | [] | [
"FStar.Tactics.NamedView.term",
"FStar.Tactics.NamedView.named_sigelt_view__Sg_Let__payload",
"FStar.Tactics.V2.Derived.fail",
"FStar.Stubs.Reflection.Types.name",
"Prims.list",
"FStar.Tactics.NamedView.univ_name",
"FStar.Tactics.NamedView.binders",
"FStar.Stubs.Reflection.Types.typ",
"FStar.Stubs.Reflection.V2.Data.ctor",
"FStar.Tactics.NamedView.pack",
"FStar.Tactics.NamedView.Tv_Abs",
"FStar.Tactics.NamedView.Tv_Let",
"Prims.Nil",
"FStar.Reflection.V2.Derived.mk_e_app",
"Prims.Cons",
"FStar.Stubs.Reflection.Types.term",
"FStar.Tactics.NamedView.Tv_Var",
"FStar.Tactics.V2.SyntaxCoercions.binder_to_namedv",
"FStar.Tactics.NamedView.binder",
"FStar.Tactics.NamedView.Mkbinder",
"FStar.Tactics.NamedView.__proj__Mkbinder__item__uniq",
"FStar.Tactics.NamedView.__proj__Mkbinder__item__ppname",
"FStar.Tactics.NamedView.__proj__Mkbinder__item__qual",
"FStar.Tactics.NamedView.__proj__Mkbinder__item__attrs",
"FStar.Tactics.NamedView.simple_binder",
"FStar.Tactics.V2.Derived.namedv_to_simple_binder",
"FStar.Tactics.NamedView.Tv_Match",
"FStar.Pervasives.Native.None",
"FStar.Tactics.NamedView.match_returns_ascription",
"FStar.Tactics.V2.Derived.fresh_binder_named",
"FStar.Tactics.NamedView.branch",
"FStar.Tactics.Util.map",
"FStar.Pervasives.Native.tuple2",
"Prims.string",
"FStar.Tactics.NamedView.comp",
"FStar.Tactics.NamedView.namedv",
"FStar.Tactics.NamedView.pattern",
"Prims.bool",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Tactics.NamedView.Pat_Cons",
"FStar.Tactics.NamedView.Mkpattern__Pat_Cons__payload",
"FStar.Stubs.Reflection.V2.Builtins.pack_fv",
"FStar.Stubs.Reflection.V2.Data.universes",
"Printers.paren",
"Printers.mk_concat",
"FStar.Reflection.V2.Derived.mk_stringlit",
"Printers.mk_print_bv",
"FStar.Tactics.NamedView.Tv_Const",
"FStar.Stubs.Reflection.V2.Data.C_String",
"FStar.List.Tot.Base.split",
"FStar.Tactics.NamedView.Pat_Var",
"FStar.Tactics.NamedView.Mkpattern__Pat_Var__payload",
"FStar.Sealed.seal",
"FStar.Tactics.V2.Derived.fresh_namedv_named",
"FStar.Tactics.V2.SyntaxHelpers.collect_arr",
"FStar.String.concat",
"FStar.Tactics.NamedView.named_sigelt_view",
"FStar.Tactics.NamedView.inspect_sigelt",
"FStar.Stubs.Reflection.Types.sigelt",
"FStar.Stubs.Reflection.V2.Builtins.lookup_typ",
"FStar.Stubs.Reflection.Types.fv",
"FStar.Stubs.Reflection.V2.Builtins.inspect_fv",
"FStar.Tactics.NamedView.named_term_view",
"FStar.Tactics.NamedView.inspect",
"Printers.mk_printer_type",
"FStar.Stubs.Reflection.Types.env",
"FStar.Stubs.Tactics.V2.Builtins.top_env",
"Prims.unit",
"FStar.Stubs.Tactics.V2.Builtins.set_guard_policy",
"FStar.Stubs.Tactics.Types.SMT"
] | [] | false | true | false | false | false | let mk_printer_fun (dom: term) : Tac term =
| set_guard_policy SMT;
let e = top_env () in
let ff = fresh_namedv_named "ff_rec" in
let ffty = mk_printer_type dom in
let fftm = pack (Tv_Var ff) in
let x = fresh_binder_named "v" dom in
let xt_ns =
match inspect dom with
| Tv_FVar fv -> (inspect_fv fv)
| _ -> fail "not a qname type?"
in
let se =
match lookup_typ e xt_ns with
| None -> fail "Type not found..?"
| Some se -> se
in
match inspect_sigelt se with
| Sg_Let _ -> fail "cannot create printer for let"
| Sg_Inductive { params = bs ; typ = y ; ctors = ctors } ->
let br1 ctor : Tac branch =
let name, t = ctor in
let pn = String.concat "." name in
let t_args, _ = collect_arr t in
let bv_ty_pats =
TU.map (fun ti ->
let bv = fresh_namedv_named "a" in
((bv, ti), (Pat_Var ({ v = bv; sort = seal ti }), false)))
t_args
in
let bvs, pats = List.Tot.split bv_ty_pats in
let head = pack (Tv_Const (C_String pn)) in
let bod = mk_concat (mk_stringlit " ") (head :: TU.map (mk_print_bv xt_ns fftm) bvs) in
let bod =
match t_args with
| [] -> bod
| _ -> paren bod
in
(Pat_Cons ({ head = pack_fv name; univs = None; subpats = pats }), bod)
in
let branches = TU.map br1 ctors in
let xi = fresh_binder_named "v_inner" dom in
let m = pack (Tv_Match (pack (Tv_Var (binder_to_namedv xi))) None branches) in
let f = pack (Tv_Abs xi m) in
let ff_bnd:binder = { namedv_to_simple_binder ff with sort = ffty } in
let xtm = pack (Tv_Var (binder_to_namedv x)) in
let b = pack (Tv_Let true [] ff_bnd f (mk_e_app fftm [xtm])) in
let tm = pack (Tv_Abs x b) in
tm
| _ -> fail "type not found?" | false |
Hacl.Impl.FFDHE.fst | Hacl.Impl.FFDHE.ffdhe_secret_to_public_st | val ffdhe_secret_to_public_st : t: Hacl.Bignum.Definitions.limb_t ->
a: Spec.FFDHE.ffdhe_alg ->
len: Hacl.Impl.FFDHE.size_pos ->
ke: Hacl.Bignum.Exponentiation.exp t
-> Type0 | let ffdhe_secret_to_public_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
sk:lbuffer uint8 len
-> pk:lbuffer uint8 len ->
Stack unit
(requires fun h ->
live h sk /\ live h pk /\ disjoint sk pk /\
v len == S.ffdhe_len a /\
ke.BE.bn.BN.len == blocks len (size (numbytes t)) /\
1 < Lib.ByteSequence.nat_from_bytes_be (as_seq h sk))
(ensures fun h0 _ h1 -> modifies (loc pk) h0 h1 /\
as_seq h1 pk == S.ffdhe_secret_to_public a (as_seq h0 sk)) | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 62,
"end_line": 325,
"start_col": 0,
"start_line": 314
} | module Hacl.Impl.FFDHE
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.FFDHE.Constants
open Hacl.Bignum.Definitions
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module S = Spec.FFDHE
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Lemmas = Hacl.Spec.FFDHE.Lemmas
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module BE = Hacl.Bignum.Exponentiation
module SB = Hacl.Spec.Bignum
module SM = Hacl.Spec.Bignum.Montgomery
module SE = Hacl.Spec.Bignum.Exponentiation
module SD = Hacl.Spec.Bignum.Definitions
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let size_pos = x:size_t{v x > 0}
[@CInline]
let ffdhe_len (a:S.ffdhe_alg) : x:size_pos{v x = S.ffdhe_len a} =
allow_inversion S.ffdhe_alg;
match a with
| S.FFDHE2048 -> 256ul
| S.FFDHE3072 -> 384ul
| S.FFDHE4096 -> 512ul
| S.FFDHE6144 -> 768ul
| S.FFDHE8192 -> 1024ul
inline_for_extraction noextract
let get_ffdhe_p (a:S.ffdhe_alg) :x:glbuffer pub_uint8 (ffdhe_len a)
{witnessed x (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) /\ recallable x}
=
allow_inversion S.ffdhe_alg;
match a with
| S.FFDHE2048 -> ffdhe_p2048
| S.FFDHE3072 -> ffdhe_p3072
| S.FFDHE4096 -> ffdhe_p4096
| S.FFDHE6144 -> ffdhe_p6144
| S.FFDHE8192 -> ffdhe_p8192
inline_for_extraction noextract
val ffdhe_p_to_ps:
a:S.ffdhe_alg
-> p_s:lbuffer uint8 (ffdhe_len a) ->
Stack unit
(requires fun h -> live h p_s)
(ensures fun h0 _ h1 -> modifies (loc p_s) h0 h1 /\
BSeq.nat_from_intseq_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) ==
BSeq.nat_from_intseq_be (as_seq h1 p_s))
let ffdhe_p_to_ps a p_s =
let p = get_ffdhe_p a in
recall_contents p (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a));
let len = ffdhe_len a in
mapT len p_s secret p;
BSeq.nat_from_intseq_be_public_to_secret (v len) (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a))
inline_for_extraction noextract
let ffdhe_bn_from_g_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) =
g_n:lbignum t (blocks len (size (numbytes t))) ->
Stack unit
(requires fun h ->
live h g_n /\
v len = S.ffdhe_len a /\
as_seq h g_n == LSeq.create (v (blocks len (size (numbytes t)))) (uint #t 0))
(ensures fun h0 _ h1 -> modifies (loc g_n) h0 h1 /\
bn_v h1 g_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_g (S.get_ffdhe_params a)))
inline_for_extraction noextract
val ffdhe_bn_from_g: #t:limb_t -> a:S.ffdhe_alg -> len:size_pos -> ffdhe_bn_from_g_st t a len
let ffdhe_bn_from_g #t a len g_n =
recall_contents ffdhe_g2 S.ffdhe_g2;
[@inline_let] let nLen = blocks len (size (numbytes t)) in
push_frame ();
let g = create 1ul (u8 0) in
mapT 1ul g secret ffdhe_g2;
BSeq.nat_from_intseq_be_public_to_secret 1 S.ffdhe_g2;
let h0 = ST.get () in
update_sub_f h0 g_n 0ul 1ul
(fun h -> SB.bn_from_bytes_be 1 (as_seq h0 g))
(fun _ -> BN.bn_from_bytes_be 1ul g (sub g_n 0ul 1ul));
let h1 = ST.get () in
SD.bn_eval_update_sub #t 1 (SB.bn_from_bytes_be 1 (as_seq h0 g)) (v nLen);
assert (bn_v h1 g_n == SD.bn_v (SB.bn_from_bytes_be #t 1 (as_seq h0 g)));
SB.bn_from_bytes_be_lemma #t 1 (as_seq h0 g);
assert (bn_v h1 g_n == BSeq.nat_from_bytes_be (as_seq h0 g));
pop_frame ()
inline_for_extraction noextract
let ffdhe_precomp_inv (#t:limb_t) (#len:size_nat{0 < len /\ len + len <= max_size_t})
(a:S.ffdhe_alg) (p_r2_n:SD.lbignum t (len + len))
=
let p_n = LSeq.sub p_r2_n 0 len in
let r2_n = LSeq.sub p_r2_n len len in
SD.bn_v p_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) /\
0 < SD.bn_v p_n /\ SD.bn_v r2_n == pow2 (2 * bits t * len) % SD.bn_v p_n
inline_for_extraction noextract
let ffdhe_precomp_p_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen) ->
Stack unit
(requires fun h ->
live h p_r2_n /\
v len = S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen)
(ensures fun h0 _ h1 -> modifies (loc p_r2_n) h0 h1 /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h1 p_r2_n))
inline_for_extraction noextract
val ffdhe_precomp_p:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t ->
ffdhe_precomp_p_st t a len ke
let ffdhe_precomp_p #t a len ke p_r2_n =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let r2_n = sub p_r2_n nLen nLen in
let p_s = create len (u8 0) in
ffdhe_p_to_ps a p_s;
let h0 = ST.get () in
BN.bn_from_bytes_be len p_s p_n;
let h1 = ST.get () in
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 p_s);
assert (bn_v h1 p_n == BSeq.nat_from_bytes_be (as_seq h0 p_s));
S.ffdhe_p_lemma a;
Lemmas.ffdhe_p_bits_lemma a;
ke.BE.precompr2 (8ul *! len -! 1ul) p_n r2_n;
SM.bn_precomp_r2_mod_n_lemma (8 * v len - 1) (as_seq h1 p_n);
pop_frame ()
inline_for_extraction noextract
let new_ffdhe_precomp_p_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
r:HS.rid ->
ST (B.buffer (limb t))
(requires fun h ->
ST.is_eternal_region r /\
v len = S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen)
(ensures fun h0 res h1 ->
B.(modifies loc_none h0 h1) /\
not (B.g_is_null res) ==> (
B.len res == nLen +! nLen /\
B.(fresh_loc (loc_buffer res) h0 h1) /\
B.(loc_includes (loc_region_only false r) (loc_buffer res)) /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h1 (res <: lbignum t (nLen +! nLen)))))
inline_for_extraction noextract
val new_ffdhe_precomp_p:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_precomp_p:ffdhe_precomp_p_st t a len ke ->
new_ffdhe_precomp_p_st t a len ke
let new_ffdhe_precomp_p #t a len ke ffdhe_precomp_p r =
let h0 = ST.get () in
let nLen = blocks len (size (numbytes t)) in
assert (v (nLen +! nLen) > 0);
let res = LowStar.Monotonic.Buffer.mmalloc_partial r (uint #t #SEC 0) (nLen +! nLen) in
if B.is_null res then
res
else
let h1 = ST.get () in
B.(modifies_only_not_unused_in loc_none h0 h1);
assert (B.len res == nLen +! nLen);
let res: Lib.Buffer.buffer (limb t) = res in
assert (B.length res == v nLen + v nLen);
let res: lbignum t (nLen +! nLen) = res in
ffdhe_precomp_p res;
let h2 = ST.get () in
B.(modifies_only_not_unused_in loc_none h0 h2);
res
inline_for_extraction noextract
let ffdhe_compute_exp_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen)
-> sk_n:lbignum t nLen
-> b_n:lbignum t nLen
-> res:lbuffer uint8 len ->
Stack unit
(requires fun h ->
live h p_r2_n /\ live h sk_n /\ live h b_n /\ live h res /\
disjoint p_r2_n res /\ disjoint sk_n res /\ disjoint b_n res /\
disjoint p_r2_n b_n /\ disjoint p_r2_n sk_n /\
v len == S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h p_r2_n) /\
bn_v h b_n < bn_v h (gsub p_r2_n 0ul nLen) - 1 /\
1 < bn_v h sk_n)
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
(S.ffdhe_p_lemma a;
let res_n = Lib.NatMod.pow_mod #(bn_v h0 (gsub p_r2_n 0ul nLen)) (bn_v h0 b_n) (bn_v h0 sk_n) in
as_seq h1 res == BSeq.nat_to_bytes_be (v len) res_n))
#push-options "--z3rlimit 100"
inline_for_extraction noextract
val ffdhe_compute_exp:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t ->
ffdhe_compute_exp_st t a len ke
let ffdhe_compute_exp #t a len ke p_r2_n sk_n b_n res =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let r2_n = sub p_r2_n nLen nLen in
let res_n = create nLen (uint #t #SEC 0) in
let h1 = ST.get () in
S.ffdhe_p_lemma a;
assert_norm (pow2 4 = 16);
assert_norm (pow2 10 = 1024);
Math.Lemmas.pow2_plus 4 10;
Math.Lemmas.pow2_lt_compat 32 14;
SD.bn_eval_bound #t (as_seq h1 sk_n) (v nLen);
BE.mk_bn_mod_exp_precompr2 nLen ke.BE.exp_ct_precomp p_n r2_n b_n (size (bits t) *! nLen) sk_n res_n; //b_n ^ sk_n % p_n
let h2 = ST.get () in
BN.bn_to_bytes_be len res_n res;
SB.bn_to_bytes_be_lemma (v len) (as_seq h2 res_n);
pop_frame ()
#pop-options
inline_for_extraction noextract
let ffdhe_secret_to_public_precomp_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen)
-> sk:lbuffer uint8 len
-> pk:lbuffer uint8 len ->
Stack unit
(requires fun h ->
live h sk /\ live h pk /\ live h p_r2_n /\
disjoint sk pk /\ disjoint sk p_r2_n /\ disjoint pk p_r2_n /\
v len == S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen /\
1 < Lib.ByteSequence.nat_from_bytes_be (as_seq h sk) /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h p_r2_n))
(ensures fun h0 _ h1 -> modifies (loc pk) h0 h1 /\
as_seq h1 pk == S.ffdhe_secret_to_public a (as_seq h0 sk))
//TODO: pass sBits?
inline_for_extraction noextract
val ffdhe_secret_to_public_precomp:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_compute_exp:ffdhe_compute_exp_st t a len ke ->
ffdhe_secret_to_public_precomp_st t a len ke
let ffdhe_secret_to_public_precomp #t a len ke ffdhe_compute_exp p_r2_n sk pk =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let g_n = create nLen (uint #t #SEC 0) in
ffdhe_bn_from_g a len g_n;
let sk_n = create nLen (uint #t #SEC 0) in
let h0 = ST.get () in
BN.bn_from_bytes_be len sk sk_n;
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 sk);
S.ffdhe_g2_lemma ();
S.ffdhe_p_lemma a;
ffdhe_compute_exp p_r2_n sk_n g_n pk;
pop_frame () | {
"checked_file": "/",
"dependencies": [
"Spec.FFDHE.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.FFDHE.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.Exponentiation.fsti.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"Hacl.Impl.FFDHE.Constants.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Base.fst.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.FFDHE.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Exponentiation",
"short_module": "SE"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "SM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "SB"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.FFDHE.Lemmas",
"short_module": "Lemmas"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "Spec.FFDHE",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.FFDHE.Constants",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
t: Hacl.Bignum.Definitions.limb_t ->
a: Spec.FFDHE.ffdhe_alg ->
len: Hacl.Impl.FFDHE.size_pos ->
ke: Hacl.Bignum.Exponentiation.exp t
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Definitions.limb_t",
"Spec.FFDHE.ffdhe_alg",
"Hacl.Impl.FFDHE.size_pos",
"Hacl.Bignum.Exponentiation.exp",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"Prims.unit",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_and",
"Lib.Buffer.live",
"Lib.Buffer.MUT",
"Lib.Buffer.disjoint",
"Prims.eq2",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Lib.IntTypes.U32",
"Prims.b2t",
"Prims.op_GreaterThan",
"Prims.op_LessThanOrEqual",
"Lib.IntTypes.max_size_t",
"Lib.IntTypes.v",
"Lib.IntTypes.PUB",
"Spec.FFDHE.ffdhe_len",
"Lib.IntTypes.size_t",
"FStar.Mul.op_Star",
"Lib.IntTypes.size",
"Lib.IntTypes.numbytes",
"Hacl.Spec.Bignum.Definitions.blocks",
"Prims.op_LessThan",
"Lib.IntTypes.bits",
"Hacl.Bignum.__proj__Mkbn__item__len",
"Hacl.Bignum.Exponentiation.__proj__Mkexp__item__bn",
"Hacl.Bignum.Definitions.blocks",
"Lib.ByteSequence.nat_from_bytes_be",
"Lib.IntTypes.SEC",
"Lib.Buffer.as_seq",
"Lib.Buffer.modifies",
"Lib.Buffer.loc",
"Lib.Sequence.seq",
"Prims.nat",
"FStar.Seq.Base.length",
"Spec.FFDHE.ffdhe_secret_to_public"
] | [] | false | false | false | false | true | let ffdhe_secret_to_public_st (t: limb_t) (a: S.ffdhe_alg) (len: size_pos) (ke: BE.exp t) =
| sk: lbuffer uint8 len -> pk: lbuffer uint8 len
-> Stack unit
(requires
fun h ->
live h sk /\ live h pk /\ disjoint sk pk /\ v len == S.ffdhe_len a /\
ke.BE.bn.BN.len == blocks len (size (numbytes t)) /\
1 < Lib.ByteSequence.nat_from_bytes_be (as_seq h sk))
(ensures
fun h0 _ h1 ->
modifies (loc pk) h0 h1 /\ as_seq h1 pk == S.ffdhe_secret_to_public a (as_seq h0 sk)) | false |
|
Vale.AES.X64.AESopt.fsti | Vale.AES.X64.AESopt.xor_reverse_inc32lite_6 | val xor_reverse_inc32lite_6 (n i0: int) (ctr_BE rndkey: quad32) : GTot quad32_6 | val xor_reverse_inc32lite_6 (n i0: int) (ctr_BE rndkey: quad32) : GTot quad32_6 | let xor_reverse_inc32lite_6 (n i0:int) (ctr_BE rndkey:quad32) : GTot quad32_6 =
make_six_of (fun i ->
let r = reverse_bytes_quad32 (inc32lite ctr_BE (i0 + i)) in
if i < n then quad32_xor r rndkey else r) | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 45,
"end_line": 81,
"start_col": 0,
"start_line": 78
} | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let aes_reqs0
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ pclmulqdq_enabled /\ avx_enabled /\
alg = AES_128 /\
//(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
buffer128_as_seq heap0 keys_b == round_keys
let aes_reqs_offset
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ avx_enabled /\ pclmulqdq_enabled /\
(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
s128 heap0 keys_b == round_keys
let six_of (a:Type0) = a & a & a & a & a & a
let quad32_6 = six_of quad32
unfold let make_six_of (#a:Type0) (f:(n:nat{n < 6}) -> GTot a) : GTot (six_of a) =
(f 0, f 1, f 2, f 3, f 4, f 5)
unfold let map_six_of (#a #b:Type0) (x:six_of a) (f:a -> GTot b) : GTot (six_of b) =
let (x0, x1, x2, x3, x4, x5) = x in
(f x0, f x1, f x2, f x3, f x4, f x5)
unfold let map2_six_of (#a #b #c:Type0) (x:six_of a) (y:six_of b) (f:a -> b -> GTot c) : GTot (six_of c) =
let (x0, x1, x2, x3, x4, x5) = x in
let (y0, y1, y2, y3, y4, y5) = y in
(f x0 y0, f x1 y1, f x2 y2, f x3 y3, f x4 y4, f x5 y5)
let rounds_opaque_6 (init:quad32_6) (round_keys:seq quad32) (rnd:nat{rnd < length round_keys}) : GTot quad32_6 =
map_six_of init (fun x -> eval_rounds x round_keys rnd) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Transformers.Transform.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESGCM_expected_code.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "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 | n: Prims.int -> i0: Prims.int -> ctr_BE: Vale.X64.Decls.quad32 -> rndkey: Vale.X64.Decls.quad32
-> Prims.GTot Vale.AES.X64.AESopt.quad32_6 | Prims.GTot | [
"sometrivial"
] | [] | [
"Prims.int",
"Vale.X64.Decls.quad32",
"Vale.AES.X64.AESopt.make_six_of",
"Vale.Def.Types_s.quad32",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"Vale.Def.Types_s.quad32_xor",
"Prims.bool",
"Vale.Def.Types_s.reverse_bytes_quad32",
"Vale.AES.GCTR.inc32lite",
"Prims.op_Addition",
"Vale.AES.X64.AESopt.quad32_6"
] | [] | false | false | false | false | false | let xor_reverse_inc32lite_6 (n i0: int) (ctr_BE rndkey: quad32) : GTot quad32_6 =
| make_six_of (fun i ->
let r = reverse_bytes_quad32 (inc32lite ctr_BE (i0 + i)) in
if i < n then quad32_xor r rndkey else r) | false |
Vale.AES.X64.AESopt.fsti | Vale.AES.X64.AESopt.va_wp_Load_one_lsb | val va_wp_Load_one_lsb (dst: va_operand_xmm) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_Load_one_lsb (dst: va_operand_xmm) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_Load_one_lsb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 88,
"end_line": 151,
"start_col": 0,
"start_line": 146
} | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let aes_reqs0
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ pclmulqdq_enabled /\ avx_enabled /\
alg = AES_128 /\
//(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
buffer128_as_seq heap0 keys_b == round_keys
let aes_reqs_offset
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ avx_enabled /\ pclmulqdq_enabled /\
(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
s128 heap0 keys_b == round_keys
let six_of (a:Type0) = a & a & a & a & a & a
let quad32_6 = six_of quad32
unfold let make_six_of (#a:Type0) (f:(n:nat{n < 6}) -> GTot a) : GTot (six_of a) =
(f 0, f 1, f 2, f 3, f 4, f 5)
unfold let map_six_of (#a #b:Type0) (x:six_of a) (f:a -> GTot b) : GTot (six_of b) =
let (x0, x1, x2, x3, x4, x5) = x in
(f x0, f x1, f x2, f x3, f x4, f x5)
unfold let map2_six_of (#a #b #c:Type0) (x:six_of a) (y:six_of b) (f:a -> b -> GTot c) : GTot (six_of c) =
let (x0, x1, x2, x3, x4, x5) = x in
let (y0, y1, y2, y3, y4, y5) = y in
(f x0 y0, f x1 y1, f x2 y2, f x3 y3, f x4 y4, f x5 y5)
let rounds_opaque_6 (init:quad32_6) (round_keys:seq quad32) (rnd:nat{rnd < length round_keys}) : GTot quad32_6 =
map_six_of init (fun x -> eval_rounds x round_keys rnd)
let xor_reverse_inc32lite_6 (n i0:int) (ctr_BE rndkey:quad32) : GTot quad32_6 =
make_six_of (fun i ->
let r = reverse_bytes_quad32 (inc32lite ctr_BE (i0 + i)) in
if i < n then quad32_xor r rndkey else r)
//let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
// count * 6 + 6 <= length s /\ (
// let data = slice s (count * 6) (count * 6 + 6) in
// z3 == reverse_bytes_quad32 (index data 5) /\
// scratch_b_blocks true true scratch_b 8 5 heap3 data)
let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
count * 6 + 6 <= length s /\ (
let data = slice s (count * 6) (count * 6 + 6) in
z3 == reverse_bytes_quad32 (index data 5) /\
buffer128_read scratch_b 3 heap3 == reverse_bytes_quad32 (index data 4) /\
buffer128_read scratch_b 4 heap3 == reverse_bytes_quad32 (index data 3) /\
buffer128_read scratch_b 5 heap3 == reverse_bytes_quad32 (index data 2) /\
buffer128_read scratch_b 6 heap3 == reverse_bytes_quad32 (index data 1) /\
buffer128_read scratch_b 7 heap3 == reverse_bytes_quad32 (index data 0))
//-- Load_two_lsb
val va_code_Load_two_lsb : dst:va_operand_xmm -> Tot va_code
val va_codegen_success_Load_two_lsb : dst:va_operand_xmm -> Tot va_pbool
val va_lemma_Load_two_lsb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_two_lsb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@ va_qattr]
let va_wp_Load_two_lsb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 ==> va_k va_sM (())))
val va_wpProof_Load_two_lsb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_two_lsb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_two_lsb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Load_two_lsb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_two_lsb dst)) =
(va_QProc (va_code_Load_two_lsb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_two_lsb dst) (va_wpProof_Load_two_lsb dst))
//--
//-- Load_one_lsb
val va_code_Load_one_lsb : dst:va_operand_xmm -> Tot va_code
val va_codegen_success_Load_one_lsb : dst:va_operand_xmm -> Tot va_pbool
val va_lemma_Load_one_lsb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_one_lsb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0)))))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Transformers.Transform.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESGCM_expected_code.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
dst: Vale.X64.Decls.va_operand_xmm ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_operand_xmm",
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Vale.X64.Decls.va_is_dst_xmm",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.X64.CPU_Features_s.sse_enabled",
"Prims.l_Forall",
"Vale.X64.Decls.va_value_xmm",
"Vale.X64.Memory.nat64",
"Vale.X64.Flags.t",
"Prims.l_imp",
"Prims.eq2",
"Vale.Def.Words_s.four",
"Vale.Def.Types_s.nat32",
"Vale.X64.Decls.va_eval_xmm",
"Vale.Def.Words_s.Mkfour",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Decls.va_upd_operand_xmm"
] | [] | false | false | false | true | true | let va_wp_Load_one_lsb (dst: va_operand_xmm) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\
(forall (va_x_dst: va_value_xmm) (va_x_r11: nat64) (va_x_efl: Vale.X64.Flags.t).
let va_sM =
va_upd_flags va_x_efl (va_upd_reg64 rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0))
in
va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 ==>
va_k va_sM (()))) | false |
Hacl.Impl.FFDHE.fst | Hacl.Impl.FFDHE.ffdhe_check_pk_st | val ffdhe_check_pk_st : t: Hacl.Bignum.Definitions.limb_t -> a: Spec.FFDHE.ffdhe_alg -> len: Hacl.Impl.FFDHE.size_pos
-> Type0 | let ffdhe_check_pk_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) =
let nLen = blocks len (size (numbytes t)) in
pk_n:lbignum t nLen
-> p_n:lbignum t nLen ->
Stack (limb t)
(requires fun h ->
live h pk_n /\ live h p_n /\ disjoint pk_n p_n /\
v len = S.ffdhe_len a /\
bn_v h p_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)))
(ensures fun h0 m h1 -> modifies0 h0 h1 /\
v m == (if (1 < bn_v h0 pk_n && bn_v h0 pk_n < bn_v h0 p_n - 1) then v (ones t SEC) else 0)) | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 95,
"end_line": 361,
"start_col": 0,
"start_line": 350
} | module Hacl.Impl.FFDHE
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.FFDHE.Constants
open Hacl.Bignum.Definitions
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module S = Spec.FFDHE
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Lemmas = Hacl.Spec.FFDHE.Lemmas
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module BE = Hacl.Bignum.Exponentiation
module SB = Hacl.Spec.Bignum
module SM = Hacl.Spec.Bignum.Montgomery
module SE = Hacl.Spec.Bignum.Exponentiation
module SD = Hacl.Spec.Bignum.Definitions
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let size_pos = x:size_t{v x > 0}
[@CInline]
let ffdhe_len (a:S.ffdhe_alg) : x:size_pos{v x = S.ffdhe_len a} =
allow_inversion S.ffdhe_alg;
match a with
| S.FFDHE2048 -> 256ul
| S.FFDHE3072 -> 384ul
| S.FFDHE4096 -> 512ul
| S.FFDHE6144 -> 768ul
| S.FFDHE8192 -> 1024ul
inline_for_extraction noextract
let get_ffdhe_p (a:S.ffdhe_alg) :x:glbuffer pub_uint8 (ffdhe_len a)
{witnessed x (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) /\ recallable x}
=
allow_inversion S.ffdhe_alg;
match a with
| S.FFDHE2048 -> ffdhe_p2048
| S.FFDHE3072 -> ffdhe_p3072
| S.FFDHE4096 -> ffdhe_p4096
| S.FFDHE6144 -> ffdhe_p6144
| S.FFDHE8192 -> ffdhe_p8192
inline_for_extraction noextract
val ffdhe_p_to_ps:
a:S.ffdhe_alg
-> p_s:lbuffer uint8 (ffdhe_len a) ->
Stack unit
(requires fun h -> live h p_s)
(ensures fun h0 _ h1 -> modifies (loc p_s) h0 h1 /\
BSeq.nat_from_intseq_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) ==
BSeq.nat_from_intseq_be (as_seq h1 p_s))
let ffdhe_p_to_ps a p_s =
let p = get_ffdhe_p a in
recall_contents p (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a));
let len = ffdhe_len a in
mapT len p_s secret p;
BSeq.nat_from_intseq_be_public_to_secret (v len) (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a))
inline_for_extraction noextract
let ffdhe_bn_from_g_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) =
g_n:lbignum t (blocks len (size (numbytes t))) ->
Stack unit
(requires fun h ->
live h g_n /\
v len = S.ffdhe_len a /\
as_seq h g_n == LSeq.create (v (blocks len (size (numbytes t)))) (uint #t 0))
(ensures fun h0 _ h1 -> modifies (loc g_n) h0 h1 /\
bn_v h1 g_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_g (S.get_ffdhe_params a)))
inline_for_extraction noextract
val ffdhe_bn_from_g: #t:limb_t -> a:S.ffdhe_alg -> len:size_pos -> ffdhe_bn_from_g_st t a len
let ffdhe_bn_from_g #t a len g_n =
recall_contents ffdhe_g2 S.ffdhe_g2;
[@inline_let] let nLen = blocks len (size (numbytes t)) in
push_frame ();
let g = create 1ul (u8 0) in
mapT 1ul g secret ffdhe_g2;
BSeq.nat_from_intseq_be_public_to_secret 1 S.ffdhe_g2;
let h0 = ST.get () in
update_sub_f h0 g_n 0ul 1ul
(fun h -> SB.bn_from_bytes_be 1 (as_seq h0 g))
(fun _ -> BN.bn_from_bytes_be 1ul g (sub g_n 0ul 1ul));
let h1 = ST.get () in
SD.bn_eval_update_sub #t 1 (SB.bn_from_bytes_be 1 (as_seq h0 g)) (v nLen);
assert (bn_v h1 g_n == SD.bn_v (SB.bn_from_bytes_be #t 1 (as_seq h0 g)));
SB.bn_from_bytes_be_lemma #t 1 (as_seq h0 g);
assert (bn_v h1 g_n == BSeq.nat_from_bytes_be (as_seq h0 g));
pop_frame ()
inline_for_extraction noextract
let ffdhe_precomp_inv (#t:limb_t) (#len:size_nat{0 < len /\ len + len <= max_size_t})
(a:S.ffdhe_alg) (p_r2_n:SD.lbignum t (len + len))
=
let p_n = LSeq.sub p_r2_n 0 len in
let r2_n = LSeq.sub p_r2_n len len in
SD.bn_v p_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) /\
0 < SD.bn_v p_n /\ SD.bn_v r2_n == pow2 (2 * bits t * len) % SD.bn_v p_n
inline_for_extraction noextract
let ffdhe_precomp_p_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen) ->
Stack unit
(requires fun h ->
live h p_r2_n /\
v len = S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen)
(ensures fun h0 _ h1 -> modifies (loc p_r2_n) h0 h1 /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h1 p_r2_n))
inline_for_extraction noextract
val ffdhe_precomp_p:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t ->
ffdhe_precomp_p_st t a len ke
let ffdhe_precomp_p #t a len ke p_r2_n =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let r2_n = sub p_r2_n nLen nLen in
let p_s = create len (u8 0) in
ffdhe_p_to_ps a p_s;
let h0 = ST.get () in
BN.bn_from_bytes_be len p_s p_n;
let h1 = ST.get () in
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 p_s);
assert (bn_v h1 p_n == BSeq.nat_from_bytes_be (as_seq h0 p_s));
S.ffdhe_p_lemma a;
Lemmas.ffdhe_p_bits_lemma a;
ke.BE.precompr2 (8ul *! len -! 1ul) p_n r2_n;
SM.bn_precomp_r2_mod_n_lemma (8 * v len - 1) (as_seq h1 p_n);
pop_frame ()
inline_for_extraction noextract
let new_ffdhe_precomp_p_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
r:HS.rid ->
ST (B.buffer (limb t))
(requires fun h ->
ST.is_eternal_region r /\
v len = S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen)
(ensures fun h0 res h1 ->
B.(modifies loc_none h0 h1) /\
not (B.g_is_null res) ==> (
B.len res == nLen +! nLen /\
B.(fresh_loc (loc_buffer res) h0 h1) /\
B.(loc_includes (loc_region_only false r) (loc_buffer res)) /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h1 (res <: lbignum t (nLen +! nLen)))))
inline_for_extraction noextract
val new_ffdhe_precomp_p:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_precomp_p:ffdhe_precomp_p_st t a len ke ->
new_ffdhe_precomp_p_st t a len ke
let new_ffdhe_precomp_p #t a len ke ffdhe_precomp_p r =
let h0 = ST.get () in
let nLen = blocks len (size (numbytes t)) in
assert (v (nLen +! nLen) > 0);
let res = LowStar.Monotonic.Buffer.mmalloc_partial r (uint #t #SEC 0) (nLen +! nLen) in
if B.is_null res then
res
else
let h1 = ST.get () in
B.(modifies_only_not_unused_in loc_none h0 h1);
assert (B.len res == nLen +! nLen);
let res: Lib.Buffer.buffer (limb t) = res in
assert (B.length res == v nLen + v nLen);
let res: lbignum t (nLen +! nLen) = res in
ffdhe_precomp_p res;
let h2 = ST.get () in
B.(modifies_only_not_unused_in loc_none h0 h2);
res
inline_for_extraction noextract
let ffdhe_compute_exp_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen)
-> sk_n:lbignum t nLen
-> b_n:lbignum t nLen
-> res:lbuffer uint8 len ->
Stack unit
(requires fun h ->
live h p_r2_n /\ live h sk_n /\ live h b_n /\ live h res /\
disjoint p_r2_n res /\ disjoint sk_n res /\ disjoint b_n res /\
disjoint p_r2_n b_n /\ disjoint p_r2_n sk_n /\
v len == S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h p_r2_n) /\
bn_v h b_n < bn_v h (gsub p_r2_n 0ul nLen) - 1 /\
1 < bn_v h sk_n)
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
(S.ffdhe_p_lemma a;
let res_n = Lib.NatMod.pow_mod #(bn_v h0 (gsub p_r2_n 0ul nLen)) (bn_v h0 b_n) (bn_v h0 sk_n) in
as_seq h1 res == BSeq.nat_to_bytes_be (v len) res_n))
#push-options "--z3rlimit 100"
inline_for_extraction noextract
val ffdhe_compute_exp:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t ->
ffdhe_compute_exp_st t a len ke
let ffdhe_compute_exp #t a len ke p_r2_n sk_n b_n res =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let r2_n = sub p_r2_n nLen nLen in
let res_n = create nLen (uint #t #SEC 0) in
let h1 = ST.get () in
S.ffdhe_p_lemma a;
assert_norm (pow2 4 = 16);
assert_norm (pow2 10 = 1024);
Math.Lemmas.pow2_plus 4 10;
Math.Lemmas.pow2_lt_compat 32 14;
SD.bn_eval_bound #t (as_seq h1 sk_n) (v nLen);
BE.mk_bn_mod_exp_precompr2 nLen ke.BE.exp_ct_precomp p_n r2_n b_n (size (bits t) *! nLen) sk_n res_n; //b_n ^ sk_n % p_n
let h2 = ST.get () in
BN.bn_to_bytes_be len res_n res;
SB.bn_to_bytes_be_lemma (v len) (as_seq h2 res_n);
pop_frame ()
#pop-options
inline_for_extraction noextract
let ffdhe_secret_to_public_precomp_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen)
-> sk:lbuffer uint8 len
-> pk:lbuffer uint8 len ->
Stack unit
(requires fun h ->
live h sk /\ live h pk /\ live h p_r2_n /\
disjoint sk pk /\ disjoint sk p_r2_n /\ disjoint pk p_r2_n /\
v len == S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen /\
1 < Lib.ByteSequence.nat_from_bytes_be (as_seq h sk) /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h p_r2_n))
(ensures fun h0 _ h1 -> modifies (loc pk) h0 h1 /\
as_seq h1 pk == S.ffdhe_secret_to_public a (as_seq h0 sk))
//TODO: pass sBits?
inline_for_extraction noextract
val ffdhe_secret_to_public_precomp:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_compute_exp:ffdhe_compute_exp_st t a len ke ->
ffdhe_secret_to_public_precomp_st t a len ke
let ffdhe_secret_to_public_precomp #t a len ke ffdhe_compute_exp p_r2_n sk pk =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let g_n = create nLen (uint #t #SEC 0) in
ffdhe_bn_from_g a len g_n;
let sk_n = create nLen (uint #t #SEC 0) in
let h0 = ST.get () in
BN.bn_from_bytes_be len sk sk_n;
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 sk);
S.ffdhe_g2_lemma ();
S.ffdhe_p_lemma a;
ffdhe_compute_exp p_r2_n sk_n g_n pk;
pop_frame ()
inline_for_extraction noextract
let ffdhe_secret_to_public_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
sk:lbuffer uint8 len
-> pk:lbuffer uint8 len ->
Stack unit
(requires fun h ->
live h sk /\ live h pk /\ disjoint sk pk /\
v len == S.ffdhe_len a /\
ke.BE.bn.BN.len == blocks len (size (numbytes t)) /\
1 < Lib.ByteSequence.nat_from_bytes_be (as_seq h sk))
(ensures fun h0 _ h1 -> modifies (loc pk) h0 h1 /\
as_seq h1 pk == S.ffdhe_secret_to_public a (as_seq h0 sk))
//TODO: pass sBits?
inline_for_extraction noextract
val ffdhe_secret_to_public:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_secret_to_public_precomp:ffdhe_secret_to_public_precomp_st t a len ke
-> ffdhe_precomp_p:ffdhe_precomp_p_st t a len ke ->
ffdhe_secret_to_public_st t a len ke
let ffdhe_secret_to_public #t a len ke ffdhe_secret_to_public_precomp ffdhe_precomp_p sk pk =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_r2_n = create (nLen +! nLen) (uint #t #SEC 0) in
ffdhe_precomp_p p_r2_n;
ffdhe_secret_to_public_precomp p_r2_n sk pk;
pop_frame () | {
"checked_file": "/",
"dependencies": [
"Spec.FFDHE.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.FFDHE.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.Exponentiation.fsti.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"Hacl.Impl.FFDHE.Constants.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Base.fst.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.FFDHE.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Exponentiation",
"short_module": "SE"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "SM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "SB"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.FFDHE.Lemmas",
"short_module": "Lemmas"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "Spec.FFDHE",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.FFDHE.Constants",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: Hacl.Bignum.Definitions.limb_t -> a: Spec.FFDHE.ffdhe_alg -> len: Hacl.Impl.FFDHE.size_pos
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Definitions.limb_t",
"Spec.FFDHE.ffdhe_alg",
"Hacl.Impl.FFDHE.size_pos",
"Hacl.Bignum.Definitions.lbignum",
"Hacl.Bignum.Definitions.limb",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_and",
"Lib.Buffer.live",
"Lib.Buffer.MUT",
"Lib.Buffer.disjoint",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Lib.IntTypes.U32",
"Prims.op_GreaterThan",
"Prims.op_LessThanOrEqual",
"Lib.IntTypes.max_size_t",
"Lib.IntTypes.v",
"Lib.IntTypes.PUB",
"Spec.FFDHE.ffdhe_len",
"Prims.eq2",
"Prims.nat",
"Hacl.Bignum.Definitions.bn_v",
"Lib.ByteSequence.nat_from_bytes_be",
"Spec.FFDHE.__proj__Mk_ffdhe_params__item__ffdhe_p",
"Spec.FFDHE.get_ffdhe_params",
"Lib.Buffer.modifies0",
"Lib.IntTypes.SEC",
"Prims.op_AmpAmp",
"Prims.op_LessThan",
"Prims.op_Subtraction",
"Lib.IntTypes.ones",
"Prims.bool",
"Lib.IntTypes.int_t",
"Prims.pow2",
"Prims.op_Multiply",
"Lib.IntTypes.mk_int",
"Lib.IntTypes.numbytes",
"Hacl.Spec.Bignum.Definitions.blocks",
"Hacl.Bignum.Definitions.blocks",
"Lib.IntTypes.size"
] | [] | false | false | false | true | true | let ffdhe_check_pk_st (t: limb_t) (a: S.ffdhe_alg) (len: size_pos) =
| let nLen = blocks len (size (numbytes t)) in
pk_n: lbignum t nLen -> p_n: lbignum t nLen
-> Stack (limb t)
(requires
fun h ->
live h pk_n /\ live h p_n /\ disjoint pk_n p_n /\ v len = S.ffdhe_len a /\
bn_v h p_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)))
(ensures
fun h0 m h1 ->
modifies0 h0 h1 /\
v m ==
(if (1 < bn_v h0 pk_n && bn_v h0 pk_n < bn_v h0 p_n - 1) then v (ones t SEC) else 0)) | false |
|
Vale.AES.X64.AESopt.fsti | Vale.AES.X64.AESopt.va_wp_Load_two_lsb | val va_wp_Load_two_lsb (dst: va_operand_xmm) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_Load_two_lsb (dst: va_operand_xmm) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_Load_two_lsb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 88,
"end_line": 118,
"start_col": 0,
"start_line": 113
} | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let aes_reqs0
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ pclmulqdq_enabled /\ avx_enabled /\
alg = AES_128 /\
//(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
buffer128_as_seq heap0 keys_b == round_keys
let aes_reqs_offset
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ avx_enabled /\ pclmulqdq_enabled /\
(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
s128 heap0 keys_b == round_keys
let six_of (a:Type0) = a & a & a & a & a & a
let quad32_6 = six_of quad32
unfold let make_six_of (#a:Type0) (f:(n:nat{n < 6}) -> GTot a) : GTot (six_of a) =
(f 0, f 1, f 2, f 3, f 4, f 5)
unfold let map_six_of (#a #b:Type0) (x:six_of a) (f:a -> GTot b) : GTot (six_of b) =
let (x0, x1, x2, x3, x4, x5) = x in
(f x0, f x1, f x2, f x3, f x4, f x5)
unfold let map2_six_of (#a #b #c:Type0) (x:six_of a) (y:six_of b) (f:a -> b -> GTot c) : GTot (six_of c) =
let (x0, x1, x2, x3, x4, x5) = x in
let (y0, y1, y2, y3, y4, y5) = y in
(f x0 y0, f x1 y1, f x2 y2, f x3 y3, f x4 y4, f x5 y5)
let rounds_opaque_6 (init:quad32_6) (round_keys:seq quad32) (rnd:nat{rnd < length round_keys}) : GTot quad32_6 =
map_six_of init (fun x -> eval_rounds x round_keys rnd)
let xor_reverse_inc32lite_6 (n i0:int) (ctr_BE rndkey:quad32) : GTot quad32_6 =
make_six_of (fun i ->
let r = reverse_bytes_quad32 (inc32lite ctr_BE (i0 + i)) in
if i < n then quad32_xor r rndkey else r)
//let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
// count * 6 + 6 <= length s /\ (
// let data = slice s (count * 6) (count * 6 + 6) in
// z3 == reverse_bytes_quad32 (index data 5) /\
// scratch_b_blocks true true scratch_b 8 5 heap3 data)
let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
count * 6 + 6 <= length s /\ (
let data = slice s (count * 6) (count * 6 + 6) in
z3 == reverse_bytes_quad32 (index data 5) /\
buffer128_read scratch_b 3 heap3 == reverse_bytes_quad32 (index data 4) /\
buffer128_read scratch_b 4 heap3 == reverse_bytes_quad32 (index data 3) /\
buffer128_read scratch_b 5 heap3 == reverse_bytes_quad32 (index data 2) /\
buffer128_read scratch_b 6 heap3 == reverse_bytes_quad32 (index data 1) /\
buffer128_read scratch_b 7 heap3 == reverse_bytes_quad32 (index data 0))
//-- Load_two_lsb
val va_code_Load_two_lsb : dst:va_operand_xmm -> Tot va_code
val va_codegen_success_Load_two_lsb : dst:va_operand_xmm -> Tot va_pbool
val va_lemma_Load_two_lsb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_two_lsb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0)))))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Transformers.Transform.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESGCM_expected_code.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
dst: Vale.X64.Decls.va_operand_xmm ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_operand_xmm",
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Vale.X64.Decls.va_is_dst_xmm",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.X64.CPU_Features_s.sse_enabled",
"Prims.l_Forall",
"Vale.X64.Decls.va_value_xmm",
"Vale.X64.Memory.nat64",
"Vale.X64.Flags.t",
"Prims.l_imp",
"Prims.eq2",
"Vale.Def.Words_s.four",
"Vale.Def.Types_s.nat32",
"Vale.X64.Decls.va_eval_xmm",
"Vale.Def.Words_s.Mkfour",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Decls.va_upd_operand_xmm"
] | [] | false | false | false | true | true | let va_wp_Load_two_lsb (dst: va_operand_xmm) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\
(forall (va_x_dst: va_value_xmm) (va_x_r11: nat64) (va_x_efl: Vale.X64.Flags.t).
let va_sM =
va_upd_flags va_x_efl (va_upd_reg64 rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0))
in
va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 ==>
va_k va_sM (()))) | false |
OPLSS.HMACSHA1.fst | OPLSS.HMACSHA1.keysize | val keysize : Prims.int | let keysize = 64 | {
"file_name": "examples/crypto/OPLSS.HMACSHA1.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 18,
"end_line": 19,
"start_col": 0,
"start_line": 19
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module OPLSS.HMACSHA1
open OPLSS | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"OPLSS.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "OPLSS.HMACSHA1.fst"
} | [
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.int | Prims.Tot | [
"total"
] | [] | [] | [] | false | false | false | true | false | let keysize =
| 64 | false |
|
Hacl.Impl.FFDHE.fst | Hacl.Impl.FFDHE.ffdhe_shared_secret_precomp_st | val ffdhe_shared_secret_precomp_st : t: Hacl.Bignum.Definitions.limb_t ->
a: Spec.FFDHE.ffdhe_alg ->
len: Hacl.Impl.FFDHE.size_pos ->
ke: Hacl.Bignum.Exponentiation.exp t
-> Type0 | let ffdhe_shared_secret_precomp_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen)
-> sk:lbuffer uint8 len
-> pk:lbuffer uint8 len
-> ss:lbuffer uint8 len ->
Stack (limb t)
(requires fun h ->
live h sk /\ live h pk /\ live h ss /\ live h p_r2_n /\
disjoint sk pk /\ disjoint sk ss /\ disjoint pk ss /\
disjoint p_r2_n ss /\ disjoint p_r2_n pk /\ disjoint p_r2_n sk /\
v len = S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen /\
1 < Lib.ByteSequence.nat_from_bytes_be (as_seq h sk) /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h p_r2_n))
(ensures fun h0 m h1 -> modifies (loc ss) h0 h1 /\
(let ss_s = S.ffdhe_shared_secret a (as_seq h0 sk) (as_seq h0 pk) in
if v m = v (ones t SEC) then Some? ss_s /\ as_seq h1 ss == Some?.v ss_s else None? ss_s)) | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 93,
"end_line": 412,
"start_col": 0,
"start_line": 395
} | module Hacl.Impl.FFDHE
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.FFDHE.Constants
open Hacl.Bignum.Definitions
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module S = Spec.FFDHE
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Lemmas = Hacl.Spec.FFDHE.Lemmas
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module BE = Hacl.Bignum.Exponentiation
module SB = Hacl.Spec.Bignum
module SM = Hacl.Spec.Bignum.Montgomery
module SE = Hacl.Spec.Bignum.Exponentiation
module SD = Hacl.Spec.Bignum.Definitions
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let size_pos = x:size_t{v x > 0}
[@CInline]
let ffdhe_len (a:S.ffdhe_alg) : x:size_pos{v x = S.ffdhe_len a} =
allow_inversion S.ffdhe_alg;
match a with
| S.FFDHE2048 -> 256ul
| S.FFDHE3072 -> 384ul
| S.FFDHE4096 -> 512ul
| S.FFDHE6144 -> 768ul
| S.FFDHE8192 -> 1024ul
inline_for_extraction noextract
let get_ffdhe_p (a:S.ffdhe_alg) :x:glbuffer pub_uint8 (ffdhe_len a)
{witnessed x (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) /\ recallable x}
=
allow_inversion S.ffdhe_alg;
match a with
| S.FFDHE2048 -> ffdhe_p2048
| S.FFDHE3072 -> ffdhe_p3072
| S.FFDHE4096 -> ffdhe_p4096
| S.FFDHE6144 -> ffdhe_p6144
| S.FFDHE8192 -> ffdhe_p8192
inline_for_extraction noextract
val ffdhe_p_to_ps:
a:S.ffdhe_alg
-> p_s:lbuffer uint8 (ffdhe_len a) ->
Stack unit
(requires fun h -> live h p_s)
(ensures fun h0 _ h1 -> modifies (loc p_s) h0 h1 /\
BSeq.nat_from_intseq_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) ==
BSeq.nat_from_intseq_be (as_seq h1 p_s))
let ffdhe_p_to_ps a p_s =
let p = get_ffdhe_p a in
recall_contents p (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a));
let len = ffdhe_len a in
mapT len p_s secret p;
BSeq.nat_from_intseq_be_public_to_secret (v len) (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a))
inline_for_extraction noextract
let ffdhe_bn_from_g_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) =
g_n:lbignum t (blocks len (size (numbytes t))) ->
Stack unit
(requires fun h ->
live h g_n /\
v len = S.ffdhe_len a /\
as_seq h g_n == LSeq.create (v (blocks len (size (numbytes t)))) (uint #t 0))
(ensures fun h0 _ h1 -> modifies (loc g_n) h0 h1 /\
bn_v h1 g_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_g (S.get_ffdhe_params a)))
inline_for_extraction noextract
val ffdhe_bn_from_g: #t:limb_t -> a:S.ffdhe_alg -> len:size_pos -> ffdhe_bn_from_g_st t a len
let ffdhe_bn_from_g #t a len g_n =
recall_contents ffdhe_g2 S.ffdhe_g2;
[@inline_let] let nLen = blocks len (size (numbytes t)) in
push_frame ();
let g = create 1ul (u8 0) in
mapT 1ul g secret ffdhe_g2;
BSeq.nat_from_intseq_be_public_to_secret 1 S.ffdhe_g2;
let h0 = ST.get () in
update_sub_f h0 g_n 0ul 1ul
(fun h -> SB.bn_from_bytes_be 1 (as_seq h0 g))
(fun _ -> BN.bn_from_bytes_be 1ul g (sub g_n 0ul 1ul));
let h1 = ST.get () in
SD.bn_eval_update_sub #t 1 (SB.bn_from_bytes_be 1 (as_seq h0 g)) (v nLen);
assert (bn_v h1 g_n == SD.bn_v (SB.bn_from_bytes_be #t 1 (as_seq h0 g)));
SB.bn_from_bytes_be_lemma #t 1 (as_seq h0 g);
assert (bn_v h1 g_n == BSeq.nat_from_bytes_be (as_seq h0 g));
pop_frame ()
inline_for_extraction noextract
let ffdhe_precomp_inv (#t:limb_t) (#len:size_nat{0 < len /\ len + len <= max_size_t})
(a:S.ffdhe_alg) (p_r2_n:SD.lbignum t (len + len))
=
let p_n = LSeq.sub p_r2_n 0 len in
let r2_n = LSeq.sub p_r2_n len len in
SD.bn_v p_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) /\
0 < SD.bn_v p_n /\ SD.bn_v r2_n == pow2 (2 * bits t * len) % SD.bn_v p_n
inline_for_extraction noextract
let ffdhe_precomp_p_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen) ->
Stack unit
(requires fun h ->
live h p_r2_n /\
v len = S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen)
(ensures fun h0 _ h1 -> modifies (loc p_r2_n) h0 h1 /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h1 p_r2_n))
inline_for_extraction noextract
val ffdhe_precomp_p:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t ->
ffdhe_precomp_p_st t a len ke
let ffdhe_precomp_p #t a len ke p_r2_n =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let r2_n = sub p_r2_n nLen nLen in
let p_s = create len (u8 0) in
ffdhe_p_to_ps a p_s;
let h0 = ST.get () in
BN.bn_from_bytes_be len p_s p_n;
let h1 = ST.get () in
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 p_s);
assert (bn_v h1 p_n == BSeq.nat_from_bytes_be (as_seq h0 p_s));
S.ffdhe_p_lemma a;
Lemmas.ffdhe_p_bits_lemma a;
ke.BE.precompr2 (8ul *! len -! 1ul) p_n r2_n;
SM.bn_precomp_r2_mod_n_lemma (8 * v len - 1) (as_seq h1 p_n);
pop_frame ()
inline_for_extraction noextract
let new_ffdhe_precomp_p_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
r:HS.rid ->
ST (B.buffer (limb t))
(requires fun h ->
ST.is_eternal_region r /\
v len = S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen)
(ensures fun h0 res h1 ->
B.(modifies loc_none h0 h1) /\
not (B.g_is_null res) ==> (
B.len res == nLen +! nLen /\
B.(fresh_loc (loc_buffer res) h0 h1) /\
B.(loc_includes (loc_region_only false r) (loc_buffer res)) /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h1 (res <: lbignum t (nLen +! nLen)))))
inline_for_extraction noextract
val new_ffdhe_precomp_p:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_precomp_p:ffdhe_precomp_p_st t a len ke ->
new_ffdhe_precomp_p_st t a len ke
let new_ffdhe_precomp_p #t a len ke ffdhe_precomp_p r =
let h0 = ST.get () in
let nLen = blocks len (size (numbytes t)) in
assert (v (nLen +! nLen) > 0);
let res = LowStar.Monotonic.Buffer.mmalloc_partial r (uint #t #SEC 0) (nLen +! nLen) in
if B.is_null res then
res
else
let h1 = ST.get () in
B.(modifies_only_not_unused_in loc_none h0 h1);
assert (B.len res == nLen +! nLen);
let res: Lib.Buffer.buffer (limb t) = res in
assert (B.length res == v nLen + v nLen);
let res: lbignum t (nLen +! nLen) = res in
ffdhe_precomp_p res;
let h2 = ST.get () in
B.(modifies_only_not_unused_in loc_none h0 h2);
res
inline_for_extraction noextract
let ffdhe_compute_exp_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen)
-> sk_n:lbignum t nLen
-> b_n:lbignum t nLen
-> res:lbuffer uint8 len ->
Stack unit
(requires fun h ->
live h p_r2_n /\ live h sk_n /\ live h b_n /\ live h res /\
disjoint p_r2_n res /\ disjoint sk_n res /\ disjoint b_n res /\
disjoint p_r2_n b_n /\ disjoint p_r2_n sk_n /\
v len == S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h p_r2_n) /\
bn_v h b_n < bn_v h (gsub p_r2_n 0ul nLen) - 1 /\
1 < bn_v h sk_n)
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
(S.ffdhe_p_lemma a;
let res_n = Lib.NatMod.pow_mod #(bn_v h0 (gsub p_r2_n 0ul nLen)) (bn_v h0 b_n) (bn_v h0 sk_n) in
as_seq h1 res == BSeq.nat_to_bytes_be (v len) res_n))
#push-options "--z3rlimit 100"
inline_for_extraction noextract
val ffdhe_compute_exp:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t ->
ffdhe_compute_exp_st t a len ke
let ffdhe_compute_exp #t a len ke p_r2_n sk_n b_n res =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let r2_n = sub p_r2_n nLen nLen in
let res_n = create nLen (uint #t #SEC 0) in
let h1 = ST.get () in
S.ffdhe_p_lemma a;
assert_norm (pow2 4 = 16);
assert_norm (pow2 10 = 1024);
Math.Lemmas.pow2_plus 4 10;
Math.Lemmas.pow2_lt_compat 32 14;
SD.bn_eval_bound #t (as_seq h1 sk_n) (v nLen);
BE.mk_bn_mod_exp_precompr2 nLen ke.BE.exp_ct_precomp p_n r2_n b_n (size (bits t) *! nLen) sk_n res_n; //b_n ^ sk_n % p_n
let h2 = ST.get () in
BN.bn_to_bytes_be len res_n res;
SB.bn_to_bytes_be_lemma (v len) (as_seq h2 res_n);
pop_frame ()
#pop-options
inline_for_extraction noextract
let ffdhe_secret_to_public_precomp_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen)
-> sk:lbuffer uint8 len
-> pk:lbuffer uint8 len ->
Stack unit
(requires fun h ->
live h sk /\ live h pk /\ live h p_r2_n /\
disjoint sk pk /\ disjoint sk p_r2_n /\ disjoint pk p_r2_n /\
v len == S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen /\
1 < Lib.ByteSequence.nat_from_bytes_be (as_seq h sk) /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h p_r2_n))
(ensures fun h0 _ h1 -> modifies (loc pk) h0 h1 /\
as_seq h1 pk == S.ffdhe_secret_to_public a (as_seq h0 sk))
//TODO: pass sBits?
inline_for_extraction noextract
val ffdhe_secret_to_public_precomp:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_compute_exp:ffdhe_compute_exp_st t a len ke ->
ffdhe_secret_to_public_precomp_st t a len ke
let ffdhe_secret_to_public_precomp #t a len ke ffdhe_compute_exp p_r2_n sk pk =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let g_n = create nLen (uint #t #SEC 0) in
ffdhe_bn_from_g a len g_n;
let sk_n = create nLen (uint #t #SEC 0) in
let h0 = ST.get () in
BN.bn_from_bytes_be len sk sk_n;
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 sk);
S.ffdhe_g2_lemma ();
S.ffdhe_p_lemma a;
ffdhe_compute_exp p_r2_n sk_n g_n pk;
pop_frame ()
inline_for_extraction noextract
let ffdhe_secret_to_public_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
sk:lbuffer uint8 len
-> pk:lbuffer uint8 len ->
Stack unit
(requires fun h ->
live h sk /\ live h pk /\ disjoint sk pk /\
v len == S.ffdhe_len a /\
ke.BE.bn.BN.len == blocks len (size (numbytes t)) /\
1 < Lib.ByteSequence.nat_from_bytes_be (as_seq h sk))
(ensures fun h0 _ h1 -> modifies (loc pk) h0 h1 /\
as_seq h1 pk == S.ffdhe_secret_to_public a (as_seq h0 sk))
//TODO: pass sBits?
inline_for_extraction noextract
val ffdhe_secret_to_public:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_secret_to_public_precomp:ffdhe_secret_to_public_precomp_st t a len ke
-> ffdhe_precomp_p:ffdhe_precomp_p_st t a len ke ->
ffdhe_secret_to_public_st t a len ke
let ffdhe_secret_to_public #t a len ke ffdhe_secret_to_public_precomp ffdhe_precomp_p sk pk =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_r2_n = create (nLen +! nLen) (uint #t #SEC 0) in
ffdhe_precomp_p p_r2_n;
ffdhe_secret_to_public_precomp p_r2_n sk pk;
pop_frame ()
inline_for_extraction noextract
let ffdhe_check_pk_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) =
let nLen = blocks len (size (numbytes t)) in
pk_n:lbignum t nLen
-> p_n:lbignum t nLen ->
Stack (limb t)
(requires fun h ->
live h pk_n /\ live h p_n /\ disjoint pk_n p_n /\
v len = S.ffdhe_len a /\
bn_v h p_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)))
(ensures fun h0 m h1 -> modifies0 h0 h1 /\
v m == (if (1 < bn_v h0 pk_n && bn_v h0 pk_n < bn_v h0 p_n - 1) then v (ones t SEC) else 0))
inline_for_extraction noextract
val ffdhe_check_pk: #t:limb_t -> a:S.ffdhe_alg -> len:size_pos -> ffdhe_check_pk_st t a len
let ffdhe_check_pk #t a len pk_n p_n =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n1 = create nLen (uint #t #SEC 0) in
let h0 = ST.get () in
let c = BN.bn_sub1 nLen p_n (uint #t 1) p_n1 in
SB.bn_sub1_lemma (as_seq h0 p_n) (uint #t 1);
let h1 = ST.get () in
S.ffdhe_p_lemma a;
SD.bn_eval_bound (as_seq h1 p_n1) (v nLen);
assert (bn_v h1 p_n1 == bn_v h0 p_n - 1);
let m0 = BN.bn_gt_pow2_mask nLen pk_n 0ul in
SB.bn_gt_pow2_mask_lemma (as_seq h1 pk_n) 0;
assert_norm (pow2 0 = 1);
assert (if v m0 = 0 then 1 >= bn_v h1 pk_n else 1 < bn_v h1 pk_n);
let m1 = BN.bn_lt_mask nLen pk_n p_n1 in
SB.bn_lt_mask_lemma (as_seq h1 pk_n) (as_seq h1 p_n1);
assert (if v m1 = 0 then bn_v h1 pk_n >= bn_v h1 p_n1 else bn_v h1 pk_n < bn_v h1 p_n1);
let m = m0 &. m1 in
logand_lemma m0 m1;
pop_frame ();
m | {
"checked_file": "/",
"dependencies": [
"Spec.FFDHE.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.FFDHE.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.Exponentiation.fsti.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"Hacl.Impl.FFDHE.Constants.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Base.fst.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.FFDHE.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Exponentiation",
"short_module": "SE"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "SM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "SB"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.FFDHE.Lemmas",
"short_module": "Lemmas"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "Spec.FFDHE",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.FFDHE.Constants",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
t: Hacl.Bignum.Definitions.limb_t ->
a: Spec.FFDHE.ffdhe_alg ->
len: Hacl.Impl.FFDHE.size_pos ->
ke: Hacl.Bignum.Exponentiation.exp t
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Definitions.limb_t",
"Spec.FFDHE.ffdhe_alg",
"Hacl.Impl.FFDHE.size_pos",
"Hacl.Bignum.Exponentiation.exp",
"Hacl.Bignum.Definitions.lbignum",
"Lib.IntTypes.op_Plus_Bang",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"Hacl.Bignum.Definitions.limb",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_and",
"Lib.Buffer.live",
"Lib.Buffer.MUT",
"Lib.Buffer.disjoint",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Prims.op_GreaterThan",
"Prims.op_LessThanOrEqual",
"Lib.IntTypes.max_size_t",
"Lib.IntTypes.v",
"Spec.FFDHE.ffdhe_len",
"Prims.eq2",
"Lib.IntTypes.size_t",
"FStar.Mul.op_Star",
"Lib.IntTypes.size",
"Lib.IntTypes.numbytes",
"Hacl.Spec.Bignum.Definitions.blocks",
"Prims.op_LessThan",
"Lib.IntTypes.bits",
"Hacl.Bignum.__proj__Mkbn__item__len",
"Hacl.Bignum.Exponentiation.__proj__Mkexp__item__bn",
"Lib.ByteSequence.nat_from_bytes_be",
"Lib.IntTypes.SEC",
"Lib.Buffer.as_seq",
"Hacl.Impl.FFDHE.ffdhe_precomp_inv",
"Lib.Buffer.modifies",
"Lib.Buffer.loc",
"Lib.IntTypes.range_t",
"Lib.IntTypes.ones",
"FStar.Pervasives.Native.uu___is_Some",
"Lib.Sequence.lseq",
"Lib.Sequence.seq",
"Prims.nat",
"FStar.Seq.Base.length",
"FStar.Pervasives.Native.__proj__Some__item__v",
"Prims.bool",
"FStar.Pervasives.Native.uu___is_None",
"Prims.logical",
"FStar.Pervasives.Native.option",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Spec.FFDHE.ffdhe_shared_secret",
"Prims.op_Subtraction",
"Prims.pow2",
"Prims.op_Multiply",
"Lib.IntTypes.mk_int",
"Hacl.Bignum.Definitions.blocks"
] | [] | false | false | false | false | true | let ffdhe_shared_secret_precomp_st (t: limb_t) (a: S.ffdhe_alg) (len: size_pos) (ke: BE.exp t) =
| let nLen = blocks len (size (numbytes t)) in
p_r2_n: lbignum t (nLen +! nLen) ->
sk: lbuffer uint8 len ->
pk: lbuffer uint8 len ->
ss: lbuffer uint8 len
-> Stack (limb t)
(requires
fun h ->
live h sk /\ live h pk /\ live h ss /\ live h p_r2_n /\ disjoint sk pk /\ disjoint sk ss /\
disjoint pk ss /\ disjoint p_r2_n ss /\ disjoint p_r2_n pk /\ disjoint p_r2_n sk /\
v len = S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen /\
1 < Lib.ByteSequence.nat_from_bytes_be (as_seq h sk) /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h p_r2_n))
(ensures
fun h0 m h1 ->
modifies (loc ss) h0 h1 /\
(let ss_s = S.ffdhe_shared_secret a (as_seq h0 sk) (as_seq h0 pk) in
if v m = v (ones t SEC) then Some? ss_s /\ as_seq h1 ss == Some?.v ss_s else None? ss_s)
) | false |
|
OPLSS.HMACSHA1.fst | OPLSS.HMACSHA1.blocksize | val blocksize : Prims.int | let blocksize = keysize | {
"file_name": "examples/crypto/OPLSS.HMACSHA1.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 23,
"end_line": 20,
"start_col": 0,
"start_line": 20
} | (*
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 OPLSS.HMACSHA1
open OPLSS | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"OPLSS.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "OPLSS.HMACSHA1.fst"
} | [
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.int | Prims.Tot | [
"total"
] | [] | [
"OPLSS.HMACSHA1.keysize"
] | [] | false | false | false | true | false | let blocksize =
| keysize | false |
|
Cert.ACLs.fst | Cert.ACLs.publicFile | val publicFile : _: Prims.string -> Prims.bool | let publicFile = function
| "C:/public/README" -> true
| _ -> false | {
"file_name": "examples/crypto/Cert.ACLs.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 14,
"end_line": 29,
"start_col": 0,
"start_line": 27
} | (*
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 Cert.ACLs
open FStar.All
open FStar.String
open FStar.List.Tot
type file = string
let canWrite = function
| "C:/temp/tempfile" -> true
| _ -> false | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.String.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Cert.ACLs.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.String",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "Cert",
"short_module": null
},
{
"abbrev": false,
"full_module": "Cert",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.string -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Prims.string",
"Prims.bool"
] | [] | false | false | false | true | false | let publicFile =
| function
| "C:/public/README" -> true
| _ -> false | false |
|
Cert.ACLs.fst | Cert.ACLs.readme | val readme : Prims.string | let readme = "C:/public/README" | {
"file_name": "examples/crypto/Cert.ACLs.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 31,
"end_line": 42,
"start_col": 0,
"start_line": 42
} | (*
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 Cert.ACLs
open FStar.All
open FStar.String
open FStar.List.Tot
type file = string
let canWrite = function
| "C:/temp/tempfile" -> true
| _ -> false
let publicFile = function
| "C:/public/README" -> true
| _ -> false
let canRead (f:file) =
canWrite f (* 1. writeable files are also readable *)
|| publicFile f (* 2. public files are readable *)
|| f="C:/acls2.fst" (* and so is this file *)
(* two dangerous primitives *)
assume val read: file:string{canRead file} -> string
assume val delete: file:string{canWrite file} -> unit
(* some sample files, one of them writable *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.String.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Cert.ACLs.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.String",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "Cert",
"short_module": null
},
{
"abbrev": false,
"full_module": "Cert",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.string | Prims.Tot | [
"total"
] | [] | [] | [] | false | false | false | true | false | let readme =
| "C:/public/README" | false |
|
Cert.ACLs.fst | Cert.ACLs.tmp | val tmp : Prims.string | let tmp = "C:/temp/tempfile" | {
"file_name": "examples/crypto/Cert.ACLs.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 31,
"end_line": 43,
"start_col": 0,
"start_line": 43
} | (*
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 Cert.ACLs
open FStar.All
open FStar.String
open FStar.List.Tot
type file = string
let canWrite = function
| "C:/temp/tempfile" -> true
| _ -> false
let publicFile = function
| "C:/public/README" -> true
| _ -> false
let canRead (f:file) =
canWrite f (* 1. writeable files are also readable *)
|| publicFile f (* 2. public files are readable *)
|| f="C:/acls2.fst" (* and so is this file *)
(* two dangerous primitives *)
assume val read: file:string{canRead file} -> string
assume val delete: file:string{canWrite file} -> unit
(* some sample files, one of them writable *)
let pwd = "C:/etc/password" | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.String.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Cert.ACLs.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.String",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "Cert",
"short_module": null
},
{
"abbrev": false,
"full_module": "Cert",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.string | Prims.Tot | [
"total"
] | [] | [] | [] | false | false | false | true | false | let tmp =
| "C:/temp/tempfile" | false |
|
Cert.ACLs.fst | Cert.ACLs.canWrite | val canWrite : _: Prims.string -> Prims.bool | let canWrite = function
| "C:/temp/tempfile" -> true
| _ -> false | {
"file_name": "examples/crypto/Cert.ACLs.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 14,
"end_line": 25,
"start_col": 0,
"start_line": 23
} | (*
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 Cert.ACLs
open FStar.All
open FStar.String
open FStar.List.Tot
type file = string | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.String.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Cert.ACLs.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.String",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "Cert",
"short_module": null
},
{
"abbrev": false,
"full_module": "Cert",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.string -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Prims.string",
"Prims.bool"
] | [] | false | false | false | true | false | let canWrite =
| function
| "C:/temp/tempfile" -> true
| _ -> false | false |
|
Cert.ACLs.fst | Cert.ACLs.pwd | val pwd : Prims.string | let pwd = "C:/etc/password" | {
"file_name": "examples/crypto/Cert.ACLs.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 30,
"end_line": 41,
"start_col": 0,
"start_line": 41
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Cert.ACLs
open FStar.All
open FStar.String
open FStar.List.Tot
type file = string
let canWrite = function
| "C:/temp/tempfile" -> true
| _ -> false
let publicFile = function
| "C:/public/README" -> true
| _ -> false
let canRead (f:file) =
canWrite f (* 1. writeable files are also readable *)
|| publicFile f (* 2. public files are readable *)
|| f="C:/acls2.fst" (* and so is this file *)
(* two dangerous primitives *)
assume val read: file:string{canRead file} -> string
assume val delete: file:string{canWrite file} -> unit | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.String.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Cert.ACLs.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.String",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "Cert",
"short_module": null
},
{
"abbrev": false,
"full_module": "Cert",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.string | Prims.Tot | [
"total"
] | [] | [] | [] | false | false | false | true | false | let pwd =
| "C:/etc/password" | false |
|
OPLSS.HMACSHA1.fst | OPLSS.HMACSHA1.macsize | val macsize : Prims.int | let macsize = 20 | {
"file_name": "examples/crypto/OPLSS.HMACSHA1.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 18,
"end_line": 21,
"start_col": 0,
"start_line": 21
} | (*
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 OPLSS.HMACSHA1
open OPLSS
let keysize = 64 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"OPLSS.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "OPLSS.HMACSHA1.fst"
} | [
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.int | Prims.Tot | [
"total"
] | [] | [] | [] | false | false | false | true | false | let macsize =
| 20 | false |
|
Hacl.Impl.FFDHE.fst | Hacl.Impl.FFDHE.ffdhe_bn_from_g | val ffdhe_bn_from_g: #t:limb_t -> a:S.ffdhe_alg -> len:size_pos -> ffdhe_bn_from_g_st t a len | val ffdhe_bn_from_g: #t:limb_t -> a:S.ffdhe_alg -> len:size_pos -> ffdhe_bn_from_g_st t a len | let ffdhe_bn_from_g #t a len g_n =
recall_contents ffdhe_g2 S.ffdhe_g2;
[@inline_let] let nLen = blocks len (size (numbytes t)) in
push_frame ();
let g = create 1ul (u8 0) in
mapT 1ul g secret ffdhe_g2;
BSeq.nat_from_intseq_be_public_to_secret 1 S.ffdhe_g2;
let h0 = ST.get () in
update_sub_f h0 g_n 0ul 1ul
(fun h -> SB.bn_from_bytes_be 1 (as_seq h0 g))
(fun _ -> BN.bn_from_bytes_be 1ul g (sub g_n 0ul 1ul));
let h1 = ST.get () in
SD.bn_eval_update_sub #t 1 (SB.bn_from_bytes_be 1 (as_seq h0 g)) (v nLen);
assert (bn_v h1 g_n == SD.bn_v (SB.bn_from_bytes_be #t 1 (as_seq h0 g)));
SB.bn_from_bytes_be_lemma #t 1 (as_seq h0 g);
assert (bn_v h1 g_n == BSeq.nat_from_bytes_be (as_seq h0 g));
pop_frame () | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 14,
"end_line": 110,
"start_col": 0,
"start_line": 91
} | module Hacl.Impl.FFDHE
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.FFDHE.Constants
open Hacl.Bignum.Definitions
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module S = Spec.FFDHE
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Lemmas = Hacl.Spec.FFDHE.Lemmas
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module BE = Hacl.Bignum.Exponentiation
module SB = Hacl.Spec.Bignum
module SM = Hacl.Spec.Bignum.Montgomery
module SE = Hacl.Spec.Bignum.Exponentiation
module SD = Hacl.Spec.Bignum.Definitions
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let size_pos = x:size_t{v x > 0}
[@CInline]
let ffdhe_len (a:S.ffdhe_alg) : x:size_pos{v x = S.ffdhe_len a} =
allow_inversion S.ffdhe_alg;
match a with
| S.FFDHE2048 -> 256ul
| S.FFDHE3072 -> 384ul
| S.FFDHE4096 -> 512ul
| S.FFDHE6144 -> 768ul
| S.FFDHE8192 -> 1024ul
inline_for_extraction noextract
let get_ffdhe_p (a:S.ffdhe_alg) :x:glbuffer pub_uint8 (ffdhe_len a)
{witnessed x (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) /\ recallable x}
=
allow_inversion S.ffdhe_alg;
match a with
| S.FFDHE2048 -> ffdhe_p2048
| S.FFDHE3072 -> ffdhe_p3072
| S.FFDHE4096 -> ffdhe_p4096
| S.FFDHE6144 -> ffdhe_p6144
| S.FFDHE8192 -> ffdhe_p8192
inline_for_extraction noextract
val ffdhe_p_to_ps:
a:S.ffdhe_alg
-> p_s:lbuffer uint8 (ffdhe_len a) ->
Stack unit
(requires fun h -> live h p_s)
(ensures fun h0 _ h1 -> modifies (loc p_s) h0 h1 /\
BSeq.nat_from_intseq_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) ==
BSeq.nat_from_intseq_be (as_seq h1 p_s))
let ffdhe_p_to_ps a p_s =
let p = get_ffdhe_p a in
recall_contents p (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a));
let len = ffdhe_len a in
mapT len p_s secret p;
BSeq.nat_from_intseq_be_public_to_secret (v len) (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a))
inline_for_extraction noextract
let ffdhe_bn_from_g_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) =
g_n:lbignum t (blocks len (size (numbytes t))) ->
Stack unit
(requires fun h ->
live h g_n /\
v len = S.ffdhe_len a /\
as_seq h g_n == LSeq.create (v (blocks len (size (numbytes t)))) (uint #t 0))
(ensures fun h0 _ h1 -> modifies (loc g_n) h0 h1 /\
bn_v h1 g_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_g (S.get_ffdhe_params a)))
inline_for_extraction noextract | {
"checked_file": "/",
"dependencies": [
"Spec.FFDHE.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.FFDHE.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.Exponentiation.fsti.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"Hacl.Impl.FFDHE.Constants.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Base.fst.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.FFDHE.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Exponentiation",
"short_module": "SE"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "SM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "SB"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.FFDHE.Lemmas",
"short_module": "Lemmas"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "Spec.FFDHE",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.FFDHE.Constants",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Spec.FFDHE.ffdhe_alg -> len: Hacl.Impl.FFDHE.size_pos
-> Hacl.Impl.FFDHE.ffdhe_bn_from_g_st t a len | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Definitions.limb_t",
"Spec.FFDHE.ffdhe_alg",
"Hacl.Impl.FFDHE.size_pos",
"Hacl.Bignum.Definitions.lbignum",
"Hacl.Bignum.Definitions.blocks",
"Lib.IntTypes.size",
"Lib.IntTypes.numbytes",
"FStar.HyperStack.ST.pop_frame",
"Prims.unit",
"Prims._assert",
"Prims.eq2",
"Prims.nat",
"Hacl.Bignum.Definitions.bn_v",
"Lib.ByteSequence.nat_from_bytes_be",
"Lib.IntTypes.SEC",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"Lib.IntTypes.uint8",
"FStar.UInt32.__uint_to_t",
"Hacl.Spec.Bignum.bn_from_bytes_be_lemma",
"Hacl.Spec.Bignum.Definitions.bn_v",
"Hacl.Spec.Bignum.Definitions.blocks",
"Hacl.Spec.Bignum.bn_from_bytes_be",
"Hacl.Spec.Bignum.Definitions.bn_eval_update_sub",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Lib.Buffer.update_sub_f",
"Hacl.Bignum.Definitions.limb",
"Lib.Sequence.lseq",
"Hacl.Bignum.bn_from_bytes_be",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.IntTypes.mk_int",
"Lib.Buffer.sub",
"Lib.Buffer.lbuffer_t",
"Lib.ByteSequence.nat_from_intseq_be_public_to_secret",
"Lib.IntTypes.U8",
"Spec.FFDHE.ffdhe_g2",
"Lib.Buffer.mapT",
"Lib.Buffer.CONST",
"Lib.IntTypes.int_t",
"Lib.IntTypes.secret",
"Hacl.Impl.FFDHE.Constants.ffdhe_g2",
"Lib.Buffer.create",
"Lib.IntTypes.u8",
"Lib.Buffer.lbuffer",
"FStar.HyperStack.ST.push_frame",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Prims.l_and",
"Prims.b2t",
"Prims.op_GreaterThan",
"Prims.op_LessThanOrEqual",
"Prims.op_Subtraction",
"Prims.pow2",
"Prims.op_Multiply",
"Lib.Buffer.recall_contents"
] | [] | false | false | false | false | false | let ffdhe_bn_from_g #t a len g_n =
| recall_contents ffdhe_g2 S.ffdhe_g2;
[@@ inline_let ]let nLen = blocks len (size (numbytes t)) in
push_frame ();
let g = create 1ul (u8 0) in
mapT 1ul g secret ffdhe_g2;
BSeq.nat_from_intseq_be_public_to_secret 1 S.ffdhe_g2;
let h0 = ST.get () in
update_sub_f h0
g_n
0ul
1ul
(fun h -> SB.bn_from_bytes_be 1 (as_seq h0 g))
(fun _ -> BN.bn_from_bytes_be 1ul g (sub g_n 0ul 1ul));
let h1 = ST.get () in
SD.bn_eval_update_sub #t 1 (SB.bn_from_bytes_be 1 (as_seq h0 g)) (v nLen);
assert (bn_v h1 g_n == SD.bn_v (SB.bn_from_bytes_be #t 1 (as_seq h0 g)));
SB.bn_from_bytes_be_lemma #t 1 (as_seq h0 g);
assert (bn_v h1 g_n == BSeq.nat_from_bytes_be (as_seq h0 g));
pop_frame () | false |
Cert.ACLs.fst | Cert.ACLs.canRead | val canRead : f: Cert.ACLs.file -> Prims.bool | let canRead (f:file) =
canWrite f (* 1. writeable files are also readable *)
|| publicFile f (* 2. public files are readable *)
|| f="C:/acls2.fst" | {
"file_name": "examples/crypto/Cert.ACLs.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 21,
"end_line": 34,
"start_col": 0,
"start_line": 31
} | (*
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 Cert.ACLs
open FStar.All
open FStar.String
open FStar.List.Tot
type file = string
let canWrite = function
| "C:/temp/tempfile" -> true
| _ -> false
let publicFile = function
| "C:/public/README" -> true
| _ -> false | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.String.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Cert.ACLs.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.String",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "Cert",
"short_module": null
},
{
"abbrev": false,
"full_module": "Cert",
"short_module": null
},
{
"abbrev": 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: Cert.ACLs.file -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Cert.ACLs.file",
"Prims.op_BarBar",
"Cert.ACLs.canWrite",
"Cert.ACLs.publicFile",
"Prims.op_Equality",
"Prims.string",
"Prims.bool"
] | [] | false | false | false | true | false | let canRead (f: file) =
| canWrite f || publicFile f || f = "C:/acls2.fst" | false |
|
Hacl.Impl.FFDHE.fst | Hacl.Impl.FFDHE.ffdhe_compute_exp_st | val ffdhe_compute_exp_st : t: Hacl.Bignum.Definitions.limb_t ->
a: Spec.FFDHE.ffdhe_alg ->
len: Hacl.Impl.FFDHE.size_pos ->
ke: Hacl.Bignum.Exponentiation.exp t
-> Type0 | let ffdhe_compute_exp_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen)
-> sk_n:lbignum t nLen
-> b_n:lbignum t nLen
-> res:lbuffer uint8 len ->
Stack unit
(requires fun h ->
live h p_r2_n /\ live h sk_n /\ live h b_n /\ live h res /\
disjoint p_r2_n res /\ disjoint sk_n res /\ disjoint b_n res /\
disjoint p_r2_n b_n /\ disjoint p_r2_n sk_n /\
v len == S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h p_r2_n) /\
bn_v h b_n < bn_v h (gsub p_r2_n 0ul nLen) - 1 /\
1 < bn_v h sk_n)
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
(S.ffdhe_p_lemma a;
let res_n = Lib.NatMod.pow_mod #(bn_v h0 (gsub p_r2_n 0ul nLen)) (bn_v h0 b_n) (bn_v h0 sk_n) in
as_seq h1 res == BSeq.nat_to_bytes_be (v len) res_n)) | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 57,
"end_line": 231,
"start_col": 0,
"start_line": 212
} | module Hacl.Impl.FFDHE
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.FFDHE.Constants
open Hacl.Bignum.Definitions
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module S = Spec.FFDHE
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Lemmas = Hacl.Spec.FFDHE.Lemmas
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module BE = Hacl.Bignum.Exponentiation
module SB = Hacl.Spec.Bignum
module SM = Hacl.Spec.Bignum.Montgomery
module SE = Hacl.Spec.Bignum.Exponentiation
module SD = Hacl.Spec.Bignum.Definitions
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let size_pos = x:size_t{v x > 0}
[@CInline]
let ffdhe_len (a:S.ffdhe_alg) : x:size_pos{v x = S.ffdhe_len a} =
allow_inversion S.ffdhe_alg;
match a with
| S.FFDHE2048 -> 256ul
| S.FFDHE3072 -> 384ul
| S.FFDHE4096 -> 512ul
| S.FFDHE6144 -> 768ul
| S.FFDHE8192 -> 1024ul
inline_for_extraction noextract
let get_ffdhe_p (a:S.ffdhe_alg) :x:glbuffer pub_uint8 (ffdhe_len a)
{witnessed x (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) /\ recallable x}
=
allow_inversion S.ffdhe_alg;
match a with
| S.FFDHE2048 -> ffdhe_p2048
| S.FFDHE3072 -> ffdhe_p3072
| S.FFDHE4096 -> ffdhe_p4096
| S.FFDHE6144 -> ffdhe_p6144
| S.FFDHE8192 -> ffdhe_p8192
inline_for_extraction noextract
val ffdhe_p_to_ps:
a:S.ffdhe_alg
-> p_s:lbuffer uint8 (ffdhe_len a) ->
Stack unit
(requires fun h -> live h p_s)
(ensures fun h0 _ h1 -> modifies (loc p_s) h0 h1 /\
BSeq.nat_from_intseq_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) ==
BSeq.nat_from_intseq_be (as_seq h1 p_s))
let ffdhe_p_to_ps a p_s =
let p = get_ffdhe_p a in
recall_contents p (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a));
let len = ffdhe_len a in
mapT len p_s secret p;
BSeq.nat_from_intseq_be_public_to_secret (v len) (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a))
inline_for_extraction noextract
let ffdhe_bn_from_g_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) =
g_n:lbignum t (blocks len (size (numbytes t))) ->
Stack unit
(requires fun h ->
live h g_n /\
v len = S.ffdhe_len a /\
as_seq h g_n == LSeq.create (v (blocks len (size (numbytes t)))) (uint #t 0))
(ensures fun h0 _ h1 -> modifies (loc g_n) h0 h1 /\
bn_v h1 g_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_g (S.get_ffdhe_params a)))
inline_for_extraction noextract
val ffdhe_bn_from_g: #t:limb_t -> a:S.ffdhe_alg -> len:size_pos -> ffdhe_bn_from_g_st t a len
let ffdhe_bn_from_g #t a len g_n =
recall_contents ffdhe_g2 S.ffdhe_g2;
[@inline_let] let nLen = blocks len (size (numbytes t)) in
push_frame ();
let g = create 1ul (u8 0) in
mapT 1ul g secret ffdhe_g2;
BSeq.nat_from_intseq_be_public_to_secret 1 S.ffdhe_g2;
let h0 = ST.get () in
update_sub_f h0 g_n 0ul 1ul
(fun h -> SB.bn_from_bytes_be 1 (as_seq h0 g))
(fun _ -> BN.bn_from_bytes_be 1ul g (sub g_n 0ul 1ul));
let h1 = ST.get () in
SD.bn_eval_update_sub #t 1 (SB.bn_from_bytes_be 1 (as_seq h0 g)) (v nLen);
assert (bn_v h1 g_n == SD.bn_v (SB.bn_from_bytes_be #t 1 (as_seq h0 g)));
SB.bn_from_bytes_be_lemma #t 1 (as_seq h0 g);
assert (bn_v h1 g_n == BSeq.nat_from_bytes_be (as_seq h0 g));
pop_frame ()
inline_for_extraction noextract
let ffdhe_precomp_inv (#t:limb_t) (#len:size_nat{0 < len /\ len + len <= max_size_t})
(a:S.ffdhe_alg) (p_r2_n:SD.lbignum t (len + len))
=
let p_n = LSeq.sub p_r2_n 0 len in
let r2_n = LSeq.sub p_r2_n len len in
SD.bn_v p_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) /\
0 < SD.bn_v p_n /\ SD.bn_v r2_n == pow2 (2 * bits t * len) % SD.bn_v p_n
inline_for_extraction noextract
let ffdhe_precomp_p_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen) ->
Stack unit
(requires fun h ->
live h p_r2_n /\
v len = S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen)
(ensures fun h0 _ h1 -> modifies (loc p_r2_n) h0 h1 /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h1 p_r2_n))
inline_for_extraction noextract
val ffdhe_precomp_p:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t ->
ffdhe_precomp_p_st t a len ke
let ffdhe_precomp_p #t a len ke p_r2_n =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let r2_n = sub p_r2_n nLen nLen in
let p_s = create len (u8 0) in
ffdhe_p_to_ps a p_s;
let h0 = ST.get () in
BN.bn_from_bytes_be len p_s p_n;
let h1 = ST.get () in
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 p_s);
assert (bn_v h1 p_n == BSeq.nat_from_bytes_be (as_seq h0 p_s));
S.ffdhe_p_lemma a;
Lemmas.ffdhe_p_bits_lemma a;
ke.BE.precompr2 (8ul *! len -! 1ul) p_n r2_n;
SM.bn_precomp_r2_mod_n_lemma (8 * v len - 1) (as_seq h1 p_n);
pop_frame ()
inline_for_extraction noextract
let new_ffdhe_precomp_p_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
r:HS.rid ->
ST (B.buffer (limb t))
(requires fun h ->
ST.is_eternal_region r /\
v len = S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen)
(ensures fun h0 res h1 ->
B.(modifies loc_none h0 h1) /\
not (B.g_is_null res) ==> (
B.len res == nLen +! nLen /\
B.(fresh_loc (loc_buffer res) h0 h1) /\
B.(loc_includes (loc_region_only false r) (loc_buffer res)) /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h1 (res <: lbignum t (nLen +! nLen)))))
inline_for_extraction noextract
val new_ffdhe_precomp_p:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_precomp_p:ffdhe_precomp_p_st t a len ke ->
new_ffdhe_precomp_p_st t a len ke
let new_ffdhe_precomp_p #t a len ke ffdhe_precomp_p r =
let h0 = ST.get () in
let nLen = blocks len (size (numbytes t)) in
assert (v (nLen +! nLen) > 0);
let res = LowStar.Monotonic.Buffer.mmalloc_partial r (uint #t #SEC 0) (nLen +! nLen) in
if B.is_null res then
res
else
let h1 = ST.get () in
B.(modifies_only_not_unused_in loc_none h0 h1);
assert (B.len res == nLen +! nLen);
let res: Lib.Buffer.buffer (limb t) = res in
assert (B.length res == v nLen + v nLen);
let res: lbignum t (nLen +! nLen) = res in
ffdhe_precomp_p res;
let h2 = ST.get () in
B.(modifies_only_not_unused_in loc_none h0 h2);
res | {
"checked_file": "/",
"dependencies": [
"Spec.FFDHE.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.FFDHE.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.Exponentiation.fsti.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"Hacl.Impl.FFDHE.Constants.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Base.fst.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.FFDHE.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Exponentiation",
"short_module": "SE"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "SM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "SB"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.FFDHE.Lemmas",
"short_module": "Lemmas"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "Spec.FFDHE",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.FFDHE.Constants",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
t: Hacl.Bignum.Definitions.limb_t ->
a: Spec.FFDHE.ffdhe_alg ->
len: Hacl.Impl.FFDHE.size_pos ->
ke: Hacl.Bignum.Exponentiation.exp t
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Definitions.limb_t",
"Spec.FFDHE.ffdhe_alg",
"Hacl.Impl.FFDHE.size_pos",
"Hacl.Bignum.Exponentiation.exp",
"Hacl.Bignum.Definitions.lbignum",
"Lib.IntTypes.op_Plus_Bang",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"Prims.unit",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_and",
"Lib.Buffer.live",
"Lib.Buffer.MUT",
"Hacl.Bignum.Definitions.limb",
"Lib.Buffer.disjoint",
"Prims.eq2",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Prims.b2t",
"Prims.op_GreaterThan",
"Prims.op_LessThanOrEqual",
"Lib.IntTypes.max_size_t",
"Lib.IntTypes.v",
"Spec.FFDHE.ffdhe_len",
"Lib.IntTypes.size_t",
"FStar.Mul.op_Star",
"Lib.IntTypes.size",
"Lib.IntTypes.numbytes",
"Hacl.Spec.Bignum.Definitions.blocks",
"Prims.op_LessThan",
"Lib.IntTypes.bits",
"Hacl.Bignum.__proj__Mkbn__item__len",
"Hacl.Bignum.Exponentiation.__proj__Mkexp__item__bn",
"Hacl.Impl.FFDHE.ffdhe_precomp_inv",
"Lib.Buffer.as_seq",
"Hacl.Bignum.Definitions.bn_v",
"Prims.op_Subtraction",
"Lib.Buffer.gsub",
"FStar.UInt32.__uint_to_t",
"Lib.Buffer.modifies",
"Lib.Buffer.loc",
"Lib.Sequence.seq",
"Prims.nat",
"FStar.Seq.Base.length",
"Lib.Sequence.length",
"Lib.IntTypes.uint_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.pow2",
"Lib.ByteSequence.nat_from_intseq_be",
"Lib.ByteSequence.nat_to_bytes_be",
"Lib.NatMod.nat_mod",
"Lib.IntTypes.add",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.NatMod.pow_mod",
"Spec.FFDHE.ffdhe_p_lemma",
"Lib.IntTypes.int_t",
"Prims.op_Multiply",
"Lib.IntTypes.mk_int",
"Hacl.Bignum.Definitions.blocks"
] | [] | false | false | false | false | true | let ffdhe_compute_exp_st (t: limb_t) (a: S.ffdhe_alg) (len: size_pos) (ke: BE.exp t) =
| let nLen = blocks len (size (numbytes t)) in
p_r2_n: lbignum t (nLen +! nLen) ->
sk_n: lbignum t nLen ->
b_n: lbignum t nLen ->
res: lbuffer uint8 len
-> Stack unit
(requires
fun h ->
live h p_r2_n /\ live h sk_n /\ live h b_n /\ live h res /\ disjoint p_r2_n res /\
disjoint sk_n res /\ disjoint b_n res /\ disjoint p_r2_n b_n /\ disjoint p_r2_n sk_n /\
v len == S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h p_r2_n) /\
bn_v h b_n < bn_v h (gsub p_r2_n 0ul nLen) - 1 /\ 1 < bn_v h sk_n)
(ensures
fun h0 _ h1 ->
modifies (loc res) h0 h1 /\
(S.ffdhe_p_lemma a;
let res_n =
Lib.NatMod.pow_mod #(bn_v h0 (gsub p_r2_n 0ul nLen)) (bn_v h0 b_n) (bn_v h0 sk_n)
in
as_seq h1 res == BSeq.nat_to_bytes_be (v len) res_n)) | false |
|
OPLSS.HMACSHA1.fst | OPLSS.HMACSHA1.msg | val msg : Type0 | let msg = bytes | {
"file_name": "examples/crypto/OPLSS.HMACSHA1.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 15,
"end_line": 26,
"start_col": 0,
"start_line": 26
} | (*
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 OPLSS.HMACSHA1
open OPLSS
let keysize = 64
let blocksize = keysize
let macsize = 20
assume //demo scaffolding
val sha1: bytes -> Tot (h:bytes{Seq.length h = macsize}) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"OPLSS.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "OPLSS.HMACSHA1.fst"
} | [
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": 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 | Type0 | Prims.Tot | [
"total"
] | [] | [
"OPLSS.bytes"
] | [] | false | false | false | true | true | let msg =
| bytes | false |
|
LowParse.Tot.DER.fst | LowParse.Tot.DER.parse_bounded_der_length32_bare | val parse_bounded_der_length32_bare
(min: der_length_t)
(max: der_length_t{min <= max /\ max < 4294967296})
(input: bytes)
: Pure (option (bounded_int32 min max & consumed_length input))
(requires True)
(ensures (fun y -> y == parse (parse_bounded_der_length32 min max) input)) | val parse_bounded_der_length32_bare
(min: der_length_t)
(max: der_length_t{min <= max /\ max < 4294967296})
(input: bytes)
: Pure (option (bounded_int32 min max & consumed_length input))
(requires True)
(ensures (fun y -> y == parse (parse_bounded_der_length32 min max) input)) | let parse_bounded_der_length32_bare
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 })
(input: bytes)
: Pure (option (bounded_int32 min max & consumed_length input))
(requires True)
(ensures (fun y ->
y == parse (parse_bounded_der_length32 min max) input
))
=
parse_bounded_der_length32_unfold min max input;
match parse_u8 input with
| None -> None
| Some (x, consumed_x) ->
let len = der_length_payload_size_of_tag x in
if der_length_payload_size min <= len && len <= der_length_payload_size max then
let input' = Seq.slice input consumed_x (Seq.length input) in
match (parse_der_length_payload32_bare x) input' with
| Some (y, consumed_y) ->
if min <= U32.v y && U32.v y <= max
then Some (y, consumed_x + consumed_y)
else None
| None -> None
else
None | {
"file_name": "src/lowparse/LowParse.Tot.DER.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 11,
"end_line": 65,
"start_col": 0,
"start_line": 41
} | module LowParse.Tot.DER
include LowParse.Spec.DER
include LowParse.Tot.BoundedInt
module U32 = FStar.UInt32
module U8 = FStar.UInt8
let parse_der_length_payload32_bare
(x: U8.t { der_length_payload_size_of_tag x <= 4 } )
(input: bytes)
: Pure (option ((refine_with_tag tag_of_der_length32 x) * consumed_length input))
(requires True)
(ensures (fun y ->
y == parse (parse_der_length_payload32 x) input
))
=
parse_der_length_payload32_unfold x input;
if U8.v x < 128
then Some (FStar.Int.Cast.uint8_to_uint32 x, 0)
else if x = 128uy || x = 255uy
then None
else if x = 129uy
then
match parse_u8 input with
| None -> None
| Some (z, consumed) ->
if U8.v z < 128
then None
else Some (FStar.Int.Cast.uint8_to_uint32 z, consumed)
else
let len : nat = U8.v x - 128 in
let _ = parse_bounded_integer_spec len input in
let res : option (bounded_integer len & consumed_length input) = (parse_bounded_integer len) input in
match res with
| None -> None
| Some (z, consumed) ->
if U32.v z >= pow2 (8 `op_Multiply` (len - 1))
then Some ((z <: refine_with_tag tag_of_der_length32 x), consumed)
else None | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Tot.BoundedInt.fst.checked",
"LowParse.Spec.DER.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Int.Cast.fst.checked"
],
"interface_file": false,
"source_file": "LowParse.Tot.DER.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "LowParse.Tot.BoundedInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.DER",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Tot",
"short_module": null
},
{
"abbrev": 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 |
min: LowParse.Spec.DER.der_length_t ->
max: LowParse.Spec.DER.der_length_t{min <= max /\ max < 4294967296} ->
input: LowParse.Bytes.bytes
-> Prims.Pure
(FStar.Pervasives.Native.option (LowParse.Spec.BoundedInt.bounded_int32 min max *
LowParse.Spec.Base.consumed_length input)) | Prims.Pure | [] | [] | [
"LowParse.Spec.DER.der_length_t",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"LowParse.Bytes.bytes",
"LowParse.Tot.Int.parse_u8",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.tuple2",
"LowParse.Spec.BoundedInt.bounded_int32",
"LowParse.Spec.Base.consumed_length",
"FStar.UInt8.t",
"Prims.op_AmpAmp",
"LowParse.Spec.DER.der_length_payload_size",
"LowParse.Tot.DER.parse_der_length_payload32_bare",
"LowParse.Spec.Base.refine_with_tag",
"FStar.UInt32.t",
"LowParse.Spec.DER.tag_of_der_length32",
"FStar.UInt32.v",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.Mktuple2",
"Prims.op_Addition",
"Prims.bool",
"FStar.Pervasives.Native.option",
"FStar.Seq.Base.seq",
"LowParse.Bytes.byte",
"FStar.Seq.Base.slice",
"FStar.Seq.Base.length",
"Prims.nat",
"LowParse.Spec.DER.der_length_payload_size_of_tag",
"Prims.unit",
"LowParse.Spec.DER.parse_bounded_der_length32_unfold",
"Prims.l_True",
"Prims.eq2",
"LowParse.Spec.Base.parse",
"LowParse.Spec.DER.parse_bounded_der_length32"
] | [] | false | false | false | false | false | let parse_bounded_der_length32_bare
(min: der_length_t)
(max: der_length_t{min <= max /\ max < 4294967296})
(input: bytes)
: Pure (option (bounded_int32 min max & consumed_length input))
(requires True)
(ensures (fun y -> y == parse (parse_bounded_der_length32 min max) input)) =
| parse_bounded_der_length32_unfold min max input;
match parse_u8 input with
| None -> None
| Some (x, consumed_x) ->
let len = der_length_payload_size_of_tag x in
if der_length_payload_size min <= len && len <= der_length_payload_size max
then
let input' = Seq.slice input consumed_x (Seq.length input) in
match (parse_der_length_payload32_bare x) input' with
| Some (y, consumed_y) ->
if min <= U32.v y && U32.v y <= max then Some (y, consumed_x + consumed_y) else None
| None -> None
else None | false |
Vale.AES.X64.AESopt.fsti | Vale.AES.X64.AESopt.aes_reqs0 | val aes_reqs0
(alg: algorithm)
(key: seq nat32)
(round_keys: seq quad32)
(keys_b: buffer128)
(key_ptr: int)
(heap0: vale_heap)
(layout: vale_heap_layout)
: prop0 | val aes_reqs0
(alg: algorithm)
(key: seq nat32)
(round_keys: seq quad32)
(keys_b: buffer128)
(key_ptr: int)
(heap0: vale_heap)
(layout: vale_heap_layout)
: prop0 | let aes_reqs0
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ pclmulqdq_enabled /\ avx_enabled /\
alg = AES_128 /\
//(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
buffer128_as_seq heap0 keys_b == round_keys | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 45,
"end_line": 48,
"start_col": 0,
"start_line": 37
} | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Transformers.Transform.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESGCM_expected_code.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
alg: Vale.AES.AES_common_s.algorithm ->
key: FStar.Seq.Base.seq Vale.X64.Memory.nat32 ->
round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
keys_b: Vale.X64.Memory.buffer128 ->
key_ptr: Prims.int ->
heap0: Vale.X64.InsBasic.vale_heap ->
layout: Vale.Arch.HeapImpl.vale_heap_layout
-> Vale.Def.Prop_s.prop0 | Prims.Tot | [
"total"
] | [] | [
"Vale.AES.AES_common_s.algorithm",
"FStar.Seq.Base.seq",
"Vale.X64.Memory.nat32",
"Vale.X64.Decls.quad32",
"Vale.X64.Memory.buffer128",
"Prims.int",
"Vale.X64.InsBasic.vale_heap",
"Vale.Arch.HeapImpl.vale_heap_layout",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.CPU_Features_s.aesni_enabled",
"Vale.X64.CPU_Features_s.pclmulqdq_enabled",
"Vale.X64.CPU_Features_s.avx_enabled",
"Prims.op_Equality",
"Vale.AES.AES_common_s.AES_128",
"Vale.AES.AES_s.is_aes_key_LE",
"Prims.eq2",
"FStar.Seq.Base.length",
"Prims.op_Addition",
"Vale.AES.AES_common_s.nr",
"Vale.Def.Types_s.quad32",
"Vale.AES.AES_s.key_to_round_keys_LE",
"Vale.X64.Decls.validSrcAddrsOffset128",
"Prims.op_Subtraction",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.X64.Decls.buffer128_as_seq",
"Vale.Def.Prop_s.prop0"
] | [] | false | false | false | true | false | let aes_reqs0
(alg: algorithm)
(key: seq nat32)
(round_keys: seq quad32)
(keys_b: buffer128)
(key_ptr: int)
(heap0: vale_heap)
(layout: vale_heap_layout)
: prop0 =
| aesni_enabled /\ pclmulqdq_enabled /\ avx_enabled /\ alg = AES_128 /\ is_aes_key_LE alg key /\
length (round_keys) == nr (alg) + 1 /\ round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
buffer128_as_seq heap0 keys_b == round_keys | false |
LowParse.Tot.DER.fst | LowParse.Tot.DER.serialize_bounded_der_length32 | val serialize_bounded_der_length32
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 })
: Tot (serializer #(parse_bounded_der_length32_kind min max) (parse_bounded_der_length32 min max)) | val serialize_bounded_der_length32
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 })
: Tot (serializer #(parse_bounded_der_length32_kind min max) (parse_bounded_der_length32 min max)) | let serialize_bounded_der_length32
min max
= serialize_ext
_
(serialize_bounded_der_length32 min max)
_ | {
"file_name": "src/lowparse/LowParse.Tot.DER.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 5,
"end_line": 88,
"start_col": 0,
"start_line": 83
} | module LowParse.Tot.DER
include LowParse.Spec.DER
include LowParse.Tot.BoundedInt
module U32 = FStar.UInt32
module U8 = FStar.UInt8
let parse_der_length_payload32_bare
(x: U8.t { der_length_payload_size_of_tag x <= 4 } )
(input: bytes)
: Pure (option ((refine_with_tag tag_of_der_length32 x) * consumed_length input))
(requires True)
(ensures (fun y ->
y == parse (parse_der_length_payload32 x) input
))
=
parse_der_length_payload32_unfold x input;
if U8.v x < 128
then Some (FStar.Int.Cast.uint8_to_uint32 x, 0)
else if x = 128uy || x = 255uy
then None
else if x = 129uy
then
match parse_u8 input with
| None -> None
| Some (z, consumed) ->
if U8.v z < 128
then None
else Some (FStar.Int.Cast.uint8_to_uint32 z, consumed)
else
let len : nat = U8.v x - 128 in
let _ = parse_bounded_integer_spec len input in
let res : option (bounded_integer len & consumed_length input) = (parse_bounded_integer len) input in
match res with
| None -> None
| Some (z, consumed) ->
if U32.v z >= pow2 (8 `op_Multiply` (len - 1))
then Some ((z <: refine_with_tag tag_of_der_length32 x), consumed)
else None
let parse_bounded_der_length32_bare
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 })
(input: bytes)
: Pure (option (bounded_int32 min max & consumed_length input))
(requires True)
(ensures (fun y ->
y == parse (parse_bounded_der_length32 min max) input
))
=
parse_bounded_der_length32_unfold min max input;
match parse_u8 input with
| None -> None
| Some (x, consumed_x) ->
let len = der_length_payload_size_of_tag x in
if der_length_payload_size min <= len && len <= der_length_payload_size max then
let input' = Seq.slice input consumed_x (Seq.length input) in
match (parse_der_length_payload32_bare x) input' with
| Some (y, consumed_y) ->
if min <= U32.v y && U32.v y <= max
then Some (y, consumed_x + consumed_y)
else None
| None -> None
else
None
val parse_bounded_der_length32
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 })
: Tot (parser (parse_bounded_der_length32_kind min max) (bounded_int32 min max))
let parse_bounded_der_length32
min max
=
parser_kind_prop_ext (parse_bounded_der_length32_kind min max) (parse_bounded_der_length32 min max) (parse_bounded_der_length32_bare min max);
parse_bounded_der_length32_bare min max
val serialize_bounded_der_length32
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 })
: Tot (serializer #(parse_bounded_der_length32_kind min max) (parse_bounded_der_length32 min max)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Tot.BoundedInt.fst.checked",
"LowParse.Spec.DER.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Int.Cast.fst.checked"
],
"interface_file": false,
"source_file": "LowParse.Tot.DER.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "LowParse.Tot.BoundedInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.DER",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Tot",
"short_module": null
},
{
"abbrev": 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 |
min: LowParse.Spec.DER.der_length_t ->
max: LowParse.Spec.DER.der_length_t{min <= max /\ max < 4294967296}
-> LowParse.Tot.Base.serializer (LowParse.Tot.DER.parse_bounded_der_length32 min max) | Prims.Tot | [
"total"
] | [] | [
"LowParse.Spec.DER.der_length_t",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"LowParse.Spec.Base.serialize_ext",
"LowParse.Spec.DER.parse_bounded_der_length32_kind",
"LowParse.Spec.BoundedInt.bounded_int32",
"LowParse.Spec.DER.parse_bounded_der_length32",
"LowParse.Spec.DER.serialize_bounded_der_length32",
"LowParse.Tot.DER.parse_bounded_der_length32",
"LowParse.Tot.Base.serializer"
] | [] | false | false | false | false | false | let serialize_bounded_der_length32 min max =
| serialize_ext _ (serialize_bounded_der_length32 min max) _ | false |
Vale.AES.X64.AESopt.fsti | Vale.AES.X64.AESopt.aes_reqs_offset | val aes_reqs_offset
(alg: algorithm)
(key: seq nat32)
(round_keys: seq quad32)
(keys_b: buffer128)
(key_ptr: int)
(heap0: vale_heap)
(layout: vale_heap_layout)
: prop0 | val aes_reqs_offset
(alg: algorithm)
(key: seq nat32)
(round_keys: seq quad32)
(keys_b: buffer128)
(key_ptr: int)
(heap0: vale_heap)
(layout: vale_heap_layout)
: prop0 | let aes_reqs_offset
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ avx_enabled /\ pclmulqdq_enabled /\
(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
s128 heap0 keys_b == round_keys | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 33,
"end_line": 60,
"start_col": 0,
"start_line": 50
} | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let aes_reqs0
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ pclmulqdq_enabled /\ avx_enabled /\
alg = AES_128 /\
//(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
buffer128_as_seq heap0 keys_b == round_keys | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Transformers.Transform.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESGCM_expected_code.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
alg: Vale.AES.AES_common_s.algorithm ->
key: FStar.Seq.Base.seq Vale.X64.Memory.nat32 ->
round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
keys_b: Vale.X64.Memory.buffer128 ->
key_ptr: Prims.int ->
heap0: Vale.X64.InsBasic.vale_heap ->
layout: Vale.Arch.HeapImpl.vale_heap_layout
-> Vale.Def.Prop_s.prop0 | Prims.Tot | [
"total"
] | [] | [
"Vale.AES.AES_common_s.algorithm",
"FStar.Seq.Base.seq",
"Vale.X64.Memory.nat32",
"Vale.X64.Decls.quad32",
"Vale.X64.Memory.buffer128",
"Prims.int",
"Vale.X64.InsBasic.vale_heap",
"Vale.Arch.HeapImpl.vale_heap_layout",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.CPU_Features_s.aesni_enabled",
"Vale.X64.CPU_Features_s.avx_enabled",
"Vale.X64.CPU_Features_s.pclmulqdq_enabled",
"Prims.op_BarBar",
"Prims.op_Equality",
"Vale.AES.AES_common_s.AES_128",
"Vale.AES.AES_common_s.AES_256",
"Vale.AES.AES_s.is_aes_key_LE",
"Prims.eq2",
"FStar.Seq.Base.length",
"Prims.op_Addition",
"Vale.AES.AES_common_s.nr",
"Vale.Def.Types_s.quad32",
"Vale.AES.AES_s.key_to_round_keys_LE",
"Vale.X64.Decls.validSrcAddrsOffset128",
"Prims.op_Subtraction",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.X64.Decls.s128",
"Vale.Def.Prop_s.prop0"
] | [] | false | false | false | true | false | let aes_reqs_offset
(alg: algorithm)
(key: seq nat32)
(round_keys: seq quad32)
(keys_b: buffer128)
(key_ptr: int)
(heap0: vale_heap)
(layout: vale_heap_layout)
: prop0 =
| aesni_enabled /\ avx_enabled /\ pclmulqdq_enabled /\ (alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\ length (round_keys) == nr (alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
s128 heap0 keys_b == round_keys | false |
OPLSS.HMACSHA1.fst | OPLSS.HMACSHA1.hmac_sha1 | val hmac_sha1 (k: sha1_key) (m: msg) : tag | val hmac_sha1 (k: sha1_key) (m: msg) : tag | let hmac_sha1 (k:sha1_key) (m:msg)
: tag =
let x5c = byte_of_int 92 in
let x36 = byte_of_int 54 in
let opad = Seq.create blocksize x5c in
let ipad = Seq.create blocksize x36 in
let xor_key_opad = xor keysize k opad in
let xor_key_ipad = xor keysize k ipad in
sha1 (xor_key_opad `Seq.append`
(sha1 (xor_key_ipad `Seq.append` m))) | {
"file_name": "examples/crypto/OPLSS.HMACSHA1.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 44,
"end_line": 39,
"start_col": 0,
"start_line": 30
} | (*
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 OPLSS.HMACSHA1
open OPLSS
let keysize = 64
let blocksize = keysize
let macsize = 20
assume //demo scaffolding
val sha1: bytes -> Tot (h:bytes{Seq.length h = macsize})
let msg = bytes
type sha1_key = lbytes keysize
type tag = lbytes macsize | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"OPLSS.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "OPLSS.HMACSHA1.fst"
} | [
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS",
"short_module": null
},
{
"abbrev": 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 | k: OPLSS.HMACSHA1.sha1_key -> m: OPLSS.HMACSHA1.msg -> OPLSS.HMACSHA1.tag | Prims.Tot | [
"total"
] | [] | [
"OPLSS.HMACSHA1.sha1_key",
"OPLSS.HMACSHA1.msg",
"OPLSS.HMACSHA1.sha1",
"FStar.Seq.Base.append",
"FStar.UInt8.t",
"OPLSS.lbytes",
"OPLSS.HMACSHA1.keysize",
"OPLSS.xor",
"FStar.Seq.Base.seq",
"FStar.Seq.Base.create",
"OPLSS.HMACSHA1.blocksize",
"OPLSS.byte_of_int",
"OPLSS.HMACSHA1.tag"
] | [] | false | false | false | true | false | let hmac_sha1 (k: sha1_key) (m: msg) : tag =
| let x5c = byte_of_int 92 in
let x36 = byte_of_int 54 in
let opad = Seq.create blocksize x5c in
let ipad = Seq.create blocksize x36 in
let xor_key_opad = xor keysize k opad in
let xor_key_ipad = xor keysize k ipad in
sha1 (xor_key_opad `Seq.append` (sha1 (xor_key_ipad `Seq.append` m))) | false |
LowParse.Tot.DER.fst | LowParse.Tot.DER.parse_bounded_der_length32 | val parse_bounded_der_length32
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 })
: Tot (parser (parse_bounded_der_length32_kind min max) (bounded_int32 min max)) | val parse_bounded_der_length32
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 })
: Tot (parser (parse_bounded_der_length32_kind min max) (bounded_int32 min max)) | let parse_bounded_der_length32
min max
=
parser_kind_prop_ext (parse_bounded_der_length32_kind min max) (parse_bounded_der_length32 min max) (parse_bounded_der_length32_bare min max);
parse_bounded_der_length32_bare min max | {
"file_name": "src/lowparse/LowParse.Tot.DER.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 41,
"end_line": 76,
"start_col": 0,
"start_line": 72
} | module LowParse.Tot.DER
include LowParse.Spec.DER
include LowParse.Tot.BoundedInt
module U32 = FStar.UInt32
module U8 = FStar.UInt8
let parse_der_length_payload32_bare
(x: U8.t { der_length_payload_size_of_tag x <= 4 } )
(input: bytes)
: Pure (option ((refine_with_tag tag_of_der_length32 x) * consumed_length input))
(requires True)
(ensures (fun y ->
y == parse (parse_der_length_payload32 x) input
))
=
parse_der_length_payload32_unfold x input;
if U8.v x < 128
then Some (FStar.Int.Cast.uint8_to_uint32 x, 0)
else if x = 128uy || x = 255uy
then None
else if x = 129uy
then
match parse_u8 input with
| None -> None
| Some (z, consumed) ->
if U8.v z < 128
then None
else Some (FStar.Int.Cast.uint8_to_uint32 z, consumed)
else
let len : nat = U8.v x - 128 in
let _ = parse_bounded_integer_spec len input in
let res : option (bounded_integer len & consumed_length input) = (parse_bounded_integer len) input in
match res with
| None -> None
| Some (z, consumed) ->
if U32.v z >= pow2 (8 `op_Multiply` (len - 1))
then Some ((z <: refine_with_tag tag_of_der_length32 x), consumed)
else None
let parse_bounded_der_length32_bare
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 })
(input: bytes)
: Pure (option (bounded_int32 min max & consumed_length input))
(requires True)
(ensures (fun y ->
y == parse (parse_bounded_der_length32 min max) input
))
=
parse_bounded_der_length32_unfold min max input;
match parse_u8 input with
| None -> None
| Some (x, consumed_x) ->
let len = der_length_payload_size_of_tag x in
if der_length_payload_size min <= len && len <= der_length_payload_size max then
let input' = Seq.slice input consumed_x (Seq.length input) in
match (parse_der_length_payload32_bare x) input' with
| Some (y, consumed_y) ->
if min <= U32.v y && U32.v y <= max
then Some (y, consumed_x + consumed_y)
else None
| None -> None
else
None
val parse_bounded_der_length32
(min: der_length_t)
(max: der_length_t { min <= max /\ max < 4294967296 })
: Tot (parser (parse_bounded_der_length32_kind min max) (bounded_int32 min max)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Tot.BoundedInt.fst.checked",
"LowParse.Spec.DER.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Int.Cast.fst.checked"
],
"interface_file": false,
"source_file": "LowParse.Tot.DER.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "LowParse.Tot.BoundedInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.DER",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Tot",
"short_module": null
},
{
"abbrev": 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 |
min: LowParse.Spec.DER.der_length_t ->
max: LowParse.Spec.DER.der_length_t{min <= max /\ max < 4294967296}
-> LowParse.Tot.Base.parser (LowParse.Spec.DER.parse_bounded_der_length32_kind min max)
(LowParse.Spec.BoundedInt.bounded_int32 min max) | Prims.Tot | [
"total"
] | [] | [
"LowParse.Spec.DER.der_length_t",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"LowParse.Tot.DER.parse_bounded_der_length32_bare",
"Prims.unit",
"LowParse.Spec.Base.parser_kind_prop_ext",
"LowParse.Spec.BoundedInt.bounded_int32",
"LowParse.Spec.DER.parse_bounded_der_length32_kind",
"LowParse.Spec.DER.parse_bounded_der_length32",
"LowParse.Tot.Base.parser"
] | [] | false | false | false | false | false | let parse_bounded_der_length32 min max =
| parser_kind_prop_ext (parse_bounded_der_length32_kind min max)
(parse_bounded_der_length32 min max)
(parse_bounded_der_length32_bare min max);
parse_bounded_der_length32_bare min max | false |
Cert.ACLs.fst | Cert.ACLs.rc | val rc: file -> ML (unit -> string) | val rc: file -> ML (unit -> string) | let rc file =
if canRead file
then (fun () -> read file)
else failwith "Can't read" | {
"file_name": "examples/crypto/Cert.ACLs.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 28,
"end_line": 57,
"start_col": 0,
"start_line": 54
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Cert.ACLs
open FStar.All
open FStar.String
open FStar.List.Tot
type file = string
let canWrite = function
| "C:/temp/tempfile" -> true
| _ -> false
let publicFile = function
| "C:/public/README" -> true
| _ -> false
let canRead (f:file) =
canWrite f (* 1. writeable files are also readable *)
|| publicFile f (* 2. public files are readable *)
|| f="C:/acls2.fst" (* and so is this file *)
(* two dangerous primitives *)
assume val read: file:string{canRead file} -> string
assume val delete: file:string{canWrite file} -> unit
(* some sample files, one of them writable *)
let pwd = "C:/etc/password"
let readme = "C:/public/README"
let tmp = "C:/temp/tempfile"
let test () =
delete tmp; (* ok *)
//delete pwd; (* type error *)
let v1 = read tmp in (* ok, rule 1. *)
let v2 = read readme in (* ok, rule 2. *)
()
(* some higher-order code *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.String.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Cert.ACLs.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.String",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "Cert",
"short_module": null
},
{
"abbrev": false,
"full_module": "Cert",
"short_module": null
},
{
"abbrev": 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 | file: Cert.ACLs.file -> FStar.All.ML (_: Prims.unit -> Prims.string) | FStar.All.ML | [
"ml"
] | [] | [
"Cert.ACLs.file",
"Cert.ACLs.canRead",
"Prims.unit",
"Cert.ACLs.read",
"Prims.string",
"Prims.bool",
"FStar.All.failwith"
] | [] | false | true | false | false | false | let rc file =
| if canRead file then (fun () -> read file) else failwith "Can't read" | false |
Hacl.Impl.FFDHE.fst | Hacl.Impl.FFDHE.ffdhe_secret_to_public | val ffdhe_secret_to_public:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_secret_to_public_precomp:ffdhe_secret_to_public_precomp_st t a len ke
-> ffdhe_precomp_p:ffdhe_precomp_p_st t a len ke ->
ffdhe_secret_to_public_st t a len ke | val ffdhe_secret_to_public:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_secret_to_public_precomp:ffdhe_secret_to_public_precomp_st t a len ke
-> ffdhe_precomp_p:ffdhe_precomp_p_st t a len ke ->
ffdhe_secret_to_public_st t a len ke | let ffdhe_secret_to_public #t a len ke ffdhe_secret_to_public_precomp ffdhe_precomp_p sk pk =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_r2_n = create (nLen +! nLen) (uint #t #SEC 0) in
ffdhe_precomp_p p_r2_n;
ffdhe_secret_to_public_precomp p_r2_n sk pk;
pop_frame () | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 14,
"end_line": 346,
"start_col": 0,
"start_line": 339
} | module Hacl.Impl.FFDHE
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.FFDHE.Constants
open Hacl.Bignum.Definitions
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module S = Spec.FFDHE
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Lemmas = Hacl.Spec.FFDHE.Lemmas
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module BE = Hacl.Bignum.Exponentiation
module SB = Hacl.Spec.Bignum
module SM = Hacl.Spec.Bignum.Montgomery
module SE = Hacl.Spec.Bignum.Exponentiation
module SD = Hacl.Spec.Bignum.Definitions
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let size_pos = x:size_t{v x > 0}
[@CInline]
let ffdhe_len (a:S.ffdhe_alg) : x:size_pos{v x = S.ffdhe_len a} =
allow_inversion S.ffdhe_alg;
match a with
| S.FFDHE2048 -> 256ul
| S.FFDHE3072 -> 384ul
| S.FFDHE4096 -> 512ul
| S.FFDHE6144 -> 768ul
| S.FFDHE8192 -> 1024ul
inline_for_extraction noextract
let get_ffdhe_p (a:S.ffdhe_alg) :x:glbuffer pub_uint8 (ffdhe_len a)
{witnessed x (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) /\ recallable x}
=
allow_inversion S.ffdhe_alg;
match a with
| S.FFDHE2048 -> ffdhe_p2048
| S.FFDHE3072 -> ffdhe_p3072
| S.FFDHE4096 -> ffdhe_p4096
| S.FFDHE6144 -> ffdhe_p6144
| S.FFDHE8192 -> ffdhe_p8192
inline_for_extraction noextract
val ffdhe_p_to_ps:
a:S.ffdhe_alg
-> p_s:lbuffer uint8 (ffdhe_len a) ->
Stack unit
(requires fun h -> live h p_s)
(ensures fun h0 _ h1 -> modifies (loc p_s) h0 h1 /\
BSeq.nat_from_intseq_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) ==
BSeq.nat_from_intseq_be (as_seq h1 p_s))
let ffdhe_p_to_ps a p_s =
let p = get_ffdhe_p a in
recall_contents p (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a));
let len = ffdhe_len a in
mapT len p_s secret p;
BSeq.nat_from_intseq_be_public_to_secret (v len) (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a))
inline_for_extraction noextract
let ffdhe_bn_from_g_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) =
g_n:lbignum t (blocks len (size (numbytes t))) ->
Stack unit
(requires fun h ->
live h g_n /\
v len = S.ffdhe_len a /\
as_seq h g_n == LSeq.create (v (blocks len (size (numbytes t)))) (uint #t 0))
(ensures fun h0 _ h1 -> modifies (loc g_n) h0 h1 /\
bn_v h1 g_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_g (S.get_ffdhe_params a)))
inline_for_extraction noextract
val ffdhe_bn_from_g: #t:limb_t -> a:S.ffdhe_alg -> len:size_pos -> ffdhe_bn_from_g_st t a len
let ffdhe_bn_from_g #t a len g_n =
recall_contents ffdhe_g2 S.ffdhe_g2;
[@inline_let] let nLen = blocks len (size (numbytes t)) in
push_frame ();
let g = create 1ul (u8 0) in
mapT 1ul g secret ffdhe_g2;
BSeq.nat_from_intseq_be_public_to_secret 1 S.ffdhe_g2;
let h0 = ST.get () in
update_sub_f h0 g_n 0ul 1ul
(fun h -> SB.bn_from_bytes_be 1 (as_seq h0 g))
(fun _ -> BN.bn_from_bytes_be 1ul g (sub g_n 0ul 1ul));
let h1 = ST.get () in
SD.bn_eval_update_sub #t 1 (SB.bn_from_bytes_be 1 (as_seq h0 g)) (v nLen);
assert (bn_v h1 g_n == SD.bn_v (SB.bn_from_bytes_be #t 1 (as_seq h0 g)));
SB.bn_from_bytes_be_lemma #t 1 (as_seq h0 g);
assert (bn_v h1 g_n == BSeq.nat_from_bytes_be (as_seq h0 g));
pop_frame ()
inline_for_extraction noextract
let ffdhe_precomp_inv (#t:limb_t) (#len:size_nat{0 < len /\ len + len <= max_size_t})
(a:S.ffdhe_alg) (p_r2_n:SD.lbignum t (len + len))
=
let p_n = LSeq.sub p_r2_n 0 len in
let r2_n = LSeq.sub p_r2_n len len in
SD.bn_v p_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) /\
0 < SD.bn_v p_n /\ SD.bn_v r2_n == pow2 (2 * bits t * len) % SD.bn_v p_n
inline_for_extraction noextract
let ffdhe_precomp_p_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen) ->
Stack unit
(requires fun h ->
live h p_r2_n /\
v len = S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen)
(ensures fun h0 _ h1 -> modifies (loc p_r2_n) h0 h1 /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h1 p_r2_n))
inline_for_extraction noextract
val ffdhe_precomp_p:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t ->
ffdhe_precomp_p_st t a len ke
let ffdhe_precomp_p #t a len ke p_r2_n =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let r2_n = sub p_r2_n nLen nLen in
let p_s = create len (u8 0) in
ffdhe_p_to_ps a p_s;
let h0 = ST.get () in
BN.bn_from_bytes_be len p_s p_n;
let h1 = ST.get () in
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 p_s);
assert (bn_v h1 p_n == BSeq.nat_from_bytes_be (as_seq h0 p_s));
S.ffdhe_p_lemma a;
Lemmas.ffdhe_p_bits_lemma a;
ke.BE.precompr2 (8ul *! len -! 1ul) p_n r2_n;
SM.bn_precomp_r2_mod_n_lemma (8 * v len - 1) (as_seq h1 p_n);
pop_frame ()
inline_for_extraction noextract
let new_ffdhe_precomp_p_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
r:HS.rid ->
ST (B.buffer (limb t))
(requires fun h ->
ST.is_eternal_region r /\
v len = S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen)
(ensures fun h0 res h1 ->
B.(modifies loc_none h0 h1) /\
not (B.g_is_null res) ==> (
B.len res == nLen +! nLen /\
B.(fresh_loc (loc_buffer res) h0 h1) /\
B.(loc_includes (loc_region_only false r) (loc_buffer res)) /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h1 (res <: lbignum t (nLen +! nLen)))))
inline_for_extraction noextract
val new_ffdhe_precomp_p:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_precomp_p:ffdhe_precomp_p_st t a len ke ->
new_ffdhe_precomp_p_st t a len ke
let new_ffdhe_precomp_p #t a len ke ffdhe_precomp_p r =
let h0 = ST.get () in
let nLen = blocks len (size (numbytes t)) in
assert (v (nLen +! nLen) > 0);
let res = LowStar.Monotonic.Buffer.mmalloc_partial r (uint #t #SEC 0) (nLen +! nLen) in
if B.is_null res then
res
else
let h1 = ST.get () in
B.(modifies_only_not_unused_in loc_none h0 h1);
assert (B.len res == nLen +! nLen);
let res: Lib.Buffer.buffer (limb t) = res in
assert (B.length res == v nLen + v nLen);
let res: lbignum t (nLen +! nLen) = res in
ffdhe_precomp_p res;
let h2 = ST.get () in
B.(modifies_only_not_unused_in loc_none h0 h2);
res
inline_for_extraction noextract
let ffdhe_compute_exp_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen)
-> sk_n:lbignum t nLen
-> b_n:lbignum t nLen
-> res:lbuffer uint8 len ->
Stack unit
(requires fun h ->
live h p_r2_n /\ live h sk_n /\ live h b_n /\ live h res /\
disjoint p_r2_n res /\ disjoint sk_n res /\ disjoint b_n res /\
disjoint p_r2_n b_n /\ disjoint p_r2_n sk_n /\
v len == S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h p_r2_n) /\
bn_v h b_n < bn_v h (gsub p_r2_n 0ul nLen) - 1 /\
1 < bn_v h sk_n)
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
(S.ffdhe_p_lemma a;
let res_n = Lib.NatMod.pow_mod #(bn_v h0 (gsub p_r2_n 0ul nLen)) (bn_v h0 b_n) (bn_v h0 sk_n) in
as_seq h1 res == BSeq.nat_to_bytes_be (v len) res_n))
#push-options "--z3rlimit 100"
inline_for_extraction noextract
val ffdhe_compute_exp:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t ->
ffdhe_compute_exp_st t a len ke
let ffdhe_compute_exp #t a len ke p_r2_n sk_n b_n res =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let r2_n = sub p_r2_n nLen nLen in
let res_n = create nLen (uint #t #SEC 0) in
let h1 = ST.get () in
S.ffdhe_p_lemma a;
assert_norm (pow2 4 = 16);
assert_norm (pow2 10 = 1024);
Math.Lemmas.pow2_plus 4 10;
Math.Lemmas.pow2_lt_compat 32 14;
SD.bn_eval_bound #t (as_seq h1 sk_n) (v nLen);
BE.mk_bn_mod_exp_precompr2 nLen ke.BE.exp_ct_precomp p_n r2_n b_n (size (bits t) *! nLen) sk_n res_n; //b_n ^ sk_n % p_n
let h2 = ST.get () in
BN.bn_to_bytes_be len res_n res;
SB.bn_to_bytes_be_lemma (v len) (as_seq h2 res_n);
pop_frame ()
#pop-options
inline_for_extraction noextract
let ffdhe_secret_to_public_precomp_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen)
-> sk:lbuffer uint8 len
-> pk:lbuffer uint8 len ->
Stack unit
(requires fun h ->
live h sk /\ live h pk /\ live h p_r2_n /\
disjoint sk pk /\ disjoint sk p_r2_n /\ disjoint pk p_r2_n /\
v len == S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen /\
1 < Lib.ByteSequence.nat_from_bytes_be (as_seq h sk) /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h p_r2_n))
(ensures fun h0 _ h1 -> modifies (loc pk) h0 h1 /\
as_seq h1 pk == S.ffdhe_secret_to_public a (as_seq h0 sk))
//TODO: pass sBits?
inline_for_extraction noextract
val ffdhe_secret_to_public_precomp:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_compute_exp:ffdhe_compute_exp_st t a len ke ->
ffdhe_secret_to_public_precomp_st t a len ke
let ffdhe_secret_to_public_precomp #t a len ke ffdhe_compute_exp p_r2_n sk pk =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let g_n = create nLen (uint #t #SEC 0) in
ffdhe_bn_from_g a len g_n;
let sk_n = create nLen (uint #t #SEC 0) in
let h0 = ST.get () in
BN.bn_from_bytes_be len sk sk_n;
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 sk);
S.ffdhe_g2_lemma ();
S.ffdhe_p_lemma a;
ffdhe_compute_exp p_r2_n sk_n g_n pk;
pop_frame ()
inline_for_extraction noextract
let ffdhe_secret_to_public_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
sk:lbuffer uint8 len
-> pk:lbuffer uint8 len ->
Stack unit
(requires fun h ->
live h sk /\ live h pk /\ disjoint sk pk /\
v len == S.ffdhe_len a /\
ke.BE.bn.BN.len == blocks len (size (numbytes t)) /\
1 < Lib.ByteSequence.nat_from_bytes_be (as_seq h sk))
(ensures fun h0 _ h1 -> modifies (loc pk) h0 h1 /\
as_seq h1 pk == S.ffdhe_secret_to_public a (as_seq h0 sk))
//TODO: pass sBits?
inline_for_extraction noextract
val ffdhe_secret_to_public:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_secret_to_public_precomp:ffdhe_secret_to_public_precomp_st t a len ke
-> ffdhe_precomp_p:ffdhe_precomp_p_st t a len ke ->
ffdhe_secret_to_public_st t a len ke | {
"checked_file": "/",
"dependencies": [
"Spec.FFDHE.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.FFDHE.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.Exponentiation.fsti.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"Hacl.Impl.FFDHE.Constants.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Base.fst.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.FFDHE.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Exponentiation",
"short_module": "SE"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "SM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "SB"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.FFDHE.Lemmas",
"short_module": "Lemmas"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "Spec.FFDHE",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.FFDHE.Constants",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Spec.FFDHE.ffdhe_alg ->
len: Hacl.Impl.FFDHE.size_pos ->
ke: Hacl.Bignum.Exponentiation.exp t ->
ffdhe_secret_to_public_precomp: Hacl.Impl.FFDHE.ffdhe_secret_to_public_precomp_st t a len ke ->
ffdhe_precomp_p: Hacl.Impl.FFDHE.ffdhe_precomp_p_st t a len ke
-> Hacl.Impl.FFDHE.ffdhe_secret_to_public_st t a len ke | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Definitions.limb_t",
"Spec.FFDHE.ffdhe_alg",
"Hacl.Impl.FFDHE.size_pos",
"Hacl.Bignum.Exponentiation.exp",
"Hacl.Impl.FFDHE.ffdhe_secret_to_public_precomp_st",
"Hacl.Impl.FFDHE.ffdhe_precomp_p_st",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.HyperStack.ST.pop_frame",
"Prims.unit",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"Hacl.Bignum.Definitions.limb",
"Lib.IntTypes.add",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.Buffer.create",
"Lib.IntTypes.op_Plus_Bang",
"Lib.IntTypes.uint",
"Lib.IntTypes.SEC",
"Lib.IntTypes.int_t",
"Prims.eq2",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Prims.l_and",
"Prims.b2t",
"Prims.op_GreaterThan",
"Prims.op_LessThanOrEqual",
"Prims.op_Subtraction",
"Prims.pow2",
"Lib.IntTypes.v",
"Prims.op_Multiply",
"Lib.IntTypes.mk_int",
"Lib.IntTypes.numbytes",
"Hacl.Spec.Bignum.Definitions.blocks",
"Hacl.Bignum.Definitions.blocks",
"Lib.IntTypes.size",
"FStar.HyperStack.ST.push_frame"
] | [] | false | false | false | false | false | let ffdhe_secret_to_public #t a len ke ffdhe_secret_to_public_precomp ffdhe_precomp_p sk pk =
| push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_r2_n = create (nLen +! nLen) (uint #t #SEC 0) in
ffdhe_precomp_p p_r2_n;
ffdhe_secret_to_public_precomp p_r2_n sk pk;
pop_frame () | false |
Cert.ACLs.fst | Cert.ACLs.test | val test : _: Prims.unit -> Prims.unit | let test () =
delete tmp; (* ok *)
//delete pwd; (* type error *)
let v1 = read tmp in (* ok, rule 1. *)
let v2 = read readme in (* ok, rule 2. *)
() | {
"file_name": "examples/crypto/Cert.ACLs.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 4,
"end_line": 50,
"start_col": 0,
"start_line": 45
} | (*
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 Cert.ACLs
open FStar.All
open FStar.String
open FStar.List.Tot
type file = string
let canWrite = function
| "C:/temp/tempfile" -> true
| _ -> false
let publicFile = function
| "C:/public/README" -> true
| _ -> false
let canRead (f:file) =
canWrite f (* 1. writeable files are also readable *)
|| publicFile f (* 2. public files are readable *)
|| f="C:/acls2.fst" (* and so is this file *)
(* two dangerous primitives *)
assume val read: file:string{canRead file} -> string
assume val delete: file:string{canWrite file} -> unit
(* some sample files, one of them writable *)
let pwd = "C:/etc/password"
let readme = "C:/public/README"
let tmp = "C:/temp/tempfile" | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.String.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": false,
"source_file": "Cert.ACLs.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.String",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "Cert",
"short_module": null
},
{
"abbrev": false,
"full_module": "Cert",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit -> Prims.unit | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Prims.string",
"Cert.ACLs.read",
"Cert.ACLs.readme",
"Cert.ACLs.tmp",
"Cert.ACLs.delete"
] | [] | false | false | false | true | false | let test () =
| delete tmp;
let v1 = read tmp in
let v2 = read readme in
() | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.and_qn | val and_qn : Prims.list Prims.string | let and_qn = ["Prims"; "l_and"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 37,
"end_line": 24,
"start_col": 0,
"start_line": 24
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let and_qn =
| ["Prims"; "l_and"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.or_qn | val or_qn : Prims.list Prims.string | let or_qn = ["Prims"; "l_or"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 36,
"end_line": 25,
"start_col": 0,
"start_line": 25
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let or_qn =
| ["Prims"; "l_or"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.imp_qn | val imp_qn : Prims.list Prims.string | let imp_qn = ["Prims"; "l_imp"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 37,
"end_line": 23,
"start_col": 0,
"start_line": 23
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let imp_qn =
| ["Prims"; "l_imp"] | false |
|
Hacl.Impl.FFDHE.fst | Hacl.Impl.FFDHE.ffdhe_shared_secret | val ffdhe_shared_secret:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_shared_secret_precomp:ffdhe_shared_secret_precomp_st t a len ke
-> ffdhe_precomp_p:ffdhe_precomp_p_st t a len ke ->
ffdhe_shared_secret_st t a len ke | val ffdhe_shared_secret:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_shared_secret_precomp:ffdhe_shared_secret_precomp_st t a len ke
-> ffdhe_precomp_p:ffdhe_precomp_p_st t a len ke ->
ffdhe_shared_secret_st t a len ke | let ffdhe_shared_secret #t a len ke ffdhe_shared_secret_precomp ffdhe_precomp_p sk pk ss =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = create (nLen +! nLen) (uint #t #SEC 0) in
ffdhe_precomp_p p_n;
let m = ffdhe_shared_secret_precomp p_n sk pk ss in
pop_frame ();
m | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 3,
"end_line": 480,
"start_col": 0,
"start_line": 473
} | module Hacl.Impl.FFDHE
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.FFDHE.Constants
open Hacl.Bignum.Definitions
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module S = Spec.FFDHE
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Lemmas = Hacl.Spec.FFDHE.Lemmas
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module BE = Hacl.Bignum.Exponentiation
module SB = Hacl.Spec.Bignum
module SM = Hacl.Spec.Bignum.Montgomery
module SE = Hacl.Spec.Bignum.Exponentiation
module SD = Hacl.Spec.Bignum.Definitions
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let size_pos = x:size_t{v x > 0}
[@CInline]
let ffdhe_len (a:S.ffdhe_alg) : x:size_pos{v x = S.ffdhe_len a} =
allow_inversion S.ffdhe_alg;
match a with
| S.FFDHE2048 -> 256ul
| S.FFDHE3072 -> 384ul
| S.FFDHE4096 -> 512ul
| S.FFDHE6144 -> 768ul
| S.FFDHE8192 -> 1024ul
inline_for_extraction noextract
let get_ffdhe_p (a:S.ffdhe_alg) :x:glbuffer pub_uint8 (ffdhe_len a)
{witnessed x (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) /\ recallable x}
=
allow_inversion S.ffdhe_alg;
match a with
| S.FFDHE2048 -> ffdhe_p2048
| S.FFDHE3072 -> ffdhe_p3072
| S.FFDHE4096 -> ffdhe_p4096
| S.FFDHE6144 -> ffdhe_p6144
| S.FFDHE8192 -> ffdhe_p8192
inline_for_extraction noextract
val ffdhe_p_to_ps:
a:S.ffdhe_alg
-> p_s:lbuffer uint8 (ffdhe_len a) ->
Stack unit
(requires fun h -> live h p_s)
(ensures fun h0 _ h1 -> modifies (loc p_s) h0 h1 /\
BSeq.nat_from_intseq_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) ==
BSeq.nat_from_intseq_be (as_seq h1 p_s))
let ffdhe_p_to_ps a p_s =
let p = get_ffdhe_p a in
recall_contents p (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a));
let len = ffdhe_len a in
mapT len p_s secret p;
BSeq.nat_from_intseq_be_public_to_secret (v len) (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a))
inline_for_extraction noextract
let ffdhe_bn_from_g_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) =
g_n:lbignum t (blocks len (size (numbytes t))) ->
Stack unit
(requires fun h ->
live h g_n /\
v len = S.ffdhe_len a /\
as_seq h g_n == LSeq.create (v (blocks len (size (numbytes t)))) (uint #t 0))
(ensures fun h0 _ h1 -> modifies (loc g_n) h0 h1 /\
bn_v h1 g_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_g (S.get_ffdhe_params a)))
inline_for_extraction noextract
val ffdhe_bn_from_g: #t:limb_t -> a:S.ffdhe_alg -> len:size_pos -> ffdhe_bn_from_g_st t a len
let ffdhe_bn_from_g #t a len g_n =
recall_contents ffdhe_g2 S.ffdhe_g2;
[@inline_let] let nLen = blocks len (size (numbytes t)) in
push_frame ();
let g = create 1ul (u8 0) in
mapT 1ul g secret ffdhe_g2;
BSeq.nat_from_intseq_be_public_to_secret 1 S.ffdhe_g2;
let h0 = ST.get () in
update_sub_f h0 g_n 0ul 1ul
(fun h -> SB.bn_from_bytes_be 1 (as_seq h0 g))
(fun _ -> BN.bn_from_bytes_be 1ul g (sub g_n 0ul 1ul));
let h1 = ST.get () in
SD.bn_eval_update_sub #t 1 (SB.bn_from_bytes_be 1 (as_seq h0 g)) (v nLen);
assert (bn_v h1 g_n == SD.bn_v (SB.bn_from_bytes_be #t 1 (as_seq h0 g)));
SB.bn_from_bytes_be_lemma #t 1 (as_seq h0 g);
assert (bn_v h1 g_n == BSeq.nat_from_bytes_be (as_seq h0 g));
pop_frame ()
inline_for_extraction noextract
let ffdhe_precomp_inv (#t:limb_t) (#len:size_nat{0 < len /\ len + len <= max_size_t})
(a:S.ffdhe_alg) (p_r2_n:SD.lbignum t (len + len))
=
let p_n = LSeq.sub p_r2_n 0 len in
let r2_n = LSeq.sub p_r2_n len len in
SD.bn_v p_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) /\
0 < SD.bn_v p_n /\ SD.bn_v r2_n == pow2 (2 * bits t * len) % SD.bn_v p_n
inline_for_extraction noextract
let ffdhe_precomp_p_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen) ->
Stack unit
(requires fun h ->
live h p_r2_n /\
v len = S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen)
(ensures fun h0 _ h1 -> modifies (loc p_r2_n) h0 h1 /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h1 p_r2_n))
inline_for_extraction noextract
val ffdhe_precomp_p:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t ->
ffdhe_precomp_p_st t a len ke
let ffdhe_precomp_p #t a len ke p_r2_n =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let r2_n = sub p_r2_n nLen nLen in
let p_s = create len (u8 0) in
ffdhe_p_to_ps a p_s;
let h0 = ST.get () in
BN.bn_from_bytes_be len p_s p_n;
let h1 = ST.get () in
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 p_s);
assert (bn_v h1 p_n == BSeq.nat_from_bytes_be (as_seq h0 p_s));
S.ffdhe_p_lemma a;
Lemmas.ffdhe_p_bits_lemma a;
ke.BE.precompr2 (8ul *! len -! 1ul) p_n r2_n;
SM.bn_precomp_r2_mod_n_lemma (8 * v len - 1) (as_seq h1 p_n);
pop_frame ()
inline_for_extraction noextract
let new_ffdhe_precomp_p_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
r:HS.rid ->
ST (B.buffer (limb t))
(requires fun h ->
ST.is_eternal_region r /\
v len = S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen)
(ensures fun h0 res h1 ->
B.(modifies loc_none h0 h1) /\
not (B.g_is_null res) ==> (
B.len res == nLen +! nLen /\
B.(fresh_loc (loc_buffer res) h0 h1) /\
B.(loc_includes (loc_region_only false r) (loc_buffer res)) /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h1 (res <: lbignum t (nLen +! nLen)))))
inline_for_extraction noextract
val new_ffdhe_precomp_p:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_precomp_p:ffdhe_precomp_p_st t a len ke ->
new_ffdhe_precomp_p_st t a len ke
let new_ffdhe_precomp_p #t a len ke ffdhe_precomp_p r =
let h0 = ST.get () in
let nLen = blocks len (size (numbytes t)) in
assert (v (nLen +! nLen) > 0);
let res = LowStar.Monotonic.Buffer.mmalloc_partial r (uint #t #SEC 0) (nLen +! nLen) in
if B.is_null res then
res
else
let h1 = ST.get () in
B.(modifies_only_not_unused_in loc_none h0 h1);
assert (B.len res == nLen +! nLen);
let res: Lib.Buffer.buffer (limb t) = res in
assert (B.length res == v nLen + v nLen);
let res: lbignum t (nLen +! nLen) = res in
ffdhe_precomp_p res;
let h2 = ST.get () in
B.(modifies_only_not_unused_in loc_none h0 h2);
res
inline_for_extraction noextract
let ffdhe_compute_exp_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen)
-> sk_n:lbignum t nLen
-> b_n:lbignum t nLen
-> res:lbuffer uint8 len ->
Stack unit
(requires fun h ->
live h p_r2_n /\ live h sk_n /\ live h b_n /\ live h res /\
disjoint p_r2_n res /\ disjoint sk_n res /\ disjoint b_n res /\
disjoint p_r2_n b_n /\ disjoint p_r2_n sk_n /\
v len == S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h p_r2_n) /\
bn_v h b_n < bn_v h (gsub p_r2_n 0ul nLen) - 1 /\
1 < bn_v h sk_n)
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
(S.ffdhe_p_lemma a;
let res_n = Lib.NatMod.pow_mod #(bn_v h0 (gsub p_r2_n 0ul nLen)) (bn_v h0 b_n) (bn_v h0 sk_n) in
as_seq h1 res == BSeq.nat_to_bytes_be (v len) res_n))
#push-options "--z3rlimit 100"
inline_for_extraction noextract
val ffdhe_compute_exp:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t ->
ffdhe_compute_exp_st t a len ke
let ffdhe_compute_exp #t a len ke p_r2_n sk_n b_n res =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let r2_n = sub p_r2_n nLen nLen in
let res_n = create nLen (uint #t #SEC 0) in
let h1 = ST.get () in
S.ffdhe_p_lemma a;
assert_norm (pow2 4 = 16);
assert_norm (pow2 10 = 1024);
Math.Lemmas.pow2_plus 4 10;
Math.Lemmas.pow2_lt_compat 32 14;
SD.bn_eval_bound #t (as_seq h1 sk_n) (v nLen);
BE.mk_bn_mod_exp_precompr2 nLen ke.BE.exp_ct_precomp p_n r2_n b_n (size (bits t) *! nLen) sk_n res_n; //b_n ^ sk_n % p_n
let h2 = ST.get () in
BN.bn_to_bytes_be len res_n res;
SB.bn_to_bytes_be_lemma (v len) (as_seq h2 res_n);
pop_frame ()
#pop-options
inline_for_extraction noextract
let ffdhe_secret_to_public_precomp_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen)
-> sk:lbuffer uint8 len
-> pk:lbuffer uint8 len ->
Stack unit
(requires fun h ->
live h sk /\ live h pk /\ live h p_r2_n /\
disjoint sk pk /\ disjoint sk p_r2_n /\ disjoint pk p_r2_n /\
v len == S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen /\
1 < Lib.ByteSequence.nat_from_bytes_be (as_seq h sk) /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h p_r2_n))
(ensures fun h0 _ h1 -> modifies (loc pk) h0 h1 /\
as_seq h1 pk == S.ffdhe_secret_to_public a (as_seq h0 sk))
//TODO: pass sBits?
inline_for_extraction noextract
val ffdhe_secret_to_public_precomp:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_compute_exp:ffdhe_compute_exp_st t a len ke ->
ffdhe_secret_to_public_precomp_st t a len ke
let ffdhe_secret_to_public_precomp #t a len ke ffdhe_compute_exp p_r2_n sk pk =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let g_n = create nLen (uint #t #SEC 0) in
ffdhe_bn_from_g a len g_n;
let sk_n = create nLen (uint #t #SEC 0) in
let h0 = ST.get () in
BN.bn_from_bytes_be len sk sk_n;
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 sk);
S.ffdhe_g2_lemma ();
S.ffdhe_p_lemma a;
ffdhe_compute_exp p_r2_n sk_n g_n pk;
pop_frame ()
inline_for_extraction noextract
let ffdhe_secret_to_public_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
sk:lbuffer uint8 len
-> pk:lbuffer uint8 len ->
Stack unit
(requires fun h ->
live h sk /\ live h pk /\ disjoint sk pk /\
v len == S.ffdhe_len a /\
ke.BE.bn.BN.len == blocks len (size (numbytes t)) /\
1 < Lib.ByteSequence.nat_from_bytes_be (as_seq h sk))
(ensures fun h0 _ h1 -> modifies (loc pk) h0 h1 /\
as_seq h1 pk == S.ffdhe_secret_to_public a (as_seq h0 sk))
//TODO: pass sBits?
inline_for_extraction noextract
val ffdhe_secret_to_public:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_secret_to_public_precomp:ffdhe_secret_to_public_precomp_st t a len ke
-> ffdhe_precomp_p:ffdhe_precomp_p_st t a len ke ->
ffdhe_secret_to_public_st t a len ke
let ffdhe_secret_to_public #t a len ke ffdhe_secret_to_public_precomp ffdhe_precomp_p sk pk =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_r2_n = create (nLen +! nLen) (uint #t #SEC 0) in
ffdhe_precomp_p p_r2_n;
ffdhe_secret_to_public_precomp p_r2_n sk pk;
pop_frame ()
inline_for_extraction noextract
let ffdhe_check_pk_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) =
let nLen = blocks len (size (numbytes t)) in
pk_n:lbignum t nLen
-> p_n:lbignum t nLen ->
Stack (limb t)
(requires fun h ->
live h pk_n /\ live h p_n /\ disjoint pk_n p_n /\
v len = S.ffdhe_len a /\
bn_v h p_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)))
(ensures fun h0 m h1 -> modifies0 h0 h1 /\
v m == (if (1 < bn_v h0 pk_n && bn_v h0 pk_n < bn_v h0 p_n - 1) then v (ones t SEC) else 0))
inline_for_extraction noextract
val ffdhe_check_pk: #t:limb_t -> a:S.ffdhe_alg -> len:size_pos -> ffdhe_check_pk_st t a len
let ffdhe_check_pk #t a len pk_n p_n =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n1 = create nLen (uint #t #SEC 0) in
let h0 = ST.get () in
let c = BN.bn_sub1 nLen p_n (uint #t 1) p_n1 in
SB.bn_sub1_lemma (as_seq h0 p_n) (uint #t 1);
let h1 = ST.get () in
S.ffdhe_p_lemma a;
SD.bn_eval_bound (as_seq h1 p_n1) (v nLen);
assert (bn_v h1 p_n1 == bn_v h0 p_n - 1);
let m0 = BN.bn_gt_pow2_mask nLen pk_n 0ul in
SB.bn_gt_pow2_mask_lemma (as_seq h1 pk_n) 0;
assert_norm (pow2 0 = 1);
assert (if v m0 = 0 then 1 >= bn_v h1 pk_n else 1 < bn_v h1 pk_n);
let m1 = BN.bn_lt_mask nLen pk_n p_n1 in
SB.bn_lt_mask_lemma (as_seq h1 pk_n) (as_seq h1 p_n1);
assert (if v m1 = 0 then bn_v h1 pk_n >= bn_v h1 p_n1 else bn_v h1 pk_n < bn_v h1 p_n1);
let m = m0 &. m1 in
logand_lemma m0 m1;
pop_frame ();
m
inline_for_extraction noextract
let ffdhe_shared_secret_precomp_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen)
-> sk:lbuffer uint8 len
-> pk:lbuffer uint8 len
-> ss:lbuffer uint8 len ->
Stack (limb t)
(requires fun h ->
live h sk /\ live h pk /\ live h ss /\ live h p_r2_n /\
disjoint sk pk /\ disjoint sk ss /\ disjoint pk ss /\
disjoint p_r2_n ss /\ disjoint p_r2_n pk /\ disjoint p_r2_n sk /\
v len = S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen /\
1 < Lib.ByteSequence.nat_from_bytes_be (as_seq h sk) /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h p_r2_n))
(ensures fun h0 m h1 -> modifies (loc ss) h0 h1 /\
(let ss_s = S.ffdhe_shared_secret a (as_seq h0 sk) (as_seq h0 pk) in
if v m = v (ones t SEC) then Some? ss_s /\ as_seq h1 ss == Some?.v ss_s else None? ss_s))
inline_for_extraction noextract
val ffdhe_shared_secret_precomp:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_check_pk:ffdhe_check_pk_st t a len
-> ffdhe_compute_exp:ffdhe_compute_exp_st t a len ke ->
ffdhe_shared_secret_precomp_st t a len ke
let ffdhe_shared_secret_precomp #t a len ke ffdhe_check_pk ffdhe_compute_exp p_r2_n sk pk ss =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let sk_n = create nLen (uint #t #SEC 0) in
let pk_n = create nLen (uint #t #SEC 0) in
let h0 = ST.get () in
BN.bn_from_bytes_be len sk sk_n;
BN.bn_from_bytes_be len pk pk_n;
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 sk);
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 pk);
S.ffdhe_p_lemma a;
let m = ffdhe_check_pk pk_n p_n in
if Hacl.Bignum.Base.unsafe_bool_of_limb m then
ffdhe_compute_exp p_r2_n sk_n pk_n ss;
pop_frame ();
m
inline_for_extraction noextract
let ffdhe_shared_secret_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
sk:lbuffer uint8 len
-> pk:lbuffer uint8 len
-> ss:lbuffer uint8 len ->
Stack (limb t)
(requires fun h ->
live h sk /\ live h pk /\ live h ss /\
disjoint sk pk /\ disjoint sk ss /\ disjoint pk ss /\
v len = S.ffdhe_len a /\
ke.BE.bn.BN.len == blocks len (size (numbytes t)) /\
1 < Lib.ByteSequence.nat_from_bytes_be (as_seq h sk))
(ensures fun h0 m h1 -> modifies (loc ss) h0 h1 /\
(let ss_s = S.ffdhe_shared_secret a (as_seq h0 sk) (as_seq h0 pk) in
if v m = v (ones t SEC) then Some? ss_s /\ as_seq h1 ss == Some?.v ss_s else None? ss_s))
inline_for_extraction noextract
val ffdhe_shared_secret:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_shared_secret_precomp:ffdhe_shared_secret_precomp_st t a len ke
-> ffdhe_precomp_p:ffdhe_precomp_p_st t a len ke ->
ffdhe_shared_secret_st t a len ke | {
"checked_file": "/",
"dependencies": [
"Spec.FFDHE.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.FFDHE.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.Exponentiation.fsti.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"Hacl.Impl.FFDHE.Constants.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Base.fst.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.FFDHE.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Exponentiation",
"short_module": "SE"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "SM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "SB"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.FFDHE.Lemmas",
"short_module": "Lemmas"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "Spec.FFDHE",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.FFDHE.Constants",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Spec.FFDHE.ffdhe_alg ->
len: Hacl.Impl.FFDHE.size_pos ->
ke: Hacl.Bignum.Exponentiation.exp t ->
ffdhe_shared_secret_precomp: Hacl.Impl.FFDHE.ffdhe_shared_secret_precomp_st t a len ke ->
ffdhe_precomp_p: Hacl.Impl.FFDHE.ffdhe_precomp_p_st t a len ke
-> Hacl.Impl.FFDHE.ffdhe_shared_secret_st t a len ke | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Definitions.limb_t",
"Spec.FFDHE.ffdhe_alg",
"Hacl.Impl.FFDHE.size_pos",
"Hacl.Bignum.Exponentiation.exp",
"Hacl.Impl.FFDHE.ffdhe_shared_secret_precomp_st",
"Hacl.Impl.FFDHE.ffdhe_precomp_p_st",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"Hacl.Bignum.Definitions.limb",
"Prims.unit",
"FStar.HyperStack.ST.pop_frame",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"Lib.IntTypes.add",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.Buffer.create",
"Lib.IntTypes.op_Plus_Bang",
"Lib.IntTypes.uint",
"Lib.IntTypes.SEC",
"Lib.IntTypes.int_t",
"Prims.eq2",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Prims.l_and",
"Prims.b2t",
"Prims.op_GreaterThan",
"Prims.op_LessThanOrEqual",
"Prims.op_Subtraction",
"Prims.pow2",
"Lib.IntTypes.v",
"Prims.op_Multiply",
"Lib.IntTypes.mk_int",
"Lib.IntTypes.numbytes",
"Hacl.Spec.Bignum.Definitions.blocks",
"Hacl.Bignum.Definitions.blocks",
"Lib.IntTypes.size",
"FStar.HyperStack.ST.push_frame"
] | [] | false | false | false | false | false | let ffdhe_shared_secret #t a len ke ffdhe_shared_secret_precomp ffdhe_precomp_p sk pk ss =
| push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = create (nLen +! nLen) (uint #t #SEC 0) in
ffdhe_precomp_p p_n;
let m = ffdhe_shared_secret_precomp p_n sk pk ss in
pop_frame ();
m | false |
TwoLockQueue.fst | TwoLockQueue.open_exists | val open_exists: #a: Type -> #opened_invariants: _ -> #p: (a -> vprop) -> unit
-> SteelGhostT (Ghost.erased a) opened_invariants (h_exists p) (fun r -> p (reveal r)) | val open_exists: #a: Type -> #opened_invariants: _ -> #p: (a -> vprop) -> unit
-> SteelGhostT (Ghost.erased a) opened_invariants (h_exists p) (fun r -> p (reveal r)) | let open_exists (#a:Type) (#opened_invariants:_) (#p:a -> vprop) (_:unit)
: SteelGhostT (Ghost.erased a) opened_invariants
(h_exists p) (fun r -> p (reveal r))
= let v : erased a = witness_exists () in
v | {
"file_name": "share/steel/examples/steel/TwoLockQueue.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 5,
"end_line": 71,
"start_col": 0,
"start_line": 67
} | module TwoLockQueue
open FStar.Ghost
open Steel.Memory
open Steel.Effect.Atomic
open Steel.Effect
open Steel.FractionalPermission
open Steel.Reference
open Steel.SpinLock
module L = FStar.List.Tot
module U = Steel.Utils
module Q = Queue
/// This module provides an implementation of Michael and Scott's two lock queue, using the
/// abstract interface for queues provided in Queue.fsti.
/// This implementation allows an enqueue and a dequeue operation to safely operate in parallel.
/// There is a lock associated to both the enqueuer and the dequeuer, which guards each of those operation,
/// ensuring that at most one enqueue (resp. dequeue) is happening at any time
/// We only prove that this implementation is memory safe, and do not prove the functional correctness of the concurrent queue
#push-options "--ide_id_info_off"
/// Adding the definition of the vprop equivalence to the context, for proof purposes
let _: squash (forall p q. p `equiv` q <==> hp_of p `Steel.Memory.equiv` hp_of q) =
Classical.forall_intro_2 reveal_equiv
(* Some wrappers to reduce clutter in the code *)
[@@__reduce__]
let full = full_perm
[@@__reduce__]
let half = half_perm full
(* Wrappers around fst and snd to avoid overnormalization.
TODO: The frame inference tactic should not normalize fst and snd *)
let fst x = fst x
let snd x = snd x
(* Some wrappers around Steel functions which are easier to use inside this module *)
let ghost_gather (#a:Type) (#u:_)
(#p0 #p1:perm) (#p:perm{p == sum_perm p0 p1})
(x0 #x1:erased a)
(r:ghost_ref a)
: SteelGhost unit u
(ghost_pts_to r p0 x0 `star`
ghost_pts_to r p1 x1)
(fun _ -> ghost_pts_to r p x0)
(requires fun _ -> True)
(ensures fun _ _ _ -> x0 == x1)
= let _ = ghost_gather_pt #a #u #p0 #p1 r in ()
let rewrite #u (p q:vprop)
: SteelGhost unit u p (fun _ -> q)
(requires fun _ -> p `equiv` q)
(ensures fun _ _ _ -> True)
= rewrite_slprop p q (fun _ -> reveal_equiv p q)
let elim_pure (#p:prop) #u ()
: SteelGhost unit u
(pure p) (fun _ -> emp)
(requires fun _ -> True)
(ensures fun _ _ _ -> p)
= let _ = Steel.Effect.Atomic.elim_pure p in () | {
"checked_file": "/",
"dependencies": [
"Steel.Utils.fst.checked",
"Steel.SpinLock.fsti.checked",
"Steel.Reference.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Queue.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "TwoLockQueue.fst"
} | [
{
"abbrev": true,
"full_module": "Queue",
"short_module": "Q"
},
{
"abbrev": true,
"full_module": "Steel.Utils",
"short_module": "U"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Steel.SpinLock",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit -> Steel.Effect.Atomic.SteelGhostT (FStar.Ghost.erased a) | Steel.Effect.Atomic.SteelGhostT | [] | [] | [
"Steel.Memory.inames",
"Steel.Effect.Common.vprop",
"Prims.unit",
"FStar.Ghost.erased",
"Steel.Effect.Atomic.witness_exists",
"Steel.Effect.Atomic.h_exists",
"FStar.Ghost.reveal"
] | [] | false | true | false | false | false | let open_exists (#a: Type) (#opened_invariants: _) (#p: (a -> vprop)) (_: unit)
: SteelGhostT (Ghost.erased a) opened_invariants (h_exists p) (fun r -> p (reveal r)) =
| let v:erased a = witness_exists () in
v | false |
FStar.Reflection.Const.fst | FStar.Reflection.Const.eq2_qn | val eq2_qn : Prims.list Prims.string | let eq2_qn = ["Prims"; "eq2"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 35,
"end_line": 28,
"start_col": 0,
"start_line": 28
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let eq2_qn =
| ["Prims"; "eq2"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.eq1_qn | val eq1_qn : Prims.list Prims.string | let eq1_qn = ["Prims"; "eq"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 34,
"end_line": 29,
"start_col": 0,
"start_line": 29
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let eq1_qn =
| ["Prims"; "eq"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.not_qn | val not_qn : Prims.list Prims.string | let not_qn = ["Prims"; "l_not"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 37,
"end_line": 26,
"start_col": 0,
"start_line": 26
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let not_qn =
| ["Prims"; "l_not"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.iff_qn | val iff_qn : Prims.list Prims.string | let iff_qn = ["Prims"; "l_iff"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 37,
"end_line": 27,
"start_col": 0,
"start_line": 27
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let iff_qn =
| ["Prims"; "l_iff"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.true_qn | val true_qn : Prims.list Prims.string | let true_qn = ["Prims"; "l_True"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 38,
"end_line": 30,
"start_col": 0,
"start_line": 30
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let true_qn =
| ["Prims"; "l_True"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.b2t_qn | val b2t_qn : Prims.list Prims.string | let b2t_qn = ["Prims"; "b2t"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 35,
"end_line": 32,
"start_col": 0,
"start_line": 32
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let b2t_qn =
| ["Prims"; "b2t"] | false |
|
LowParse.Tot.DER.fst | LowParse.Tot.DER.parse_der_length_payload32_bare | val parse_der_length_payload32_bare (x: U8.t{der_length_payload_size_of_tag x <= 4}) (input: bytes)
: Pure (option ((refine_with_tag tag_of_der_length32 x) * consumed_length input))
(requires True)
(ensures (fun y -> y == parse (parse_der_length_payload32 x) input)) | val parse_der_length_payload32_bare (x: U8.t{der_length_payload_size_of_tag x <= 4}) (input: bytes)
: Pure (option ((refine_with_tag tag_of_der_length32 x) * consumed_length input))
(requires True)
(ensures (fun y -> y == parse (parse_der_length_payload32 x) input)) | let parse_der_length_payload32_bare
(x: U8.t { der_length_payload_size_of_tag x <= 4 } )
(input: bytes)
: Pure (option ((refine_with_tag tag_of_der_length32 x) * consumed_length input))
(requires True)
(ensures (fun y ->
y == parse (parse_der_length_payload32 x) input
))
=
parse_der_length_payload32_unfold x input;
if U8.v x < 128
then Some (FStar.Int.Cast.uint8_to_uint32 x, 0)
else if x = 128uy || x = 255uy
then None
else if x = 129uy
then
match parse_u8 input with
| None -> None
| Some (z, consumed) ->
if U8.v z < 128
then None
else Some (FStar.Int.Cast.uint8_to_uint32 z, consumed)
else
let len : nat = U8.v x - 128 in
let _ = parse_bounded_integer_spec len input in
let res : option (bounded_integer len & consumed_length input) = (parse_bounded_integer len) input in
match res with
| None -> None
| Some (z, consumed) ->
if U32.v z >= pow2 (8 `op_Multiply` (len - 1))
then Some ((z <: refine_with_tag tag_of_der_length32 x), consumed)
else None | {
"file_name": "src/lowparse/LowParse.Tot.DER.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 17,
"end_line": 39,
"start_col": 0,
"start_line": 8
} | module LowParse.Tot.DER
include LowParse.Spec.DER
include LowParse.Tot.BoundedInt
module U32 = FStar.UInt32
module U8 = FStar.UInt8 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Tot.BoundedInt.fst.checked",
"LowParse.Spec.DER.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Int.Cast.fst.checked"
],
"interface_file": false,
"source_file": "LowParse.Tot.DER.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "LowParse.Tot.BoundedInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.DER",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
x: FStar.UInt8.t{LowParse.Spec.DER.der_length_payload_size_of_tag x <= 4} ->
input: LowParse.Bytes.bytes
-> Prims.Pure
(FStar.Pervasives.Native.option (LowParse.Spec.Base.refine_with_tag LowParse.Spec.DER.tag_of_der_length32
x *
LowParse.Spec.Base.consumed_length input)) | Prims.Pure | [] | [] | [
"FStar.UInt8.t",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"LowParse.Spec.DER.der_length_payload_size_of_tag",
"LowParse.Bytes.bytes",
"Prims.op_LessThan",
"FStar.UInt8.v",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.tuple2",
"LowParse.Spec.Base.refine_with_tag",
"FStar.UInt32.t",
"LowParse.Spec.DER.tag_of_der_length32",
"LowParse.Spec.Base.consumed_length",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Int.Cast.uint8_to_uint32",
"Prims.bool",
"Prims.op_BarBar",
"Prims.op_Equality",
"FStar.UInt8.__uint_to_t",
"FStar.Pervasives.Native.None",
"LowParse.Tot.Int.parse_u8",
"FStar.Pervasives.Native.option",
"LowParse.Spec.BoundedInt.bounded_integer",
"Prims.op_GreaterThanOrEqual",
"FStar.UInt32.v",
"Prims.pow2",
"Prims.op_Multiply",
"Prims.op_Subtraction",
"LowParse.Tot.BoundedInt.parse_bounded_integer",
"Prims.unit",
"LowParse.Spec.BoundedInt.parse_bounded_integer_spec",
"Prims.nat",
"LowParse.Spec.DER.parse_der_length_payload32_unfold",
"Prims.l_True",
"Prims.eq2",
"LowParse.Spec.Base.parse",
"LowParse.Spec.DER.parse_der_length_payload32"
] | [] | false | false | false | false | false | let parse_der_length_payload32_bare (x: U8.t{der_length_payload_size_of_tag x <= 4}) (input: bytes)
: Pure (option ((refine_with_tag tag_of_der_length32 x) * consumed_length input))
(requires True)
(ensures (fun y -> y == parse (parse_der_length_payload32 x) input)) =
| parse_der_length_payload32_unfold x input;
if U8.v x < 128
then Some (FStar.Int.Cast.uint8_to_uint32 x, 0)
else
if x = 128uy || x = 255uy
then None
else
if x = 129uy
then
match parse_u8 input with
| None -> None
| Some (z, consumed) ->
if U8.v z < 128 then None else Some (FStar.Int.Cast.uint8_to_uint32 z, consumed)
else
let len:nat = U8.v x - 128 in
let _ = parse_bounded_integer_spec len input in
let res:option (bounded_integer len & consumed_length input) =
(parse_bounded_integer len) input
in
match res with
| None -> None
| Some (z, consumed) ->
if U32.v z >= pow2 (8 `op_Multiply` (len - 1))
then Some ((z <: refine_with_tag tag_of_der_length32 x), consumed)
else None | false |
Hacl.Impl.FFDHE.fst | Hacl.Impl.FFDHE.ffdhe_check_pk | val ffdhe_check_pk: #t:limb_t -> a:S.ffdhe_alg -> len:size_pos -> ffdhe_check_pk_st t a len | val ffdhe_check_pk: #t:limb_t -> a:S.ffdhe_alg -> len:size_pos -> ffdhe_check_pk_st t a len | let ffdhe_check_pk #t a len pk_n p_n =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n1 = create nLen (uint #t #SEC 0) in
let h0 = ST.get () in
let c = BN.bn_sub1 nLen p_n (uint #t 1) p_n1 in
SB.bn_sub1_lemma (as_seq h0 p_n) (uint #t 1);
let h1 = ST.get () in
S.ffdhe_p_lemma a;
SD.bn_eval_bound (as_seq h1 p_n1) (v nLen);
assert (bn_v h1 p_n1 == bn_v h0 p_n - 1);
let m0 = BN.bn_gt_pow2_mask nLen pk_n 0ul in
SB.bn_gt_pow2_mask_lemma (as_seq h1 pk_n) 0;
assert_norm (pow2 0 = 1);
assert (if v m0 = 0 then 1 >= bn_v h1 pk_n else 1 < bn_v h1 pk_n);
let m1 = BN.bn_lt_mask nLen pk_n p_n1 in
SB.bn_lt_mask_lemma (as_seq h1 pk_n) (as_seq h1 p_n1);
assert (if v m1 = 0 then bn_v h1 pk_n >= bn_v h1 p_n1 else bn_v h1 pk_n < bn_v h1 p_n1);
let m = m0 &. m1 in
logand_lemma m0 m1;
pop_frame ();
m | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 3,
"end_line": 391,
"start_col": 0,
"start_line": 366
} | module Hacl.Impl.FFDHE
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.FFDHE.Constants
open Hacl.Bignum.Definitions
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module S = Spec.FFDHE
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Lemmas = Hacl.Spec.FFDHE.Lemmas
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module BE = Hacl.Bignum.Exponentiation
module SB = Hacl.Spec.Bignum
module SM = Hacl.Spec.Bignum.Montgomery
module SE = Hacl.Spec.Bignum.Exponentiation
module SD = Hacl.Spec.Bignum.Definitions
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let size_pos = x:size_t{v x > 0}
[@CInline]
let ffdhe_len (a:S.ffdhe_alg) : x:size_pos{v x = S.ffdhe_len a} =
allow_inversion S.ffdhe_alg;
match a with
| S.FFDHE2048 -> 256ul
| S.FFDHE3072 -> 384ul
| S.FFDHE4096 -> 512ul
| S.FFDHE6144 -> 768ul
| S.FFDHE8192 -> 1024ul
inline_for_extraction noextract
let get_ffdhe_p (a:S.ffdhe_alg) :x:glbuffer pub_uint8 (ffdhe_len a)
{witnessed x (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) /\ recallable x}
=
allow_inversion S.ffdhe_alg;
match a with
| S.FFDHE2048 -> ffdhe_p2048
| S.FFDHE3072 -> ffdhe_p3072
| S.FFDHE4096 -> ffdhe_p4096
| S.FFDHE6144 -> ffdhe_p6144
| S.FFDHE8192 -> ffdhe_p8192
inline_for_extraction noextract
val ffdhe_p_to_ps:
a:S.ffdhe_alg
-> p_s:lbuffer uint8 (ffdhe_len a) ->
Stack unit
(requires fun h -> live h p_s)
(ensures fun h0 _ h1 -> modifies (loc p_s) h0 h1 /\
BSeq.nat_from_intseq_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) ==
BSeq.nat_from_intseq_be (as_seq h1 p_s))
let ffdhe_p_to_ps a p_s =
let p = get_ffdhe_p a in
recall_contents p (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a));
let len = ffdhe_len a in
mapT len p_s secret p;
BSeq.nat_from_intseq_be_public_to_secret (v len) (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a))
inline_for_extraction noextract
let ffdhe_bn_from_g_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) =
g_n:lbignum t (blocks len (size (numbytes t))) ->
Stack unit
(requires fun h ->
live h g_n /\
v len = S.ffdhe_len a /\
as_seq h g_n == LSeq.create (v (blocks len (size (numbytes t)))) (uint #t 0))
(ensures fun h0 _ h1 -> modifies (loc g_n) h0 h1 /\
bn_v h1 g_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_g (S.get_ffdhe_params a)))
inline_for_extraction noextract
val ffdhe_bn_from_g: #t:limb_t -> a:S.ffdhe_alg -> len:size_pos -> ffdhe_bn_from_g_st t a len
let ffdhe_bn_from_g #t a len g_n =
recall_contents ffdhe_g2 S.ffdhe_g2;
[@inline_let] let nLen = blocks len (size (numbytes t)) in
push_frame ();
let g = create 1ul (u8 0) in
mapT 1ul g secret ffdhe_g2;
BSeq.nat_from_intseq_be_public_to_secret 1 S.ffdhe_g2;
let h0 = ST.get () in
update_sub_f h0 g_n 0ul 1ul
(fun h -> SB.bn_from_bytes_be 1 (as_seq h0 g))
(fun _ -> BN.bn_from_bytes_be 1ul g (sub g_n 0ul 1ul));
let h1 = ST.get () in
SD.bn_eval_update_sub #t 1 (SB.bn_from_bytes_be 1 (as_seq h0 g)) (v nLen);
assert (bn_v h1 g_n == SD.bn_v (SB.bn_from_bytes_be #t 1 (as_seq h0 g)));
SB.bn_from_bytes_be_lemma #t 1 (as_seq h0 g);
assert (bn_v h1 g_n == BSeq.nat_from_bytes_be (as_seq h0 g));
pop_frame ()
inline_for_extraction noextract
let ffdhe_precomp_inv (#t:limb_t) (#len:size_nat{0 < len /\ len + len <= max_size_t})
(a:S.ffdhe_alg) (p_r2_n:SD.lbignum t (len + len))
=
let p_n = LSeq.sub p_r2_n 0 len in
let r2_n = LSeq.sub p_r2_n len len in
SD.bn_v p_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) /\
0 < SD.bn_v p_n /\ SD.bn_v r2_n == pow2 (2 * bits t * len) % SD.bn_v p_n
inline_for_extraction noextract
let ffdhe_precomp_p_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen) ->
Stack unit
(requires fun h ->
live h p_r2_n /\
v len = S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen)
(ensures fun h0 _ h1 -> modifies (loc p_r2_n) h0 h1 /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h1 p_r2_n))
inline_for_extraction noextract
val ffdhe_precomp_p:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t ->
ffdhe_precomp_p_st t a len ke
let ffdhe_precomp_p #t a len ke p_r2_n =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let r2_n = sub p_r2_n nLen nLen in
let p_s = create len (u8 0) in
ffdhe_p_to_ps a p_s;
let h0 = ST.get () in
BN.bn_from_bytes_be len p_s p_n;
let h1 = ST.get () in
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 p_s);
assert (bn_v h1 p_n == BSeq.nat_from_bytes_be (as_seq h0 p_s));
S.ffdhe_p_lemma a;
Lemmas.ffdhe_p_bits_lemma a;
ke.BE.precompr2 (8ul *! len -! 1ul) p_n r2_n;
SM.bn_precomp_r2_mod_n_lemma (8 * v len - 1) (as_seq h1 p_n);
pop_frame ()
inline_for_extraction noextract
let new_ffdhe_precomp_p_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
r:HS.rid ->
ST (B.buffer (limb t))
(requires fun h ->
ST.is_eternal_region r /\
v len = S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen)
(ensures fun h0 res h1 ->
B.(modifies loc_none h0 h1) /\
not (B.g_is_null res) ==> (
B.len res == nLen +! nLen /\
B.(fresh_loc (loc_buffer res) h0 h1) /\
B.(loc_includes (loc_region_only false r) (loc_buffer res)) /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h1 (res <: lbignum t (nLen +! nLen)))))
inline_for_extraction noextract
val new_ffdhe_precomp_p:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_precomp_p:ffdhe_precomp_p_st t a len ke ->
new_ffdhe_precomp_p_st t a len ke
let new_ffdhe_precomp_p #t a len ke ffdhe_precomp_p r =
let h0 = ST.get () in
let nLen = blocks len (size (numbytes t)) in
assert (v (nLen +! nLen) > 0);
let res = LowStar.Monotonic.Buffer.mmalloc_partial r (uint #t #SEC 0) (nLen +! nLen) in
if B.is_null res then
res
else
let h1 = ST.get () in
B.(modifies_only_not_unused_in loc_none h0 h1);
assert (B.len res == nLen +! nLen);
let res: Lib.Buffer.buffer (limb t) = res in
assert (B.length res == v nLen + v nLen);
let res: lbignum t (nLen +! nLen) = res in
ffdhe_precomp_p res;
let h2 = ST.get () in
B.(modifies_only_not_unused_in loc_none h0 h2);
res
inline_for_extraction noextract
let ffdhe_compute_exp_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen)
-> sk_n:lbignum t nLen
-> b_n:lbignum t nLen
-> res:lbuffer uint8 len ->
Stack unit
(requires fun h ->
live h p_r2_n /\ live h sk_n /\ live h b_n /\ live h res /\
disjoint p_r2_n res /\ disjoint sk_n res /\ disjoint b_n res /\
disjoint p_r2_n b_n /\ disjoint p_r2_n sk_n /\
v len == S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h p_r2_n) /\
bn_v h b_n < bn_v h (gsub p_r2_n 0ul nLen) - 1 /\
1 < bn_v h sk_n)
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
(S.ffdhe_p_lemma a;
let res_n = Lib.NatMod.pow_mod #(bn_v h0 (gsub p_r2_n 0ul nLen)) (bn_v h0 b_n) (bn_v h0 sk_n) in
as_seq h1 res == BSeq.nat_to_bytes_be (v len) res_n))
#push-options "--z3rlimit 100"
inline_for_extraction noextract
val ffdhe_compute_exp:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t ->
ffdhe_compute_exp_st t a len ke
let ffdhe_compute_exp #t a len ke p_r2_n sk_n b_n res =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let r2_n = sub p_r2_n nLen nLen in
let res_n = create nLen (uint #t #SEC 0) in
let h1 = ST.get () in
S.ffdhe_p_lemma a;
assert_norm (pow2 4 = 16);
assert_norm (pow2 10 = 1024);
Math.Lemmas.pow2_plus 4 10;
Math.Lemmas.pow2_lt_compat 32 14;
SD.bn_eval_bound #t (as_seq h1 sk_n) (v nLen);
BE.mk_bn_mod_exp_precompr2 nLen ke.BE.exp_ct_precomp p_n r2_n b_n (size (bits t) *! nLen) sk_n res_n; //b_n ^ sk_n % p_n
let h2 = ST.get () in
BN.bn_to_bytes_be len res_n res;
SB.bn_to_bytes_be_lemma (v len) (as_seq h2 res_n);
pop_frame ()
#pop-options
inline_for_extraction noextract
let ffdhe_secret_to_public_precomp_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen)
-> sk:lbuffer uint8 len
-> pk:lbuffer uint8 len ->
Stack unit
(requires fun h ->
live h sk /\ live h pk /\ live h p_r2_n /\
disjoint sk pk /\ disjoint sk p_r2_n /\ disjoint pk p_r2_n /\
v len == S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen /\
1 < Lib.ByteSequence.nat_from_bytes_be (as_seq h sk) /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h p_r2_n))
(ensures fun h0 _ h1 -> modifies (loc pk) h0 h1 /\
as_seq h1 pk == S.ffdhe_secret_to_public a (as_seq h0 sk))
//TODO: pass sBits?
inline_for_extraction noextract
val ffdhe_secret_to_public_precomp:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_compute_exp:ffdhe_compute_exp_st t a len ke ->
ffdhe_secret_to_public_precomp_st t a len ke
let ffdhe_secret_to_public_precomp #t a len ke ffdhe_compute_exp p_r2_n sk pk =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let g_n = create nLen (uint #t #SEC 0) in
ffdhe_bn_from_g a len g_n;
let sk_n = create nLen (uint #t #SEC 0) in
let h0 = ST.get () in
BN.bn_from_bytes_be len sk sk_n;
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 sk);
S.ffdhe_g2_lemma ();
S.ffdhe_p_lemma a;
ffdhe_compute_exp p_r2_n sk_n g_n pk;
pop_frame ()
inline_for_extraction noextract
let ffdhe_secret_to_public_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
sk:lbuffer uint8 len
-> pk:lbuffer uint8 len ->
Stack unit
(requires fun h ->
live h sk /\ live h pk /\ disjoint sk pk /\
v len == S.ffdhe_len a /\
ke.BE.bn.BN.len == blocks len (size (numbytes t)) /\
1 < Lib.ByteSequence.nat_from_bytes_be (as_seq h sk))
(ensures fun h0 _ h1 -> modifies (loc pk) h0 h1 /\
as_seq h1 pk == S.ffdhe_secret_to_public a (as_seq h0 sk))
//TODO: pass sBits?
inline_for_extraction noextract
val ffdhe_secret_to_public:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t
-> ffdhe_secret_to_public_precomp:ffdhe_secret_to_public_precomp_st t a len ke
-> ffdhe_precomp_p:ffdhe_precomp_p_st t a len ke ->
ffdhe_secret_to_public_st t a len ke
let ffdhe_secret_to_public #t a len ke ffdhe_secret_to_public_precomp ffdhe_precomp_p sk pk =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_r2_n = create (nLen +! nLen) (uint #t #SEC 0) in
ffdhe_precomp_p p_r2_n;
ffdhe_secret_to_public_precomp p_r2_n sk pk;
pop_frame ()
inline_for_extraction noextract
let ffdhe_check_pk_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) =
let nLen = blocks len (size (numbytes t)) in
pk_n:lbignum t nLen
-> p_n:lbignum t nLen ->
Stack (limb t)
(requires fun h ->
live h pk_n /\ live h p_n /\ disjoint pk_n p_n /\
v len = S.ffdhe_len a /\
bn_v h p_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)))
(ensures fun h0 m h1 -> modifies0 h0 h1 /\
v m == (if (1 < bn_v h0 pk_n && bn_v h0 pk_n < bn_v h0 p_n - 1) then v (ones t SEC) else 0))
inline_for_extraction noextract | {
"checked_file": "/",
"dependencies": [
"Spec.FFDHE.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.FFDHE.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.Exponentiation.fsti.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"Hacl.Impl.FFDHE.Constants.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Base.fst.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.FFDHE.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Exponentiation",
"short_module": "SE"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "SM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "SB"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.FFDHE.Lemmas",
"short_module": "Lemmas"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "Spec.FFDHE",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.FFDHE.Constants",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Spec.FFDHE.ffdhe_alg -> len: Hacl.Impl.FFDHE.size_pos
-> Hacl.Impl.FFDHE.ffdhe_check_pk_st t a len | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Definitions.limb_t",
"Spec.FFDHE.ffdhe_alg",
"Hacl.Impl.FFDHE.size_pos",
"Hacl.Bignum.Definitions.lbignum",
"Hacl.Bignum.Definitions.blocks",
"Lib.IntTypes.size",
"Lib.IntTypes.numbytes",
"Hacl.Bignum.Definitions.limb",
"Prims.unit",
"FStar.HyperStack.ST.pop_frame",
"Lib.IntTypes.logand_lemma",
"Lib.IntTypes.SEC",
"Lib.IntTypes.int_t",
"Lib.IntTypes.op_Amp_Dot",
"Prims._assert",
"Prims.op_Equality",
"Prims.int",
"Lib.IntTypes.v",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"Hacl.Bignum.Definitions.bn_v",
"Prims.bool",
"Prims.op_LessThan",
"Hacl.Spec.Bignum.bn_lt_mask_lemma",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"Hacl.Bignum.bn_lt_mask",
"FStar.Pervasives.assert_norm",
"Prims.pow2",
"Hacl.Spec.Bignum.bn_gt_pow2_mask_lemma",
"Hacl.Bignum.bn_gt_pow2_mask",
"FStar.UInt32.__uint_to_t",
"Prims.eq2",
"Prims.op_Subtraction",
"Hacl.Spec.Bignum.Definitions.bn_eval_bound",
"Spec.FFDHE.ffdhe_p_lemma",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Hacl.Spec.Bignum.bn_sub1_lemma",
"Lib.IntTypes.uint",
"Hacl.Spec.Bignum.Base.carry",
"Hacl.Bignum.bn_sub1",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.create",
"Lib.Buffer.lbuffer",
"Prims.l_or",
"Lib.IntTypes.range",
"Prims.l_and",
"Prims.op_GreaterThan",
"Prims.op_LessThanOrEqual",
"Prims.op_Multiply",
"Lib.IntTypes.mk_int",
"Hacl.Spec.Bignum.Definitions.blocks",
"FStar.HyperStack.ST.push_frame"
] | [] | false | false | false | false | false | let ffdhe_check_pk #t a len pk_n p_n =
| push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n1 = create nLen (uint #t #SEC 0) in
let h0 = ST.get () in
let c = BN.bn_sub1 nLen p_n (uint #t 1) p_n1 in
SB.bn_sub1_lemma (as_seq h0 p_n) (uint #t 1);
let h1 = ST.get () in
S.ffdhe_p_lemma a;
SD.bn_eval_bound (as_seq h1 p_n1) (v nLen);
assert (bn_v h1 p_n1 == bn_v h0 p_n - 1);
let m0 = BN.bn_gt_pow2_mask nLen pk_n 0ul in
SB.bn_gt_pow2_mask_lemma (as_seq h1 pk_n) 0;
assert_norm (pow2 0 = 1);
assert (if v m0 = 0 then 1 >= bn_v h1 pk_n else 1 < bn_v h1 pk_n);
let m1 = BN.bn_lt_mask nLen pk_n p_n1 in
SB.bn_lt_mask_lemma (as_seq h1 pk_n) (as_seq h1 p_n1);
assert (if v m1 = 0 then bn_v h1 pk_n >= bn_v h1 p_n1 else bn_v h1 pk_n < bn_v h1 p_n1);
let m = m0 &. m1 in
logand_lemma m0 m1;
pop_frame ();
m | false |
FStar.Reflection.Const.fst | FStar.Reflection.Const.false_qn | val false_qn : Prims.list Prims.string | let false_qn = ["Prims"; "l_False"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 39,
"end_line": 31,
"start_col": 0,
"start_line": 31
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let false_qn =
| ["Prims"; "l_False"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.forall_qn | val forall_qn : Prims.list Prims.string | let forall_qn = ["Prims"; "l_Forall"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 40,
"end_line": 33,
"start_col": 0,
"start_line": 33
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let forall_qn =
| ["Prims"; "l_Forall"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.exists_qn | val exists_qn : Prims.list Prims.string | let exists_qn = ["Prims"; "l_Exists"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 40,
"end_line": 34,
"start_col": 0,
"start_line": 34
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let exists_qn =
| ["Prims"; "l_Exists"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.bool_true_qn | val bool_true_qn : Prims.list Prims.string | let bool_true_qn = ["Prims"; "true"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 37,
"end_line": 38,
"start_col": 0,
"start_line": 38
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let bool_true_qn =
| ["Prims"; "true"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.squash_qn | val squash_qn : Prims.list Prims.string | let squash_qn = ["Prims"; "squash"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 38,
"end_line": 35,
"start_col": 0,
"start_line": 35
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let squash_qn =
| ["Prims"; "squash"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.prop_qn | val prop_qn : Prims.list Prims.string | let prop_qn = ["Prims"; "prop"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 36,
"end_line": 36,
"start_col": 0,
"start_line": 36
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let prop_qn =
| ["Prims"; "prop"] | false |
|
Pulse.Typing.Combinators.fsti | Pulse.Typing.Combinators.st_comp_with_pre | val st_comp_with_pre (st: st_comp) (pre: term) : st_comp | val st_comp_with_pre (st: st_comp) (pre: term) : st_comp | let st_comp_with_pre (st:st_comp) (pre:term) : st_comp = { st with pre } | {
"file_name": "lib/steel/pulse/Pulse.Typing.Combinators.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 72,
"end_line": 25,
"start_col": 0,
"start_line": 25
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Typing.Combinators
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Typing | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Typing.Combinators.fsti"
} | [
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | st: Pulse.Syntax.Base.st_comp -> pre: Pulse.Syntax.Base.term -> Pulse.Syntax.Base.st_comp | Prims.Tot | [
"total"
] | [] | [
"Pulse.Syntax.Base.st_comp",
"Pulse.Syntax.Base.term",
"Pulse.Syntax.Base.Mkst_comp",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__u",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__res",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__post"
] | [] | false | false | false | true | false | let st_comp_with_pre (st: st_comp) (pre: term) : st_comp =
| { st with pre = pre } | false |
FStar.Reflection.Const.fst | FStar.Reflection.Const.bool_false_qn | val bool_false_qn : Prims.list Prims.string | let bool_false_qn = ["Prims"; "false"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 38,
"end_line": 39,
"start_col": 0,
"start_line": 39
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let bool_false_qn =
| ["Prims"; "false"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.int_lid | val int_lid : Prims.list Prims.string | let int_lid = ["Prims"; "int"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 35,
"end_line": 41,
"start_col": 0,
"start_line": 41
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let int_lid =
| ["Prims"; "int"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.bool_lid | val bool_lid : Prims.list Prims.string | let bool_lid = ["Prims"; "bool"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 36,
"end_line": 42,
"start_col": 0,
"start_line": 42
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let bool_lid =
| ["Prims"; "bool"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.unit_lid | val unit_lid : Prims.list Prims.string | let unit_lid = ["Prims"; "unit"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 36,
"end_line": 43,
"start_col": 0,
"start_line": 43
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let unit_lid =
| ["Prims"; "unit"] | false |
|
Hacl.Impl.FFDHE.fst | Hacl.Impl.FFDHE.ffdhe_precomp_p | val ffdhe_precomp_p:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t ->
ffdhe_precomp_p_st t a len ke | val ffdhe_precomp_p:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t ->
ffdhe_precomp_p_st t a len ke | let ffdhe_precomp_p #t a len ke p_r2_n =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let r2_n = sub p_r2_n nLen nLen in
let p_s = create len (u8 0) in
ffdhe_p_to_ps a p_s;
let h0 = ST.get () in
BN.bn_from_bytes_be len p_s p_n;
let h1 = ST.get () in
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 p_s);
assert (bn_v h1 p_n == BSeq.nat_from_bytes_be (as_seq h0 p_s));
S.ffdhe_p_lemma a;
Lemmas.ffdhe_p_bits_lemma a;
ke.BE.precompr2 (8ul *! len -! 1ul) p_n r2_n;
SM.bn_precomp_r2_mod_n_lemma (8 * v len - 1) (as_seq h1 p_n);
pop_frame () | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 14,
"end_line": 161,
"start_col": 0,
"start_line": 144
} | module Hacl.Impl.FFDHE
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Impl.FFDHE.Constants
open Hacl.Bignum.Definitions
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module S = Spec.FFDHE
module LSeq = Lib.Sequence
module BSeq = Lib.ByteSequence
module Lemmas = Hacl.Spec.FFDHE.Lemmas
module BN = Hacl.Bignum
module BM = Hacl.Bignum.Montgomery
module BE = Hacl.Bignum.Exponentiation
module SB = Hacl.Spec.Bignum
module SM = Hacl.Spec.Bignum.Montgomery
module SE = Hacl.Spec.Bignum.Exponentiation
module SD = Hacl.Spec.Bignum.Definitions
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let size_pos = x:size_t{v x > 0}
[@CInline]
let ffdhe_len (a:S.ffdhe_alg) : x:size_pos{v x = S.ffdhe_len a} =
allow_inversion S.ffdhe_alg;
match a with
| S.FFDHE2048 -> 256ul
| S.FFDHE3072 -> 384ul
| S.FFDHE4096 -> 512ul
| S.FFDHE6144 -> 768ul
| S.FFDHE8192 -> 1024ul
inline_for_extraction noextract
let get_ffdhe_p (a:S.ffdhe_alg) :x:glbuffer pub_uint8 (ffdhe_len a)
{witnessed x (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) /\ recallable x}
=
allow_inversion S.ffdhe_alg;
match a with
| S.FFDHE2048 -> ffdhe_p2048
| S.FFDHE3072 -> ffdhe_p3072
| S.FFDHE4096 -> ffdhe_p4096
| S.FFDHE6144 -> ffdhe_p6144
| S.FFDHE8192 -> ffdhe_p8192
inline_for_extraction noextract
val ffdhe_p_to_ps:
a:S.ffdhe_alg
-> p_s:lbuffer uint8 (ffdhe_len a) ->
Stack unit
(requires fun h -> live h p_s)
(ensures fun h0 _ h1 -> modifies (loc p_s) h0 h1 /\
BSeq.nat_from_intseq_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) ==
BSeq.nat_from_intseq_be (as_seq h1 p_s))
let ffdhe_p_to_ps a p_s =
let p = get_ffdhe_p a in
recall_contents p (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a));
let len = ffdhe_len a in
mapT len p_s secret p;
BSeq.nat_from_intseq_be_public_to_secret (v len) (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a))
inline_for_extraction noextract
let ffdhe_bn_from_g_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) =
g_n:lbignum t (blocks len (size (numbytes t))) ->
Stack unit
(requires fun h ->
live h g_n /\
v len = S.ffdhe_len a /\
as_seq h g_n == LSeq.create (v (blocks len (size (numbytes t)))) (uint #t 0))
(ensures fun h0 _ h1 -> modifies (loc g_n) h0 h1 /\
bn_v h1 g_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_g (S.get_ffdhe_params a)))
inline_for_extraction noextract
val ffdhe_bn_from_g: #t:limb_t -> a:S.ffdhe_alg -> len:size_pos -> ffdhe_bn_from_g_st t a len
let ffdhe_bn_from_g #t a len g_n =
recall_contents ffdhe_g2 S.ffdhe_g2;
[@inline_let] let nLen = blocks len (size (numbytes t)) in
push_frame ();
let g = create 1ul (u8 0) in
mapT 1ul g secret ffdhe_g2;
BSeq.nat_from_intseq_be_public_to_secret 1 S.ffdhe_g2;
let h0 = ST.get () in
update_sub_f h0 g_n 0ul 1ul
(fun h -> SB.bn_from_bytes_be 1 (as_seq h0 g))
(fun _ -> BN.bn_from_bytes_be 1ul g (sub g_n 0ul 1ul));
let h1 = ST.get () in
SD.bn_eval_update_sub #t 1 (SB.bn_from_bytes_be 1 (as_seq h0 g)) (v nLen);
assert (bn_v h1 g_n == SD.bn_v (SB.bn_from_bytes_be #t 1 (as_seq h0 g)));
SB.bn_from_bytes_be_lemma #t 1 (as_seq h0 g);
assert (bn_v h1 g_n == BSeq.nat_from_bytes_be (as_seq h0 g));
pop_frame ()
inline_for_extraction noextract
let ffdhe_precomp_inv (#t:limb_t) (#len:size_nat{0 < len /\ len + len <= max_size_t})
(a:S.ffdhe_alg) (p_r2_n:SD.lbignum t (len + len))
=
let p_n = LSeq.sub p_r2_n 0 len in
let r2_n = LSeq.sub p_r2_n len len in
SD.bn_v p_n == BSeq.nat_from_bytes_be (S.Mk_ffdhe_params?.ffdhe_p (S.get_ffdhe_params a)) /\
0 < SD.bn_v p_n /\ SD.bn_v r2_n == pow2 (2 * bits t * len) % SD.bn_v p_n
inline_for_extraction noextract
let ffdhe_precomp_p_st (t:limb_t) (a:S.ffdhe_alg) (len:size_pos) (ke:BE.exp t) =
let nLen = blocks len (size (numbytes t)) in
p_r2_n:lbignum t (nLen +! nLen) ->
Stack unit
(requires fun h ->
live h p_r2_n /\
v len = S.ffdhe_len a /\ ke.BE.bn.BN.len == nLen)
(ensures fun h0 _ h1 -> modifies (loc p_r2_n) h0 h1 /\
ffdhe_precomp_inv #t #(v nLen) a (as_seq h1 p_r2_n))
inline_for_extraction noextract
val ffdhe_precomp_p:
#t:limb_t
-> a:S.ffdhe_alg
-> len:size_pos
-> ke:BE.exp t ->
ffdhe_precomp_p_st t a len ke | {
"checked_file": "/",
"dependencies": [
"Spec.FFDHE.fst.checked",
"prims.fst.checked",
"LowStar.Monotonic.Buffer.fsti.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.NatMod.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.FFDHE.Lemmas.fst.checked",
"Hacl.Spec.Bignum.Montgomery.fsti.checked",
"Hacl.Spec.Bignum.Exponentiation.fsti.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.fsti.checked",
"Hacl.Impl.FFDHE.Constants.fst.checked",
"Hacl.Bignum.Montgomery.fsti.checked",
"Hacl.Bignum.Exponentiation.fsti.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Base.fst.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.FFDHE.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Exponentiation",
"short_module": "SE"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Montgomery",
"short_module": "SM"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum",
"short_module": "SB"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Exponentiation",
"short_module": "BE"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.Montgomery",
"short_module": "BM"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.FFDHE.Lemmas",
"short_module": "Lemmas"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "Spec.FFDHE",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.FFDHE.Constants",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Spec.FFDHE.ffdhe_alg -> len: Hacl.Impl.FFDHE.size_pos -> ke: Hacl.Bignum.Exponentiation.exp t
-> Hacl.Impl.FFDHE.ffdhe_precomp_p_st t a len ke | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Definitions.limb_t",
"Spec.FFDHE.ffdhe_alg",
"Hacl.Impl.FFDHE.size_pos",
"Hacl.Bignum.Exponentiation.exp",
"Hacl.Bignum.Definitions.lbignum",
"Lib.IntTypes.op_Plus_Bang",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Hacl.Bignum.Definitions.blocks",
"Lib.IntTypes.size",
"Lib.IntTypes.numbytes",
"FStar.HyperStack.ST.pop_frame",
"Prims.unit",
"Hacl.Spec.Bignum.Montgomery.bn_precomp_r2_mod_n_lemma",
"Lib.IntTypes.v",
"Prims.op_Subtraction",
"FStar.Mul.op_Star",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"Hacl.Bignum.Definitions.limb",
"Hacl.Bignum.Exponentiation.__proj__Mkexp__item__precompr2",
"Lib.IntTypes.op_Subtraction_Bang",
"Lib.IntTypes.op_Star_Bang",
"FStar.UInt32.__uint_to_t",
"Hacl.Spec.FFDHE.Lemmas.ffdhe_p_bits_lemma",
"Spec.FFDHE.ffdhe_p_lemma",
"Prims._assert",
"Prims.eq2",
"Prims.nat",
"Hacl.Bignum.Definitions.bn_v",
"Lib.ByteSequence.nat_from_bytes_be",
"Lib.IntTypes.SEC",
"Lib.IntTypes.uint8",
"Hacl.Spec.Bignum.bn_from_bytes_be_lemma",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Hacl.Bignum.bn_from_bytes_be",
"Hacl.Impl.FFDHE.ffdhe_p_to_ps",
"Lib.Buffer.lbuffer_t",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.Buffer.create",
"Lib.IntTypes.u8",
"Lib.Buffer.lbuffer",
"Lib.Buffer.sub",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Prims.l_and",
"Prims.b2t",
"Prims.op_GreaterThan",
"Prims.op_LessThanOrEqual",
"Prims.pow2",
"Prims.op_Multiply",
"Lib.IntTypes.mk_int",
"Hacl.Spec.Bignum.Definitions.blocks",
"FStar.HyperStack.ST.push_frame"
] | [] | false | false | false | false | false | let ffdhe_precomp_p #t a len ke p_r2_n =
| push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let r2_n = sub p_r2_n nLen nLen in
let p_s = create len (u8 0) in
ffdhe_p_to_ps a p_s;
let h0 = ST.get () in
BN.bn_from_bytes_be len p_s p_n;
let h1 = ST.get () in
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 p_s);
assert (bn_v h1 p_n == BSeq.nat_from_bytes_be (as_seq h0 p_s));
S.ffdhe_p_lemma a;
Lemmas.ffdhe_p_bits_lemma a;
ke.BE.precompr2 (8ul *! len -! 1ul) p_n r2_n;
SM.bn_precomp_r2_mod_n_lemma (8 * v len - 1) (as_seq h1 p_n);
pop_frame () | false |
Vale.AES.X64.AESopt.fsti | Vale.AES.X64.AESopt.scratch_reqs | val scratch_reqs (scratch_b: buffer128) (count: nat) (heap3: vale_heap) (s: seq quad32) (z3: quad32)
: prop0 | val scratch_reqs (scratch_b: buffer128) (count: nat) (heap3: vale_heap) (s: seq quad32) (z3: quad32)
: prop0 | let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
count * 6 + 6 <= length s /\ (
let data = slice s (count * 6) (count * 6 + 6) in
z3 == reverse_bytes_quad32 (index data 5) /\
buffer128_read scratch_b 3 heap3 == reverse_bytes_quad32 (index data 4) /\
buffer128_read scratch_b 4 heap3 == reverse_bytes_quad32 (index data 3) /\
buffer128_read scratch_b 5 heap3 == reverse_bytes_quad32 (index data 2) /\
buffer128_read scratch_b 6 heap3 == reverse_bytes_quad32 (index data 1) /\
buffer128_read scratch_b 7 heap3 == reverse_bytes_quad32 (index data 0)) | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 76,
"end_line": 97,
"start_col": 0,
"start_line": 89
} | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let aes_reqs0
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ pclmulqdq_enabled /\ avx_enabled /\
alg = AES_128 /\
//(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
buffer128_as_seq heap0 keys_b == round_keys
let aes_reqs_offset
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ avx_enabled /\ pclmulqdq_enabled /\
(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
s128 heap0 keys_b == round_keys
let six_of (a:Type0) = a & a & a & a & a & a
let quad32_6 = six_of quad32
unfold let make_six_of (#a:Type0) (f:(n:nat{n < 6}) -> GTot a) : GTot (six_of a) =
(f 0, f 1, f 2, f 3, f 4, f 5)
unfold let map_six_of (#a #b:Type0) (x:six_of a) (f:a -> GTot b) : GTot (six_of b) =
let (x0, x1, x2, x3, x4, x5) = x in
(f x0, f x1, f x2, f x3, f x4, f x5)
unfold let map2_six_of (#a #b #c:Type0) (x:six_of a) (y:six_of b) (f:a -> b -> GTot c) : GTot (six_of c) =
let (x0, x1, x2, x3, x4, x5) = x in
let (y0, y1, y2, y3, y4, y5) = y in
(f x0 y0, f x1 y1, f x2 y2, f x3 y3, f x4 y4, f x5 y5)
let rounds_opaque_6 (init:quad32_6) (round_keys:seq quad32) (rnd:nat{rnd < length round_keys}) : GTot quad32_6 =
map_six_of init (fun x -> eval_rounds x round_keys rnd)
let xor_reverse_inc32lite_6 (n i0:int) (ctr_BE rndkey:quad32) : GTot quad32_6 =
make_six_of (fun i ->
let r = reverse_bytes_quad32 (inc32lite ctr_BE (i0 + i)) in
if i < n then quad32_xor r rndkey else r)
//let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
// count * 6 + 6 <= length s /\ (
// let data = slice s (count * 6) (count * 6 + 6) in
// z3 == reverse_bytes_quad32 (index data 5) /\
// scratch_b_blocks true true scratch_b 8 5 heap3 data) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Transformers.Transform.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESGCM_expected_code.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "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 |
scratch_b: Vale.X64.Memory.buffer128 ->
count: Prims.nat ->
heap3: Vale.X64.InsBasic.vale_heap ->
s: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
z3: Vale.X64.Decls.quad32
-> Vale.Def.Prop_s.prop0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Memory.buffer128",
"Prims.nat",
"Vale.X64.InsBasic.vale_heap",
"FStar.Seq.Base.seq",
"Vale.X64.Decls.quad32",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"FStar.Mul.op_Star",
"FStar.Seq.Base.length",
"Prims.eq2",
"Vale.Def.Types_s.quad32",
"Vale.Def.Types_s.reverse_bytes_quad32",
"FStar.Seq.Base.index",
"Vale.X64.Decls.buffer128_read",
"FStar.Seq.Base.slice",
"Vale.Def.Prop_s.prop0"
] | [] | false | false | false | true | false | let scratch_reqs (scratch_b: buffer128) (count: nat) (heap3: vale_heap) (s: seq quad32) (z3: quad32)
: prop0 =
| count * 6 + 6 <= length s /\
(let data = slice s (count * 6) (count * 6 + 6) in
z3 == reverse_bytes_quad32 (index data 5) /\
buffer128_read scratch_b 3 heap3 == reverse_bytes_quad32 (index data 4) /\
buffer128_read scratch_b 4 heap3 == reverse_bytes_quad32 (index data 3) /\
buffer128_read scratch_b 5 heap3 == reverse_bytes_quad32 (index data 2) /\
buffer128_read scratch_b 6 heap3 == reverse_bytes_quad32 (index data 1) /\
buffer128_read scratch_b 7 heap3 == reverse_bytes_quad32 (index data 0)) | false |
FStar.Reflection.Const.fst | FStar.Reflection.Const.string_lid | val string_lid : Prims.list Prims.string | let string_lid = ["Prims"; "string"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 38,
"end_line": 44,
"start_col": 0,
"start_line": 44
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let string_lid =
| ["Prims"; "string"] | false |
|
Pulse.Typing.Combinators.fsti | Pulse.Typing.Combinators.nvar_as_binder | val nvar_as_binder (x: nvar) (t: term) : binder | val nvar_as_binder (x: nvar) (t: term) : binder | let nvar_as_binder (x:nvar) (t:term) : binder =
mk_binder_ppname t (fst x) | {
"file_name": "lib/steel/pulse/Pulse.Typing.Combinators.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 28,
"end_line": 28,
"start_col": 0,
"start_line": 27
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Typing.Combinators
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Typing
let st_comp_with_pre (st:st_comp) (pre:term) : st_comp = { st with pre } | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Typing.Combinators.fsti"
} | [
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: Pulse.Syntax.Base.nvar -> t: Pulse.Syntax.Base.term -> Pulse.Syntax.Base.binder | Prims.Tot | [
"total"
] | [] | [
"Pulse.Syntax.Base.nvar",
"Pulse.Syntax.Base.term",
"Pulse.Syntax.Base.mk_binder_ppname",
"FStar.Pervasives.Native.fst",
"Pulse.Syntax.Base.ppname",
"Pulse.Syntax.Base.var",
"Pulse.Syntax.Base.binder"
] | [] | false | false | false | true | false | let nvar_as_binder (x: nvar) (t: term) : binder =
| mk_binder_ppname t (fst x) | false |
FStar.Reflection.Const.fst | FStar.Reflection.Const.add_qn | val add_qn : Prims.list Prims.string | let add_qn = ["Prims"; "op_Addition"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 43,
"end_line": 46,
"start_col": 0,
"start_line": 46
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let add_qn =
| ["Prims"; "op_Addition"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.neg_qn | val neg_qn : Prims.list Prims.string | let neg_qn = ["Prims"; "op_Minus"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 40,
"end_line": 47,
"start_col": 0,
"start_line": 47
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let neg_qn =
| ["Prims"; "op_Minus"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.minus_qn | val minus_qn : Prims.list Prims.string | let minus_qn = ["Prims"; "op_Subtraction"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 46,
"end_line": 48,
"start_col": 0,
"start_line": 48
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let minus_qn =
| ["Prims"; "op_Subtraction"] | false |
|
Pulse.Typing.Combinators.fsti | Pulse.Typing.Combinators.frame_of | val frame_of : f: Pulse.Typing.Combinators.frame_for_req_in_ctxt g ctxt req -> Pulse.Syntax.Base.term | let frame_of #g #ctxt #req (f:frame_for_req_in_ctxt g ctxt req) =
let (| frame, _, _ |) = f in frame | {
"file_name": "lib/steel/pulse/Pulse.Typing.Combinators.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 36,
"end_line": 81,
"start_col": 0,
"start_line": 80
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Typing.Combinators
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Typing
let st_comp_with_pre (st:st_comp) (pre:term) : st_comp = { st with pre }
let nvar_as_binder (x:nvar) (t:term) : binder =
mk_binder_ppname t (fst x)
val vprop_equiv_typing (#g:_) (#t0 #t1:term) (v:vprop_equiv g t0 t1)
: GTot ((tot_typing g t0 tm_vprop -> tot_typing g t1 tm_vprop) &
(tot_typing g t1 tm_vprop -> tot_typing g t0 tm_vprop))
val mk_bind (g:env)
(pre:term)
(e1:st_term)
(e2:st_term)
(c1:comp_st)
(c2:comp_st)
(px:nvar { ~ (Set.mem (snd px) (dom g)) })
(d_e1:st_typing g e1 c1)
(d_c1res:tot_typing g (comp_res c1) (tm_type (comp_u c1)))
(d_e2:st_typing (push_binding g (snd px) (fst px) (comp_res c1)) (open_st_term_nv e2 px) c2)
(res_typing:universe_of g (comp_res c2) (comp_u c2))
(post_typing:tot_typing (push_binding g (snd px) (fst px) (comp_res c2))
(open_term_nv (comp_post c2) px)
tm_vprop)
(bias_towards_continuation:bool)
: T.TacH (t:st_term &
c:comp_st { st_comp_of_comp c == st_comp_with_pre (st_comp_of_comp c2) pre /\
(bias_towards_continuation ==> effect_annot_of_comp c == effect_annot_of_comp c2) } &
st_typing g t c)
(requires fun _ ->
let _, x = px in
comp_pre c1 == pre /\
None? (lookup g x) /\
(~(x `Set.mem` freevars_st e2)) /\
open_term (comp_post c1) x == comp_pre c2 /\
(~ (x `Set.mem` freevars (comp_post c2))))
(ensures fun _ _ -> True)
val bind_res_and_post_typing (g:env) (s2:comp_st) (x:var { fresh_wrt x g (freevars (comp_post s2)) })
(post_hint:post_hint_opt g { comp_post_matches_hint s2 post_hint })
: T.Tac (universe_of g (comp_res s2) (comp_u s2) &
tot_typing (push_binding g x ppname_default (comp_res s2)) (open_term_nv (comp_post s2) (v_as_nv x)) tm_vprop)
val add_frame (#g:env) (#t:st_term) (#c:comp_st) (t_typing:st_typing g t c)
(#frame:vprop)
(frame_typing:tot_typing g frame tm_vprop)
: t':st_term &
c':comp_st { c' == add_frame c frame } &
st_typing g t' c'
let frame_for_req_in_ctxt (g:env) (ctxt:term) (req:term)
= (frame:term &
tot_typing g frame tm_vprop &
vprop_equiv g (tm_star req frame) ctxt) | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Typing.Combinators.fsti"
} | [
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | f: Pulse.Typing.Combinators.frame_for_req_in_ctxt g ctxt req -> Pulse.Syntax.Base.term | Prims.Tot | [
"total"
] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"Pulse.Typing.Combinators.frame_for_req_in_ctxt",
"Pulse.Typing.tot_typing",
"Pulse.Syntax.Base.tm_vprop",
"Pulse.Typing.vprop_equiv",
"Pulse.Syntax.Base.tm_star"
] | [] | false | false | false | false | false | let frame_of #g #ctxt #req (f: frame_for_req_in_ctxt g ctxt req) =
| let (| frame , _ , _ |) = f in
frame | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.mult'_qn | val mult'_qn : Prims.list Prims.string | let mult'_qn = ["FStar"; "Mul"; "op_Star"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 46,
"end_line": 50,
"start_col": 0,
"start_line": 50
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let mult'_qn =
| ["FStar"; "Mul"; "op_Star"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.mult_qn | val mult_qn : Prims.list Prims.string | let mult_qn = ["Prims"; "op_Multiply"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 43,
"end_line": 49,
"start_col": 0,
"start_line": 49
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let mult_qn =
| ["Prims"; "op_Multiply"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.nil_qn | val nil_qn : Prims.list Prims.string | let nil_qn = ["Prims"; "Nil"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 35,
"end_line": 58,
"start_col": 0,
"start_line": 58
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"]
let mult_qn = ["Prims"; "op_Multiply"]
let mult'_qn = ["FStar"; "Mul"; "op_Star"]
let div_qn = ["Prims"; "op_Division"]
let lt_qn = ["Prims"; "op_LessThan"]
let lte_qn = ["Prims"; "op_LessThanOrEqual"]
let gt_qn = ["Prims"; "op_GreaterThan"]
let gte_qn = ["Prims"; "op_GreaterThanOrEqual"]
let mod_qn = ["Prims"; "op_Modulus"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let nil_qn =
| ["Prims"; "Nil"] | false |
|
Vale.AES.X64.AESopt.fsti | Vale.AES.X64.AESopt.va_quick_Load_two_lsb | val va_quick_Load_two_lsb (dst: va_operand_xmm) : (va_quickCode unit (va_code_Load_two_lsb dst)) | val va_quick_Load_two_lsb (dst: va_operand_xmm) : (va_quickCode unit (va_code_Load_two_lsb dst)) | let va_quick_Load_two_lsb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_two_lsb dst)) =
(va_QProc (va_code_Load_two_lsb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_two_lsb dst) (va_wpProof_Load_two_lsb dst)) | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 59,
"end_line": 129,
"start_col": 0,
"start_line": 127
} | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let aes_reqs0
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ pclmulqdq_enabled /\ avx_enabled /\
alg = AES_128 /\
//(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
buffer128_as_seq heap0 keys_b == round_keys
let aes_reqs_offset
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ avx_enabled /\ pclmulqdq_enabled /\
(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
s128 heap0 keys_b == round_keys
let six_of (a:Type0) = a & a & a & a & a & a
let quad32_6 = six_of quad32
unfold let make_six_of (#a:Type0) (f:(n:nat{n < 6}) -> GTot a) : GTot (six_of a) =
(f 0, f 1, f 2, f 3, f 4, f 5)
unfold let map_six_of (#a #b:Type0) (x:six_of a) (f:a -> GTot b) : GTot (six_of b) =
let (x0, x1, x2, x3, x4, x5) = x in
(f x0, f x1, f x2, f x3, f x4, f x5)
unfold let map2_six_of (#a #b #c:Type0) (x:six_of a) (y:six_of b) (f:a -> b -> GTot c) : GTot (six_of c) =
let (x0, x1, x2, x3, x4, x5) = x in
let (y0, y1, y2, y3, y4, y5) = y in
(f x0 y0, f x1 y1, f x2 y2, f x3 y3, f x4 y4, f x5 y5)
let rounds_opaque_6 (init:quad32_6) (round_keys:seq quad32) (rnd:nat{rnd < length round_keys}) : GTot quad32_6 =
map_six_of init (fun x -> eval_rounds x round_keys rnd)
let xor_reverse_inc32lite_6 (n i0:int) (ctr_BE rndkey:quad32) : GTot quad32_6 =
make_six_of (fun i ->
let r = reverse_bytes_quad32 (inc32lite ctr_BE (i0 + i)) in
if i < n then quad32_xor r rndkey else r)
//let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
// count * 6 + 6 <= length s /\ (
// let data = slice s (count * 6) (count * 6 + 6) in
// z3 == reverse_bytes_quad32 (index data 5) /\
// scratch_b_blocks true true scratch_b 8 5 heap3 data)
let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
count * 6 + 6 <= length s /\ (
let data = slice s (count * 6) (count * 6 + 6) in
z3 == reverse_bytes_quad32 (index data 5) /\
buffer128_read scratch_b 3 heap3 == reverse_bytes_quad32 (index data 4) /\
buffer128_read scratch_b 4 heap3 == reverse_bytes_quad32 (index data 3) /\
buffer128_read scratch_b 5 heap3 == reverse_bytes_quad32 (index data 2) /\
buffer128_read scratch_b 6 heap3 == reverse_bytes_quad32 (index data 1) /\
buffer128_read scratch_b 7 heap3 == reverse_bytes_quad32 (index data 0))
//-- Load_two_lsb
val va_code_Load_two_lsb : dst:va_operand_xmm -> Tot va_code
val va_codegen_success_Load_two_lsb : dst:va_operand_xmm -> Tot va_pbool
val va_lemma_Load_two_lsb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_two_lsb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@ va_qattr]
let va_wp_Load_two_lsb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 ==> va_k va_sM (())))
val va_wpProof_Load_two_lsb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_two_lsb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_two_lsb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Transformers.Transform.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESGCM_expected_code.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | dst: Vale.X64.Decls.va_operand_xmm
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.AES.X64.AESopt.va_code_Load_two_lsb dst) | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_operand_xmm",
"Vale.X64.QuickCode.va_QProc",
"Prims.unit",
"Vale.AES.X64.AESopt.va_code_Load_two_lsb",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR11",
"Vale.X64.QuickCode.va_mod_xmm",
"Prims.Nil",
"Vale.AES.X64.AESopt.va_wp_Load_two_lsb",
"Vale.AES.X64.AESopt.va_wpProof_Load_two_lsb",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Load_two_lsb (dst: va_operand_xmm) : (va_quickCode unit (va_code_Load_two_lsb dst)) =
| (va_QProc (va_code_Load_two_lsb dst)
([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_two_lsb dst)
(va_wpProof_Load_two_lsb dst)) | false |
FStar.Reflection.Const.fst | FStar.Reflection.Const.lt_qn | val lt_qn : Prims.list Prims.string | let lt_qn = ["Prims"; "op_LessThan"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 43,
"end_line": 52,
"start_col": 0,
"start_line": 52
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"]
let mult_qn = ["Prims"; "op_Multiply"]
let mult'_qn = ["FStar"; "Mul"; "op_Star"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let lt_qn =
| ["Prims"; "op_LessThan"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.lte_qn | val lte_qn : Prims.list Prims.string | let lte_qn = ["Prims"; "op_LessThanOrEqual"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 50,
"end_line": 53,
"start_col": 0,
"start_line": 53
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"]
let mult_qn = ["Prims"; "op_Multiply"]
let mult'_qn = ["FStar"; "Mul"; "op_Star"]
let div_qn = ["Prims"; "op_Division"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let lte_qn =
| ["Prims"; "op_LessThanOrEqual"] | false |
|
Pulse.Typing.Combinators.fsti | Pulse.Typing.Combinators.frame_for_req_in_ctxt | val frame_for_req_in_ctxt : g: Pulse.Typing.Env.env -> ctxt: Pulse.Syntax.Base.term -> req: Pulse.Syntax.Base.term -> Type0 | let frame_for_req_in_ctxt (g:env) (ctxt:term) (req:term)
= (frame:term &
tot_typing g frame tm_vprop &
vprop_equiv g (tm_star req frame) ctxt) | {
"file_name": "lib/steel/pulse/Pulse.Typing.Combinators.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 45,
"end_line": 78,
"start_col": 0,
"start_line": 75
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Typing.Combinators
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Typing
let st_comp_with_pre (st:st_comp) (pre:term) : st_comp = { st with pre }
let nvar_as_binder (x:nvar) (t:term) : binder =
mk_binder_ppname t (fst x)
val vprop_equiv_typing (#g:_) (#t0 #t1:term) (v:vprop_equiv g t0 t1)
: GTot ((tot_typing g t0 tm_vprop -> tot_typing g t1 tm_vprop) &
(tot_typing g t1 tm_vprop -> tot_typing g t0 tm_vprop))
val mk_bind (g:env)
(pre:term)
(e1:st_term)
(e2:st_term)
(c1:comp_st)
(c2:comp_st)
(px:nvar { ~ (Set.mem (snd px) (dom g)) })
(d_e1:st_typing g e1 c1)
(d_c1res:tot_typing g (comp_res c1) (tm_type (comp_u c1)))
(d_e2:st_typing (push_binding g (snd px) (fst px) (comp_res c1)) (open_st_term_nv e2 px) c2)
(res_typing:universe_of g (comp_res c2) (comp_u c2))
(post_typing:tot_typing (push_binding g (snd px) (fst px) (comp_res c2))
(open_term_nv (comp_post c2) px)
tm_vprop)
(bias_towards_continuation:bool)
: T.TacH (t:st_term &
c:comp_st { st_comp_of_comp c == st_comp_with_pre (st_comp_of_comp c2) pre /\
(bias_towards_continuation ==> effect_annot_of_comp c == effect_annot_of_comp c2) } &
st_typing g t c)
(requires fun _ ->
let _, x = px in
comp_pre c1 == pre /\
None? (lookup g x) /\
(~(x `Set.mem` freevars_st e2)) /\
open_term (comp_post c1) x == comp_pre c2 /\
(~ (x `Set.mem` freevars (comp_post c2))))
(ensures fun _ _ -> True)
val bind_res_and_post_typing (g:env) (s2:comp_st) (x:var { fresh_wrt x g (freevars (comp_post s2)) })
(post_hint:post_hint_opt g { comp_post_matches_hint s2 post_hint })
: T.Tac (universe_of g (comp_res s2) (comp_u s2) &
tot_typing (push_binding g x ppname_default (comp_res s2)) (open_term_nv (comp_post s2) (v_as_nv x)) tm_vprop)
val add_frame (#g:env) (#t:st_term) (#c:comp_st) (t_typing:st_typing g t c)
(#frame:vprop)
(frame_typing:tot_typing g frame tm_vprop)
: t':st_term &
c':comp_st { c' == add_frame c frame } &
st_typing g t' c' | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "Pulse.Typing.Combinators.fsti"
} | [
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | g: Pulse.Typing.Env.env -> ctxt: Pulse.Syntax.Base.term -> req: Pulse.Syntax.Base.term -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"FStar.Pervasives.dtuple3",
"Pulse.Typing.tot_typing",
"Pulse.Syntax.Base.tm_vprop",
"Pulse.Typing.vprop_equiv",
"Pulse.Syntax.Base.tm_star"
] | [] | false | false | false | true | true | let frame_for_req_in_ctxt (g: env) (ctxt req: term) =
| (frame: term & tot_typing g frame tm_vprop & vprop_equiv g (tm_star req frame) ctxt) | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.div_qn | val div_qn : Prims.list Prims.string | let div_qn = ["Prims"; "op_Division"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 43,
"end_line": 51,
"start_col": 0,
"start_line": 51
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"]
let mult_qn = ["Prims"; "op_Multiply"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let div_qn =
| ["Prims"; "op_Division"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.mktuple2_qn | val mktuple2_qn : Prims.list Prims.string | let mktuple2_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple2"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 64,
"end_line": 61,
"start_col": 0,
"start_line": 61
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"]
let mult_qn = ["Prims"; "op_Multiply"]
let mult'_qn = ["FStar"; "Mul"; "op_Star"]
let div_qn = ["Prims"; "op_Division"]
let lt_qn = ["Prims"; "op_LessThan"]
let lte_qn = ["Prims"; "op_LessThanOrEqual"]
let gt_qn = ["Prims"; "op_GreaterThan"]
let gte_qn = ["Prims"; "op_GreaterThanOrEqual"]
let mod_qn = ["Prims"; "op_Modulus"]
let nil_qn = ["Prims"; "Nil"]
let cons_qn = ["Prims"; "Cons"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let mktuple2_qn =
| ["FStar"; "Pervasives"; "Native"; "Mktuple2"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.cons_qn | val cons_qn : Prims.list Prims.string | let cons_qn = ["Prims"; "Cons"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 36,
"end_line": 59,
"start_col": 0,
"start_line": 59
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"]
let mult_qn = ["Prims"; "op_Multiply"]
let mult'_qn = ["FStar"; "Mul"; "op_Star"]
let div_qn = ["Prims"; "op_Division"]
let lt_qn = ["Prims"; "op_LessThan"]
let lte_qn = ["Prims"; "op_LessThanOrEqual"]
let gt_qn = ["Prims"; "op_GreaterThan"]
let gte_qn = ["Prims"; "op_GreaterThanOrEqual"]
let mod_qn = ["Prims"; "op_Modulus"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let cons_qn =
| ["Prims"; "Cons"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.gt_qn | val gt_qn : Prims.list Prims.string | let gt_qn = ["Prims"; "op_GreaterThan"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 46,
"end_line": 54,
"start_col": 0,
"start_line": 54
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"]
let mult_qn = ["Prims"; "op_Multiply"]
let mult'_qn = ["FStar"; "Mul"; "op_Star"]
let div_qn = ["Prims"; "op_Division"]
let lt_qn = ["Prims"; "op_LessThan"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let gt_qn =
| ["Prims"; "op_GreaterThan"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.mktuple4_qn | val mktuple4_qn : Prims.list Prims.string | let mktuple4_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple4"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 64,
"end_line": 63,
"start_col": 0,
"start_line": 63
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"]
let mult_qn = ["Prims"; "op_Multiply"]
let mult'_qn = ["FStar"; "Mul"; "op_Star"]
let div_qn = ["Prims"; "op_Division"]
let lt_qn = ["Prims"; "op_LessThan"]
let lte_qn = ["Prims"; "op_LessThanOrEqual"]
let gt_qn = ["Prims"; "op_GreaterThan"]
let gte_qn = ["Prims"; "op_GreaterThanOrEqual"]
let mod_qn = ["Prims"; "op_Modulus"]
let nil_qn = ["Prims"; "Nil"]
let cons_qn = ["Prims"; "Cons"]
let mktuple2_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple2"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let mktuple4_qn =
| ["FStar"; "Pervasives"; "Native"; "Mktuple4"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.gte_qn | val gte_qn : Prims.list Prims.string | let gte_qn = ["Prims"; "op_GreaterThanOrEqual"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 53,
"end_line": 55,
"start_col": 0,
"start_line": 55
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"]
let mult_qn = ["Prims"; "op_Multiply"]
let mult'_qn = ["FStar"; "Mul"; "op_Star"]
let div_qn = ["Prims"; "op_Division"]
let lt_qn = ["Prims"; "op_LessThan"]
let lte_qn = ["Prims"; "op_LessThanOrEqual"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let gte_qn =
| ["Prims"; "op_GreaterThanOrEqual"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.mod_qn | val mod_qn : Prims.list Prims.string | let mod_qn = ["Prims"; "op_Modulus"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 42,
"end_line": 56,
"start_col": 0,
"start_line": 56
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"]
let mult_qn = ["Prims"; "op_Multiply"]
let mult'_qn = ["FStar"; "Mul"; "op_Star"]
let div_qn = ["Prims"; "op_Division"]
let lt_qn = ["Prims"; "op_LessThan"]
let lte_qn = ["Prims"; "op_LessThanOrEqual"]
let gt_qn = ["Prims"; "op_GreaterThan"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let mod_qn =
| ["Prims"; "op_Modulus"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.mktuple3_qn | val mktuple3_qn : Prims.list Prims.string | let mktuple3_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple3"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 64,
"end_line": 62,
"start_col": 0,
"start_line": 62
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"]
let mult_qn = ["Prims"; "op_Multiply"]
let mult'_qn = ["FStar"; "Mul"; "op_Star"]
let div_qn = ["Prims"; "op_Division"]
let lt_qn = ["Prims"; "op_LessThan"]
let lte_qn = ["Prims"; "op_LessThanOrEqual"]
let gt_qn = ["Prims"; "op_GreaterThan"]
let gte_qn = ["Prims"; "op_GreaterThanOrEqual"]
let mod_qn = ["Prims"; "op_Modulus"]
let nil_qn = ["Prims"; "Nil"]
let cons_qn = ["Prims"; "Cons"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let mktuple3_qn =
| ["FStar"; "Pervasives"; "Native"; "Mktuple3"] | false |
|
Vale.AES.X64.AESopt.fsti | Vale.AES.X64.AESopt.va_quick_Loop6x_final | val va_quick_Loop6x_final
(alg: algorithm)
(iv_b scratch_b: buffer128)
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b: buffer128)
(ctr_orig: quad32)
(init ctrs plain: quad32_6)
(inb: quad32)
: (va_quickCode unit (va_code_Loop6x_final alg)) | val va_quick_Loop6x_final
(alg: algorithm)
(iv_b scratch_b: buffer128)
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b: buffer128)
(ctr_orig: quad32)
(init ctrs plain: quad32_6)
(inb: quad32)
: (va_quickCode unit (va_code_Loop6x_final alg)) | let va_quick_Loop6x_final (alg:algorithm) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (ctr_orig:quad32) (init:quad32_6)
(ctrs:quad32_6) (plain:quad32_6) (inb:quad32) : (va_quickCode unit (va_code_Loop6x_final alg)) =
(va_QProc (va_code_Loop6x_final alg) ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 15;
va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRsi; va_Mod_reg64
rRdi; va_Mod_mem]) (va_wp_Loop6x_final alg iv_b scratch_b key_words round_keys keys_b ctr_orig
init ctrs plain inb) (va_wpProof_Loop6x_final alg iv_b scratch_b key_words round_keys keys_b
ctr_orig init ctrs plain inb)) | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 34,
"end_line": 283,
"start_col": 0,
"start_line": 274
} | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let aes_reqs0
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ pclmulqdq_enabled /\ avx_enabled /\
alg = AES_128 /\
//(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
buffer128_as_seq heap0 keys_b == round_keys
let aes_reqs_offset
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ avx_enabled /\ pclmulqdq_enabled /\
(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
s128 heap0 keys_b == round_keys
let six_of (a:Type0) = a & a & a & a & a & a
let quad32_6 = six_of quad32
unfold let make_six_of (#a:Type0) (f:(n:nat{n < 6}) -> GTot a) : GTot (six_of a) =
(f 0, f 1, f 2, f 3, f 4, f 5)
unfold let map_six_of (#a #b:Type0) (x:six_of a) (f:a -> GTot b) : GTot (six_of b) =
let (x0, x1, x2, x3, x4, x5) = x in
(f x0, f x1, f x2, f x3, f x4, f x5)
unfold let map2_six_of (#a #b #c:Type0) (x:six_of a) (y:six_of b) (f:a -> b -> GTot c) : GTot (six_of c) =
let (x0, x1, x2, x3, x4, x5) = x in
let (y0, y1, y2, y3, y4, y5) = y in
(f x0 y0, f x1 y1, f x2 y2, f x3 y3, f x4 y4, f x5 y5)
let rounds_opaque_6 (init:quad32_6) (round_keys:seq quad32) (rnd:nat{rnd < length round_keys}) : GTot quad32_6 =
map_six_of init (fun x -> eval_rounds x round_keys rnd)
let xor_reverse_inc32lite_6 (n i0:int) (ctr_BE rndkey:quad32) : GTot quad32_6 =
make_six_of (fun i ->
let r = reverse_bytes_quad32 (inc32lite ctr_BE (i0 + i)) in
if i < n then quad32_xor r rndkey else r)
//let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
// count * 6 + 6 <= length s /\ (
// let data = slice s (count * 6) (count * 6 + 6) in
// z3 == reverse_bytes_quad32 (index data 5) /\
// scratch_b_blocks true true scratch_b 8 5 heap3 data)
let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
count * 6 + 6 <= length s /\ (
let data = slice s (count * 6) (count * 6 + 6) in
z3 == reverse_bytes_quad32 (index data 5) /\
buffer128_read scratch_b 3 heap3 == reverse_bytes_quad32 (index data 4) /\
buffer128_read scratch_b 4 heap3 == reverse_bytes_quad32 (index data 3) /\
buffer128_read scratch_b 5 heap3 == reverse_bytes_quad32 (index data 2) /\
buffer128_read scratch_b 6 heap3 == reverse_bytes_quad32 (index data 1) /\
buffer128_read scratch_b 7 heap3 == reverse_bytes_quad32 (index data 0))
//-- Load_two_lsb
val va_code_Load_two_lsb : dst:va_operand_xmm -> Tot va_code
val va_codegen_success_Load_two_lsb : dst:va_operand_xmm -> Tot va_pbool
val va_lemma_Load_two_lsb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_two_lsb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@ va_qattr]
let va_wp_Load_two_lsb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 ==> va_k va_sM (())))
val va_wpProof_Load_two_lsb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_two_lsb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_two_lsb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Load_two_lsb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_two_lsb dst)) =
(va_QProc (va_code_Load_two_lsb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_two_lsb dst) (va_wpProof_Load_two_lsb dst))
//--
//-- Load_one_lsb
val va_code_Load_one_lsb : dst:va_operand_xmm -> Tot va_code
val va_codegen_success_Load_one_lsb : dst:va_operand_xmm -> Tot va_pbool
val va_lemma_Load_one_lsb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_one_lsb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@ va_qattr]
let va_wp_Load_one_lsb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 ==> va_k va_sM (())))
val va_wpProof_Load_one_lsb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_one_lsb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_one_lsb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Load_one_lsb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_one_lsb dst)) =
(va_QProc (va_code_Load_one_lsb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_one_lsb dst) (va_wpProof_Load_one_lsb dst))
//--
//-- Loop6x_final
val va_code_Loop6x_final : alg:algorithm -> Tot va_code
val va_codegen_success_Loop6x_final : alg:algorithm -> Tot va_pbool
val va_lemma_Loop6x_final : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> iv_b:buffer128 ->
scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
ctr_orig:quad32 -> init:quad32_6 -> ctrs:quad32_6 -> plain:quad32_6 -> inb:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop6x_final alg) va_s0 /\ va_get_ok va_s0 /\
(sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validDstAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0)
Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\ va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\
aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0
va_s0) (va_get_mem_layout va_s0) /\ init == map_six_of #quad32 #quad32 ctrs (fun (c:quad32) ->
Vale.Def.Types_s.quad32_xor c (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0)) /\
(va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm
13 va_s0, va_get_xmm 14 va_s0) == rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg
- 1) /\ va_get_reg64 rR13 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64
inb) /\ va_get_reg64 rR12 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64
inb) /\ (let rk = FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in
(va_get_xmm 2 va_s0, va_get_xmm 0 va_s0, va_get_xmm 5 va_s0, va_get_xmm 6 va_s0, va_get_xmm 7
va_s0, va_get_xmm 3 va_s0) == map_six_of #quad32 #quad32 plain (fun (p:quad32) ->
Vale.Def.Types_s.quad32_xor rk p) /\ Vale.X64.Decls.buffer128_read scratch_b 8
(va_get_mem_heaplet 3 va_s0) == Vale.Def.Types_s.reverse_bytes_quad32 ctr_orig))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 7 7 /\ Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 inb /\ (va_get_xmm 9
va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM,
va_get_xmm 14 va_sM) == map2_six_of #quad32 #quad32 #quad32 plain ctrs (fun (p:quad32)
(c:quad32) -> Vale.Def.Types_s.quad32_xor p (Vale.AES.AES_s.aes_encrypt_LE alg key_words c)) /\
va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_reg64 rRdi va_sM ==
va_get_reg64 rRdi va_s0 + 96 /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96 /\
va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_sM == Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) /\
(let ctr = Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_orig `op_Modulus` 256 in ctr + 6 <
256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM,
va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 0 ctr_orig (va_get_xmm 15
va_sM))) /\ va_state_eq va_sM (va_update_mem_heaplet 3 va_sM (va_update_flags va_sM
(va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM
(va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 7 va_sM
(va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12
va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Loop6x_final (alg:algorithm) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (ctr_orig:quad32) (init:quad32_6)
(ctrs:quad32_6) (plain:quad32_6) (inb:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0))
: Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 2 va_s0)
(va_get_reg64 rR8 va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0)
scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\
va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\ aes_reqs_offset alg key_words round_keys keys_b
(va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ init ==
map_six_of #quad32 #quad32 ctrs (fun (c:quad32) -> Vale.Def.Types_s.quad32_xor c
(FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0)) /\ (va_get_xmm 9 va_s0,
va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm
14 va_s0) == rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64
rR13 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 inb) /\ va_get_reg64
rR12 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 inb) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_s0,
va_get_xmm 0 va_s0, va_get_xmm 5 va_s0, va_get_xmm 6 va_s0, va_get_xmm 7 va_s0, va_get_xmm 3
va_s0) == map_six_of #quad32 #quad32 plain (fun (p:quad32) -> Vale.Def.Types_s.quad32_xor rk p)
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) ==
Vale.Def.Types_s.reverse_bytes_quad32 ctr_orig)) /\ (forall (va_x_mem:vale_heap)
(va_x_rdi:nat64) (va_x_rsi:nat64) (va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm5:quad32)
(va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32)
(va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32)
(va_x_xmm15:quad32) (va_x_efl:Vale.X64.Flags.t) (va_x_heap3:vale_heap) . let va_sM =
va_upd_mem_heaplet 3 va_x_heap3 (va_upd_flags va_x_efl (va_upd_xmm 15 va_x_xmm15 (va_upd_xmm 14
va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11
(va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6
va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1
va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR13 va_x_r13 (va_upd_reg64 rR12 va_x_r12
(va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRsi va_x_rsi (va_upd_reg64 rRdi va_x_rdi (va_upd_mem
va_x_mem va_s0))))))))))))))))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 7 7 /\ Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 inb /\ (va_get_xmm 9
va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM,
va_get_xmm 14 va_sM) == map2_six_of #quad32 #quad32 #quad32 plain ctrs (fun (p:quad32)
(c:quad32) -> Vale.Def.Types_s.quad32_xor p (Vale.AES.AES_s.aes_encrypt_LE alg key_words c)) /\
va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_reg64 rRdi va_sM ==
va_get_reg64 rRdi va_s0 + 96 /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96 /\
va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_sM == Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) /\
(let ctr = Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_orig `op_Modulus` 256 in ctr + 6 <
256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM,
va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 0 ctr_orig (va_get_xmm 15
va_sM))) ==> va_k va_sM (())))
val va_wpProof_Loop6x_final : alg:algorithm -> iv_b:buffer128 -> scratch_b:buffer128 ->
key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> ctr_orig:quad32 ->
init:quad32_6 -> ctrs:quad32_6 -> plain:quad32_6 -> inb:quad32 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop6x_final alg iv_b scratch_b key_words round_keys
keys_b ctr_orig init ctrs plain inb va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_final alg) ([va_Mod_mem_heaplet
3; va_Mod_flags; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11;
va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm
2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11;
va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Transformers.Transform.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESGCM_expected_code.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
alg: Vale.AES.AES_common_s.algorithm ->
iv_b: Vale.X64.Memory.buffer128 ->
scratch_b: Vale.X64.Memory.buffer128 ->
key_words: FStar.Seq.Base.seq Vale.X64.Memory.nat32 ->
round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
keys_b: Vale.X64.Memory.buffer128 ->
ctr_orig: Vale.X64.Decls.quad32 ->
init: Vale.AES.X64.AESopt.quad32_6 ->
ctrs: Vale.AES.X64.AESopt.quad32_6 ->
plain: Vale.AES.X64.AESopt.quad32_6 ->
inb: Vale.X64.Decls.quad32
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.AES.X64.AESopt.va_code_Loop6x_final alg) | Prims.Tot | [
"total"
] | [] | [
"Vale.AES.AES_common_s.algorithm",
"Vale.X64.Memory.buffer128",
"FStar.Seq.Base.seq",
"Vale.X64.Memory.nat32",
"Vale.X64.Decls.quad32",
"Vale.AES.X64.AESopt.quad32_6",
"Vale.X64.QuickCode.va_QProc",
"Prims.unit",
"Vale.AES.X64.AESopt.va_code_Loop6x_final",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_mem_heaplet",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_xmm",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR13",
"Vale.X64.Machine_s.rR12",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Machine_s.rRsi",
"Vale.X64.Machine_s.rRdi",
"Vale.X64.QuickCode.va_Mod_mem",
"Prims.Nil",
"Vale.AES.X64.AESopt.va_wp_Loop6x_final",
"Vale.AES.X64.AESopt.va_wpProof_Loop6x_final",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Loop6x_final
(alg: algorithm)
(iv_b scratch_b: buffer128)
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b: buffer128)
(ctr_orig: quad32)
(init ctrs plain: quad32_6)
(inb: quad32)
: (va_quickCode unit (va_code_Loop6x_final alg)) =
| (va_QProc (va_code_Loop6x_final alg)
([
va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13;
va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 7; va_Mod_xmm 6;
va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13;
va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_mem
])
(va_wp_Loop6x_final alg iv_b scratch_b key_words round_keys keys_b ctr_orig init ctrs plain inb)
(va_wpProof_Loop6x_final alg iv_b scratch_b key_words round_keys keys_b ctr_orig init ctrs plain
inb)) | false |
FStar.Reflection.Const.fst | FStar.Reflection.Const.mktuple6_qn | val mktuple6_qn : Prims.list Prims.string | let mktuple6_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple6"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 64,
"end_line": 65,
"start_col": 0,
"start_line": 65
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"]
let mult_qn = ["Prims"; "op_Multiply"]
let mult'_qn = ["FStar"; "Mul"; "op_Star"]
let div_qn = ["Prims"; "op_Division"]
let lt_qn = ["Prims"; "op_LessThan"]
let lte_qn = ["Prims"; "op_LessThanOrEqual"]
let gt_qn = ["Prims"; "op_GreaterThan"]
let gte_qn = ["Prims"; "op_GreaterThanOrEqual"]
let mod_qn = ["Prims"; "op_Modulus"]
let nil_qn = ["Prims"; "Nil"]
let cons_qn = ["Prims"; "Cons"]
let mktuple2_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple2"]
let mktuple3_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple3"]
let mktuple4_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple4"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let mktuple6_qn =
| ["FStar"; "Pervasives"; "Native"; "Mktuple6"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.mktuple5_qn | val mktuple5_qn : Prims.list Prims.string | let mktuple5_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple5"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 64,
"end_line": 64,
"start_col": 0,
"start_line": 64
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"]
let mult_qn = ["Prims"; "op_Multiply"]
let mult'_qn = ["FStar"; "Mul"; "op_Star"]
let div_qn = ["Prims"; "op_Division"]
let lt_qn = ["Prims"; "op_LessThan"]
let lte_qn = ["Prims"; "op_LessThanOrEqual"]
let gt_qn = ["Prims"; "op_GreaterThan"]
let gte_qn = ["Prims"; "op_GreaterThanOrEqual"]
let mod_qn = ["Prims"; "op_Modulus"]
let nil_qn = ["Prims"; "Nil"]
let cons_qn = ["Prims"; "Cons"]
let mktuple2_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple2"]
let mktuple3_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple3"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let mktuple5_qn =
| ["FStar"; "Pervasives"; "Native"; "Mktuple5"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.mktuple7_qn | val mktuple7_qn : Prims.list Prims.string | let mktuple7_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple7"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 64,
"end_line": 66,
"start_col": 0,
"start_line": 66
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"]
let mult_qn = ["Prims"; "op_Multiply"]
let mult'_qn = ["FStar"; "Mul"; "op_Star"]
let div_qn = ["Prims"; "op_Division"]
let lt_qn = ["Prims"; "op_LessThan"]
let lte_qn = ["Prims"; "op_LessThanOrEqual"]
let gt_qn = ["Prims"; "op_GreaterThan"]
let gte_qn = ["Prims"; "op_GreaterThanOrEqual"]
let mod_qn = ["Prims"; "op_Modulus"]
let nil_qn = ["Prims"; "Nil"]
let cons_qn = ["Prims"; "Cons"]
let mktuple2_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple2"]
let mktuple3_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple3"]
let mktuple4_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple4"]
let mktuple5_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple5"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let mktuple7_qn =
| ["FStar"; "Pervasives"; "Native"; "Mktuple7"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.mktuple8_qn | val mktuple8_qn : Prims.list Prims.string | let mktuple8_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple8"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 64,
"end_line": 67,
"start_col": 0,
"start_line": 67
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"]
let mult_qn = ["Prims"; "op_Multiply"]
let mult'_qn = ["FStar"; "Mul"; "op_Star"]
let div_qn = ["Prims"; "op_Division"]
let lt_qn = ["Prims"; "op_LessThan"]
let lte_qn = ["Prims"; "op_LessThanOrEqual"]
let gt_qn = ["Prims"; "op_GreaterThan"]
let gte_qn = ["Prims"; "op_GreaterThanOrEqual"]
let mod_qn = ["Prims"; "op_Modulus"]
let nil_qn = ["Prims"; "Nil"]
let cons_qn = ["Prims"; "Cons"]
let mktuple2_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple2"]
let mktuple3_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple3"]
let mktuple4_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple4"]
let mktuple5_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple5"]
let mktuple6_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple6"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let mktuple8_qn =
| ["FStar"; "Pervasives"; "Native"; "Mktuple8"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.land_qn | val land_qn : Prims.list Prims.string | let land_qn = ["FStar" ; "UInt" ; "logand"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 46,
"end_line": 69,
"start_col": 0,
"start_line": 69
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"]
let mult_qn = ["Prims"; "op_Multiply"]
let mult'_qn = ["FStar"; "Mul"; "op_Star"]
let div_qn = ["Prims"; "op_Division"]
let lt_qn = ["Prims"; "op_LessThan"]
let lte_qn = ["Prims"; "op_LessThanOrEqual"]
let gt_qn = ["Prims"; "op_GreaterThan"]
let gte_qn = ["Prims"; "op_GreaterThanOrEqual"]
let mod_qn = ["Prims"; "op_Modulus"]
let nil_qn = ["Prims"; "Nil"]
let cons_qn = ["Prims"; "Cons"]
let mktuple2_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple2"]
let mktuple3_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple3"]
let mktuple4_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple4"]
let mktuple5_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple5"]
let mktuple6_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple6"]
let mktuple7_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple7"]
let mktuple8_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple8"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let land_qn =
| ["FStar"; "UInt"; "logand"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.lxor_qn | val lxor_qn : Prims.list Prims.string | let lxor_qn = ["FStar" ; "UInt" ; "logxor"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 46,
"end_line": 70,
"start_col": 0,
"start_line": 70
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"]
let mult_qn = ["Prims"; "op_Multiply"]
let mult'_qn = ["FStar"; "Mul"; "op_Star"]
let div_qn = ["Prims"; "op_Division"]
let lt_qn = ["Prims"; "op_LessThan"]
let lte_qn = ["Prims"; "op_LessThanOrEqual"]
let gt_qn = ["Prims"; "op_GreaterThan"]
let gte_qn = ["Prims"; "op_GreaterThanOrEqual"]
let mod_qn = ["Prims"; "op_Modulus"]
let nil_qn = ["Prims"; "Nil"]
let cons_qn = ["Prims"; "Cons"]
let mktuple2_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple2"]
let mktuple3_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple3"]
let mktuple4_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple4"]
let mktuple5_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple5"]
let mktuple6_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple6"]
let mktuple7_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple7"]
let mktuple8_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple8"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let lxor_qn =
| ["FStar"; "UInt"; "logxor"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.udiv_qn | val udiv_qn : Prims.list Prims.string | let udiv_qn = ["FStar" ; "UInt" ; "udiv"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 44,
"end_line": 76,
"start_col": 0,
"start_line": 76
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"]
let mult_qn = ["Prims"; "op_Multiply"]
let mult'_qn = ["FStar"; "Mul"; "op_Star"]
let div_qn = ["Prims"; "op_Division"]
let lt_qn = ["Prims"; "op_LessThan"]
let lte_qn = ["Prims"; "op_LessThanOrEqual"]
let gt_qn = ["Prims"; "op_GreaterThan"]
let gte_qn = ["Prims"; "op_GreaterThanOrEqual"]
let mod_qn = ["Prims"; "op_Modulus"]
let nil_qn = ["Prims"; "Nil"]
let cons_qn = ["Prims"; "Cons"]
let mktuple2_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple2"]
let mktuple3_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple3"]
let mktuple4_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple4"]
let mktuple5_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple5"]
let mktuple6_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple6"]
let mktuple7_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple7"]
let mktuple8_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple8"]
let land_qn = ["FStar" ; "UInt" ; "logand"]
let lxor_qn = ["FStar" ; "UInt" ; "logxor"]
let lor_qn = ["FStar" ; "UInt" ; "logor"]
let ladd_qn = ["FStar" ; "UInt" ; "add_mod"]
let lsub_qn = ["FStar" ; "UInt" ; "sub_mod"]
let shiftl_qn = ["FStar" ; "UInt" ; "shift_left"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let udiv_qn =
| ["FStar"; "UInt"; "udiv"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.lor_qn | val lor_qn : Prims.list Prims.string | let lor_qn = ["FStar" ; "UInt" ; "logor"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 45,
"end_line": 71,
"start_col": 0,
"start_line": 71
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"]
let mult_qn = ["Prims"; "op_Multiply"]
let mult'_qn = ["FStar"; "Mul"; "op_Star"]
let div_qn = ["Prims"; "op_Division"]
let lt_qn = ["Prims"; "op_LessThan"]
let lte_qn = ["Prims"; "op_LessThanOrEqual"]
let gt_qn = ["Prims"; "op_GreaterThan"]
let gte_qn = ["Prims"; "op_GreaterThanOrEqual"]
let mod_qn = ["Prims"; "op_Modulus"]
let nil_qn = ["Prims"; "Nil"]
let cons_qn = ["Prims"; "Cons"]
let mktuple2_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple2"]
let mktuple3_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple3"]
let mktuple4_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple4"]
let mktuple5_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple5"]
let mktuple6_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple6"]
let mktuple7_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple7"]
let mktuple8_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple8"]
let land_qn = ["FStar" ; "UInt" ; "logand"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let lor_qn =
| ["FStar"; "UInt"; "logor"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.shiftl_qn | val shiftl_qn : Prims.list Prims.string | let shiftl_qn = ["FStar" ; "UInt" ; "shift_left"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 50,
"end_line": 74,
"start_col": 0,
"start_line": 74
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"]
let mult_qn = ["Prims"; "op_Multiply"]
let mult'_qn = ["FStar"; "Mul"; "op_Star"]
let div_qn = ["Prims"; "op_Division"]
let lt_qn = ["Prims"; "op_LessThan"]
let lte_qn = ["Prims"; "op_LessThanOrEqual"]
let gt_qn = ["Prims"; "op_GreaterThan"]
let gte_qn = ["Prims"; "op_GreaterThanOrEqual"]
let mod_qn = ["Prims"; "op_Modulus"]
let nil_qn = ["Prims"; "Nil"]
let cons_qn = ["Prims"; "Cons"]
let mktuple2_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple2"]
let mktuple3_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple3"]
let mktuple4_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple4"]
let mktuple5_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple5"]
let mktuple6_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple6"]
let mktuple7_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple7"]
let mktuple8_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple8"]
let land_qn = ["FStar" ; "UInt" ; "logand"]
let lxor_qn = ["FStar" ; "UInt" ; "logxor"]
let lor_qn = ["FStar" ; "UInt" ; "logor"]
let ladd_qn = ["FStar" ; "UInt" ; "add_mod"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let shiftl_qn =
| ["FStar"; "UInt"; "shift_left"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.shiftr_qn | val shiftr_qn : Prims.list Prims.string | let shiftr_qn = ["FStar" ; "UInt" ; "shift_right"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 51,
"end_line": 75,
"start_col": 0,
"start_line": 75
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"]
let mult_qn = ["Prims"; "op_Multiply"]
let mult'_qn = ["FStar"; "Mul"; "op_Star"]
let div_qn = ["Prims"; "op_Division"]
let lt_qn = ["Prims"; "op_LessThan"]
let lte_qn = ["Prims"; "op_LessThanOrEqual"]
let gt_qn = ["Prims"; "op_GreaterThan"]
let gte_qn = ["Prims"; "op_GreaterThanOrEqual"]
let mod_qn = ["Prims"; "op_Modulus"]
let nil_qn = ["Prims"; "Nil"]
let cons_qn = ["Prims"; "Cons"]
let mktuple2_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple2"]
let mktuple3_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple3"]
let mktuple4_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple4"]
let mktuple5_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple5"]
let mktuple6_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple6"]
let mktuple7_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple7"]
let mktuple8_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple8"]
let land_qn = ["FStar" ; "UInt" ; "logand"]
let lxor_qn = ["FStar" ; "UInt" ; "logxor"]
let lor_qn = ["FStar" ; "UInt" ; "logor"]
let ladd_qn = ["FStar" ; "UInt" ; "add_mod"]
let lsub_qn = ["FStar" ; "UInt" ; "sub_mod"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let shiftr_qn =
| ["FStar"; "UInt"; "shift_right"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.ladd_qn | val ladd_qn : Prims.list Prims.string | let ladd_qn = ["FStar" ; "UInt" ; "add_mod"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 47,
"end_line": 72,
"start_col": 0,
"start_line": 72
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"]
let mult_qn = ["Prims"; "op_Multiply"]
let mult'_qn = ["FStar"; "Mul"; "op_Star"]
let div_qn = ["Prims"; "op_Division"]
let lt_qn = ["Prims"; "op_LessThan"]
let lte_qn = ["Prims"; "op_LessThanOrEqual"]
let gt_qn = ["Prims"; "op_GreaterThan"]
let gte_qn = ["Prims"; "op_GreaterThanOrEqual"]
let mod_qn = ["Prims"; "op_Modulus"]
let nil_qn = ["Prims"; "Nil"]
let cons_qn = ["Prims"; "Cons"]
let mktuple2_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple2"]
let mktuple3_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple3"]
let mktuple4_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple4"]
let mktuple5_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple5"]
let mktuple6_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple6"]
let mktuple7_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple7"]
let mktuple8_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple8"]
let land_qn = ["FStar" ; "UInt" ; "logand"]
let lxor_qn = ["FStar" ; "UInt" ; "logxor"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let ladd_qn =
| ["FStar"; "UInt"; "add_mod"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.mul_mod_qn | val mul_mod_qn : Prims.list Prims.string | let mul_mod_qn = ["FStar" ; "UInt" ; "mul_mod"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 47,
"end_line": 78,
"start_col": 0,
"start_line": 78
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"]
let mult_qn = ["Prims"; "op_Multiply"]
let mult'_qn = ["FStar"; "Mul"; "op_Star"]
let div_qn = ["Prims"; "op_Division"]
let lt_qn = ["Prims"; "op_LessThan"]
let lte_qn = ["Prims"; "op_LessThanOrEqual"]
let gt_qn = ["Prims"; "op_GreaterThan"]
let gte_qn = ["Prims"; "op_GreaterThanOrEqual"]
let mod_qn = ["Prims"; "op_Modulus"]
let nil_qn = ["Prims"; "Nil"]
let cons_qn = ["Prims"; "Cons"]
let mktuple2_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple2"]
let mktuple3_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple3"]
let mktuple4_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple4"]
let mktuple5_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple5"]
let mktuple6_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple6"]
let mktuple7_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple7"]
let mktuple8_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple8"]
let land_qn = ["FStar" ; "UInt" ; "logand"]
let lxor_qn = ["FStar" ; "UInt" ; "logxor"]
let lor_qn = ["FStar" ; "UInt" ; "logor"]
let ladd_qn = ["FStar" ; "UInt" ; "add_mod"]
let lsub_qn = ["FStar" ; "UInt" ; "sub_mod"]
let shiftl_qn = ["FStar" ; "UInt" ; "shift_left"]
let shiftr_qn = ["FStar" ; "UInt" ; "shift_right"]
let udiv_qn = ["FStar" ; "UInt" ; "udiv"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let mul_mod_qn =
| ["FStar"; "UInt"; "mul_mod"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.lsub_qn | val lsub_qn : Prims.list Prims.string | let lsub_qn = ["FStar" ; "UInt" ; "sub_mod"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 47,
"end_line": 73,
"start_col": 0,
"start_line": 73
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"]
let mult_qn = ["Prims"; "op_Multiply"]
let mult'_qn = ["FStar"; "Mul"; "op_Star"]
let div_qn = ["Prims"; "op_Division"]
let lt_qn = ["Prims"; "op_LessThan"]
let lte_qn = ["Prims"; "op_LessThanOrEqual"]
let gt_qn = ["Prims"; "op_GreaterThan"]
let gte_qn = ["Prims"; "op_GreaterThanOrEqual"]
let mod_qn = ["Prims"; "op_Modulus"]
let nil_qn = ["Prims"; "Nil"]
let cons_qn = ["Prims"; "Cons"]
let mktuple2_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple2"]
let mktuple3_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple3"]
let mktuple4_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple4"]
let mktuple5_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple5"]
let mktuple6_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple6"]
let mktuple7_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple7"]
let mktuple8_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple8"]
let land_qn = ["FStar" ; "UInt" ; "logand"]
let lxor_qn = ["FStar" ; "UInt" ; "logxor"]
let lor_qn = ["FStar" ; "UInt" ; "logor"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let lsub_qn =
| ["FStar"; "UInt"; "sub_mod"] | false |
|
FStar.Reflection.Const.fst | FStar.Reflection.Const.nat_bv_qn | val nat_bv_qn : Prims.list Prims.string | let nat_bv_qn = ["FStar" ; "BV" ; "int2bv"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 46,
"end_line": 79,
"start_col": 0,
"start_line": 79
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"]
let mult_qn = ["Prims"; "op_Multiply"]
let mult'_qn = ["FStar"; "Mul"; "op_Star"]
let div_qn = ["Prims"; "op_Division"]
let lt_qn = ["Prims"; "op_LessThan"]
let lte_qn = ["Prims"; "op_LessThanOrEqual"]
let gt_qn = ["Prims"; "op_GreaterThan"]
let gte_qn = ["Prims"; "op_GreaterThanOrEqual"]
let mod_qn = ["Prims"; "op_Modulus"]
let nil_qn = ["Prims"; "Nil"]
let cons_qn = ["Prims"; "Cons"]
let mktuple2_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple2"]
let mktuple3_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple3"]
let mktuple4_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple4"]
let mktuple5_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple5"]
let mktuple6_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple6"]
let mktuple7_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple7"]
let mktuple8_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple8"]
let land_qn = ["FStar" ; "UInt" ; "logand"]
let lxor_qn = ["FStar" ; "UInt" ; "logxor"]
let lor_qn = ["FStar" ; "UInt" ; "logor"]
let ladd_qn = ["FStar" ; "UInt" ; "add_mod"]
let lsub_qn = ["FStar" ; "UInt" ; "sub_mod"]
let shiftl_qn = ["FStar" ; "UInt" ; "shift_left"]
let shiftr_qn = ["FStar" ; "UInt" ; "shift_right"]
let udiv_qn = ["FStar" ; "UInt" ; "udiv"]
let umod_qn = ["FStar" ; "UInt" ; "mod"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let nat_bv_qn =
| ["FStar"; "BV"; "int2bv"] | false |
|
MerkleTree.Low.fst | MerkleTree.Low.mt_flush_to_ | val mt_flush_to_:
hsz:hash_size_t ->
lv:uint32_t{lv < merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
pi:index_t ->
i:index_t{i >= pi} ->
j:Ghost.erased index_t{
Ghost.reveal j >= i &&
U32.v (Ghost.reveal j) < pow2 (32 - U32.v lv)} ->
HST.ST unit
(requires (fun h0 ->
RV.rv_inv h0 hs /\
mt_safe_elts h0 lv hs pi (Ghost.reveal j)))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (loc_union
(RV.rv_loc_elems h0 hs lv (V.size_of hs))
(V.loc_vector_within hs lv (V.size_of hs)))
h0 h1 /\
RV.rv_inv h1 hs /\
mt_safe_elts h1 lv hs i (Ghost.reveal j) /\
// correctness
(mt_safe_elts_spec h0 lv hs pi (Ghost.reveal j);
S.equal (RV.as_seq h1 hs)
(MTH.mt_flush_to_
(U32.v lv) (RV.as_seq h0 hs) (U32.v pi)
(U32.v i) (U32.v (Ghost.reveal j))))))
(decreases (U32.v i)) | val mt_flush_to_:
hsz:hash_size_t ->
lv:uint32_t{lv < merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
pi:index_t ->
i:index_t{i >= pi} ->
j:Ghost.erased index_t{
Ghost.reveal j >= i &&
U32.v (Ghost.reveal j) < pow2 (32 - U32.v lv)} ->
HST.ST unit
(requires (fun h0 ->
RV.rv_inv h0 hs /\
mt_safe_elts h0 lv hs pi (Ghost.reveal j)))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (loc_union
(RV.rv_loc_elems h0 hs lv (V.size_of hs))
(V.loc_vector_within hs lv (V.size_of hs)))
h0 h1 /\
RV.rv_inv h1 hs /\
mt_safe_elts h1 lv hs i (Ghost.reveal j) /\
// correctness
(mt_safe_elts_spec h0 lv hs pi (Ghost.reveal j);
S.equal (RV.as_seq h1 hs)
(MTH.mt_flush_to_
(U32.v lv) (RV.as_seq h0 hs) (U32.v pi)
(U32.v i) (U32.v (Ghost.reveal j))))))
(decreases (U32.v i)) | let rec mt_flush_to_ hsz lv hs pi i j =
let hh0 = HST.get () in
// Base conditions
mt_safe_elts_rec hh0 lv hs pi (Ghost.reveal j);
V.loc_vector_within_included hs 0ul lv;
V.loc_vector_within_included hs lv (lv + 1ul);
V.loc_vector_within_included hs (lv + 1ul) (V.size_of hs);
V.loc_vector_within_disjoint hs lv (lv + 1ul) (lv + 1ul) (V.size_of hs);
let oi = offset_of i in
let opi = offset_of pi in
if oi = opi then mt_safe_elts_spec hh0 lv hs pi (Ghost.reveal j)
else begin
/// 1) Flush hashes at the level `lv`, where the new vector is
/// not yet connected to `hs`.
let ofs = oi - opi in
let hvec = V.index hs lv in
let flushed:(rvector (hreg hsz)) = rv_flush_inplace hvec ofs in
let hh1 = HST.get () in
// 1-0) Basic disjointness conditions for `RV.assign`
V.forall2_forall_left hh0 hs 0ul (V.size_of hs) lv
(fun b1 b2 -> HH.disjoint (Rgl?.region_of (hvreg hsz) b1)
(Rgl?.region_of (hvreg hsz) b2));
V.forall2_forall_right hh0 hs 0ul (V.size_of hs) lv
(fun b1 b2 -> HH.disjoint (Rgl?.region_of (hvreg hsz) b1)
(Rgl?.region_of (hvreg hsz) b2));
V.forall_preserved
hs 0ul lv
(fun b -> HH.disjoint (Rgl?.region_of (hvreg hsz) hvec)
(Rgl?.region_of (hvreg hsz) b))
(RV.loc_rvector hvec)
hh0 hh1;
V.forall_preserved
hs (lv + 1ul) (V.size_of hs)
(fun b -> HH.disjoint (Rgl?.region_of (hvreg hsz) hvec)
(Rgl?.region_of (hvreg hsz) b))
(RV.loc_rvector hvec)
hh0 hh1;
assert (Rgl?.region_of (hvreg hsz) hvec == Rgl?.region_of (hvreg hsz) flushed);
// 1-1) For the `modifies` postcondition.
assert (modifies (RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv)) hh0 hh1);
// 1-2) Preservation
RV.rv_loc_elems_preserved
hs (lv + 1ul) (V.size_of hs)
(RV.loc_rvector (V.get hh0 hs lv)) hh0 hh1;
// 1-3) For `mt_safe_elts`
assert (V.size_of flushed == Ghost.reveal j - offset_of i); // head updated
mt_safe_elts_preserved
(lv + 1ul) hs (pi / 2ul) (Ghost.reveal j / 2ul)
(RV.loc_rvector (V.get hh0 hs lv)) hh0 hh1; // tail not yet
// 1-4) For the `rv_inv` postcondition
RV.rs_loc_elems_elem_disj
(hvreg hsz) (V.as_seq hh0 hs) (V.frameOf hs)
0 (U32.v (V.size_of hs)) 0 (U32.v lv) (U32.v lv);
RV.rs_loc_elems_parent_disj
(hvreg hsz) (V.as_seq hh0 hs) (V.frameOf hs)
0 (U32.v lv);
RV.rv_elems_inv_preserved
hs 0ul lv (RV.loc_rvector (V.get hh0 hs lv))
hh0 hh1;
assert (RV.rv_elems_inv hh1 hs 0ul lv);
RV.rs_loc_elems_elem_disj
(hvreg hsz) (V.as_seq hh0 hs) (V.frameOf hs)
0 (U32.v (V.size_of hs))
(U32.v lv + 1) (U32.v (V.size_of hs))
(U32.v lv);
RV.rs_loc_elems_parent_disj
(hvreg hsz) (V.as_seq hh0 hs) (V.frameOf hs)
(U32.v lv + 1) (U32.v (V.size_of hs));
RV.rv_elems_inv_preserved
hs (lv + 1ul) (V.size_of hs) (RV.loc_rvector (V.get hh0 hs lv))
hh0 hh1;
assert (RV.rv_elems_inv hh1 hs (lv + 1ul) (V.size_of hs));
assert (rv_itself_inv hh1 hs);
assert (elems_reg hh1 hs);
// 1-5) Correctness
assert (S.equal (RV.as_seq hh1 flushed)
(S.slice (RV.as_seq hh0 (V.get hh0 hs lv)) (U32.v ofs)
(S.length (RV.as_seq hh0 (V.get hh0 hs lv)))));
/// 2) Assign the flushed vector to `hs` at the level `lv`.
RV.assign hs lv flushed;
let hh2 = HST.get () in
// 2-1) For the `modifies` postcondition.
assert (modifies (V.loc_vector_within hs lv (lv + 1ul)) hh1 hh2);
assert (modifies (loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul))) hh0 hh2);
// 2-2) Preservation
V.loc_vector_within_disjoint hs lv (lv + 1ul) (lv + 1ul) (V.size_of hs);
RV.rv_loc_elems_preserved
hs (lv + 1ul) (V.size_of hs)
(V.loc_vector_within hs lv (lv + 1ul)) hh1 hh2;
// 2-3) For `mt_safe_elts`
assert (V.size_of (V.get hh2 hs lv) ==
Ghost.reveal j - offset_of i);
mt_safe_elts_preserved
(lv + 1ul) hs (pi / 2ul) (Ghost.reveal j / 2ul)
(V.loc_vector_within hs lv (lv + 1ul)) hh1 hh2;
// 2-4) Correctness
RV.as_seq_sub_preserved hs 0ul lv (loc_rvector flushed) hh0 hh1;
RV.as_seq_sub_preserved hs (lv + 1ul) merkle_tree_size_lg (loc_rvector flushed) hh0 hh1;
assert (S.equal (RV.as_seq hh2 hs)
(S.append
(RV.as_seq_sub hh0 hs 0ul lv)
(S.cons (RV.as_seq hh1 flushed)
(RV.as_seq_sub hh0 hs (lv + 1ul) merkle_tree_size_lg))));
as_seq_sub_upd hh0 hs lv (RV.as_seq hh1 flushed);
// if `lv = 31` then `pi <= i <= j < 2` thus `oi = opi`,
// contradicting the branch.
assert (lv + 1ul < merkle_tree_size_lg);
assert (U32.v (Ghost.reveal j / 2ul) < pow2 (32 - U32.v (lv + 1ul)));
assert (RV.rv_inv hh2 hs);
assert (mt_safe_elts hh2 (lv + 1ul) hs (pi / 2ul) (Ghost.reveal j / 2ul));
/// 3) Recursion
mt_flush_to_ hsz (lv + 1ul) hs (pi / 2ul) (i / 2ul)
(Ghost.hide (Ghost.reveal j / 2ul));
let hh3 = HST.get () in
// 3-0) Memory safety brought from the postcondition of the recursion
assert (modifies
(loc_union
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
(loc_union
(RV.rv_loc_elems hh0 hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs))))
hh0 hh3);
mt_flush_to_modifies_rec_helper lv hs hh0;
V.loc_vector_within_disjoint hs lv (lv + 1ul) (lv + 1ul) (V.size_of hs);
V.loc_vector_within_included hs lv (lv + 1ul);
RV.rv_loc_elems_included hh2 hs (lv + 1ul) (V.size_of hs);
assert (loc_disjoint
(V.loc_vector_within hs lv (lv + 1ul))
(RV.rv_loc_elems hh2 hs (lv + 1ul) (V.size_of hs)));
V.get_preserved hs lv
(loc_union
(RV.rv_loc_elems hh2 hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)))
hh2 hh3;
assert (V.size_of (V.get hh3 hs lv) ==
Ghost.reveal j - offset_of i);
assert (RV.rv_inv hh3 hs);
mt_safe_elts_constr hh3 lv hs i (Ghost.reveal j);
assert (mt_safe_elts hh3 lv hs i (Ghost.reveal j));
// 3-1) Correctness
mt_safe_elts_spec hh2 (lv + 1ul) hs (pi / 2ul) (Ghost.reveal j / 2ul);
assert (S.equal (RV.as_seq hh3 hs)
(MTH.mt_flush_to_ (U32.v lv + 1) (RV.as_seq hh2 hs)
(U32.v pi / 2) (U32.v i / 2) (U32.v (Ghost.reveal j) / 2)));
mt_safe_elts_spec hh0 lv hs pi (Ghost.reveal j);
MTH.mt_flush_to_rec
(U32.v lv) (RV.as_seq hh0 hs)
(U32.v pi) (U32.v i) (U32.v (Ghost.reveal j));
assert (S.equal (RV.as_seq hh3 hs)
(MTH.mt_flush_to_ (U32.v lv) (RV.as_seq hh0 hs)
(U32.v pi) (U32.v i) (U32.v (Ghost.reveal j))))
end | {
"file_name": "src/MerkleTree.Low.fst",
"git_rev": "7d7bdc20f2033171e279c176b26e84f9069d23c6",
"git_url": "https://github.com/hacl-star/merkle-tree.git",
"project_name": "merkle-tree"
} | {
"end_col": 5,
"end_line": 2403,
"start_col": 0,
"start_line": 2229
} | module MerkleTree.Low
open EverCrypt.Helpers
open FStar.All
open FStar.Integers
open FStar.Mul
open LowStar.Buffer
open LowStar.BufferOps
open LowStar.Vector
open LowStar.Regional
open LowStar.RVector
open LowStar.Regional.Instances
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST
module MHS = FStar.Monotonic.HyperStack
module HH = FStar.Monotonic.HyperHeap
module B = LowStar.Buffer
module CB = LowStar.ConstBuffer
module V = LowStar.Vector
module RV = LowStar.RVector
module RVI = LowStar.Regional.Instances
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module MTH = MerkleTree.New.High
module MTS = MerkleTree.Spec
open Lib.IntTypes
open MerkleTree.Low.Datastructures
open MerkleTree.Low.Hashfunctions
open MerkleTree.Low.VectorExtras
#set-options "--z3rlimit 10 --initial_fuel 0 --max_fuel 0 --initial_ifuel 0 --max_ifuel 0"
type const_pointer (a:Type0) = b:CB.const_buffer a{CB.length b == 1 /\ CB.qual_of b == CB.MUTABLE}
/// Low-level Merkle tree data structure
///
// NOTE: because of a lack of 64-bit LowStar.Buffer support, currently
// we cannot change below to some other types.
type index_t = uint32_t
let uint32_32_max = 4294967295ul
inline_for_extraction
let uint32_max = 4294967295UL
let uint64_max = 18446744073709551615UL
let offset_range_limit = uint32_max
type offset_t = uint64_t
inline_for_extraction noextract unfold let u32_64 = Int.Cast.uint32_to_uint64
inline_for_extraction noextract unfold let u64_32 = Int.Cast.uint64_to_uint32
private inline_for_extraction
let offsets_connect (x:offset_t) (y:offset_t): Tot bool = y >= x && (y - x) <= offset_range_limit
private inline_for_extraction
let split_offset (tree:offset_t) (index:offset_t{offsets_connect tree index}): Tot index_t =
[@inline_let] let diff = U64.sub_mod index tree in
assert (diff <= offset_range_limit);
Int.Cast.uint64_to_uint32 diff
private inline_for_extraction
let add64_fits (x:offset_t) (i:index_t): Tot bool = uint64_max - x >= (u32_64 i)
private inline_for_extraction
let join_offset (tree:offset_t) (i:index_t{add64_fits tree i}): Tot (r:offset_t{offsets_connect tree r}) =
U64.add tree (u32_64 i)
inline_for_extraction val merkle_tree_size_lg: uint32_t
let merkle_tree_size_lg = 32ul
// A Merkle tree `MT i j hs rhs_ok rhs` stores all necessary hashes to generate
// a Merkle path for each element from the index `i` to `j-1`.
// - Parameters
// `hs`: a 2-dim store for hashes, where `hs[0]` contains leaf hash values.
// `rhs_ok`: to check the rightmost hashes are up-to-date
// `rhs`: a store for "rightmost" hashes, manipulated only when required to
// calculate some merkle paths that need the rightmost hashes
// as a part of them.
// `mroot`: during the construction of `rhs` we can also calculate the Merkle
// root of the tree. If `rhs_ok` is true then it has the up-to-date
// root value.
noeq type merkle_tree =
| MT: hash_size:hash_size_t ->
offset:offset_t ->
i:index_t -> j:index_t{i <= j /\ add64_fits offset j} ->
hs:hash_vv hash_size {V.size_of hs = merkle_tree_size_lg} ->
rhs_ok:bool ->
rhs:hash_vec #hash_size {V.size_of rhs = merkle_tree_size_lg} ->
mroot:hash #hash_size ->
hash_spec:Ghost.erased (MTS.hash_fun_t #(U32.v hash_size)) ->
hash_fun:hash_fun_t #hash_size #hash_spec ->
merkle_tree
type mt_p = B.pointer merkle_tree
type const_mt_p = const_pointer merkle_tree
inline_for_extraction
let merkle_tree_conditions (#hsz:Ghost.erased hash_size_t) (offset:uint64_t) (i j:uint32_t) (hs:hash_vv hsz) (rhs_ok:bool) (rhs:hash_vec #hsz) (mroot:hash #hsz): Tot bool =
j >= i && add64_fits offset j &&
V.size_of hs = merkle_tree_size_lg &&
V.size_of rhs = merkle_tree_size_lg
// The maximum number of currently held elements in the tree is (2^32 - 1).
// cwinter: even when using 64-bit indices, we fail if the underlying 32-bit
// vector is full; this can be fixed if necessary.
private inline_for_extraction
val mt_not_full_nst: mtv:merkle_tree -> Tot bool
let mt_not_full_nst mtv = MT?.j mtv < uint32_32_max
val mt_not_full: HS.mem -> mt_p -> GTot bool
let mt_not_full h mt = mt_not_full_nst (B.get h mt 0)
/// (Memory) Safety
val offset_of: i:index_t -> Tot index_t
let offset_of i = if i % 2ul = 0ul then i else i - 1ul
// `mt_safe_elts` says that it is safe to access an element from `i` to `j - 1`
// at level `lv` in the Merkle tree, i.e., hs[lv][k] (i <= k < j) is a valid
// element.
inline_for_extraction noextract
val mt_safe_elts:
#hsz:hash_size_t ->
h:HS.mem -> lv:uint32_t{lv <= merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
i:index_t -> j:index_t{j >= i} ->
GTot Type0 (decreases (32 - U32.v lv))
let rec mt_safe_elts #hsz h lv hs i j =
if lv = merkle_tree_size_lg then true
else (let ofs = offset_of i in
V.size_of (V.get h hs lv) == j - ofs /\
mt_safe_elts #hsz h (lv + 1ul) hs (i / 2ul) (j / 2ul))
#push-options "--initial_fuel 1 --max_fuel 1"
val mt_safe_elts_constr:
#hsz:hash_size_t ->
h:HS.mem -> lv:uint32_t{lv < merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
i:index_t -> j:index_t{j >= i} ->
Lemma (requires (V.size_of (V.get h hs lv) == j - offset_of i /\
mt_safe_elts #hsz h (lv + 1ul) hs (i / 2ul) (j / 2ul)))
(ensures (mt_safe_elts #hsz h lv hs i j))
let mt_safe_elts_constr #_ h lv hs i j = ()
val mt_safe_elts_head:
#hsz:hash_size_t ->
h:HS.mem -> lv:uint32_t{lv < merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
i:index_t -> j:index_t{j >= i} ->
Lemma (requires (mt_safe_elts #hsz h lv hs i j))
(ensures (V.size_of (V.get h hs lv) == j - offset_of i))
let mt_safe_elts_head #_ h lv hs i j = ()
val mt_safe_elts_rec:
#hsz:hash_size_t ->
h:HS.mem -> lv:uint32_t{lv < merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
i:index_t -> j:index_t{j >= i} ->
Lemma (requires (mt_safe_elts #hsz h lv hs i j))
(ensures (mt_safe_elts #hsz h (lv + 1ul) hs (i / 2ul) (j / 2ul)))
let mt_safe_elts_rec #_ h lv hs i j = ()
val mt_safe_elts_init:
#hsz:hash_size_t ->
h:HS.mem -> lv:uint32_t{lv <= merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
Lemma (requires (V.forall_ h hs lv (V.size_of hs)
(fun hv -> V.size_of hv = 0ul)))
(ensures (mt_safe_elts #hsz h lv hs 0ul 0ul))
(decreases (32 - U32.v lv))
let rec mt_safe_elts_init #hsz h lv hs =
if lv = merkle_tree_size_lg then ()
else mt_safe_elts_init #hsz h (lv + 1ul) hs
#pop-options
val mt_safe_elts_preserved:
#hsz:hash_size_t ->
lv:uint32_t{lv <= merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
i:index_t -> j:index_t{j >= i} ->
p:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma (requires (V.live h0 hs /\
mt_safe_elts #hsz h0 lv hs i j /\
loc_disjoint p (V.loc_vector_within hs lv (V.size_of hs)) /\
modifies p h0 h1))
(ensures (mt_safe_elts #hsz h1 lv hs i j))
(decreases (32 - U32.v lv))
[SMTPat (V.live h0 hs);
SMTPat (mt_safe_elts #hsz h0 lv hs i j);
SMTPat (loc_disjoint p (RV.loc_rvector hs));
SMTPat (modifies p h0 h1)]
#push-options "--z3rlimit 100 --initial_fuel 2 --max_fuel 2"
let rec mt_safe_elts_preserved #hsz lv hs i j p h0 h1 =
if lv = merkle_tree_size_lg then ()
else (V.get_preserved hs lv p h0 h1;
mt_safe_elts_preserved #hsz (lv + 1ul) hs (i / 2ul) (j / 2ul) p h0 h1)
#pop-options
// `mt_safe` is the invariant of a Merkle tree through its lifetime.
// It includes liveness, regionality, disjointness (to each data structure),
// and valid element access (`mt_safe_elts`).
inline_for_extraction noextract
val mt_safe: HS.mem -> mt_p -> GTot Type0
let mt_safe h mt =
B.live h mt /\ B.freeable mt /\
(let mtv = B.get h mt 0 in
// Liveness & Accessibility
RV.rv_inv h (MT?.hs mtv) /\
RV.rv_inv h (MT?.rhs mtv) /\
Rgl?.r_inv (hreg (MT?.hash_size mtv)) h (MT?.mroot mtv) /\
mt_safe_elts h 0ul (MT?.hs mtv) (MT?.i mtv) (MT?.j mtv) /\
// Regionality
HH.extends (V.frameOf (MT?.hs mtv)) (B.frameOf mt) /\
HH.extends (V.frameOf (MT?.rhs mtv)) (B.frameOf mt) /\
HH.extends (B.frameOf (MT?.mroot mtv)) (B.frameOf mt) /\
HH.disjoint (V.frameOf (MT?.hs mtv)) (V.frameOf (MT?.rhs mtv)) /\
HH.disjoint (V.frameOf (MT?.hs mtv)) (B.frameOf (MT?.mroot mtv)) /\
HH.disjoint (V.frameOf (MT?.rhs mtv)) (B.frameOf (MT?.mroot mtv)))
// Since a Merkle tree satisfies regionality, it's ok to take all regions from
// a tree pointer as a location of the tree.
val mt_loc: mt_p -> GTot loc
let mt_loc mt = B.loc_all_regions_from false (B.frameOf mt)
val mt_safe_preserved:
mt:mt_p -> p:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma (requires (mt_safe h0 mt /\
loc_disjoint p (mt_loc mt) /\
modifies p h0 h1))
(ensures (B.get h0 mt 0 == B.get h1 mt 0 /\
mt_safe h1 mt))
let mt_safe_preserved mt p h0 h1 =
assert (loc_includes (mt_loc mt) (B.loc_buffer mt));
let mtv = B.get h0 mt 0 in
assert (loc_includes (mt_loc mt) (RV.loc_rvector (MT?.hs mtv)));
assert (loc_includes (mt_loc mt) (RV.loc_rvector (MT?.rhs mtv)));
assert (loc_includes (mt_loc mt) (V.loc_vector (MT?.hs mtv)));
assert (loc_includes (mt_loc mt)
(B.loc_all_regions_from false (B.frameOf (MT?.mroot mtv))));
RV.rv_inv_preserved (MT?.hs mtv) p h0 h1;
RV.rv_inv_preserved (MT?.rhs mtv) p h0 h1;
Rgl?.r_sep (hreg (MT?.hash_size mtv)) (MT?.mroot mtv) p h0 h1;
V.loc_vector_within_included (MT?.hs mtv) 0ul (V.size_of (MT?.hs mtv));
mt_safe_elts_preserved 0ul (MT?.hs mtv) (MT?.i mtv) (MT?.j mtv) p h0 h1
/// Lifting to a high-level Merkle tree structure
val mt_safe_elts_spec:
#hsz:hash_size_t ->
h:HS.mem ->
lv:uint32_t{lv <= merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
i:index_t ->
j:index_t{j >= i} ->
Lemma (requires (RV.rv_inv h hs /\
mt_safe_elts #hsz h lv hs i j))
(ensures (MTH.hs_wf_elts #(U32.v hsz)
(U32.v lv) (RV.as_seq h hs)
(U32.v i) (U32.v j)))
(decreases (32 - U32.v lv))
#push-options "--z3rlimit 100 --initial_fuel 2 --max_fuel 2"
let rec mt_safe_elts_spec #_ h lv hs i j =
if lv = merkle_tree_size_lg then ()
else mt_safe_elts_spec h (lv + 1ul) hs (i / 2ul) (j / 2ul)
#pop-options
val merkle_tree_lift:
h:HS.mem ->
mtv:merkle_tree{
RV.rv_inv h (MT?.hs mtv) /\
RV.rv_inv h (MT?.rhs mtv) /\
Rgl?.r_inv (hreg (MT?.hash_size mtv)) h (MT?.mroot mtv) /\
mt_safe_elts #(MT?.hash_size mtv) h 0ul (MT?.hs mtv) (MT?.i mtv) (MT?.j mtv)} ->
GTot (r:MTH.merkle_tree #(U32.v (MT?.hash_size mtv)) {MTH.mt_wf_elts #_ r})
let merkle_tree_lift h mtv =
mt_safe_elts_spec h 0ul (MT?.hs mtv) (MT?.i mtv) (MT?.j mtv);
MTH.MT #(U32.v (MT?.hash_size mtv))
(U32.v (MT?.i mtv))
(U32.v (MT?.j mtv))
(RV.as_seq h (MT?.hs mtv))
(MT?.rhs_ok mtv)
(RV.as_seq h (MT?.rhs mtv))
(Rgl?.r_repr (hreg (MT?.hash_size mtv)) h (MT?.mroot mtv))
(Ghost.reveal (MT?.hash_spec mtv))
val mt_lift:
h:HS.mem -> mt:mt_p{mt_safe h mt} ->
GTot (r:MTH.merkle_tree #(U32.v (MT?.hash_size (B.get h mt 0))) {MTH.mt_wf_elts #_ r})
let mt_lift h mt =
merkle_tree_lift h (B.get h mt 0)
val mt_preserved:
mt:mt_p -> p:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma (requires (mt_safe h0 mt /\
loc_disjoint p (mt_loc mt) /\
modifies p h0 h1))
(ensures (mt_safe_preserved mt p h0 h1;
mt_lift h0 mt == mt_lift h1 mt))
let mt_preserved mt p h0 h1 =
assert (loc_includes (B.loc_all_regions_from false (B.frameOf mt))
(B.loc_buffer mt));
B.modifies_buffer_elim mt p h0 h1;
assert (B.get h0 mt 0 == B.get h1 mt 0);
assert (loc_includes (B.loc_all_regions_from false (B.frameOf mt))
(RV.loc_rvector (MT?.hs (B.get h0 mt 0))));
assert (loc_includes (B.loc_all_regions_from false (B.frameOf mt))
(RV.loc_rvector (MT?.rhs (B.get h0 mt 0))));
assert (loc_includes (B.loc_all_regions_from false (B.frameOf mt))
(B.loc_buffer (MT?.mroot (B.get h0 mt 0))));
RV.as_seq_preserved (MT?.hs (B.get h0 mt 0)) p h0 h1;
RV.as_seq_preserved (MT?.rhs (B.get h0 mt 0)) p h0 h1;
B.modifies_buffer_elim (MT?.mroot (B.get h0 mt 0)) p h0 h1
/// Construction
// Note that the public function for creation is `mt_create` defined below,
// which builds a tree with an initial hash.
#push-options "--z3rlimit 100 --initial_fuel 1 --max_fuel 1 --initial_ifuel 1 --max_ifuel 1"
private
val create_empty_mt:
hash_size:hash_size_t ->
hash_spec:Ghost.erased (MTS.hash_fun_t #(U32.v hash_size)) ->
hash_fun:hash_fun_t #hash_size #hash_spec ->
r:HST.erid ->
HST.ST mt_p
(requires (fun _ -> true))
(ensures (fun h0 mt h1 ->
let dmt = B.get h1 mt 0 in
// memory safety
B.frameOf mt = r /\
modifies (mt_loc mt) h0 h1 /\
mt_safe h1 mt /\
mt_not_full h1 mt /\
// correctness
MT?.hash_size dmt = hash_size /\
MT?.offset dmt = 0UL /\
merkle_tree_lift h1 dmt == MTH.create_empty_mt #_ #(Ghost.reveal hash_spec) ()))
let create_empty_mt hsz hash_spec hash_fun r =
[@inline_let] let hrg = hreg hsz in
[@inline_let] let hvrg = hvreg hsz in
[@inline_let] let hvvrg = hvvreg hsz in
let hs_region = HST.new_region r in
let hs = RV.alloc_rid hvrg merkle_tree_size_lg hs_region in
let h0 = HST.get () in
mt_safe_elts_init #hsz h0 0ul hs;
let rhs_region = HST.new_region r in
let rhs = RV.alloc_rid hrg merkle_tree_size_lg rhs_region in
let h1 = HST.get () in
assert (RV.as_seq h1 rhs == S.create 32 (MTH.hash_init #(U32.v hsz)));
RV.rv_inv_preserved hs (V.loc_vector rhs) h0 h1;
RV.as_seq_preserved hs (V.loc_vector rhs) h0 h1;
V.loc_vector_within_included hs 0ul (V.size_of hs);
mt_safe_elts_preserved #hsz 0ul hs 0ul 0ul (V.loc_vector rhs) h0 h1;
let mroot_region = HST.new_region r in
let mroot = rg_alloc hrg mroot_region in
let h2 = HST.get () in
RV.as_seq_preserved hs loc_none h1 h2;
RV.as_seq_preserved rhs loc_none h1 h2;
mt_safe_elts_preserved #hsz 0ul hs 0ul 0ul loc_none h1 h2;
let mt = B.malloc r (MT hsz 0UL 0ul 0ul hs false rhs mroot hash_spec hash_fun) 1ul in
let h3 = HST.get () in
RV.as_seq_preserved hs loc_none h2 h3;
RV.as_seq_preserved rhs loc_none h2 h3;
Rgl?.r_sep hrg mroot loc_none h2 h3;
mt_safe_elts_preserved #hsz 0ul hs 0ul 0ul loc_none h2 h3;
mt
#pop-options
/// Destruction (free)
val mt_free: mt:mt_p ->
HST.ST unit
(requires (fun h0 -> mt_safe h0 mt))
(ensures (fun h0 _ h1 -> modifies (mt_loc mt) h0 h1))
#push-options "--z3rlimit 100"
let mt_free mt =
let mtv = !*mt in
RV.free (MT?.hs mtv);
RV.free (MT?.rhs mtv);
[@inline_let] let rg = hreg (MT?.hash_size mtv) in
rg_free rg (MT?.mroot mtv);
B.free mt
#pop-options
/// Insertion
private
val as_seq_sub_upd:
#a:Type0 -> #rst:Type -> #rg:regional rst a ->
h:HS.mem -> rv:rvector #a #rst rg ->
i:uint32_t{i < V.size_of rv} -> v:Rgl?.repr rg ->
Lemma (requires (RV.rv_inv h rv))
(ensures (S.equal (S.upd (RV.as_seq h rv) (U32.v i) v)
(S.append
(RV.as_seq_sub h rv 0ul i)
(S.cons v (RV.as_seq_sub h rv (i + 1ul) (V.size_of rv))))))
#push-options "--z3rlimit 20"
let as_seq_sub_upd #a #rst #rg h rv i v =
Seq.Properties.slice_upd (RV.as_seq h rv) 0 (U32.v i) (U32.v i) v;
Seq.Properties.slice_upd (RV.as_seq h rv) (U32.v i + 1) (U32.v (V.size_of rv)) (U32.v i) v;
RV.as_seq_seq_slice rg h (V.as_seq h rv)
0 (U32.v (V.size_of rv)) 0 (U32.v i);
assert (S.equal (S.slice (RV.as_seq h rv) 0 (U32.v i))
(RV.as_seq_sub h rv 0ul i));
RV.as_seq_seq_slice rg h (V.as_seq h rv)
0 (U32.v (V.size_of rv)) (U32.v i + 1) (U32.v (V.size_of rv));
assert (S.equal (S.slice (RV.as_seq h rv) (U32.v i + 1) (U32.v (V.size_of rv)))
(RV.as_seq_sub h rv (i + 1ul) (V.size_of rv)));
assert (S.index (S.upd (RV.as_seq h rv) (U32.v i) v) (U32.v i) == v)
#pop-options
// `hash_vv_insert_copy` inserts a hash element at a level `lv`, by copying
// and pushing its content to `hs[lv]`. For detailed insertion procedure, see
// `insert_` and `mt_insert`.
#push-options "--z3rlimit 100 --initial_fuel 1 --max_fuel 1"
private
inline_for_extraction
val hash_vv_insert_copy:
#hsz:hash_size_t ->
lv:uint32_t{lv < merkle_tree_size_lg} ->
i:Ghost.erased index_t ->
j:index_t{
Ghost.reveal i <= j &&
U32.v j < pow2 (32 - U32.v lv) - 1 &&
j < uint32_32_max} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
v:hash #hsz ->
HST.ST unit
(requires (fun h0 ->
RV.rv_inv h0 hs /\
Rgl?.r_inv (hreg hsz) h0 v /\
HH.disjoint (V.frameOf hs) (B.frameOf v) /\
mt_safe_elts #hsz h0 lv hs (Ghost.reveal i) j))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq h0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
h0 h1 /\
RV.rv_inv h1 hs /\
Rgl?.r_inv (hreg hsz) h1 v /\
V.size_of (V.get h1 hs lv) == j + 1ul - offset_of (Ghost.reveal i) /\
V.size_of (V.get h1 hs lv) == V.size_of (V.get h0 hs lv) + 1ul /\
mt_safe_elts #hsz h1 (lv + 1ul) hs (Ghost.reveal i / 2ul) (j / 2ul) /\
RV.rv_loc_elems h0 hs (lv + 1ul) (V.size_of hs) ==
RV.rv_loc_elems h1 hs (lv + 1ul) (V.size_of hs) /\
// correctness
(mt_safe_elts_spec #hsz h0 lv hs (Ghost.reveal i) j;
S.equal (RV.as_seq h1 hs)
(MTH.hashess_insert
(U32.v lv) (U32.v (Ghost.reveal i)) (U32.v j)
(RV.as_seq h0 hs) (Rgl?.r_repr (hreg hsz) h0 v))) /\
S.equal (S.index (RV.as_seq h1 hs) (U32.v lv))
(S.snoc (S.index (RV.as_seq h0 hs) (U32.v lv))
(Rgl?.r_repr (hreg hsz) h0 v))))
let hash_vv_insert_copy #hsz lv i j hs v =
let hh0 = HST.get () in
mt_safe_elts_rec hh0 lv hs (Ghost.reveal i) j;
/// 1) Insert an element at the level `lv`, where the new vector is not yet
/// connected to `hs`.
let ihv = RV.insert_copy (hcpy hsz) (V.index hs lv) v in
let hh1 = HST.get () in
// 1-0) Basic disjointness conditions
V.forall2_forall_left hh0 hs 0ul (V.size_of hs) lv
(fun b1 b2 -> HH.disjoint (Rgl?.region_of (hvreg hsz) b1)
(Rgl?.region_of (hvreg hsz) b2));
V.forall2_forall_right hh0 hs 0ul (V.size_of hs) lv
(fun b1 b2 -> HH.disjoint (Rgl?.region_of (hvreg hsz) b1)
(Rgl?.region_of (hvreg hsz) b2));
V.loc_vector_within_included hs lv (lv + 1ul);
V.loc_vector_within_included hs (lv + 1ul) (V.size_of hs);
V.loc_vector_within_disjoint hs lv (lv + 1ul) (lv + 1ul) (V.size_of hs);
// 1-1) For the `modifies` postcondition.
assert (modifies (RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv)) hh0 hh1);
// 1-2) Preservation
Rgl?.r_sep (hreg hsz) v (RV.loc_rvector (V.get hh0 hs lv)) hh0 hh1;
RV.rv_loc_elems_preserved
hs (lv + 1ul) (V.size_of hs)
(RV.loc_rvector (V.get hh0 hs lv)) hh0 hh1;
// 1-3) For `mt_safe_elts`
assert (V.size_of ihv == j + 1ul - offset_of (Ghost.reveal i)); // head updated
mt_safe_elts_preserved
(lv + 1ul) hs (Ghost.reveal i / 2ul) (j / 2ul)
(RV.loc_rvector (V.get hh0 hs lv)) hh0 hh1; // tail not yet
// 1-4) For the `rv_inv` postcondition
RV.rs_loc_elems_elem_disj
(hvreg hsz) (V.as_seq hh0 hs) (V.frameOf hs)
0 (U32.v (V.size_of hs)) 0 (U32.v lv) (U32.v lv);
RV.rs_loc_elems_parent_disj
(hvreg hsz) (V.as_seq hh0 hs) (V.frameOf hs)
0 (U32.v lv);
RV.rv_elems_inv_preserved
hs 0ul lv (RV.loc_rvector (V.get hh0 hs lv))
hh0 hh1;
assert (RV.rv_elems_inv hh1 hs 0ul lv);
RV.rs_loc_elems_elem_disj
(hvreg hsz) (V.as_seq hh0 hs) (V.frameOf hs)
0 (U32.v (V.size_of hs))
(U32.v lv + 1) (U32.v (V.size_of hs))
(U32.v lv);
RV.rs_loc_elems_parent_disj
(hvreg hsz) (V.as_seq hh0 hs) (V.frameOf hs)
(U32.v lv + 1) (U32.v (V.size_of hs));
RV.rv_elems_inv_preserved
hs (lv + 1ul) (V.size_of hs) (RV.loc_rvector (V.get hh0 hs lv))
hh0 hh1;
assert (RV.rv_elems_inv hh1 hs (lv + 1ul) (V.size_of hs));
// assert (rv_itself_inv hh1 hs);
// assert (elems_reg hh1 hs);
// 1-5) Correctness
assert (S.equal (RV.as_seq hh1 ihv)
(S.snoc (RV.as_seq hh0 (V.get hh0 hs lv)) (Rgl?.r_repr (hreg hsz) hh0 v)));
/// 2) Assign the updated vector to `hs` at the level `lv`.
RV.assign hs lv ihv;
let hh2 = HST.get () in
// 2-1) For the `modifies` postcondition.
assert (modifies (V.loc_vector_within hs lv (lv + 1ul)) hh1 hh2);
assert (modifies (loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul))) hh0 hh2);
// 2-2) Preservation
Rgl?.r_sep (hreg hsz) v (RV.loc_rvector hs) hh1 hh2;
RV.rv_loc_elems_preserved
hs (lv + 1ul) (V.size_of hs)
(V.loc_vector_within hs lv (lv + 1ul)) hh1 hh2;
// 2-3) For `mt_safe_elts`
assert (V.size_of (V.get hh2 hs lv) == j + 1ul - offset_of (Ghost.reveal i));
mt_safe_elts_preserved
(lv + 1ul) hs (Ghost.reveal i / 2ul) (j / 2ul)
(V.loc_vector_within hs lv (lv + 1ul)) hh1 hh2;
// 2-4) Correctness
RV.as_seq_sub_preserved hs 0ul lv (loc_rvector ihv) hh0 hh1;
RV.as_seq_sub_preserved hs (lv + 1ul) merkle_tree_size_lg (loc_rvector ihv) hh0 hh1;
assert (S.equal (RV.as_seq hh2 hs)
(S.append
(RV.as_seq_sub hh0 hs 0ul lv)
(S.cons (RV.as_seq hh1 ihv)
(RV.as_seq_sub hh0 hs (lv + 1ul) merkle_tree_size_lg))));
as_seq_sub_upd hh0 hs lv (RV.as_seq hh1 ihv)
#pop-options
private
val insert_index_helper_even:
lv:uint32_t{lv < merkle_tree_size_lg} ->
j:index_t{U32.v j < pow2 (32 - U32.v lv) - 1} ->
Lemma (requires (j % 2ul <> 1ul))
(ensures (U32.v j % 2 <> 1 /\ j / 2ul == (j + 1ul) / 2ul))
let insert_index_helper_even lv j = ()
#push-options "--z3rlimit 100 --initial_fuel 1 --max_fuel 1 --initial_ifuel 1 --max_ifuel 1"
private
val insert_index_helper_odd:
lv:uint32_t{lv < merkle_tree_size_lg} ->
i:index_t ->
j:index_t{i <= j && U32.v j < pow2 (32 - U32.v lv) - 1} ->
Lemma (requires (j % 2ul = 1ul /\
j < uint32_32_max))
(ensures (U32.v j % 2 = 1 /\
U32.v (j / 2ul) < pow2 (32 - U32.v (lv + 1ul)) - 1 /\
(j + 1ul) / 2ul == j / 2ul + 1ul /\
j - offset_of i > 0ul))
let insert_index_helper_odd lv i j = ()
#pop-options
private
val loc_union_assoc_4:
a:loc -> b:loc -> c:loc -> d:loc ->
Lemma (loc_union (loc_union a b) (loc_union c d) ==
loc_union (loc_union a c) (loc_union b d))
let loc_union_assoc_4 a b c d =
loc_union_assoc (loc_union a b) c d;
loc_union_assoc a b c;
loc_union_assoc a c b;
loc_union_assoc (loc_union a c) b d
private
val insert_modifies_rec_helper:
#hsz:hash_size_t ->
lv:uint32_t{lv < merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
aloc:loc ->
h:HS.mem ->
Lemma (loc_union
(loc_union
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq h hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
aloc)
(loc_union
(loc_union
(RV.rv_loc_elems h hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)))
aloc) ==
loc_union
(loc_union
(RV.rv_loc_elems h hs lv (V.size_of hs))
(V.loc_vector_within hs lv (V.size_of hs)))
aloc)
#push-options "--z3rlimit 100 --initial_fuel 2 --max_fuel 2"
let insert_modifies_rec_helper #hsz lv hs aloc h =
assert (V.loc_vector_within hs lv (V.size_of hs) ==
loc_union (V.loc_vector_within hs lv (lv + 1ul))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)));
RV.rs_loc_elems_rec_inverse (hvreg hsz) (V.as_seq h hs) (U32.v lv) (U32.v (V.size_of hs));
assert (RV.rv_loc_elems h hs lv (V.size_of hs) ==
loc_union (RV.rs_loc_elem (hvreg hsz) (V.as_seq h hs) (U32.v lv))
(RV.rv_loc_elems h hs (lv + 1ul) (V.size_of hs)));
// Applying some association rules...
loc_union_assoc
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq h hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul))) aloc
(loc_union
(loc_union
(RV.rv_loc_elems h hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)))
aloc);
loc_union_assoc
(loc_union
(RV.rv_loc_elems h hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs))) aloc aloc;
loc_union_assoc
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq h hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
(loc_union
(RV.rv_loc_elems h hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)))
aloc;
loc_union_assoc_4
(RV.rs_loc_elem (hvreg hsz) (V.as_seq h hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul))
(RV.rv_loc_elems h hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs))
#pop-options
private
val insert_modifies_union_loc_weakening:
l1:loc -> l2:loc -> l3:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma (requires (modifies l1 h0 h1))
(ensures (modifies (loc_union (loc_union l1 l2) l3) h0 h1))
let insert_modifies_union_loc_weakening l1 l2 l3 h0 h1 =
B.loc_includes_union_l l1 l2 l1;
B.loc_includes_union_l (loc_union l1 l2) l3 (loc_union l1 l2)
private
val insert_snoc_last_helper:
#a:Type -> s:S.seq a{S.length s > 0} -> v:a ->
Lemma (S.index (S.snoc s v) (S.length s - 1) == S.last s)
let insert_snoc_last_helper #a s v = ()
private
val rv_inv_rv_elems_reg:
#a:Type0 -> #rst:Type -> #rg:regional rst a ->
h:HS.mem -> rv:rvector rg ->
i:uint32_t -> j:uint32_t{i <= j && j <= V.size_of rv} ->
Lemma (requires (RV.rv_inv h rv))
(ensures (RV.rv_elems_reg h rv i j))
let rv_inv_rv_elems_reg #a #rst #rg h rv i j = ()
// `insert_` recursively inserts proper hashes to each level `lv` by
// accumulating a compressed hash. For example, if there are three leaf elements
// in the tree, `insert_` will change `hs` as follow:
// (`hij` is a compressed hash from `hi` to `hj`)
//
// BEFORE INSERTION AFTER INSERTION
// lv
// 0 h0 h1 h2 ====> h0 h1 h2 h3
// 1 h01 h01 h23
// 2 h03
//
private
val insert_:
#hsz:hash_size_t ->
#hash_spec:Ghost.erased (MTS.hash_fun_t #(U32.v hsz)) ->
lv:uint32_t{lv < merkle_tree_size_lg} ->
i:Ghost.erased index_t ->
j:index_t{
Ghost.reveal i <= j &&
U32.v j < pow2 (32 - U32.v lv) - 1 &&
j < uint32_32_max} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
acc:hash #hsz ->
hash_fun:hash_fun_t #hsz #hash_spec ->
HST.ST unit
(requires (fun h0 ->
RV.rv_inv h0 hs /\
Rgl?.r_inv (hreg hsz) h0 acc /\
HH.disjoint (V.frameOf hs) (B.frameOf acc) /\
mt_safe_elts h0 lv hs (Ghost.reveal i) j))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (loc_union
(loc_union
(RV.rv_loc_elems h0 hs lv (V.size_of hs))
(V.loc_vector_within hs lv (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf acc)))
h0 h1 /\
RV.rv_inv h1 hs /\
Rgl?.r_inv (hreg hsz) h1 acc /\
mt_safe_elts h1 lv hs (Ghost.reveal i) (j + 1ul) /\
// correctness
(mt_safe_elts_spec h0 lv hs (Ghost.reveal i) j;
S.equal (RV.as_seq h1 hs)
(MTH.insert_ #(U32.v hsz) #hash_spec (U32.v lv) (U32.v (Ghost.reveal i)) (U32.v j)
(RV.as_seq h0 hs) (Rgl?.r_repr (hreg hsz) h0 acc)))))
(decreases (U32.v j))
#push-options "--z3rlimit 800 --initial_fuel 1 --max_fuel 1 --initial_ifuel 1 --max_ifuel 1"
let rec insert_ #hsz #hash_spec lv i j hs acc hash_fun =
let hh0 = HST.get () in
hash_vv_insert_copy lv i j hs acc;
let hh1 = HST.get () in
// Base conditions
V.loc_vector_within_included hs lv (lv + 1ul);
V.loc_vector_within_included hs (lv + 1ul) (V.size_of hs);
V.loc_vector_within_disjoint hs lv (lv + 1ul) (lv + 1ul) (V.size_of hs);
assert (V.size_of (V.get hh1 hs lv) == j + 1ul - offset_of (Ghost.reveal i));
assert (mt_safe_elts hh1 (lv + 1ul) hs (Ghost.reveal i / 2ul) (j / 2ul));
if j % 2ul = 1ul
then (insert_index_helper_odd lv (Ghost.reveal i) j;
assert (S.length (S.index (RV.as_seq hh0 hs) (U32.v lv)) > 0);
let lvhs = V.index hs lv in
assert (U32.v (V.size_of lvhs) ==
S.length (S.index (RV.as_seq hh0 hs) (U32.v lv)) + 1);
assert (V.size_of lvhs > 1ul);
/// 3) Update the accumulator `acc`.
hash_vec_rv_inv_r_inv hh1 (V.get hh1 hs lv) (V.size_of (V.get hh1 hs lv) - 2ul);
assert (Rgl?.r_inv (hreg hsz) hh1 acc);
hash_fun (V.index lvhs (V.size_of lvhs - 2ul)) acc acc;
let hh2 = HST.get () in
// 3-1) For the `modifies` postcondition
assert (modifies (B.loc_all_regions_from false (B.frameOf acc)) hh1 hh2);
assert (modifies
(loc_union
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
(B.loc_all_regions_from false (B.frameOf acc)))
hh0 hh2);
// 3-2) Preservation
RV.rv_inv_preserved
hs (B.loc_region_only false (B.frameOf acc)) hh1 hh2;
RV.as_seq_preserved
hs (B.loc_region_only false (B.frameOf acc)) hh1 hh2;
RV.rv_loc_elems_preserved
hs (lv + 1ul) (V.size_of hs)
(B.loc_region_only false (B.frameOf acc)) hh1 hh2;
assert (RV.rv_inv hh2 hs);
assert (Rgl?.r_inv (hreg hsz) hh2 acc);
// 3-3) For `mt_safe_elts`
V.get_preserved hs lv
(B.loc_region_only false (B.frameOf acc)) hh1 hh2; // head preserved
mt_safe_elts_preserved
(lv + 1ul) hs (Ghost.reveal i / 2ul) (j / 2ul)
(B.loc_region_only false (B.frameOf acc)) hh1 hh2; // tail preserved
// 3-4) Correctness
insert_snoc_last_helper
(RV.as_seq hh0 (V.get hh0 hs lv))
(Rgl?.r_repr (hreg hsz) hh0 acc);
assert (S.equal (Rgl?.r_repr (hreg hsz) hh2 acc) // `nacc` in `MTH.insert_`
((Ghost.reveal hash_spec)
(S.last (S.index (RV.as_seq hh0 hs) (U32.v lv)))
(Rgl?.r_repr (hreg hsz) hh0 acc)));
/// 4) Recursion
insert_ (lv + 1ul)
(Ghost.hide (Ghost.reveal i / 2ul)) (j / 2ul)
hs acc hash_fun;
let hh3 = HST.get () in
// 4-0) Memory safety brought from the postcondition of the recursion
assert (RV.rv_inv hh3 hs);
assert (Rgl?.r_inv (hreg hsz) hh3 acc);
assert (modifies (loc_union
(loc_union
(RV.rv_loc_elems hh0 hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf acc)))
hh2 hh3);
assert (modifies
(loc_union
(loc_union
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
(B.loc_all_regions_from false (B.frameOf acc)))
(loc_union
(loc_union
(RV.rv_loc_elems hh0 hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf acc))))
hh0 hh3);
// 4-1) For `mt_safe_elts`
rv_inv_rv_elems_reg hh2 hs (lv + 1ul) (V.size_of hs);
RV.rv_loc_elems_included hh2 hs (lv + 1ul) (V.size_of hs);
assert (loc_disjoint
(V.loc_vector_within hs lv (lv + 1ul))
(RV.rv_loc_elems hh2 hs (lv + 1ul) (V.size_of hs)));
assert (loc_disjoint
(V.loc_vector_within hs lv (lv + 1ul))
(B.loc_all_regions_from false (B.frameOf acc)));
V.get_preserved hs lv
(loc_union
(loc_union
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs))
(RV.rv_loc_elems hh2 hs (lv + 1ul) (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf acc)))
hh2 hh3;
assert (V.size_of (V.get hh3 hs lv) ==
j + 1ul - offset_of (Ghost.reveal i)); // head preserved
assert (mt_safe_elts hh3 (lv + 1ul) hs
(Ghost.reveal i / 2ul) (j / 2ul + 1ul)); // tail by recursion
mt_safe_elts_constr hh3 lv hs (Ghost.reveal i) (j + 1ul);
assert (mt_safe_elts hh3 lv hs (Ghost.reveal i) (j + 1ul));
// 4-2) Correctness
mt_safe_elts_spec hh2 (lv + 1ul) hs (Ghost.reveal i / 2ul) (j / 2ul);
assert (S.equal (RV.as_seq hh3 hs)
(MTH.insert_ #(U32.v hsz) #(Ghost.reveal hash_spec) (U32.v lv + 1) (U32.v (Ghost.reveal i) / 2) (U32.v j / 2)
(RV.as_seq hh2 hs) (Rgl?.r_repr (hreg hsz) hh2 acc)));
mt_safe_elts_spec hh0 lv hs (Ghost.reveal i) j;
MTH.insert_rec #(U32.v hsz) #(Ghost.reveal hash_spec) (U32.v lv) (U32.v (Ghost.reveal i)) (U32.v j)
(RV.as_seq hh0 hs) (Rgl?.r_repr (hreg hsz) hh0 acc);
assert (S.equal (RV.as_seq hh3 hs)
(MTH.insert_ #(U32.v hsz) #(Ghost.reveal hash_spec) (U32.v lv) (U32.v (Ghost.reveal i)) (U32.v j)
(RV.as_seq hh0 hs) (Rgl?.r_repr (hreg hsz) hh0 acc))))
else (insert_index_helper_even lv j;
// memory safety
assert (mt_safe_elts hh1 (lv + 1ul) hs (Ghost.reveal i / 2ul) ((j + 1ul) / 2ul));
mt_safe_elts_constr hh1 lv hs (Ghost.reveal i) (j + 1ul);
assert (mt_safe_elts hh1 lv hs (Ghost.reveal i) (j + 1ul));
assert (modifies
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
hh0 hh1);
insert_modifies_union_loc_weakening
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
(B.loc_all_regions_from false (B.frameOf acc))
(loc_union
(loc_union
(RV.rv_loc_elems hh0 hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf acc)))
hh0 hh1;
// correctness
mt_safe_elts_spec hh0 lv hs (Ghost.reveal i) j;
MTH.insert_base #(U32.v hsz) #(Ghost.reveal hash_spec) (U32.v lv) (U32.v (Ghost.reveal i)) (U32.v j)
(RV.as_seq hh0 hs) (Rgl?.r_repr (hreg hsz) hh0 acc);
assert (S.equal (RV.as_seq hh1 hs)
(MTH.insert_ #(U32.v hsz) #(Ghost.reveal hash_spec) (U32.v lv) (U32.v (Ghost.reveal i)) (U32.v j)
(RV.as_seq hh0 hs) (Rgl?.r_repr (hreg hsz) hh0 acc))));
/// 5) Proving the postcondition after recursion
let hh4 = HST.get () in
// 5-1) For the `modifies` postcondition.
assert (modifies
(loc_union
(loc_union
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
(B.loc_all_regions_from false (B.frameOf acc)))
(loc_union
(loc_union
(RV.rv_loc_elems hh0 hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf acc))))
hh0 hh4);
insert_modifies_rec_helper
lv hs (B.loc_all_regions_from false (B.frameOf acc)) hh0;
// 5-2) For `mt_safe_elts`
assert (mt_safe_elts hh4 lv hs (Ghost.reveal i) (j + 1ul));
// 5-3) Preservation
assert (RV.rv_inv hh4 hs);
assert (Rgl?.r_inv (hreg hsz) hh4 acc);
// 5-4) Correctness
mt_safe_elts_spec hh0 lv hs (Ghost.reveal i) j;
assert (S.equal (RV.as_seq hh4 hs)
(MTH.insert_ #(U32.v hsz) #hash_spec (U32.v lv) (U32.v (Ghost.reveal i)) (U32.v j)
(RV.as_seq hh0 hs) (Rgl?.r_repr (hreg hsz) hh0 acc))) // QED
#pop-options
private inline_for_extraction
val mt_insert_pre_nst: mtv:merkle_tree -> v:hash #(MT?.hash_size mtv) -> Tot bool
let mt_insert_pre_nst mtv v = mt_not_full_nst mtv && add64_fits (MT?.offset mtv) ((MT?.j mtv) + 1ul)
val mt_insert_pre: #hsz:Ghost.erased hash_size_t -> mt:const_mt_p -> v:hash #hsz -> HST.ST bool
(requires (fun h0 -> mt_safe h0 (CB.cast mt) /\ (MT?.hash_size (B.get h0 (CB.cast mt) 0)) = Ghost.reveal hsz))
(ensures (fun _ _ _ -> True))
let mt_insert_pre #hsz mt v =
let mt = !*(CB.cast mt) in
assert (MT?.hash_size mt == (MT?.hash_size mt));
mt_insert_pre_nst mt v
// `mt_insert` inserts a hash to a Merkle tree. Note that this operation
// manipulates the content in `v`, since it uses `v` as an accumulator during
// insertion.
#push-options "--z3rlimit 100 --initial_fuel 1 --max_fuel 1 --initial_ifuel 1 --max_ifuel 1"
val mt_insert:
hsz:Ghost.erased hash_size_t ->
mt:mt_p -> v:hash #hsz ->
HST.ST unit
(requires (fun h0 ->
let dmt = B.get h0 mt 0 in
mt_safe h0 mt /\
Rgl?.r_inv (hreg hsz) h0 v /\
HH.disjoint (B.frameOf mt) (B.frameOf v) /\
MT?.hash_size dmt = Ghost.reveal hsz /\
mt_insert_pre_nst dmt v))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (loc_union
(mt_loc mt)
(B.loc_all_regions_from false (B.frameOf v)))
h0 h1 /\
mt_safe h1 mt /\
// correctness
MT?.hash_size (B.get h1 mt 0) = Ghost.reveal hsz /\
mt_lift h1 mt == MTH.mt_insert (mt_lift h0 mt) (Rgl?.r_repr (hreg hsz) h0 v)))
#pop-options
#push-options "--z3rlimit 40"
let mt_insert hsz mt v =
let hh0 = HST.get () in
let mtv = !*mt in
let hs = MT?.hs mtv in
let hsz = MT?.hash_size mtv in
insert_ #hsz #(Ghost.reveal (MT?.hash_spec mtv)) 0ul (Ghost.hide (MT?.i mtv)) (MT?.j mtv) hs v (MT?.hash_fun mtv);
let hh1 = HST.get () in
RV.rv_loc_elems_included hh0 (MT?.hs mtv) 0ul (V.size_of hs);
V.loc_vector_within_included hs 0ul (V.size_of hs);
RV.rv_inv_preserved
(MT?.rhs mtv)
(loc_union
(loc_union
(RV.rv_loc_elems hh0 hs 0ul (V.size_of hs))
(V.loc_vector_within hs 0ul (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf v)))
hh0 hh1;
RV.as_seq_preserved
(MT?.rhs mtv)
(loc_union
(loc_union
(RV.rv_loc_elems hh0 hs 0ul (V.size_of hs))
(V.loc_vector_within hs 0ul (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf v)))
hh0 hh1;
Rgl?.r_sep (hreg hsz) (MT?.mroot mtv)
(loc_union
(loc_union
(RV.rv_loc_elems hh0 hs 0ul (V.size_of hs))
(V.loc_vector_within hs 0ul (V.size_of hs)))
(B.loc_all_regions_from false (B.frameOf v)))
hh0 hh1;
mt *= MT (MT?.hash_size mtv)
(MT?.offset mtv)
(MT?.i mtv)
(MT?.j mtv + 1ul)
(MT?.hs mtv)
false // `rhs` is always deprecated right after an insertion.
(MT?.rhs mtv)
(MT?.mroot mtv)
(MT?.hash_spec mtv)
(MT?.hash_fun mtv);
let hh2 = HST.get () in
RV.rv_inv_preserved
(MT?.hs mtv) (B.loc_buffer mt) hh1 hh2;
RV.rv_inv_preserved
(MT?.rhs mtv) (B.loc_buffer mt) hh1 hh2;
RV.as_seq_preserved
(MT?.hs mtv) (B.loc_buffer mt) hh1 hh2;
RV.as_seq_preserved
(MT?.rhs mtv) (B.loc_buffer mt) hh1 hh2;
Rgl?.r_sep (hreg hsz) (MT?.mroot mtv) (B.loc_buffer mt) hh1 hh2;
mt_safe_elts_preserved
0ul (MT?.hs mtv) (MT?.i mtv) (MT?.j mtv + 1ul) (B.loc_buffer mt)
hh1 hh2
#pop-options
// `mt_create` initiates a Merkle tree with a given initial hash `init`.
// A valid Merkle tree should contain at least one element.
val mt_create_custom:
hsz:hash_size_t ->
hash_spec:Ghost.erased (MTS.hash_fun_t #(U32.v hsz)) ->
r:HST.erid -> init:hash #hsz -> hash_fun:hash_fun_t #hsz #hash_spec -> HST.ST mt_p
(requires (fun h0 ->
Rgl?.r_inv (hreg hsz) h0 init /\
HH.disjoint r (B.frameOf init)))
(ensures (fun h0 mt h1 ->
// memory safety
modifies (loc_union (mt_loc mt) (B.loc_all_regions_from false (B.frameOf init))) h0 h1 /\
mt_safe h1 mt /\
// correctness
MT?.hash_size (B.get h1 mt 0) = hsz /\
mt_lift h1 mt == MTH.mt_create (U32.v hsz) (Ghost.reveal hash_spec) (Rgl?.r_repr (hreg hsz) h0 init)))
#push-options "--z3rlimit 40"
let mt_create_custom hsz hash_spec r init hash_fun =
let hh0 = HST.get () in
let mt = create_empty_mt hsz hash_spec hash_fun r in
mt_insert hsz mt init;
let hh2 = HST.get () in
mt
#pop-options
/// Construction and Destruction of paths
// Since each element pointer in `path` is from the target Merkle tree and
// each element has different location in `MT?.hs` (thus different region id),
// we cannot use the regionality property for `path`s. Hence here we manually
// define invariants and representation.
noeq type path =
| Path: hash_size:hash_size_t ->
hashes:V.vector (hash #hash_size) ->
path
type path_p = B.pointer path
type const_path_p = const_pointer path
private
let phashes (h:HS.mem) (p:path_p)
: GTot (V.vector (hash #(Path?.hash_size (B.get h p 0))))
= Path?.hashes (B.get h p 0)
// Memory safety of a path as an invariant
inline_for_extraction noextract
val path_safe:
h:HS.mem -> mtr:HH.rid -> p:path_p -> GTot Type0
let path_safe h mtr p =
B.live h p /\ B.freeable p /\
V.live h (phashes h p) /\ V.freeable (phashes h p) /\
HST.is_eternal_region (V.frameOf (phashes h p)) /\
(let hsz = Path?.hash_size (B.get h p 0) in
V.forall_all h (phashes h p)
(fun hp -> Rgl?.r_inv (hreg hsz) h hp /\
HH.includes mtr (Rgl?.region_of (hreg hsz) hp)) /\
HH.extends (V.frameOf (phashes h p)) (B.frameOf p) /\
HH.disjoint mtr (B.frameOf p))
val path_loc: path_p -> GTot loc
let path_loc p = B.loc_all_regions_from false (B.frameOf p)
val lift_path_:
#hsz:hash_size_t ->
h:HS.mem ->
hs:S.seq (hash #hsz) ->
i:nat ->
j:nat{
i <= j /\ j <= S.length hs /\
V.forall_seq hs i j (fun hp -> Rgl?.r_inv (hreg hsz) h hp)} ->
GTot (hp:MTH.path #(U32.v hsz) {S.length hp = j - i}) (decreases j)
let rec lift_path_ #hsz h hs i j =
if i = j then S.empty
else (S.snoc (lift_path_ h hs i (j - 1))
(Rgl?.r_repr (hreg hsz) h (S.index hs (j - 1))))
// Representation of a path
val lift_path:
#hsz:hash_size_t ->
h:HS.mem -> mtr:HH.rid -> p:path_p {path_safe h mtr p /\ (Path?.hash_size (B.get h p 0)) = hsz} ->
GTot (hp:MTH.path #(U32.v hsz) {S.length hp = U32.v (V.size_of (phashes h p))})
let lift_path #hsz h mtr p =
lift_path_ h (V.as_seq h (phashes h p))
0 (S.length (V.as_seq h (phashes h p)))
val lift_path_index_:
#hsz:hash_size_t ->
h:HS.mem ->
hs:S.seq (hash #hsz) ->
i:nat -> j:nat{i <= j && j <= S.length hs} ->
k:nat{i <= k && k < j} ->
Lemma (requires (V.forall_seq hs i j (fun hp -> Rgl?.r_inv (hreg hsz) h hp)))
(ensures (Rgl?.r_repr (hreg hsz) h (S.index hs k) ==
S.index (lift_path_ h hs i j) (k - i)))
(decreases j)
[SMTPat (S.index (lift_path_ h hs i j) (k - i))]
#push-options "--initial_fuel 1 --max_fuel 1 --initial_ifuel 1 --max_ifuel 1"
let rec lift_path_index_ #hsz h hs i j k =
if i = j then ()
else if k = j - 1 then ()
else lift_path_index_ #hsz h hs i (j - 1) k
#pop-options
val lift_path_index:
h:HS.mem -> mtr:HH.rid ->
p:path_p -> i:uint32_t ->
Lemma (requires (path_safe h mtr p /\
i < V.size_of (phashes h p)))
(ensures (let hsz = Path?.hash_size (B.get h p 0) in
Rgl?.r_repr (hreg hsz) h (V.get h (phashes h p) i) ==
S.index (lift_path #(hsz) h mtr p) (U32.v i)))
let lift_path_index h mtr p i =
lift_path_index_ h (V.as_seq h (phashes h p))
0 (S.length (V.as_seq h (phashes h p))) (U32.v i)
val lift_path_eq:
#hsz:hash_size_t ->
h:HS.mem ->
hs1:S.seq (hash #hsz) -> hs2:S.seq (hash #hsz) ->
i:nat -> j:nat ->
Lemma (requires (i <= j /\ j <= S.length hs1 /\ j <= S.length hs2 /\
S.equal (S.slice hs1 i j) (S.slice hs2 i j) /\
V.forall_seq hs1 i j (fun hp -> Rgl?.r_inv (hreg hsz) h hp) /\
V.forall_seq hs2 i j (fun hp -> Rgl?.r_inv (hreg hsz) h hp)))
(ensures (S.equal (lift_path_ h hs1 i j) (lift_path_ h hs2 i j)))
let lift_path_eq #hsz h hs1 hs2 i j =
assert (forall (k:nat{i <= k && k < j}).
S.index (lift_path_ h hs1 i j) (k - i) ==
Rgl?.r_repr (hreg hsz) h (S.index hs1 k));
assert (forall (k:nat{i <= k && k < j}).
S.index (lift_path_ h hs2 i j) (k - i) ==
Rgl?.r_repr (hreg hsz) h (S.index hs2 k));
assert (forall (k:nat{k < j - i}).
S.index (lift_path_ h hs1 i j) k ==
Rgl?.r_repr (hreg hsz) h (S.index hs1 (k + i)));
assert (forall (k:nat{k < j - i}).
S.index (lift_path_ h hs2 i j) k ==
Rgl?.r_repr (hreg hsz) h (S.index hs2 (k + i)));
assert (forall (k:nat{k < j - i}).
S.index (S.slice hs1 i j) k == S.index (S.slice hs2 i j) k);
assert (forall (k:nat{i <= k && k < j}).
S.index (S.slice hs1 i j) (k - i) == S.index (S.slice hs2 i j) (k - i))
private
val path_safe_preserved_:
#hsz:hash_size_t ->
mtr:HH.rid -> hs:S.seq (hash #hsz) ->
i:nat -> j:nat{i <= j && j <= S.length hs} ->
dl:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma
(requires (V.forall_seq hs i j
(fun hp ->
Rgl?.r_inv (hreg hsz) h0 hp /\
HH.includes mtr (Rgl?.region_of (hreg hsz) hp)) /\
loc_disjoint dl (B.loc_all_regions_from false mtr) /\
modifies dl h0 h1))
(ensures (V.forall_seq hs i j
(fun hp ->
Rgl?.r_inv (hreg hsz) h1 hp /\
HH.includes mtr (Rgl?.region_of (hreg hsz) hp))))
(decreases j)
let rec path_safe_preserved_ #hsz mtr hs i j dl h0 h1 =
if i = j then ()
else (assert (loc_includes
(B.loc_all_regions_from false mtr)
(B.loc_all_regions_from false
(Rgl?.region_of (hreg hsz) (S.index hs (j - 1)))));
Rgl?.r_sep (hreg hsz) (S.index hs (j - 1)) dl h0 h1;
path_safe_preserved_ mtr hs i (j - 1) dl h0 h1)
val path_safe_preserved:
mtr:HH.rid -> p:path_p ->
dl:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma (requires (path_safe h0 mtr p /\
loc_disjoint dl (path_loc p) /\
loc_disjoint dl (B.loc_all_regions_from false mtr) /\
modifies dl h0 h1))
(ensures (path_safe h1 mtr p))
let path_safe_preserved mtr p dl h0 h1 =
assert (loc_includes (path_loc p) (B.loc_buffer p));
assert (loc_includes (path_loc p) (V.loc_vector (phashes h0 p)));
path_safe_preserved_
mtr (V.as_seq h0 (phashes h0 p))
0 (S.length (V.as_seq h0 (phashes h0 p))) dl h0 h1
val path_safe_init_preserved:
mtr:HH.rid -> p:path_p ->
dl:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma (requires (path_safe h0 mtr p /\
V.size_of (phashes h0 p) = 0ul /\
B.loc_disjoint dl (path_loc p) /\
modifies dl h0 h1))
(ensures (path_safe h1 mtr p /\
V.size_of (phashes h1 p) = 0ul))
let path_safe_init_preserved mtr p dl h0 h1 =
assert (loc_includes (path_loc p) (B.loc_buffer p));
assert (loc_includes (path_loc p) (V.loc_vector (phashes h0 p)))
val path_preserved_:
#hsz:hash_size_t ->
mtr:HH.rid ->
hs:S.seq (hash #hsz) ->
i:nat -> j:nat{i <= j && j <= S.length hs} ->
dl:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma (requires (V.forall_seq hs i j
(fun hp -> Rgl?.r_inv (hreg hsz) h0 hp /\
HH.includes mtr (Rgl?.region_of (hreg hsz) hp)) /\
loc_disjoint dl (B.loc_all_regions_from false mtr) /\
modifies dl h0 h1))
(ensures (path_safe_preserved_ mtr hs i j dl h0 h1;
S.equal (lift_path_ h0 hs i j)
(lift_path_ h1 hs i j)))
(decreases j)
#push-options "--initial_fuel 1 --max_fuel 1 --initial_ifuel 1 --max_ifuel 1"
let rec path_preserved_ #hsz mtr hs i j dl h0 h1 =
if i = j then ()
else (path_safe_preserved_ mtr hs i (j - 1) dl h0 h1;
path_preserved_ mtr hs i (j - 1) dl h0 h1;
assert (loc_includes
(B.loc_all_regions_from false mtr)
(B.loc_all_regions_from false
(Rgl?.region_of (hreg hsz) (S.index hs (j - 1)))));
Rgl?.r_sep (hreg hsz) (S.index hs (j - 1)) dl h0 h1)
#pop-options
val path_preserved:
mtr:HH.rid -> p:path_p ->
dl:loc -> h0:HS.mem -> h1:HS.mem ->
Lemma (requires (path_safe h0 mtr p /\
loc_disjoint dl (path_loc p) /\
loc_disjoint dl (B.loc_all_regions_from false mtr) /\
modifies dl h0 h1))
(ensures (path_safe_preserved mtr p dl h0 h1;
let hsz0 = (Path?.hash_size (B.get h0 p 0)) in
let hsz1 = (Path?.hash_size (B.get h1 p 0)) in
let b:MTH.path = lift_path #hsz0 h0 mtr p in
let a:MTH.path = lift_path #hsz1 h1 mtr p in
hsz0 = hsz1 /\ S.equal b a))
let path_preserved mtr p dl h0 h1 =
assert (loc_includes (path_loc p) (B.loc_buffer p));
assert (loc_includes (path_loc p) (V.loc_vector (phashes h0 p)));
path_preserved_ mtr (V.as_seq h0 (phashes h0 p))
0 (S.length (V.as_seq h0 (phashes h0 p)))
dl h0 h1
val init_path:
hsz:hash_size_t ->
mtr:HH.rid -> r:HST.erid ->
HST.ST path_p
(requires (fun h0 -> HH.disjoint mtr r))
(ensures (fun h0 p h1 ->
// memory safety
path_safe h1 mtr p /\
// correctness
Path?.hash_size (B.get h1 p 0) = hsz /\
S.equal (lift_path #hsz h1 mtr p) S.empty))
let init_path hsz mtr r =
let nrid = HST.new_region r in
(B.malloc r (Path hsz (rg_alloc (hvreg hsz) nrid)) 1ul)
val clear_path:
mtr:HH.rid -> p:path_p ->
HST.ST unit
(requires (fun h0 -> path_safe h0 mtr p))
(ensures (fun h0 _ h1 ->
// memory safety
path_safe h1 mtr p /\
// correctness
V.size_of (phashes h1 p) = 0ul /\
S.equal (lift_path #(Path?.hash_size (B.get h1 p 0)) h1 mtr p) S.empty))
let clear_path mtr p =
let pv = !*p in
p *= Path (Path?.hash_size pv) (V.clear (Path?.hashes pv))
val free_path:
p:path_p ->
HST.ST unit
(requires (fun h0 ->
B.live h0 p /\ B.freeable p /\
V.live h0 (phashes h0 p) /\ V.freeable (phashes h0 p) /\
HH.extends (V.frameOf (phashes h0 p)) (B.frameOf p)))
(ensures (fun h0 _ h1 ->
modifies (path_loc p) h0 h1))
let free_path p =
let pv = !*p in
V.free (Path?.hashes pv);
B.free p
/// Getting the Merkle root and path
// Construct "rightmost hashes" for a given (incomplete) Merkle tree.
// This function calculates the Merkle root as well, which is the final
// accumulator value.
private
val construct_rhs:
#hsz:hash_size_t ->
#hash_spec:Ghost.erased (MTS.hash_fun_t #(U32.v hsz)) ->
lv:uint32_t{lv <= merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
rhs:hash_vec #hsz {V.size_of rhs = merkle_tree_size_lg} ->
i:index_t ->
j:index_t{i <= j && (U32.v j) < pow2 (32 - U32.v lv)} ->
acc:hash #hsz ->
actd:bool ->
hash_fun:hash_fun_t #hsz #(Ghost.reveal hash_spec) ->
HST.ST unit
(requires (fun h0 ->
RV.rv_inv h0 hs /\ RV.rv_inv h0 rhs /\
HH.disjoint (V.frameOf hs) (V.frameOf rhs) /\
Rgl?.r_inv (hreg hsz) h0 acc /\
HH.disjoint (B.frameOf acc) (V.frameOf hs) /\
HH.disjoint (B.frameOf acc) (V.frameOf rhs) /\
mt_safe_elts #hsz h0 lv hs i j))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (loc_union
(RV.loc_rvector rhs)
(B.loc_all_regions_from false (B.frameOf acc)))
h0 h1 /\
RV.rv_inv h1 rhs /\
Rgl?.r_inv (hreg hsz) h1 acc /\
// correctness
(mt_safe_elts_spec #hsz h0 lv hs i j;
MTH.construct_rhs #(U32.v hsz) #(Ghost.reveal hash_spec)
(U32.v lv)
(Rgl?.r_repr (hvvreg hsz) h0 hs)
(Rgl?.r_repr (hvreg hsz) h0 rhs)
(U32.v i) (U32.v j)
(Rgl?.r_repr (hreg hsz) h0 acc) actd ==
(Rgl?.r_repr (hvreg hsz) h1 rhs, Rgl?.r_repr (hreg hsz) h1 acc)
)))
(decreases (U32.v j))
#push-options "--z3rlimit 250 --initial_fuel 1 --max_fuel 1 --initial_ifuel 1 --max_ifuel 1"
let rec construct_rhs #hsz #hash_spec lv hs rhs i j acc actd hash_fun =
let hh0 = HST.get () in
if j = 0ul then begin
assert (RV.rv_inv hh0 hs);
assert (mt_safe_elts #hsz hh0 lv hs i j);
mt_safe_elts_spec #hsz hh0 lv hs 0ul 0ul;
assert (MTH.hs_wf_elts #(U32.v hsz)
(U32.v lv) (RV.as_seq hh0 hs)
(U32.v i) (U32.v j));
let hh1 = HST.get() in
assert (MTH.construct_rhs #(U32.v hsz) #(Ghost.reveal hash_spec)
(U32.v lv)
(Rgl?.r_repr (hvvreg hsz) hh0 hs)
(Rgl?.r_repr (hvreg hsz) hh0 rhs)
(U32.v i) (U32.v j)
(Rgl?.r_repr (hreg hsz) hh0 acc) actd ==
(Rgl?.r_repr (hvreg hsz) hh1 rhs, Rgl?.r_repr (hreg hsz) hh1 acc))
end
else
let ofs = offset_of i in
begin
(if j % 2ul = 0ul
then begin
Math.Lemmas.pow2_double_mult (32 - U32.v lv - 1);
mt_safe_elts_rec #hsz hh0 lv hs i j;
construct_rhs #hsz #hash_spec (lv + 1ul) hs rhs (i / 2ul) (j / 2ul) acc actd hash_fun;
let hh1 = HST.get () in
// correctness
mt_safe_elts_spec #hsz hh0 lv hs i j;
MTH.construct_rhs_even #(U32.v hsz) #hash_spec
(U32.v lv) (Rgl?.r_repr (hvvreg hsz) hh0 hs) (Rgl?.r_repr (hvreg hsz) hh0 rhs)
(U32.v i) (U32.v j) (Rgl?.r_repr (hreg hsz) hh0 acc) actd;
assert (MTH.construct_rhs #(U32.v hsz) #hash_spec
(U32.v lv)
(Rgl?.r_repr (hvvreg hsz) hh0 hs)
(Rgl?.r_repr (hvreg hsz) hh0 rhs)
(U32.v i) (U32.v j)
(Rgl?.r_repr (hreg hsz) hh0 acc)
actd ==
(Rgl?.r_repr (hvreg hsz) hh1 rhs, Rgl?.r_repr (hreg hsz) hh1 acc))
end
else begin
if actd
then begin
RV.assign_copy (hcpy hsz) rhs lv acc;
let hh1 = HST.get () in
// memory safety
Rgl?.r_sep (hreg hsz) acc
(B.loc_all_regions_from false (V.frameOf rhs)) hh0 hh1;
RV.rv_inv_preserved
hs (B.loc_all_regions_from false (V.frameOf rhs))
hh0 hh1;
RV.as_seq_preserved
hs (B.loc_all_regions_from false (V.frameOf rhs))
hh0 hh1;
RV.rv_inv_preserved
(V.get hh0 hs lv) (B.loc_all_regions_from false (V.frameOf rhs))
hh0 hh1;
V.loc_vector_within_included hs lv (V.size_of hs);
mt_safe_elts_preserved lv hs i j
(B.loc_all_regions_from false (V.frameOf rhs))
hh0 hh1;
mt_safe_elts_head hh1 lv hs i j;
hash_vv_rv_inv_r_inv hh1 hs lv (j - 1ul - ofs);
// correctness
assert (S.equal (RV.as_seq hh1 rhs)
(S.upd (RV.as_seq hh0 rhs) (U32.v lv)
(Rgl?.r_repr (hreg hsz) hh0 acc)));
hash_fun (V.index (V.index hs lv) (j - 1ul - ofs)) acc acc;
let hh2 = HST.get () in
// memory safety
mt_safe_elts_preserved lv hs i j
(B.loc_all_regions_from false (B.frameOf acc)) hh1 hh2;
RV.rv_inv_preserved
hs (B.loc_region_only false (B.frameOf acc)) hh1 hh2;
RV.rv_inv_preserved
rhs (B.loc_region_only false (B.frameOf acc)) hh1 hh2;
RV.as_seq_preserved
hs (B.loc_region_only false (B.frameOf acc)) hh1 hh2;
RV.as_seq_preserved
rhs (B.loc_region_only false (B.frameOf acc)) hh1 hh2;
// correctness
hash_vv_as_seq_get_index hh0 hs lv (j - 1ul - ofs);
assert (Rgl?.r_repr (hreg hsz) hh2 acc ==
(Ghost.reveal hash_spec) (S.index (S.index (RV.as_seq hh0 hs) (U32.v lv))
(U32.v j - 1 - U32.v ofs))
(Rgl?.r_repr (hreg hsz) hh0 acc))
end
else begin
mt_safe_elts_head hh0 lv hs i j;
hash_vv_rv_inv_r_inv hh0 hs lv (j - 1ul - ofs);
hash_vv_rv_inv_disjoint hh0 hs lv (j - 1ul - ofs) (B.frameOf acc);
Cpy?.copy (hcpy hsz) hsz (V.index (V.index hs lv) (j - 1ul - ofs)) acc;
let hh1 = HST.get () in
// memory safety
V.loc_vector_within_included hs lv (V.size_of hs);
mt_safe_elts_preserved lv hs i j
(B.loc_all_regions_from false (B.frameOf acc)) hh0 hh1;
RV.rv_inv_preserved
hs (B.loc_all_regions_from false (B.frameOf acc)) hh0 hh1;
RV.rv_inv_preserved
rhs (B.loc_all_regions_from false (B.frameOf acc)) hh0 hh1;
RV.as_seq_preserved
hs (B.loc_all_regions_from false (B.frameOf acc)) hh0 hh1;
RV.as_seq_preserved
rhs (B.loc_all_regions_from false (B.frameOf acc)) hh0 hh1;
// correctness
hash_vv_as_seq_get_index hh0 hs lv (j - 1ul - ofs);
assert (Rgl?.r_repr (hreg hsz) hh1 acc ==
S.index (S.index (RV.as_seq hh0 hs) (U32.v lv))
(U32.v j - 1 - U32.v ofs))
end;
let hh3 = HST.get () in
assert (S.equal (RV.as_seq hh3 hs) (RV.as_seq hh0 hs));
assert (S.equal (RV.as_seq hh3 rhs)
(if actd
then S.upd (RV.as_seq hh0 rhs) (U32.v lv)
(Rgl?.r_repr (hreg hsz) hh0 acc)
else RV.as_seq hh0 rhs));
assert (Rgl?.r_repr (hreg hsz) hh3 acc ==
(if actd
then (Ghost.reveal hash_spec) (S.index (S.index (RV.as_seq hh0 hs) (U32.v lv))
(U32.v j - 1 - U32.v ofs))
(Rgl?.r_repr (hreg hsz) hh0 acc)
else S.index (S.index (RV.as_seq hh0 hs) (U32.v lv))
(U32.v j - 1 - U32.v ofs)));
mt_safe_elts_rec hh3 lv hs i j;
construct_rhs #hsz #hash_spec (lv + 1ul) hs rhs (i / 2ul) (j / 2ul) acc true hash_fun;
let hh4 = HST.get () in
mt_safe_elts_spec hh3 (lv + 1ul) hs (i / 2ul) (j / 2ul);
assert (MTH.construct_rhs #(U32.v hsz) #hash_spec
(U32.v lv + 1)
(Rgl?.r_repr (hvvreg hsz) hh3 hs)
(Rgl?.r_repr (hvreg hsz) hh3 rhs)
(U32.v i / 2) (U32.v j / 2)
(Rgl?.r_repr (hreg hsz) hh3 acc) true ==
(Rgl?.r_repr (hvreg hsz) hh4 rhs, Rgl?.r_repr (hreg hsz) hh4 acc));
mt_safe_elts_spec hh0 lv hs i j;
MTH.construct_rhs_odd #(U32.v hsz) #hash_spec
(U32.v lv) (Rgl?.r_repr (hvvreg hsz) hh0 hs) (Rgl?.r_repr (hvreg hsz) hh0 rhs)
(U32.v i) (U32.v j) (Rgl?.r_repr (hreg hsz) hh0 acc) actd;
assert (MTH.construct_rhs #(U32.v hsz) #hash_spec
(U32.v lv)
(Rgl?.r_repr (hvvreg hsz) hh0 hs)
(Rgl?.r_repr (hvreg hsz) hh0 rhs)
(U32.v i) (U32.v j)
(Rgl?.r_repr (hreg hsz) hh0 acc) actd ==
(Rgl?.r_repr (hvreg hsz) hh4 rhs, Rgl?.r_repr (hreg hsz) hh4 acc))
end)
end
#pop-options
private inline_for_extraction
val mt_get_root_pre_nst: mtv:merkle_tree -> rt:hash #(MT?.hash_size mtv) -> Tot bool
let mt_get_root_pre_nst mtv rt = true
val mt_get_root_pre:
#hsz:Ghost.erased hash_size_t ->
mt:const_mt_p ->
rt:hash #hsz ->
HST.ST bool
(requires (fun h0 ->
let mt = CB.cast mt in
MT?.hash_size (B.get h0 mt 0) = Ghost.reveal hsz /\
mt_safe h0 mt /\ Rgl?.r_inv (hreg hsz) h0 rt /\
HH.disjoint (B.frameOf mt) (B.frameOf rt)))
(ensures (fun _ _ _ -> True))
let mt_get_root_pre #hsz mt rt =
let mt = CB.cast mt in
let mt = !*mt in
let hsz = MT?.hash_size mt in
assert (MT?.hash_size mt = hsz);
mt_get_root_pre_nst mt rt
// `mt_get_root` returns the Merkle root. If it's already calculated with
// up-to-date hashes, the root is returned immediately. Otherwise it calls
// `construct_rhs` to build rightmost hashes and to calculate the Merkle root
// as well.
val mt_get_root:
#hsz:Ghost.erased hash_size_t ->
mt:const_mt_p ->
rt:hash #hsz ->
HST.ST unit
(requires (fun h0 ->
let mt = CB.cast mt in
let dmt = B.get h0 mt 0 in
MT?.hash_size dmt = (Ghost.reveal hsz) /\
mt_get_root_pre_nst dmt rt /\
mt_safe h0 mt /\ Rgl?.r_inv (hreg hsz) h0 rt /\
HH.disjoint (B.frameOf mt) (B.frameOf rt)))
(ensures (fun h0 _ h1 ->
let mt = CB.cast mt in
// memory safety
modifies (loc_union
(mt_loc mt)
(B.loc_all_regions_from false (B.frameOf rt)))
h0 h1 /\
mt_safe h1 mt /\
(let mtv0 = B.get h0 mt 0 in
let mtv1 = B.get h1 mt 0 in
MT?.hash_size mtv0 = (Ghost.reveal hsz) /\
MT?.hash_size mtv1 = (Ghost.reveal hsz) /\
MT?.i mtv1 = MT?.i mtv0 /\ MT?.j mtv1 = MT?.j mtv0 /\
MT?.hs mtv1 == MT?.hs mtv0 /\ MT?.rhs mtv1 == MT?.rhs mtv0 /\
MT?.offset mtv1 == MT?.offset mtv0 /\
MT?.rhs_ok mtv1 = true /\
Rgl?.r_inv (hreg hsz) h1 rt /\
// correctness
MTH.mt_get_root (mt_lift h0 mt) (Rgl?.r_repr (hreg hsz) h0 rt) ==
(mt_lift h1 mt, Rgl?.r_repr (hreg hsz) h1 rt))))
#push-options "--z3rlimit 150 --initial_fuel 1 --max_fuel 1"
let mt_get_root #hsz mt rt =
let mt = CB.cast mt in
let hh0 = HST.get () in
let mtv = !*mt in
let prefix = MT?.offset mtv in
let i = MT?.i mtv in
let j = MT?.j mtv in
let hs = MT?.hs mtv in
let rhs = MT?.rhs mtv in
let mroot = MT?.mroot mtv in
let hash_size = MT?.hash_size mtv in
let hash_spec = MT?.hash_spec mtv in
let hash_fun = MT?.hash_fun mtv in
if MT?.rhs_ok mtv
then begin
Cpy?.copy (hcpy hash_size) hash_size mroot rt;
let hh1 = HST.get () in
mt_safe_preserved mt
(B.loc_all_regions_from false (Rgl?.region_of (hreg hsz) rt)) hh0 hh1;
mt_preserved mt
(B.loc_all_regions_from false (Rgl?.region_of (hreg hsz) rt)) hh0 hh1;
MTH.mt_get_root_rhs_ok_true
(mt_lift hh0 mt) (Rgl?.r_repr (hreg hsz) hh0 rt);
assert (MTH.mt_get_root (mt_lift hh0 mt) (Rgl?.r_repr (hreg hsz) hh0 rt) ==
(mt_lift hh1 mt, Rgl?.r_repr (hreg hsz) hh1 rt))
end
else begin
construct_rhs #hash_size #hash_spec 0ul hs rhs i j rt false hash_fun;
let hh1 = HST.get () in
// memory safety
assert (RV.rv_inv hh1 rhs);
assert (Rgl?.r_inv (hreg hsz) hh1 rt);
assert (B.live hh1 mt);
RV.rv_inv_preserved
hs (loc_union
(RV.loc_rvector rhs)
(B.loc_all_regions_from false (B.frameOf rt)))
hh0 hh1;
RV.as_seq_preserved
hs (loc_union
(RV.loc_rvector rhs)
(B.loc_all_regions_from false (B.frameOf rt)))
hh0 hh1;
V.loc_vector_within_included hs 0ul (V.size_of hs);
mt_safe_elts_preserved 0ul hs i j
(loc_union
(RV.loc_rvector rhs)
(B.loc_all_regions_from false (B.frameOf rt)))
hh0 hh1;
// correctness
mt_safe_elts_spec hh0 0ul hs i j;
assert (MTH.construct_rhs #(U32.v hash_size) #hash_spec 0
(Rgl?.r_repr (hvvreg hsz) hh0 hs)
(Rgl?.r_repr (hvreg hsz) hh0 rhs)
(U32.v i) (U32.v j)
(Rgl?.r_repr (hreg hsz) hh0 rt) false ==
(Rgl?.r_repr (hvreg hsz) hh1 rhs, Rgl?.r_repr (hreg hsz) hh1 rt));
Cpy?.copy (hcpy hash_size) hash_size rt mroot;
let hh2 = HST.get () in
// memory safety
RV.rv_inv_preserved
hs (B.loc_all_regions_from false (B.frameOf mroot))
hh1 hh2;
RV.rv_inv_preserved
rhs (B.loc_all_regions_from false (B.frameOf mroot))
hh1 hh2;
RV.as_seq_preserved
hs (B.loc_all_regions_from false (B.frameOf mroot))
hh1 hh2;
RV.as_seq_preserved
rhs (B.loc_all_regions_from false (B.frameOf mroot))
hh1 hh2;
B.modifies_buffer_elim
rt (B.loc_all_regions_from false (B.frameOf mroot))
hh1 hh2;
mt_safe_elts_preserved 0ul hs i j
(B.loc_all_regions_from false (B.frameOf mroot))
hh1 hh2;
// correctness
assert (Rgl?.r_repr (hreg hsz) hh2 mroot == Rgl?.r_repr (hreg hsz) hh1 rt);
mt *= MT hash_size prefix i j hs true rhs mroot hash_spec hash_fun;
let hh3 = HST.get () in
// memory safety
Rgl?.r_sep (hreg hsz) rt (B.loc_buffer mt) hh2 hh3;
RV.rv_inv_preserved hs (B.loc_buffer mt) hh2 hh3;
RV.rv_inv_preserved rhs (B.loc_buffer mt) hh2 hh3;
RV.as_seq_preserved hs (B.loc_buffer mt) hh2 hh3;
RV.as_seq_preserved rhs (B.loc_buffer mt) hh2 hh3;
Rgl?.r_sep (hreg hsz) mroot (B.loc_buffer mt) hh2 hh3;
mt_safe_elts_preserved 0ul hs i j
(B.loc_buffer mt) hh2 hh3;
assert (mt_safe hh3 mt);
// correctness
MTH.mt_get_root_rhs_ok_false
(mt_lift hh0 mt) (Rgl?.r_repr (hreg hsz) hh0 rt);
assert (MTH.mt_get_root (mt_lift hh0 mt) (Rgl?.r_repr (hreg hsz) hh0 rt) ==
(MTH.MT #(U32.v hash_size)
(U32.v i) (U32.v j)
(RV.as_seq hh0 hs)
true
(RV.as_seq hh1 rhs)
(Rgl?.r_repr (hreg hsz) hh1 rt)
hash_spec,
Rgl?.r_repr (hreg hsz) hh1 rt));
assert (MTH.mt_get_root (mt_lift hh0 mt) (Rgl?.r_repr (hreg hsz) hh0 rt) ==
(mt_lift hh3 mt, Rgl?.r_repr (hreg hsz) hh3 rt))
end
#pop-options
inline_for_extraction
val mt_path_insert:
#hsz:hash_size_t ->
mtr:HH.rid -> p:path_p -> hp:hash #hsz ->
HST.ST unit
(requires (fun h0 ->
path_safe h0 mtr p /\
not (V.is_full (phashes h0 p)) /\
Rgl?.r_inv (hreg hsz) h0 hp /\
HH.disjoint mtr (B.frameOf p) /\
HH.includes mtr (B.frameOf hp) /\
Path?.hash_size (B.get h0 p 0) = hsz))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (path_loc p) h0 h1 /\
path_safe h1 mtr p /\
// correctness
(let hsz0 = Path?.hash_size (B.get h0 p 0) in
let hsz1 = Path?.hash_size (B.get h1 p 0) in
(let before:(S.seq (MTH.hash #(U32.v hsz0))) = lift_path h0 mtr p in
let after:(S.seq (MTH.hash #(U32.v hsz1))) = lift_path h1 mtr p in
V.size_of (phashes h1 p) = V.size_of (phashes h0 p) + 1ul /\
hsz = hsz0 /\ hsz = hsz1 /\
(let hspec:(S.seq (MTH.hash #(U32.v hsz))) = (MTH.path_insert #(U32.v hsz) before (Rgl?.r_repr (hreg hsz) h0 hp)) in
S.equal hspec after)))))
#push-options "--z3rlimit 20 --initial_fuel 1 --max_fuel 1"
let mt_path_insert #hsz mtr p hp =
let pth = !*p in
let pv = Path?.hashes pth in
let hh0 = HST.get () in
let ipv = V.insert pv hp in
let hh1 = HST.get () in
path_safe_preserved_
mtr (V.as_seq hh0 pv) 0 (S.length (V.as_seq hh0 pv))
(B.loc_all_regions_from false (V.frameOf ipv)) hh0 hh1;
path_preserved_
mtr (V.as_seq hh0 pv) 0 (S.length (V.as_seq hh0 pv))
(B.loc_all_regions_from false (V.frameOf ipv)) hh0 hh1;
Rgl?.r_sep (hreg hsz) hp
(B.loc_all_regions_from false (V.frameOf ipv)) hh0 hh1;
p *= Path hsz ipv;
let hh2 = HST.get () in
path_safe_preserved_
mtr (V.as_seq hh1 ipv) 0 (S.length (V.as_seq hh1 ipv))
(B.loc_region_only false (B.frameOf p)) hh1 hh2;
path_preserved_
mtr (V.as_seq hh1 ipv) 0 (S.length (V.as_seq hh1 ipv))
(B.loc_region_only false (B.frameOf p)) hh1 hh2;
Rgl?.r_sep (hreg hsz) hp
(B.loc_region_only false (B.frameOf p)) hh1 hh2;
assert (S.equal (lift_path hh2 mtr p)
(lift_path_ hh1 (S.snoc (V.as_seq hh0 pv) hp)
0 (S.length (V.as_seq hh1 ipv))));
lift_path_eq hh1 (S.snoc (V.as_seq hh0 pv) hp) (V.as_seq hh0 pv)
0 (S.length (V.as_seq hh0 pv))
#pop-options
// For given a target index `k`, the number of elements (in the tree) `j`,
// and a boolean flag (to check the existence of rightmost hashes), we can
// calculate a required Merkle path length.
//
// `mt_path_length` is a postcondition of `mt_get_path`, and a precondition
// of `mt_verify`. For detailed description, see `mt_get_path` and `mt_verify`.
private
val mt_path_length_step:
k:index_t ->
j:index_t{k <= j} ->
actd:bool ->
Tot (sl:uint32_t{U32.v sl = MTH.mt_path_length_step (U32.v k) (U32.v j) actd})
let mt_path_length_step k j actd =
if j = 0ul then 0ul
else (if k % 2ul = 0ul
then (if j = k || (j = k + 1ul && not actd) then 0ul else 1ul)
else 1ul)
private inline_for_extraction
val mt_path_length:
lv:uint32_t{lv <= merkle_tree_size_lg} ->
k:index_t ->
j:index_t{k <= j && U32.v j < pow2 (32 - U32.v lv)} ->
actd:bool ->
Tot (l:uint32_t{
U32.v l = MTH.mt_path_length (U32.v k) (U32.v j) actd &&
l <= 32ul - lv})
(decreases (U32.v j))
#push-options "--z3rlimit 10 --initial_fuel 1 --max_fuel 1"
let rec mt_path_length lv k j actd =
if j = 0ul then 0ul
else (let nactd = actd || (j % 2ul = 1ul) in
mt_path_length_step k j actd +
mt_path_length (lv + 1ul) (k / 2ul) (j / 2ul) nactd)
#pop-options
val mt_get_path_length:
mtr:HH.rid ->
p:const_path_p ->
HST.ST uint32_t
(requires (fun h0 -> path_safe h0 mtr (CB.cast p)))
(ensures (fun h0 _ h1 -> True))
let mt_get_path_length mtr p =
let pd = !*(CB.cast p) in
V.size_of (Path?.hashes pd)
private inline_for_extraction
val mt_make_path_step:
#hsz:hash_size_t ->
lv:uint32_t{lv <= merkle_tree_size_lg} ->
mtr:HH.rid ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
rhs:hash_vec #hsz {V.size_of rhs = merkle_tree_size_lg} ->
i:index_t ->
j:index_t{j <> 0ul /\ i <= j /\ U32.v j < pow2 (32 - U32.v lv)} ->
k:index_t{i <= k && k <= j} ->
p:path_p ->
actd:bool ->
HST.ST unit
(requires (fun h0 ->
HH.includes mtr (V.frameOf hs) /\
HH.includes mtr (V.frameOf rhs) /\
RV.rv_inv h0 hs /\ RV.rv_inv h0 rhs /\
mt_safe_elts h0 lv hs i j /\
path_safe h0 mtr p /\
Path?.hash_size (B.get h0 p 0) = hsz /\
V.size_of (phashes h0 p) <= lv + 1ul))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (path_loc p) h0 h1 /\
path_safe h1 mtr p /\
V.size_of (phashes h1 p) == V.size_of (phashes h0 p) + mt_path_length_step k j actd /\
V.size_of (phashes h1 p) <= lv + 2ul /\
// correctness
(mt_safe_elts_spec h0 lv hs i j;
(let hsz0 = Path?.hash_size (B.get h0 p 0) in
let hsz1 = Path?.hash_size (B.get h1 p 0) in
let before:(S.seq (MTH.hash #(U32.v hsz0))) = lift_path h0 mtr p in
let after:(S.seq (MTH.hash #(U32.v hsz1))) = lift_path h1 mtr p in
hsz = hsz0 /\ hsz = hsz1 /\
S.equal after
(MTH.mt_make_path_step
(U32.v lv) (RV.as_seq h0 hs) (RV.as_seq h0 rhs)
(U32.v i) (U32.v j) (U32.v k) before actd)))))
#push-options "--z3rlimit 100 --initial_fuel 1 --max_fuel 1 --initial_ifuel 2 --max_ifuel 2"
let mt_make_path_step #hsz lv mtr hs rhs i j k p actd =
let pth = !*p in
let hh0 = HST.get () in
let ofs = offset_of i in
if k % 2ul = 1ul
then begin
hash_vv_rv_inv_includes hh0 hs lv (k - 1ul - ofs);
assert (HH.includes mtr
(B.frameOf (V.get hh0 (V.get hh0 hs lv) (k - 1ul - ofs))));
assert(Path?.hash_size pth = hsz);
mt_path_insert #hsz mtr p (V.index (V.index hs lv) (k - 1ul - ofs))
end
else begin
if k = j then ()
else if k + 1ul = j
then (if actd
then (assert (HH.includes mtr (B.frameOf (V.get hh0 rhs lv)));
mt_path_insert mtr p (V.index rhs lv)))
else (hash_vv_rv_inv_includes hh0 hs lv (k + 1ul - ofs);
assert (HH.includes mtr
(B.frameOf (V.get hh0 (V.get hh0 hs lv) (k + 1ul - ofs))));
mt_path_insert mtr p (V.index (V.index hs lv) (k + 1ul - ofs)))
end
#pop-options
private inline_for_extraction
val mt_get_path_step_pre_nst:
#hsz:Ghost.erased hash_size_t ->
mtr:HH.rid ->
p:path ->
i:uint32_t ->
Tot bool
let mt_get_path_step_pre_nst #hsz mtr p i =
i < V.size_of (Path?.hashes p)
val mt_get_path_step_pre:
#hsz:Ghost.erased hash_size_t ->
mtr:HH.rid ->
p:const_path_p ->
i:uint32_t ->
HST.ST bool
(requires (fun h0 ->
path_safe h0 mtr (CB.cast p) /\
(let pv = B.get h0 (CB.cast p) 0 in
Path?.hash_size pv = Ghost.reveal hsz /\
live h0 (Path?.hashes pv) /\
mt_get_path_step_pre_nst #hsz mtr pv i)))
(ensures (fun _ _ _ -> True))
let mt_get_path_step_pre #hsz mtr p i =
let p = CB.cast p in
mt_get_path_step_pre_nst #hsz mtr !*p i
val mt_get_path_step:
#hsz:Ghost.erased hash_size_t ->
mtr:HH.rid ->
p:const_path_p ->
i:uint32_t ->
HST.ST (hash #hsz)
(requires (fun h0 ->
path_safe h0 mtr (CB.cast p) /\
(let pv = B.get h0 (CB.cast p) 0 in
Path?.hash_size pv = Ghost.reveal hsz /\
live h0 (Path?.hashes pv) /\
i < V.size_of (Path?.hashes pv))))
(ensures (fun h0 r h1 -> True ))
let mt_get_path_step #hsz mtr p i =
let pd = !*(CB.cast p) in
V.index #(hash #(Path?.hash_size pd)) (Path?.hashes pd) i
private
val mt_get_path_:
#hsz:hash_size_t ->
lv:uint32_t{lv <= merkle_tree_size_lg} ->
mtr:HH.rid ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
rhs:hash_vec #hsz {V.size_of rhs = merkle_tree_size_lg} ->
i:index_t -> j:index_t{i <= j /\ U32.v j < pow2 (32 - U32.v lv)} ->
k:index_t{i <= k && k <= j} ->
p:path_p ->
actd:bool ->
HST.ST unit
(requires (fun h0 ->
HH.includes mtr (V.frameOf hs) /\
HH.includes mtr (V.frameOf rhs) /\
RV.rv_inv h0 hs /\ RV.rv_inv h0 rhs /\
mt_safe_elts h0 lv hs i j /\
path_safe h0 mtr p /\
Path?.hash_size (B.get h0 p 0) = hsz /\
V.size_of (phashes h0 p) <= lv + 1ul))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (path_loc p) h0 h1 /\
path_safe h1 mtr p /\
V.size_of (phashes h1 p) ==
V.size_of (phashes h0 p) + mt_path_length lv k j actd /\
// correctness
(mt_safe_elts_spec h0 lv hs i j;
(let hsz0 = Path?.hash_size (B.get h0 p 0) in
let hsz1 = Path?.hash_size (B.get h1 p 0) in
let before:(S.seq (MTH.hash #(U32.v hsz0))) = lift_path h0 mtr p in
let after:(S.seq (MTH.hash #(U32.v hsz1))) = lift_path h1 mtr p in
hsz = hsz0 /\ hsz = hsz1 /\
S.equal after
(MTH.mt_get_path_ (U32.v lv) (RV.as_seq h0 hs) (RV.as_seq h0 rhs)
(U32.v i) (U32.v j) (U32.v k) before actd)))))
(decreases (32 - U32.v lv))
#push-options "--z3rlimit 300 --initial_fuel 1 --max_fuel 1 --max_ifuel 2 --initial_ifuel 2"
let rec mt_get_path_ #hsz lv mtr hs rhs i j k p actd =
let hh0 = HST.get () in
mt_safe_elts_spec hh0 lv hs i j;
let ofs = offset_of i in
if j = 0ul then ()
else
(mt_make_path_step lv mtr hs rhs i j k p actd;
let hh1 = HST.get () in
mt_safe_elts_spec hh0 lv hs i j;
assert (S.equal (lift_path hh1 mtr p)
(MTH.mt_make_path_step
(U32.v lv) (RV.as_seq hh0 hs) (RV.as_seq hh0 rhs)
(U32.v i) (U32.v j) (U32.v k)
(lift_path hh0 mtr p) actd));
RV.rv_inv_preserved hs (path_loc p) hh0 hh1;
RV.rv_inv_preserved rhs (path_loc p) hh0 hh1;
RV.as_seq_preserved hs (path_loc p) hh0 hh1;
RV.as_seq_preserved rhs (path_loc p) hh0 hh1;
V.loc_vector_within_included hs lv (V.size_of hs);
mt_safe_elts_preserved lv hs i j (path_loc p) hh0 hh1;
assert (mt_safe_elts hh1 lv hs i j);
mt_safe_elts_rec hh1 lv hs i j;
mt_safe_elts_spec hh1 (lv + 1ul) hs (i / 2ul) (j / 2ul);
mt_get_path_ (lv + 1ul) mtr hs rhs (i / 2ul) (j / 2ul) (k / 2ul) p
(if j % 2ul = 0ul then actd else true);
let hh2 = HST.get () in
assert (S.equal (lift_path hh2 mtr p)
(MTH.mt_get_path_ (U32.v lv + 1)
(RV.as_seq hh1 hs) (RV.as_seq hh1 rhs)
(U32.v i / 2) (U32.v j / 2) (U32.v k / 2)
(lift_path hh1 mtr p)
(if U32.v j % 2 = 0 then actd else true)));
assert (S.equal (lift_path hh2 mtr p)
(MTH.mt_get_path_ (U32.v lv)
(RV.as_seq hh0 hs) (RV.as_seq hh0 rhs)
(U32.v i) (U32.v j) (U32.v k)
(lift_path hh0 mtr p) actd)))
#pop-options
private inline_for_extraction
val mt_get_path_pre_nst:
mtv:merkle_tree ->
idx:offset_t ->
p:path ->
root:(hash #(MT?.hash_size mtv)) ->
Tot bool
let mt_get_path_pre_nst mtv idx p root =
offsets_connect (MT?.offset mtv) idx &&
Path?.hash_size p = MT?.hash_size mtv &&
([@inline_let] let idx = split_offset (MT?.offset mtv) idx in
MT?.i mtv <= idx && idx < MT?.j mtv &&
V.size_of (Path?.hashes p) = 0ul)
val mt_get_path_pre:
#hsz:Ghost.erased hash_size_t ->
mt:const_mt_p ->
idx:offset_t ->
p:const_path_p ->
root:hash #hsz ->
HST.ST bool
(requires (fun h0 ->
let mt = CB.cast mt in
let p = CB.cast p in
let dmt = B.get h0 mt 0 in
let dp = B.get h0 p 0 in
MT?.hash_size dmt = (Ghost.reveal hsz) /\
Path?.hash_size dp = (Ghost.reveal hsz) /\
mt_safe h0 mt /\
path_safe h0 (B.frameOf mt) p /\
Rgl?.r_inv (hreg hsz) h0 root /\
HH.disjoint (B.frameOf root) (B.frameOf mt) /\
HH.disjoint (B.frameOf root) (B.frameOf p)))
(ensures (fun _ _ _ -> True))
let mt_get_path_pre #_ mt idx p root =
let mt = CB.cast mt in
let p = CB.cast p in
let mtv = !*mt in
mt_get_path_pre_nst mtv idx !*p root
val mt_get_path_loc_union_helper:
l1:loc -> l2:loc ->
Lemma (loc_union (loc_union l1 l2) l2 == loc_union l1 l2)
let mt_get_path_loc_union_helper l1 l2 = ()
// Construct a Merkle path for a given index `idx`, hashes `mt.hs`, and rightmost
// hashes `mt.rhs`. Note that this operation copies "pointers" into the Merkle tree
// to the output path.
#push-options "--z3rlimit 60"
val mt_get_path:
#hsz:Ghost.erased hash_size_t ->
mt:const_mt_p ->
idx:offset_t ->
p:path_p ->
root:hash #hsz ->
HST.ST index_t
(requires (fun h0 ->
let mt = CB.cast mt in
let dmt = B.get h0 mt 0 in
MT?.hash_size dmt = Ghost.reveal hsz /\
Path?.hash_size (B.get h0 p 0) = Ghost.reveal hsz /\
mt_get_path_pre_nst (B.get h0 mt 0) idx (B.get h0 p 0) root /\
mt_safe h0 mt /\
path_safe h0 (B.frameOf mt) p /\
Rgl?.r_inv (hreg hsz) h0 root /\
HH.disjoint (B.frameOf root) (B.frameOf mt) /\
HH.disjoint (B.frameOf root) (B.frameOf p)))
(ensures (fun h0 _ h1 ->
let mt = CB.cast mt in
let mtv0 = B.get h0 mt 0 in
let mtv1 = B.get h1 mt 0 in
let idx = split_offset (MT?.offset mtv0) idx in
MT?.hash_size mtv0 = Ghost.reveal hsz /\
MT?.hash_size mtv1 = Ghost.reveal hsz /\
Path?.hash_size (B.get h0 p 0) = Ghost.reveal hsz /\
Path?.hash_size (B.get h1 p 0) = Ghost.reveal hsz /\
// memory safety
modifies (loc_union
(loc_union
(mt_loc mt)
(B.loc_all_regions_from false (B.frameOf root)))
(path_loc p))
h0 h1 /\
mt_safe h1 mt /\
path_safe h1 (B.frameOf mt) p /\
Rgl?.r_inv (hreg hsz) h1 root /\
V.size_of (phashes h1 p) ==
1ul + mt_path_length 0ul idx (MT?.j mtv0) false /\
// correctness
(let sj, sp, srt =
MTH.mt_get_path
(mt_lift h0 mt) (U32.v idx) (Rgl?.r_repr (hreg hsz) h0 root) in
sj == U32.v (MT?.j mtv1) /\
S.equal sp (lift_path #hsz h1 (B.frameOf mt) p) /\
srt == Rgl?.r_repr (hreg hsz) h1 root)))
#pop-options
#push-options "--z3rlimit 300 --initial_fuel 1 --max_fuel 1"
let mt_get_path #hsz mt idx p root =
let ncmt = CB.cast mt in
let mtframe = B.frameOf ncmt in
let hh0 = HST.get () in
mt_get_root mt root;
let mtv = !*ncmt in
let hsz = MT?.hash_size mtv in
let hh1 = HST.get () in
path_safe_init_preserved mtframe p
(B.loc_union (mt_loc ncmt)
(B.loc_all_regions_from false (B.frameOf root)))
hh0 hh1;
assert (MTH.mt_get_root (mt_lift hh0 ncmt) (Rgl?.r_repr (hreg hsz) hh0 root) ==
(mt_lift hh1 ncmt, Rgl?.r_repr (hreg hsz) hh1 root));
assert (S.equal (lift_path #hsz hh1 mtframe p) S.empty);
let idx = split_offset (MT?.offset mtv) idx in
let i = MT?.i mtv in
let ofs = offset_of (MT?.i mtv) in
let j = MT?.j mtv in
let hs = MT?.hs mtv in
let rhs = MT?.rhs mtv in
assert (mt_safe_elts hh1 0ul hs i j);
assert (V.size_of (V.get hh1 hs 0ul) == j - ofs);
assert (idx < j);
hash_vv_rv_inv_includes hh1 hs 0ul (idx - ofs);
hash_vv_rv_inv_r_inv hh1 hs 0ul (idx - ofs);
hash_vv_as_seq_get_index hh1 hs 0ul (idx - ofs);
let ih = V.index (V.index hs 0ul) (idx - ofs) in
mt_path_insert #hsz mtframe p ih;
let hh2 = HST.get () in
assert (S.equal (lift_path hh2 mtframe p)
(MTH.path_insert
(lift_path hh1 mtframe p)
(S.index (S.index (RV.as_seq hh1 hs) 0) (U32.v idx - U32.v ofs))));
Rgl?.r_sep (hreg hsz) root (path_loc p) hh1 hh2;
mt_safe_preserved ncmt (path_loc p) hh1 hh2;
mt_preserved ncmt (path_loc p) hh1 hh2;
assert (V.size_of (phashes hh2 p) == 1ul);
mt_get_path_ 0ul mtframe hs rhs i j idx p false;
let hh3 = HST.get () in
// memory safety
mt_get_path_loc_union_helper
(loc_union (mt_loc ncmt)
(B.loc_all_regions_from false (B.frameOf root)))
(path_loc p);
Rgl?.r_sep (hreg hsz) root (path_loc p) hh2 hh3;
mt_safe_preserved ncmt (path_loc p) hh2 hh3;
mt_preserved ncmt (path_loc p) hh2 hh3;
assert (V.size_of (phashes hh3 p) ==
1ul + mt_path_length 0ul idx (MT?.j (B.get hh0 ncmt 0)) false);
assert (S.length (lift_path #hsz hh3 mtframe p) ==
S.length (lift_path #hsz hh2 mtframe p) +
MTH.mt_path_length (U32.v idx) (U32.v (MT?.j (B.get hh0 ncmt 0))) false);
assert (modifies (loc_union
(loc_union
(mt_loc ncmt)
(B.loc_all_regions_from false (B.frameOf root)))
(path_loc p))
hh0 hh3);
assert (mt_safe hh3 ncmt);
assert (path_safe hh3 mtframe p);
assert (Rgl?.r_inv (hreg hsz) hh3 root);
assert (V.size_of (phashes hh3 p) ==
1ul + mt_path_length 0ul idx (MT?.j (B.get hh0 ncmt 0)) false);
// correctness
mt_safe_elts_spec hh2 0ul hs i j;
assert (S.equal (lift_path hh3 mtframe p)
(MTH.mt_get_path_ 0 (RV.as_seq hh2 hs) (RV.as_seq hh2 rhs)
(U32.v i) (U32.v j) (U32.v idx)
(lift_path hh2 mtframe p) false));
assert (MTH.mt_get_path
(mt_lift hh0 ncmt) (U32.v idx) (Rgl?.r_repr (hreg hsz) hh0 root) ==
(U32.v (MT?.j (B.get hh3 ncmt 0)),
lift_path hh3 mtframe p,
Rgl?.r_repr (hreg hsz) hh3 root));
j
#pop-options
/// Flushing
private val
mt_flush_to_modifies_rec_helper:
#hsz:hash_size_t ->
lv:uint32_t{lv < merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
h:HS.mem ->
Lemma (loc_union
(loc_union
(RV.rs_loc_elem (hvreg hsz) (V.as_seq h hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
(loc_union
(RV.rv_loc_elems h hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs))) ==
loc_union
(RV.rv_loc_elems h hs lv (V.size_of hs))
(V.loc_vector_within hs lv (V.size_of hs)))
#push-options "--initial_fuel 2 --max_fuel 2"
let mt_flush_to_modifies_rec_helper #hsz lv hs h =
assert (V.loc_vector_within hs lv (V.size_of hs) ==
loc_union (V.loc_vector_within hs lv (lv + 1ul))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)));
RV.rs_loc_elems_rec_inverse (hvreg hsz) (V.as_seq h hs) (U32.v lv) (U32.v (V.size_of hs));
assert (RV.rv_loc_elems h hs lv (V.size_of hs) ==
loc_union (RV.rs_loc_elem (hvreg hsz) (V.as_seq h hs) (U32.v lv))
(RV.rv_loc_elems h hs (lv + 1ul) (V.size_of hs)));
loc_union_assoc_4
(RV.rs_loc_elem (hvreg hsz) (V.as_seq h hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul))
(RV.rv_loc_elems h hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs))
#pop-options
private
val mt_flush_to_:
hsz:hash_size_t ->
lv:uint32_t{lv < merkle_tree_size_lg} ->
hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->
pi:index_t ->
i:index_t{i >= pi} ->
j:Ghost.erased index_t{
Ghost.reveal j >= i &&
U32.v (Ghost.reveal j) < pow2 (32 - U32.v lv)} ->
HST.ST unit
(requires (fun h0 ->
RV.rv_inv h0 hs /\
mt_safe_elts h0 lv hs pi (Ghost.reveal j)))
(ensures (fun h0 _ h1 ->
// memory safety
modifies (loc_union
(RV.rv_loc_elems h0 hs lv (V.size_of hs))
(V.loc_vector_within hs lv (V.size_of hs)))
h0 h1 /\
RV.rv_inv h1 hs /\
mt_safe_elts h1 lv hs i (Ghost.reveal j) /\
// correctness
(mt_safe_elts_spec h0 lv hs pi (Ghost.reveal j);
S.equal (RV.as_seq h1 hs)
(MTH.mt_flush_to_
(U32.v lv) (RV.as_seq h0 hs) (U32.v pi)
(U32.v i) (U32.v (Ghost.reveal j))))))
(decreases (U32.v i))
#restart-solver | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MerkleTree.Spec.fst.checked",
"MerkleTree.New.High.fst.checked",
"MerkleTree.Low.VectorExtras.fst.checked",
"MerkleTree.Low.Hashfunctions.fst.checked",
"MerkleTree.Low.Datastructures.fst.checked",
"LowStar.Vector.fst.checked",
"LowStar.RVector.fst.checked",
"LowStar.Regional.Instances.fst.checked",
"LowStar.Regional.fst.checked",
"LowStar.ConstBuffer.fsti.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Properties.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Monotonic.HyperStack.fsti.checked",
"FStar.Monotonic.HyperHeap.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Integers.fst.checked",
"FStar.Int.Cast.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.All.fst.checked",
"EverCrypt.Helpers.fsti.checked"
],
"interface_file": false,
"source_file": "MerkleTree.Low.fst"
} | [
{
"abbrev": false,
"full_module": "MerkleTree.Low.VectorExtras",
"short_module": null
},
{
"abbrev": false,
"full_module": "MerkleTree.Low.Hashfunctions",
"short_module": null
},
{
"abbrev": false,
"full_module": "MerkleTree.Low.Datastructures",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": true,
"full_module": "MerkleTree.Spec",
"short_module": "MTS"
},
{
"abbrev": true,
"full_module": "MerkleTree.New.High",
"short_module": "MTH"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Regional.Instances",
"short_module": "RVI"
},
{
"abbrev": true,
"full_module": "LowStar.RVector",
"short_module": "RV"
},
{
"abbrev": true,
"full_module": "LowStar.Vector",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "LowStar.ConstBuffer",
"short_module": "CB"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.Monotonic.HyperHeap",
"short_module": "HH"
},
{
"abbrev": true,
"full_module": "FStar.Monotonic.HyperStack",
"short_module": "MHS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "LowStar.Regional.Instances",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.RVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Regional",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Vector",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "MerkleTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "MerkleTree",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 1500,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
hsz: MerkleTree.Low.Datastructures.hash_size_t ->
lv: LowStar.Vector.uint32_t{lv < MerkleTree.Low.merkle_tree_size_lg} ->
hs:
MerkleTree.Low.Datastructures.hash_vv hsz
{LowStar.Vector.size_of hs = MerkleTree.Low.merkle_tree_size_lg} ->
pi: MerkleTree.Low.index_t ->
i: MerkleTree.Low.index_t{i >= pi} ->
j:
FStar.Ghost.erased MerkleTree.Low.index_t
{ FStar.Ghost.reveal j >= i &&
FStar.UInt32.v (FStar.Ghost.reveal j) < Prims.pow2 (32 - FStar.UInt32.v lv) }
-> FStar.HyperStack.ST.ST Prims.unit | FStar.HyperStack.ST.ST | [
""
] | [] | [
"MerkleTree.Low.Datastructures.hash_size_t",
"LowStar.Vector.uint32_t",
"Prims.b2t",
"FStar.Integers.op_Less",
"FStar.Integers.Unsigned",
"FStar.Integers.W32",
"MerkleTree.Low.merkle_tree_size_lg",
"MerkleTree.Low.Datastructures.hash_vv",
"Prims.op_Equality",
"LowStar.Vector.size_of",
"MerkleTree.Low.Datastructures.hash_vec",
"MerkleTree.Low.index_t",
"FStar.Integers.op_Greater_Equals",
"FStar.Ghost.erased",
"Prims.op_AmpAmp",
"FStar.Ghost.reveal",
"FStar.Integers.Signed",
"FStar.Integers.Winfinite",
"FStar.UInt32.v",
"Prims.pow2",
"FStar.Integers.op_Subtraction",
"MerkleTree.Low.mt_safe_elts_spec",
"Prims.unit",
"Prims.bool",
"Prims._assert",
"FStar.Seq.Base.equal",
"LowStar.Regional.__proj__Rgl__item__repr",
"MerkleTree.Low.Datastructures.hvreg",
"LowStar.RVector.as_seq",
"MerkleTree.New.High.mt_flush_to_",
"MerkleTree.New.High.mt_flush_to_rec",
"FStar.Integers.op_Plus",
"FStar.Integers.op_Slash",
"FStar.UInt32.__uint_to_t",
"MerkleTree.Low.mt_safe_elts",
"MerkleTree.Low.mt_safe_elts_constr",
"LowStar.RVector.rv_inv",
"Prims.eq2",
"FStar.UInt32.t",
"MerkleTree.Low.Datastructures.hash",
"LowStar.Vector.get",
"MerkleTree.Low.offset_of",
"LowStar.Vector.get_preserved",
"LowStar.Monotonic.Buffer.loc_union",
"LowStar.RVector.rv_loc_elems",
"LowStar.Vector.loc_vector_within",
"LowStar.Monotonic.Buffer.loc_disjoint",
"LowStar.RVector.rv_loc_elems_included",
"LowStar.Vector.loc_vector_within_included",
"LowStar.Vector.loc_vector_within_disjoint",
"MerkleTree.Low.mt_flush_to_modifies_rec_helper",
"LowStar.Monotonic.Buffer.modifies",
"LowStar.RVector.rs_loc_elem",
"LowStar.Vector.as_seq",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"MerkleTree.Low.mt_flush_to_",
"FStar.Ghost.hide",
"MerkleTree.Low.as_seq_sub_upd",
"MerkleTree.Low.Datastructures.hreg",
"FStar.Seq.Base.append",
"LowStar.RVector.as_seq_sub",
"FStar.Seq.Base.cons",
"LowStar.RVector.as_seq_sub_preserved",
"LowStar.RVector.loc_rvector",
"MerkleTree.Low.mt_safe_elts_preserved",
"LowStar.RVector.rv_loc_elems_preserved",
"LowStar.RVector.assign",
"FStar.Seq.Base.slice",
"FStar.Seq.Base.length",
"LowStar.RVector.elems_reg",
"LowStar.RVector.rv_itself_inv",
"LowStar.RVector.rv_elems_inv",
"LowStar.RVector.rv_elems_inv_preserved",
"LowStar.RVector.rs_loc_elems_parent_disj",
"LowStar.Vector.frameOf",
"LowStar.RVector.rs_loc_elems_elem_disj",
"FStar.Monotonic.HyperHeap.rid",
"LowStar.Regional.__proj__Rgl__item__region_of",
"LowStar.Vector.forall_preserved",
"FStar.Monotonic.HyperHeap.disjoint",
"LowStar.Vector.forall2_forall_right",
"LowStar.Vector.forall2_forall_left",
"LowStar.RVector.rvector",
"MerkleTree.Low.VectorExtras.rv_flush_inplace",
"LowStar.Vector.index",
"FStar.Integers.int_t",
"MerkleTree.Low.mt_safe_elts_rec"
] | [
"recursion"
] | false | true | false | false | false | let rec mt_flush_to_ hsz lv hs pi i j =
| let hh0 = HST.get () in
mt_safe_elts_rec hh0 lv hs pi (Ghost.reveal j);
V.loc_vector_within_included hs 0ul lv;
V.loc_vector_within_included hs lv (lv + 1ul);
V.loc_vector_within_included hs (lv + 1ul) (V.size_of hs);
V.loc_vector_within_disjoint hs lv (lv + 1ul) (lv + 1ul) (V.size_of hs);
let oi = offset_of i in
let opi = offset_of pi in
if oi = opi
then mt_safe_elts_spec hh0 lv hs pi (Ghost.reveal j)
else
let ofs = oi - opi in
let hvec = V.index hs lv in
let flushed:(rvector (hreg hsz)) = rv_flush_inplace hvec ofs in
let hh1 = HST.get () in
V.forall2_forall_left hh0
hs
0ul
(V.size_of hs)
lv
(fun b1 b2 -> HH.disjoint (Rgl?.region_of (hvreg hsz) b1) (Rgl?.region_of (hvreg hsz) b2));
V.forall2_forall_right hh0
hs
0ul
(V.size_of hs)
lv
(fun b1 b2 -> HH.disjoint (Rgl?.region_of (hvreg hsz) b1) (Rgl?.region_of (hvreg hsz) b2));
V.forall_preserved hs
0ul
lv
(fun b -> HH.disjoint (Rgl?.region_of (hvreg hsz) hvec) (Rgl?.region_of (hvreg hsz) b))
(RV.loc_rvector hvec)
hh0
hh1;
V.forall_preserved hs
(lv + 1ul)
(V.size_of hs)
(fun b -> HH.disjoint (Rgl?.region_of (hvreg hsz) hvec) (Rgl?.region_of (hvreg hsz) b))
(RV.loc_rvector hvec)
hh0
hh1;
assert (Rgl?.region_of (hvreg hsz) hvec == Rgl?.region_of (hvreg hsz) flushed);
assert (modifies (RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv)) hh0 hh1);
RV.rv_loc_elems_preserved hs (lv + 1ul) (V.size_of hs) (RV.loc_rvector (V.get hh0 hs lv)) hh0 hh1;
assert (V.size_of flushed == Ghost.reveal j - offset_of i);
mt_safe_elts_preserved (lv + 1ul)
hs
(pi / 2ul)
(Ghost.reveal j / 2ul)
(RV.loc_rvector (V.get hh0 hs lv))
hh0
hh1;
RV.rs_loc_elems_elem_disj (hvreg hsz)
(V.as_seq hh0 hs)
(V.frameOf hs)
0
(U32.v (V.size_of hs))
0
(U32.v lv)
(U32.v lv);
RV.rs_loc_elems_parent_disj (hvreg hsz) (V.as_seq hh0 hs) (V.frameOf hs) 0 (U32.v lv);
RV.rv_elems_inv_preserved hs 0ul lv (RV.loc_rvector (V.get hh0 hs lv)) hh0 hh1;
assert (RV.rv_elems_inv hh1 hs 0ul lv);
RV.rs_loc_elems_elem_disj (hvreg hsz)
(V.as_seq hh0 hs)
(V.frameOf hs)
0
(U32.v (V.size_of hs))
(U32.v lv + 1)
(U32.v (V.size_of hs))
(U32.v lv);
RV.rs_loc_elems_parent_disj (hvreg hsz)
(V.as_seq hh0 hs)
(V.frameOf hs)
(U32.v lv + 1)
(U32.v (V.size_of hs));
RV.rv_elems_inv_preserved hs (lv + 1ul) (V.size_of hs) (RV.loc_rvector (V.get hh0 hs lv)) hh0 hh1;
assert (RV.rv_elems_inv hh1 hs (lv + 1ul) (V.size_of hs));
assert (rv_itself_inv hh1 hs);
assert (elems_reg hh1 hs);
assert (S.equal (RV.as_seq hh1 flushed)
(S.slice (RV.as_seq hh0 (V.get hh0 hs lv))
(U32.v ofs)
(S.length (RV.as_seq hh0 (V.get hh0 hs lv)))));
RV.assign hs lv flushed;
let hh2 = HST.get () in
assert (modifies (V.loc_vector_within hs lv (lv + 1ul)) hh1 hh2);
assert (modifies (loc_union (RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
hh0
hh2);
V.loc_vector_within_disjoint hs lv (lv + 1ul) (lv + 1ul) (V.size_of hs);
RV.rv_loc_elems_preserved hs
(lv + 1ul)
(V.size_of hs)
(V.loc_vector_within hs lv (lv + 1ul))
hh1
hh2;
assert (V.size_of (V.get hh2 hs lv) == Ghost.reveal j - offset_of i);
mt_safe_elts_preserved (lv + 1ul)
hs
(pi / 2ul)
(Ghost.reveal j / 2ul)
(V.loc_vector_within hs lv (lv + 1ul))
hh1
hh2;
RV.as_seq_sub_preserved hs 0ul lv (loc_rvector flushed) hh0 hh1;
RV.as_seq_sub_preserved hs (lv + 1ul) merkle_tree_size_lg (loc_rvector flushed) hh0 hh1;
assert (S.equal (RV.as_seq hh2 hs)
(S.append (RV.as_seq_sub hh0 hs 0ul lv)
(S.cons (RV.as_seq hh1 flushed) (RV.as_seq_sub hh0 hs (lv + 1ul) merkle_tree_size_lg))));
as_seq_sub_upd hh0 hs lv (RV.as_seq hh1 flushed);
assert (lv + 1ul < merkle_tree_size_lg);
assert (U32.v (Ghost.reveal j / 2ul) < pow2 (32 - U32.v (lv + 1ul)));
assert (RV.rv_inv hh2 hs);
assert (mt_safe_elts hh2 (lv + 1ul) hs (pi / 2ul) (Ghost.reveal j / 2ul));
mt_flush_to_ hsz (lv + 1ul) hs (pi / 2ul) (i / 2ul) (Ghost.hide (Ghost.reveal j / 2ul));
let hh3 = HST.get () in
assert (modifies (loc_union (loc_union (RV.rs_loc_elem (hvreg hsz) (V.as_seq hh0 hs) (U32.v lv))
(V.loc_vector_within hs lv (lv + 1ul)))
(loc_union (RV.rv_loc_elems hh0 hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs))))
hh0
hh3);
mt_flush_to_modifies_rec_helper lv hs hh0;
V.loc_vector_within_disjoint hs lv (lv + 1ul) (lv + 1ul) (V.size_of hs);
V.loc_vector_within_included hs lv (lv + 1ul);
RV.rv_loc_elems_included hh2 hs (lv + 1ul) (V.size_of hs);
assert (loc_disjoint (V.loc_vector_within hs lv (lv + 1ul))
(RV.rv_loc_elems hh2 hs (lv + 1ul) (V.size_of hs)));
V.get_preserved hs
lv
(loc_union (RV.rv_loc_elems hh2 hs (lv + 1ul) (V.size_of hs))
(V.loc_vector_within hs (lv + 1ul) (V.size_of hs)))
hh2
hh3;
assert (V.size_of (V.get hh3 hs lv) == Ghost.reveal j - offset_of i);
assert (RV.rv_inv hh3 hs);
mt_safe_elts_constr hh3 lv hs i (Ghost.reveal j);
assert (mt_safe_elts hh3 lv hs i (Ghost.reveal j));
mt_safe_elts_spec hh2 (lv + 1ul) hs (pi / 2ul) (Ghost.reveal j / 2ul);
assert (S.equal (RV.as_seq hh3 hs)
(MTH.mt_flush_to_ (U32.v lv + 1)
(RV.as_seq hh2 hs)
(U32.v pi / 2)
(U32.v i / 2)
(U32.v (Ghost.reveal j) / 2)));
mt_safe_elts_spec hh0 lv hs pi (Ghost.reveal j);
MTH.mt_flush_to_rec (U32.v lv) (RV.as_seq hh0 hs) (U32.v pi) (U32.v i) (U32.v (Ghost.reveal j));
assert (S.equal (RV.as_seq hh3 hs)
(MTH.mt_flush_to_ (U32.v lv)
(RV.as_seq hh0 hs)
(U32.v pi)
(U32.v i)
(U32.v (Ghost.reveal j)))) | false |
FStar.Reflection.Const.fst | FStar.Reflection.Const.umod_qn | val umod_qn : Prims.list Prims.string | let umod_qn = ["FStar" ; "UInt" ; "mod"] | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 43,
"end_line": 77,
"start_col": 0,
"start_line": 77
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Reflection.Const
(* Common lids *)
// TODO: these are awful names
// TODO: _qn vs _lid
let imp_qn = ["Prims"; "l_imp"]
let and_qn = ["Prims"; "l_and"]
let or_qn = ["Prims"; "l_or"]
let not_qn = ["Prims"; "l_not"]
let iff_qn = ["Prims"; "l_iff"]
let eq2_qn = ["Prims"; "eq2"]
let eq1_qn = ["Prims"; "eq"]
let true_qn = ["Prims"; "l_True"]
let false_qn = ["Prims"; "l_False"]
let b2t_qn = ["Prims"; "b2t"]
let forall_qn = ["Prims"; "l_Forall"]
let exists_qn = ["Prims"; "l_Exists"]
let squash_qn = ["Prims"; "squash"]
let prop_qn = ["Prims"; "prop"]
let bool_true_qn = ["Prims"; "true"]
let bool_false_qn = ["Prims"; "false"]
let int_lid = ["Prims"; "int"]
let bool_lid = ["Prims"; "bool"]
let unit_lid = ["Prims"; "unit"]
let string_lid = ["Prims"; "string"]
let add_qn = ["Prims"; "op_Addition"]
let neg_qn = ["Prims"; "op_Minus"]
let minus_qn = ["Prims"; "op_Subtraction"]
let mult_qn = ["Prims"; "op_Multiply"]
let mult'_qn = ["FStar"; "Mul"; "op_Star"]
let div_qn = ["Prims"; "op_Division"]
let lt_qn = ["Prims"; "op_LessThan"]
let lte_qn = ["Prims"; "op_LessThanOrEqual"]
let gt_qn = ["Prims"; "op_GreaterThan"]
let gte_qn = ["Prims"; "op_GreaterThanOrEqual"]
let mod_qn = ["Prims"; "op_Modulus"]
let nil_qn = ["Prims"; "Nil"]
let cons_qn = ["Prims"; "Cons"]
let mktuple2_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple2"]
let mktuple3_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple3"]
let mktuple4_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple4"]
let mktuple5_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple5"]
let mktuple6_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple6"]
let mktuple7_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple7"]
let mktuple8_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple8"]
let land_qn = ["FStar" ; "UInt" ; "logand"]
let lxor_qn = ["FStar" ; "UInt" ; "logxor"]
let lor_qn = ["FStar" ; "UInt" ; "logor"]
let ladd_qn = ["FStar" ; "UInt" ; "add_mod"]
let lsub_qn = ["FStar" ; "UInt" ; "sub_mod"]
let shiftl_qn = ["FStar" ; "UInt" ; "shift_left"]
let shiftr_qn = ["FStar" ; "UInt" ; "shift_right"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list Prims.string | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | false | false | false | true | false | let umod_qn =
| ["FStar"; "UInt"; "mod"] | false |
|
Vale.AES.X64.AESopt.fsti | Vale.AES.X64.AESopt.va_quick_Load_one_lsb | val va_quick_Load_one_lsb (dst: va_operand_xmm) : (va_quickCode unit (va_code_Load_one_lsb dst)) | val va_quick_Load_one_lsb (dst: va_operand_xmm) : (va_quickCode unit (va_code_Load_one_lsb dst)) | let va_quick_Load_one_lsb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_one_lsb dst)) =
(va_QProc (va_code_Load_one_lsb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_one_lsb dst) (va_wpProof_Load_one_lsb dst)) | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 59,
"end_line": 162,
"start_col": 0,
"start_line": 160
} | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let aes_reqs0
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ pclmulqdq_enabled /\ avx_enabled /\
alg = AES_128 /\
//(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
buffer128_as_seq heap0 keys_b == round_keys
let aes_reqs_offset
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ avx_enabled /\ pclmulqdq_enabled /\
(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
s128 heap0 keys_b == round_keys
let six_of (a:Type0) = a & a & a & a & a & a
let quad32_6 = six_of quad32
unfold let make_six_of (#a:Type0) (f:(n:nat{n < 6}) -> GTot a) : GTot (six_of a) =
(f 0, f 1, f 2, f 3, f 4, f 5)
unfold let map_six_of (#a #b:Type0) (x:six_of a) (f:a -> GTot b) : GTot (six_of b) =
let (x0, x1, x2, x3, x4, x5) = x in
(f x0, f x1, f x2, f x3, f x4, f x5)
unfold let map2_six_of (#a #b #c:Type0) (x:six_of a) (y:six_of b) (f:a -> b -> GTot c) : GTot (six_of c) =
let (x0, x1, x2, x3, x4, x5) = x in
let (y0, y1, y2, y3, y4, y5) = y in
(f x0 y0, f x1 y1, f x2 y2, f x3 y3, f x4 y4, f x5 y5)
let rounds_opaque_6 (init:quad32_6) (round_keys:seq quad32) (rnd:nat{rnd < length round_keys}) : GTot quad32_6 =
map_six_of init (fun x -> eval_rounds x round_keys rnd)
let xor_reverse_inc32lite_6 (n i0:int) (ctr_BE rndkey:quad32) : GTot quad32_6 =
make_six_of (fun i ->
let r = reverse_bytes_quad32 (inc32lite ctr_BE (i0 + i)) in
if i < n then quad32_xor r rndkey else r)
//let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
// count * 6 + 6 <= length s /\ (
// let data = slice s (count * 6) (count * 6 + 6) in
// z3 == reverse_bytes_quad32 (index data 5) /\
// scratch_b_blocks true true scratch_b 8 5 heap3 data)
let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
count * 6 + 6 <= length s /\ (
let data = slice s (count * 6) (count * 6 + 6) in
z3 == reverse_bytes_quad32 (index data 5) /\
buffer128_read scratch_b 3 heap3 == reverse_bytes_quad32 (index data 4) /\
buffer128_read scratch_b 4 heap3 == reverse_bytes_quad32 (index data 3) /\
buffer128_read scratch_b 5 heap3 == reverse_bytes_quad32 (index data 2) /\
buffer128_read scratch_b 6 heap3 == reverse_bytes_quad32 (index data 1) /\
buffer128_read scratch_b 7 heap3 == reverse_bytes_quad32 (index data 0))
//-- Load_two_lsb
val va_code_Load_two_lsb : dst:va_operand_xmm -> Tot va_code
val va_codegen_success_Load_two_lsb : dst:va_operand_xmm -> Tot va_pbool
val va_lemma_Load_two_lsb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_two_lsb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@ va_qattr]
let va_wp_Load_two_lsb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 ==> va_k va_sM (())))
val va_wpProof_Load_two_lsb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_two_lsb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_two_lsb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Load_two_lsb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_two_lsb dst)) =
(va_QProc (va_code_Load_two_lsb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_two_lsb dst) (va_wpProof_Load_two_lsb dst))
//--
//-- Load_one_lsb
val va_code_Load_one_lsb : dst:va_operand_xmm -> Tot va_code
val va_codegen_success_Load_one_lsb : dst:va_operand_xmm -> Tot va_pbool
val va_lemma_Load_one_lsb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_one_lsb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@ va_qattr]
let va_wp_Load_one_lsb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 ==> va_k va_sM (())))
val va_wpProof_Load_one_lsb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_one_lsb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_one_lsb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Transformers.Transform.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESGCM_expected_code.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | dst: Vale.X64.Decls.va_operand_xmm
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.AES.X64.AESopt.va_code_Load_one_lsb dst) | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_operand_xmm",
"Vale.X64.QuickCode.va_QProc",
"Prims.unit",
"Vale.AES.X64.AESopt.va_code_Load_one_lsb",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR11",
"Vale.X64.QuickCode.va_mod_xmm",
"Prims.Nil",
"Vale.AES.X64.AESopt.va_wp_Load_one_lsb",
"Vale.AES.X64.AESopt.va_wpProof_Load_one_lsb",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Load_one_lsb (dst: va_operand_xmm) : (va_quickCode unit (va_code_Load_one_lsb dst)) =
| (va_QProc (va_code_Load_one_lsb dst)
([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_one_lsb dst)
(va_wpProof_Load_one_lsb dst)) | false |
Vale.AES.X64.AESopt.fsti | Vale.AES.X64.AESopt.va_wp_Loop6x_final | val va_wp_Loop6x_final
(alg: algorithm)
(iv_b scratch_b: buffer128)
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b: buffer128)
(ctr_orig: quad32)
(init ctrs plain: quad32_6)
(inb: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_Loop6x_final
(alg: algorithm)
(iv_b scratch_b: buffer128)
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b: buffer128)
(ctr_orig: quad32)
(init ctrs plain: quad32_6)
(inb: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_Loop6x_final (alg:algorithm) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (ctr_orig:quad32) (init:quad32_6)
(ctrs:quad32_6) (plain:quad32_6) (inb:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0))
: Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 2 va_s0)
(va_get_reg64 rR8 va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0)
scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\
va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\ aes_reqs_offset alg key_words round_keys keys_b
(va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ init ==
map_six_of #quad32 #quad32 ctrs (fun (c:quad32) -> Vale.Def.Types_s.quad32_xor c
(FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0)) /\ (va_get_xmm 9 va_s0,
va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm
14 va_s0) == rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64
rR13 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 inb) /\ va_get_reg64
rR12 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 inb) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_s0,
va_get_xmm 0 va_s0, va_get_xmm 5 va_s0, va_get_xmm 6 va_s0, va_get_xmm 7 va_s0, va_get_xmm 3
va_s0) == map_six_of #quad32 #quad32 plain (fun (p:quad32) -> Vale.Def.Types_s.quad32_xor rk p)
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) ==
Vale.Def.Types_s.reverse_bytes_quad32 ctr_orig)) /\ (forall (va_x_mem:vale_heap)
(va_x_rdi:nat64) (va_x_rsi:nat64) (va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm5:quad32)
(va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32)
(va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32)
(va_x_xmm15:quad32) (va_x_efl:Vale.X64.Flags.t) (va_x_heap3:vale_heap) . let va_sM =
va_upd_mem_heaplet 3 va_x_heap3 (va_upd_flags va_x_efl (va_upd_xmm 15 va_x_xmm15 (va_upd_xmm 14
va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11
(va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6
va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1
va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR13 va_x_r13 (va_upd_reg64 rR12 va_x_r12
(va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRsi va_x_rsi (va_upd_reg64 rRdi va_x_rdi (va_upd_mem
va_x_mem va_s0))))))))))))))))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 7 7 /\ Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 inb /\ (va_get_xmm 9
va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM,
va_get_xmm 14 va_sM) == map2_six_of #quad32 #quad32 #quad32 plain ctrs (fun (p:quad32)
(c:quad32) -> Vale.Def.Types_s.quad32_xor p (Vale.AES.AES_s.aes_encrypt_LE alg key_words c)) /\
va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_reg64 rRdi va_sM ==
va_get_reg64 rRdi va_s0 + 96 /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96 /\
va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_sM == Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) /\
(let ctr = Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_orig `op_Modulus` 256 in ctr + 6 <
256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM,
va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 0 ctr_orig (va_get_xmm 15
va_sM))) ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 34,
"end_line": 259,
"start_col": 0,
"start_line": 213
} | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let aes_reqs0
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ pclmulqdq_enabled /\ avx_enabled /\
alg = AES_128 /\
//(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
buffer128_as_seq heap0 keys_b == round_keys
let aes_reqs_offset
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ avx_enabled /\ pclmulqdq_enabled /\
(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
s128 heap0 keys_b == round_keys
let six_of (a:Type0) = a & a & a & a & a & a
let quad32_6 = six_of quad32
unfold let make_six_of (#a:Type0) (f:(n:nat{n < 6}) -> GTot a) : GTot (six_of a) =
(f 0, f 1, f 2, f 3, f 4, f 5)
unfold let map_six_of (#a #b:Type0) (x:six_of a) (f:a -> GTot b) : GTot (six_of b) =
let (x0, x1, x2, x3, x4, x5) = x in
(f x0, f x1, f x2, f x3, f x4, f x5)
unfold let map2_six_of (#a #b #c:Type0) (x:six_of a) (y:six_of b) (f:a -> b -> GTot c) : GTot (six_of c) =
let (x0, x1, x2, x3, x4, x5) = x in
let (y0, y1, y2, y3, y4, y5) = y in
(f x0 y0, f x1 y1, f x2 y2, f x3 y3, f x4 y4, f x5 y5)
let rounds_opaque_6 (init:quad32_6) (round_keys:seq quad32) (rnd:nat{rnd < length round_keys}) : GTot quad32_6 =
map_six_of init (fun x -> eval_rounds x round_keys rnd)
let xor_reverse_inc32lite_6 (n i0:int) (ctr_BE rndkey:quad32) : GTot quad32_6 =
make_six_of (fun i ->
let r = reverse_bytes_quad32 (inc32lite ctr_BE (i0 + i)) in
if i < n then quad32_xor r rndkey else r)
//let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
// count * 6 + 6 <= length s /\ (
// let data = slice s (count * 6) (count * 6 + 6) in
// z3 == reverse_bytes_quad32 (index data 5) /\
// scratch_b_blocks true true scratch_b 8 5 heap3 data)
let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
count * 6 + 6 <= length s /\ (
let data = slice s (count * 6) (count * 6 + 6) in
z3 == reverse_bytes_quad32 (index data 5) /\
buffer128_read scratch_b 3 heap3 == reverse_bytes_quad32 (index data 4) /\
buffer128_read scratch_b 4 heap3 == reverse_bytes_quad32 (index data 3) /\
buffer128_read scratch_b 5 heap3 == reverse_bytes_quad32 (index data 2) /\
buffer128_read scratch_b 6 heap3 == reverse_bytes_quad32 (index data 1) /\
buffer128_read scratch_b 7 heap3 == reverse_bytes_quad32 (index data 0))
//-- Load_two_lsb
val va_code_Load_two_lsb : dst:va_operand_xmm -> Tot va_code
val va_codegen_success_Load_two_lsb : dst:va_operand_xmm -> Tot va_pbool
val va_lemma_Load_two_lsb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_two_lsb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@ va_qattr]
let va_wp_Load_two_lsb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 ==> va_k va_sM (())))
val va_wpProof_Load_two_lsb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_two_lsb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_two_lsb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Load_two_lsb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_two_lsb dst)) =
(va_QProc (va_code_Load_two_lsb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_two_lsb dst) (va_wpProof_Load_two_lsb dst))
//--
//-- Load_one_lsb
val va_code_Load_one_lsb : dst:va_operand_xmm -> Tot va_code
val va_codegen_success_Load_one_lsb : dst:va_operand_xmm -> Tot va_pbool
val va_lemma_Load_one_lsb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_one_lsb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@ va_qattr]
let va_wp_Load_one_lsb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 ==> va_k va_sM (())))
val va_wpProof_Load_one_lsb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_one_lsb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_one_lsb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Load_one_lsb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_one_lsb dst)) =
(va_QProc (va_code_Load_one_lsb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_one_lsb dst) (va_wpProof_Load_one_lsb dst))
//--
//-- Loop6x_final
val va_code_Loop6x_final : alg:algorithm -> Tot va_code
val va_codegen_success_Loop6x_final : alg:algorithm -> Tot va_pbool
val va_lemma_Loop6x_final : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> iv_b:buffer128 ->
scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
ctr_orig:quad32 -> init:quad32_6 -> ctrs:quad32_6 -> plain:quad32_6 -> inb:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop6x_final alg) va_s0 /\ va_get_ok va_s0 /\
(sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validDstAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0)
Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\ va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\
aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0
va_s0) (va_get_mem_layout va_s0) /\ init == map_six_of #quad32 #quad32 ctrs (fun (c:quad32) ->
Vale.Def.Types_s.quad32_xor c (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0)) /\
(va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm
13 va_s0, va_get_xmm 14 va_s0) == rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg
- 1) /\ va_get_reg64 rR13 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64
inb) /\ va_get_reg64 rR12 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64
inb) /\ (let rk = FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in
(va_get_xmm 2 va_s0, va_get_xmm 0 va_s0, va_get_xmm 5 va_s0, va_get_xmm 6 va_s0, va_get_xmm 7
va_s0, va_get_xmm 3 va_s0) == map_six_of #quad32 #quad32 plain (fun (p:quad32) ->
Vale.Def.Types_s.quad32_xor rk p) /\ Vale.X64.Decls.buffer128_read scratch_b 8
(va_get_mem_heaplet 3 va_s0) == Vale.Def.Types_s.reverse_bytes_quad32 ctr_orig))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 7 7 /\ Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 inb /\ (va_get_xmm 9
va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM,
va_get_xmm 14 va_sM) == map2_six_of #quad32 #quad32 #quad32 plain ctrs (fun (p:quad32)
(c:quad32) -> Vale.Def.Types_s.quad32_xor p (Vale.AES.AES_s.aes_encrypt_LE alg key_words c)) /\
va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_reg64 rRdi va_sM ==
va_get_reg64 rRdi va_s0 + 96 /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96 /\
va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_sM == Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) /\
(let ctr = Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_orig `op_Modulus` 256 in ctr + 6 <
256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM,
va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 0 ctr_orig (va_get_xmm 15
va_sM))) /\ va_state_eq va_sM (va_update_mem_heaplet 3 va_sM (va_update_flags va_sM
(va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM
(va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 7 va_sM
(va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12
va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Transformers.Transform.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESGCM_expected_code.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
alg: Vale.AES.AES_common_s.algorithm ->
iv_b: Vale.X64.Memory.buffer128 ->
scratch_b: Vale.X64.Memory.buffer128 ->
key_words: FStar.Seq.Base.seq Vale.X64.Memory.nat32 ->
round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
keys_b: Vale.X64.Memory.buffer128 ->
ctr_orig: Vale.X64.Decls.quad32 ->
init: Vale.AES.X64.AESopt.quad32_6 ->
ctrs: Vale.AES.X64.AESopt.quad32_6 ->
plain: Vale.AES.X64.AESopt.quad32_6 ->
inb: Vale.X64.Decls.quad32 ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.AES.AES_common_s.algorithm",
"Vale.X64.Memory.buffer128",
"FStar.Seq.Base.seq",
"Vale.X64.Memory.nat32",
"Vale.X64.Decls.quad32",
"Vale.AES.X64.AESopt.quad32_6",
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.X64.CPU_Features_s.sse_enabled",
"Vale.X64.Decls.validSrcAddrs128",
"Vale.X64.Decls.va_get_mem_heaplet",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rR8",
"Vale.X64.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Public",
"Vale.X64.Decls.validDstAddrs128",
"Vale.X64.Machine_s.rRbp",
"Vale.Arch.HeapTypes_s.Secret",
"Prims.op_LessThan",
"Prims.op_Addition",
"Vale.X64.Machine_s.rRdi",
"Vale.X64.Machine_s.pow2_64",
"Vale.X64.Machine_s.rRsi",
"Vale.AES.X64.AESopt.aes_reqs_offset",
"Vale.X64.Machine_s.rRcx",
"Prims.eq2",
"Vale.AES.X64.AESopt.six_of",
"Vale.AES.X64.AESopt.map_six_of",
"Vale.Def.Types_s.quad32_xor",
"FStar.Seq.Base.index",
"Vale.Def.Types_s.quad32",
"FStar.Pervasives.Native.tuple6",
"FStar.Pervasives.Native.Mktuple6",
"Vale.X64.Decls.va_get_xmm",
"Vale.AES.X64.AESopt.rounds_opaque_6",
"Prims.op_Subtraction",
"Vale.AES.AES_common_s.nr",
"Vale.Def.Types_s.nat64",
"Vale.X64.Machine_s.rR13",
"Vale.Def.Types_s.reverse_bytes_nat64",
"Vale.Arch.Types.hi64",
"Vale.X64.Machine_s.rR12",
"Vale.Arch.Types.lo64",
"Vale.X64.Decls.buffer128_read",
"Vale.Def.Types_s.reverse_bytes_quad32",
"Prims.l_Forall",
"Vale.X64.InsBasic.vale_heap",
"Vale.X64.Memory.nat64",
"Vale.X64.Flags.t",
"Prims.l_imp",
"Vale.X64.Decls.modifies_buffer_specific128",
"Vale.AES.X64.AESopt.map2_six_of",
"Vale.AES.AES_s.aes_encrypt_LE",
"Prims.int",
"Vale.Def.Words_s.four",
"Vale.Def.Types_s.nat32",
"Vale.Def.Words_s.Mkfour",
"Vale.AES.X64.AESopt.xor_reverse_inc32lite_6",
"Prims.op_Modulus",
"Vale.Def.Words_s.__proj__Mkfour__item__lo0",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_mem_heaplet",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_xmm",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Decls.va_upd_mem"
] | [] | false | false | false | true | true | let va_wp_Loop6x_final
(alg: algorithm)
(iv_b scratch_b: buffer128)
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b: buffer128)
(ctr_orig: quad32)
(init ctrs plain: quad32_6)
(inb: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_get_ok va_s0 /\
(sse_enabled /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 2 va_s0)
(va_get_reg64 rR8 va_s0)
iv_b
1
(va_get_mem_layout va_s0)
Public /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0)
(va_get_reg64 rRbp va_s0)
scratch_b
9
(va_get_mem_layout va_s0)
Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\ va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\
aes_reqs_offset alg
key_words
round_keys
keys_b
(va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0)
(va_get_mem_layout va_s0) /\
init ==
map_six_of #quad32
#quad32
ctrs
(fun (c: quad32) ->
Vale.Def.Types_s.quad32_xor c (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0)
) /\
(va_get_xmm 9 va_s0,
va_get_xmm 10 va_s0,
va_get_xmm 11 va_s0,
va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0,
va_get_xmm 14 va_s0) ==
rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg - 1) /\
va_get_reg64 rR13 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 inb) /\
va_get_reg64 rR12 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 inb) /\
(let rk = FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in
(va_get_xmm 2 va_s0,
va_get_xmm 0 va_s0,
va_get_xmm 5 va_s0,
va_get_xmm 6 va_s0,
va_get_xmm 7 va_s0,
va_get_xmm 3 va_s0) ==
map_six_of #quad32 #quad32 plain (fun (p: quad32) -> Vale.Def.Types_s.quad32_xor rk p) /\
Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) ==
Vale.Def.Types_s.reverse_bytes_quad32 ctr_orig)) /\
(forall (va_x_mem: vale_heap) (va_x_rdi: nat64) (va_x_rsi: nat64) (va_x_r11: nat64)
(va_x_r12: nat64) (va_x_r13: nat64) (va_x_xmm0: quad32) (va_x_xmm1: quad32)
(va_x_xmm2: quad32) (va_x_xmm3: quad32) (va_x_xmm5: quad32) (va_x_xmm6: quad32)
(va_x_xmm7: quad32) (va_x_xmm9: quad32) (va_x_xmm10: quad32) (va_x_xmm11: quad32)
(va_x_xmm12: quad32) (va_x_xmm13: quad32) (va_x_xmm14: quad32) (va_x_xmm15: quad32)
(va_x_efl: Vale.X64.Flags.t) (va_x_heap3: vale_heap).
let va_sM =
va_upd_mem_heaplet 3
va_x_heap3
(va_upd_flags va_x_efl
(va_upd_xmm 15
va_x_xmm15
(va_upd_xmm 14
va_x_xmm14
(va_upd_xmm 13
va_x_xmm13
(va_upd_xmm 12
va_x_xmm12
(va_upd_xmm 11
va_x_xmm11
(va_upd_xmm 10
va_x_xmm10
(va_upd_xmm 9
va_x_xmm9
(va_upd_xmm 7
va_x_xmm7
(va_upd_xmm 6
va_x_xmm6
(va_upd_xmm 5
va_x_xmm5
(va_upd_xmm 3
va_x_xmm3
(va_upd_xmm 2
va_x_xmm2
(va_upd_xmm 1
va_x_xmm1
(va_upd_xmm 0
va_x_xmm0
(va_upd_reg64 rR13
va_x_r13
(va_upd_reg64 rR12
va_x_r12
(va_upd_reg64 rR11
va_x_r11
(va_upd_reg64 rRsi
va_x_rsi
(va_upd_reg64 rRdi
va_x_rdi
(va_upd_mem
va_x_mem
va_s0)
))))))))))))))
))))))
in
va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 scratch_b
(va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM)
7
7 /\
Vale.X64.Decls.buffer128_read scratch_b 7 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 inb /\
(va_get_xmm 9 va_sM,
va_get_xmm 10 va_sM,
va_get_xmm 11 va_sM,
va_get_xmm 12 va_sM,
va_get_xmm 13 va_sM,
va_get_xmm 14 va_sM) ==
map2_six_of #quad32
#quad32
#quad32
plain
ctrs
(fun (p: quad32) (c: quad32) ->
Vale.Def.Types_s.quad32_xor p (Vale.AES.AES_s.aes_encrypt_LE alg key_words c)) /\
va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0 /\
va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0 + 96 /\
va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96 /\
va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_sM == Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) /\
(let ctr = (Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_orig) `op_Modulus` 256 in
ctr + 6 < 256 ==>
(va_get_xmm 1 va_sM,
va_get_xmm 0 va_sM,
va_get_xmm 5 va_sM,
va_get_xmm 6 va_sM,
va_get_xmm 7 va_sM,
va_get_xmm 3 va_sM) ==
xor_reverse_inc32lite_6 0 0 ctr_orig (va_get_xmm 15 va_sM))) ==>
va_k va_sM (()))) | false |
Vale.AES.X64.AESopt.fsti | Vale.AES.X64.AESopt.va_quick_Loop6x_save_output | val va_quick_Loop6x_save_output (count: nat) (out_b: buffer128)
: (va_quickCode unit (va_code_Loop6x_save_output ())) | val va_quick_Loop6x_save_output (count: nat) (out_b: buffer128)
: (va_quickCode unit (va_code_Loop6x_save_output ())) | let va_quick_Loop6x_save_output (count:nat) (out_b:buffer128) : (va_quickCode unit
(va_code_Loop6x_save_output ())) =
(va_QProc (va_code_Loop6x_save_output ()) ([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_xmm 14;
va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_mem])
(va_wp_Loop6x_save_output count out_b) (va_wpProof_Loop6x_save_output count out_b)) | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 87,
"end_line": 349,
"start_col": 0,
"start_line": 345
} | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let aes_reqs0
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ pclmulqdq_enabled /\ avx_enabled /\
alg = AES_128 /\
//(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
buffer128_as_seq heap0 keys_b == round_keys
let aes_reqs_offset
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ avx_enabled /\ pclmulqdq_enabled /\
(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
s128 heap0 keys_b == round_keys
let six_of (a:Type0) = a & a & a & a & a & a
let quad32_6 = six_of quad32
unfold let make_six_of (#a:Type0) (f:(n:nat{n < 6}) -> GTot a) : GTot (six_of a) =
(f 0, f 1, f 2, f 3, f 4, f 5)
unfold let map_six_of (#a #b:Type0) (x:six_of a) (f:a -> GTot b) : GTot (six_of b) =
let (x0, x1, x2, x3, x4, x5) = x in
(f x0, f x1, f x2, f x3, f x4, f x5)
unfold let map2_six_of (#a #b #c:Type0) (x:six_of a) (y:six_of b) (f:a -> b -> GTot c) : GTot (six_of c) =
let (x0, x1, x2, x3, x4, x5) = x in
let (y0, y1, y2, y3, y4, y5) = y in
(f x0 y0, f x1 y1, f x2 y2, f x3 y3, f x4 y4, f x5 y5)
let rounds_opaque_6 (init:quad32_6) (round_keys:seq quad32) (rnd:nat{rnd < length round_keys}) : GTot quad32_6 =
map_six_of init (fun x -> eval_rounds x round_keys rnd)
let xor_reverse_inc32lite_6 (n i0:int) (ctr_BE rndkey:quad32) : GTot quad32_6 =
make_six_of (fun i ->
let r = reverse_bytes_quad32 (inc32lite ctr_BE (i0 + i)) in
if i < n then quad32_xor r rndkey else r)
//let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
// count * 6 + 6 <= length s /\ (
// let data = slice s (count * 6) (count * 6 + 6) in
// z3 == reverse_bytes_quad32 (index data 5) /\
// scratch_b_blocks true true scratch_b 8 5 heap3 data)
let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
count * 6 + 6 <= length s /\ (
let data = slice s (count * 6) (count * 6 + 6) in
z3 == reverse_bytes_quad32 (index data 5) /\
buffer128_read scratch_b 3 heap3 == reverse_bytes_quad32 (index data 4) /\
buffer128_read scratch_b 4 heap3 == reverse_bytes_quad32 (index data 3) /\
buffer128_read scratch_b 5 heap3 == reverse_bytes_quad32 (index data 2) /\
buffer128_read scratch_b 6 heap3 == reverse_bytes_quad32 (index data 1) /\
buffer128_read scratch_b 7 heap3 == reverse_bytes_quad32 (index data 0))
//-- Load_two_lsb
val va_code_Load_two_lsb : dst:va_operand_xmm -> Tot va_code
val va_codegen_success_Load_two_lsb : dst:va_operand_xmm -> Tot va_pbool
val va_lemma_Load_two_lsb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_two_lsb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@ va_qattr]
let va_wp_Load_two_lsb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 ==> va_k va_sM (())))
val va_wpProof_Load_two_lsb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_two_lsb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_two_lsb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Load_two_lsb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_two_lsb dst)) =
(va_QProc (va_code_Load_two_lsb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_two_lsb dst) (va_wpProof_Load_two_lsb dst))
//--
//-- Load_one_lsb
val va_code_Load_one_lsb : dst:va_operand_xmm -> Tot va_code
val va_codegen_success_Load_one_lsb : dst:va_operand_xmm -> Tot va_pbool
val va_lemma_Load_one_lsb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_one_lsb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@ va_qattr]
let va_wp_Load_one_lsb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 ==> va_k va_sM (())))
val va_wpProof_Load_one_lsb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_one_lsb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_one_lsb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Load_one_lsb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_one_lsb dst)) =
(va_QProc (va_code_Load_one_lsb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_one_lsb dst) (va_wpProof_Load_one_lsb dst))
//--
//-- Loop6x_final
val va_code_Loop6x_final : alg:algorithm -> Tot va_code
val va_codegen_success_Loop6x_final : alg:algorithm -> Tot va_pbool
val va_lemma_Loop6x_final : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> iv_b:buffer128 ->
scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
ctr_orig:quad32 -> init:quad32_6 -> ctrs:quad32_6 -> plain:quad32_6 -> inb:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop6x_final alg) va_s0 /\ va_get_ok va_s0 /\
(sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validDstAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0)
Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\ va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\
aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0
va_s0) (va_get_mem_layout va_s0) /\ init == map_six_of #quad32 #quad32 ctrs (fun (c:quad32) ->
Vale.Def.Types_s.quad32_xor c (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0)) /\
(va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm
13 va_s0, va_get_xmm 14 va_s0) == rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg
- 1) /\ va_get_reg64 rR13 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64
inb) /\ va_get_reg64 rR12 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64
inb) /\ (let rk = FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in
(va_get_xmm 2 va_s0, va_get_xmm 0 va_s0, va_get_xmm 5 va_s0, va_get_xmm 6 va_s0, va_get_xmm 7
va_s0, va_get_xmm 3 va_s0) == map_six_of #quad32 #quad32 plain (fun (p:quad32) ->
Vale.Def.Types_s.quad32_xor rk p) /\ Vale.X64.Decls.buffer128_read scratch_b 8
(va_get_mem_heaplet 3 va_s0) == Vale.Def.Types_s.reverse_bytes_quad32 ctr_orig))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 7 7 /\ Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 inb /\ (va_get_xmm 9
va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM,
va_get_xmm 14 va_sM) == map2_six_of #quad32 #quad32 #quad32 plain ctrs (fun (p:quad32)
(c:quad32) -> Vale.Def.Types_s.quad32_xor p (Vale.AES.AES_s.aes_encrypt_LE alg key_words c)) /\
va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_reg64 rRdi va_sM ==
va_get_reg64 rRdi va_s0 + 96 /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96 /\
va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_sM == Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) /\
(let ctr = Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_orig `op_Modulus` 256 in ctr + 6 <
256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM,
va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 0 ctr_orig (va_get_xmm 15
va_sM))) /\ va_state_eq va_sM (va_update_mem_heaplet 3 va_sM (va_update_flags va_sM
(va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM
(va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 7 va_sM
(va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12
va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Loop6x_final (alg:algorithm) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (ctr_orig:quad32) (init:quad32_6)
(ctrs:quad32_6) (plain:quad32_6) (inb:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0))
: Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 2 va_s0)
(va_get_reg64 rR8 va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0)
scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\
va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\ aes_reqs_offset alg key_words round_keys keys_b
(va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ init ==
map_six_of #quad32 #quad32 ctrs (fun (c:quad32) -> Vale.Def.Types_s.quad32_xor c
(FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0)) /\ (va_get_xmm 9 va_s0,
va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm
14 va_s0) == rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64
rR13 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 inb) /\ va_get_reg64
rR12 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 inb) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_s0,
va_get_xmm 0 va_s0, va_get_xmm 5 va_s0, va_get_xmm 6 va_s0, va_get_xmm 7 va_s0, va_get_xmm 3
va_s0) == map_six_of #quad32 #quad32 plain (fun (p:quad32) -> Vale.Def.Types_s.quad32_xor rk p)
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) ==
Vale.Def.Types_s.reverse_bytes_quad32 ctr_orig)) /\ (forall (va_x_mem:vale_heap)
(va_x_rdi:nat64) (va_x_rsi:nat64) (va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm5:quad32)
(va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32)
(va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32)
(va_x_xmm15:quad32) (va_x_efl:Vale.X64.Flags.t) (va_x_heap3:vale_heap) . let va_sM =
va_upd_mem_heaplet 3 va_x_heap3 (va_upd_flags va_x_efl (va_upd_xmm 15 va_x_xmm15 (va_upd_xmm 14
va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11
(va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6
va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1
va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR13 va_x_r13 (va_upd_reg64 rR12 va_x_r12
(va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRsi va_x_rsi (va_upd_reg64 rRdi va_x_rdi (va_upd_mem
va_x_mem va_s0))))))))))))))))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 7 7 /\ Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 inb /\ (va_get_xmm 9
va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM,
va_get_xmm 14 va_sM) == map2_six_of #quad32 #quad32 #quad32 plain ctrs (fun (p:quad32)
(c:quad32) -> Vale.Def.Types_s.quad32_xor p (Vale.AES.AES_s.aes_encrypt_LE alg key_words c)) /\
va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_reg64 rRdi va_sM ==
va_get_reg64 rRdi va_s0 + 96 /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96 /\
va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_sM == Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) /\
(let ctr = Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_orig `op_Modulus` 256 in ctr + 6 <
256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM,
va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 0 ctr_orig (va_get_xmm 15
va_sM))) ==> va_k va_sM (())))
val va_wpProof_Loop6x_final : alg:algorithm -> iv_b:buffer128 -> scratch_b:buffer128 ->
key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> ctr_orig:quad32 ->
init:quad32_6 -> ctrs:quad32_6 -> plain:quad32_6 -> inb:quad32 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop6x_final alg iv_b scratch_b key_words round_keys
keys_b ctr_orig init ctrs plain inb va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_final alg) ([va_Mod_mem_heaplet
3; va_Mod_flags; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11;
va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm
2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11;
va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop6x_final (alg:algorithm) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (ctr_orig:quad32) (init:quad32_6)
(ctrs:quad32_6) (plain:quad32_6) (inb:quad32) : (va_quickCode unit (va_code_Loop6x_final alg)) =
(va_QProc (va_code_Loop6x_final alg) ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 15;
va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRsi; va_Mod_reg64
rRdi; va_Mod_mem]) (va_wp_Loop6x_final alg iv_b scratch_b key_words round_keys keys_b ctr_orig
init ctrs plain inb) (va_wpProof_Loop6x_final alg iv_b scratch_b key_words round_keys keys_b
ctr_orig init ctrs plain inb))
//--
//-- Loop6x_save_output
val va_code_Loop6x_save_output : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop6x_save_output : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop6x_save_output : va_b0:va_code -> va_s0:va_state -> count:nat -> out_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop6x_save_output ()) va_s0 /\ va_get_ok va_s0 /\
(avx_enabled /\ sse_enabled /\ Vale.X64.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rRsi va_s0 - 96) out_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0)
Secret)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) (count `op_Multiply` 6 + 0) (count `op_Multiply` 6 + 5) /\
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 6 va_sM) out_b) 0 (6 `op_Multiply` count) == FStar.Seq.Base.slice
#Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 6 va_s0) out_b) 0
(6 `op_Multiply` count) /\ (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0,
va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == make_six_of #quad32 (fun
(i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read out_b (count `op_Multiply` 6 + i)
(va_get_mem_heaplet 6 va_sM)) /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM,
va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == (Vale.Def.Types_s.quad32_xor
(va_get_xmm 1 va_sM) (va_get_xmm 15 va_sM), va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm
6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM)) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_mem_heaplet 6 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm
12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0))))))))))))
[@ va_qattr]
let va_wp_Loop6x_save_output (count:nat) (out_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit
-> Type0)) : Type0 =
(va_get_ok va_s0 /\ (avx_enabled /\ sse_enabled /\ Vale.X64.Decls.validDstAddrsOffset128
(va_get_mem_heaplet 6 va_s0) (va_get_reg64 rRsi va_s0 - 96) out_b (count `op_Multiply` 6) 6
(va_get_mem_layout va_s0) Secret) /\ (forall (va_x_mem:vale_heap) (va_x_xmm9:quad32)
(va_x_xmm10:quad32) (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32)
(va_x_xmm14:quad32) (va_x_heap6:vale_heap) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_mem_heaplet 6 va_x_heap6 (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13
va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10 va_x_xmm10
(va_upd_xmm 9 va_x_xmm9 (va_upd_mem va_x_mem va_s0)))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) (count `op_Multiply` 6 + 0) (count `op_Multiply` 6 + 5) /\
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 6 va_sM) out_b) 0 (6 `op_Multiply` count) == FStar.Seq.Base.slice
#Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 6 va_s0) out_b) 0
(6 `op_Multiply` count) /\ (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0,
va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == make_six_of #quad32 (fun
(i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read out_b (count `op_Multiply` 6 + i)
(va_get_mem_heaplet 6 va_sM)) /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM,
va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == (Vale.Def.Types_s.quad32_xor
(va_get_xmm 1 va_sM) (va_get_xmm 15 va_sM), va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm
6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM)) ==> va_k va_sM (())))
val va_wpProof_Loop6x_save_output : count:nat -> out_b:buffer128 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop6x_save_output count out_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_save_output ()) ([va_Mod_flags;
va_Mod_mem_heaplet 6; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm
10; va_Mod_xmm 9; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Transformers.Transform.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESGCM_expected_code.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | count: Prims.nat -> out_b: Vale.X64.Memory.buffer128
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.AES.X64.AESopt.va_code_Loop6x_save_output ()) | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Vale.X64.Memory.buffer128",
"Vale.X64.QuickCode.va_QProc",
"Prims.unit",
"Vale.AES.X64.AESopt.va_code_Loop6x_save_output",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_mem_heaplet",
"Vale.X64.QuickCode.va_Mod_xmm",
"Vale.X64.QuickCode.va_Mod_mem",
"Prims.Nil",
"Vale.AES.X64.AESopt.va_wp_Loop6x_save_output",
"Vale.AES.X64.AESopt.va_wpProof_Loop6x_save_output",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Loop6x_save_output (count: nat) (out_b: buffer128)
: (va_quickCode unit (va_code_Loop6x_save_output ())) =
| (va_QProc (va_code_Loop6x_save_output ())
([
va_Mod_flags;
va_Mod_mem_heaplet 6;
va_Mod_xmm 14;
va_Mod_xmm 13;
va_Mod_xmm 12;
va_Mod_xmm 11;
va_Mod_xmm 10;
va_Mod_xmm 9;
va_Mod_mem
])
(va_wp_Loop6x_save_output count out_b)
(va_wpProof_Loop6x_save_output count out_b)) | false |
Vale.AES.X64.AESopt.fsti | Vale.AES.X64.AESopt.va_wp_Loop6x_save_output | val va_wp_Loop6x_save_output
(count: nat)
(out_b: buffer128)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_Loop6x_save_output
(count: nat)
(out_b: buffer128)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_Loop6x_save_output (count:nat) (out_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit
-> Type0)) : Type0 =
(va_get_ok va_s0 /\ (avx_enabled /\ sse_enabled /\ Vale.X64.Decls.validDstAddrsOffset128
(va_get_mem_heaplet 6 va_s0) (va_get_reg64 rRsi va_s0 - 96) out_b (count `op_Multiply` 6) 6
(va_get_mem_layout va_s0) Secret) /\ (forall (va_x_mem:vale_heap) (va_x_xmm9:quad32)
(va_x_xmm10:quad32) (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32)
(va_x_xmm14:quad32) (va_x_heap6:vale_heap) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_mem_heaplet 6 va_x_heap6 (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13
va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10 va_x_xmm10
(va_upd_xmm 9 va_x_xmm9 (va_upd_mem va_x_mem va_s0)))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) (count `op_Multiply` 6 + 0) (count `op_Multiply` 6 + 5) /\
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 6 va_sM) out_b) 0 (6 `op_Multiply` count) == FStar.Seq.Base.slice
#Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 6 va_s0) out_b) 0
(6 `op_Multiply` count) /\ (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0,
va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == make_six_of #quad32 (fun
(i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read out_b (count `op_Multiply` 6 + i)
(va_get_mem_heaplet 6 va_sM)) /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM,
va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == (Vale.Def.Types_s.quad32_xor
(va_get_xmm 1 va_sM) (va_get_xmm 15 va_sM), va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm
6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM)) ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 75,
"end_line": 335,
"start_col": 0,
"start_line": 314
} | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let aes_reqs0
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ pclmulqdq_enabled /\ avx_enabled /\
alg = AES_128 /\
//(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
buffer128_as_seq heap0 keys_b == round_keys
let aes_reqs_offset
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ avx_enabled /\ pclmulqdq_enabled /\
(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
s128 heap0 keys_b == round_keys
let six_of (a:Type0) = a & a & a & a & a & a
let quad32_6 = six_of quad32
unfold let make_six_of (#a:Type0) (f:(n:nat{n < 6}) -> GTot a) : GTot (six_of a) =
(f 0, f 1, f 2, f 3, f 4, f 5)
unfold let map_six_of (#a #b:Type0) (x:six_of a) (f:a -> GTot b) : GTot (six_of b) =
let (x0, x1, x2, x3, x4, x5) = x in
(f x0, f x1, f x2, f x3, f x4, f x5)
unfold let map2_six_of (#a #b #c:Type0) (x:six_of a) (y:six_of b) (f:a -> b -> GTot c) : GTot (six_of c) =
let (x0, x1, x2, x3, x4, x5) = x in
let (y0, y1, y2, y3, y4, y5) = y in
(f x0 y0, f x1 y1, f x2 y2, f x3 y3, f x4 y4, f x5 y5)
let rounds_opaque_6 (init:quad32_6) (round_keys:seq quad32) (rnd:nat{rnd < length round_keys}) : GTot quad32_6 =
map_six_of init (fun x -> eval_rounds x round_keys rnd)
let xor_reverse_inc32lite_6 (n i0:int) (ctr_BE rndkey:quad32) : GTot quad32_6 =
make_six_of (fun i ->
let r = reverse_bytes_quad32 (inc32lite ctr_BE (i0 + i)) in
if i < n then quad32_xor r rndkey else r)
//let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
// count * 6 + 6 <= length s /\ (
// let data = slice s (count * 6) (count * 6 + 6) in
// z3 == reverse_bytes_quad32 (index data 5) /\
// scratch_b_blocks true true scratch_b 8 5 heap3 data)
let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
count * 6 + 6 <= length s /\ (
let data = slice s (count * 6) (count * 6 + 6) in
z3 == reverse_bytes_quad32 (index data 5) /\
buffer128_read scratch_b 3 heap3 == reverse_bytes_quad32 (index data 4) /\
buffer128_read scratch_b 4 heap3 == reverse_bytes_quad32 (index data 3) /\
buffer128_read scratch_b 5 heap3 == reverse_bytes_quad32 (index data 2) /\
buffer128_read scratch_b 6 heap3 == reverse_bytes_quad32 (index data 1) /\
buffer128_read scratch_b 7 heap3 == reverse_bytes_quad32 (index data 0))
//-- Load_two_lsb
val va_code_Load_two_lsb : dst:va_operand_xmm -> Tot va_code
val va_codegen_success_Load_two_lsb : dst:va_operand_xmm -> Tot va_pbool
val va_lemma_Load_two_lsb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_two_lsb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@ va_qattr]
let va_wp_Load_two_lsb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 ==> va_k va_sM (())))
val va_wpProof_Load_two_lsb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_two_lsb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_two_lsb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Load_two_lsb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_two_lsb dst)) =
(va_QProc (va_code_Load_two_lsb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_two_lsb dst) (va_wpProof_Load_two_lsb dst))
//--
//-- Load_one_lsb
val va_code_Load_one_lsb : dst:va_operand_xmm -> Tot va_code
val va_codegen_success_Load_one_lsb : dst:va_operand_xmm -> Tot va_pbool
val va_lemma_Load_one_lsb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_one_lsb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@ va_qattr]
let va_wp_Load_one_lsb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 ==> va_k va_sM (())))
val va_wpProof_Load_one_lsb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_one_lsb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_one_lsb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Load_one_lsb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_one_lsb dst)) =
(va_QProc (va_code_Load_one_lsb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_one_lsb dst) (va_wpProof_Load_one_lsb dst))
//--
//-- Loop6x_final
val va_code_Loop6x_final : alg:algorithm -> Tot va_code
val va_codegen_success_Loop6x_final : alg:algorithm -> Tot va_pbool
val va_lemma_Loop6x_final : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> iv_b:buffer128 ->
scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
ctr_orig:quad32 -> init:quad32_6 -> ctrs:quad32_6 -> plain:quad32_6 -> inb:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop6x_final alg) va_s0 /\ va_get_ok va_s0 /\
(sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validDstAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0)
Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\ va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\
aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0
va_s0) (va_get_mem_layout va_s0) /\ init == map_six_of #quad32 #quad32 ctrs (fun (c:quad32) ->
Vale.Def.Types_s.quad32_xor c (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0)) /\
(va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm
13 va_s0, va_get_xmm 14 va_s0) == rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg
- 1) /\ va_get_reg64 rR13 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64
inb) /\ va_get_reg64 rR12 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64
inb) /\ (let rk = FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in
(va_get_xmm 2 va_s0, va_get_xmm 0 va_s0, va_get_xmm 5 va_s0, va_get_xmm 6 va_s0, va_get_xmm 7
va_s0, va_get_xmm 3 va_s0) == map_six_of #quad32 #quad32 plain (fun (p:quad32) ->
Vale.Def.Types_s.quad32_xor rk p) /\ Vale.X64.Decls.buffer128_read scratch_b 8
(va_get_mem_heaplet 3 va_s0) == Vale.Def.Types_s.reverse_bytes_quad32 ctr_orig))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 7 7 /\ Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 inb /\ (va_get_xmm 9
va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM,
va_get_xmm 14 va_sM) == map2_six_of #quad32 #quad32 #quad32 plain ctrs (fun (p:quad32)
(c:quad32) -> Vale.Def.Types_s.quad32_xor p (Vale.AES.AES_s.aes_encrypt_LE alg key_words c)) /\
va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_reg64 rRdi va_sM ==
va_get_reg64 rRdi va_s0 + 96 /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96 /\
va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_sM == Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) /\
(let ctr = Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_orig `op_Modulus` 256 in ctr + 6 <
256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM,
va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 0 ctr_orig (va_get_xmm 15
va_sM))) /\ va_state_eq va_sM (va_update_mem_heaplet 3 va_sM (va_update_flags va_sM
(va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM
(va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 7 va_sM
(va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12
va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Loop6x_final (alg:algorithm) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (ctr_orig:quad32) (init:quad32_6)
(ctrs:quad32_6) (plain:quad32_6) (inb:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0))
: Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 2 va_s0)
(va_get_reg64 rR8 va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0)
scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\
va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\ aes_reqs_offset alg key_words round_keys keys_b
(va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ init ==
map_six_of #quad32 #quad32 ctrs (fun (c:quad32) -> Vale.Def.Types_s.quad32_xor c
(FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0)) /\ (va_get_xmm 9 va_s0,
va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm
14 va_s0) == rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64
rR13 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 inb) /\ va_get_reg64
rR12 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 inb) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_s0,
va_get_xmm 0 va_s0, va_get_xmm 5 va_s0, va_get_xmm 6 va_s0, va_get_xmm 7 va_s0, va_get_xmm 3
va_s0) == map_six_of #quad32 #quad32 plain (fun (p:quad32) -> Vale.Def.Types_s.quad32_xor rk p)
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) ==
Vale.Def.Types_s.reverse_bytes_quad32 ctr_orig)) /\ (forall (va_x_mem:vale_heap)
(va_x_rdi:nat64) (va_x_rsi:nat64) (va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm5:quad32)
(va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32)
(va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32)
(va_x_xmm15:quad32) (va_x_efl:Vale.X64.Flags.t) (va_x_heap3:vale_heap) . let va_sM =
va_upd_mem_heaplet 3 va_x_heap3 (va_upd_flags va_x_efl (va_upd_xmm 15 va_x_xmm15 (va_upd_xmm 14
va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11
(va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6
va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1
va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR13 va_x_r13 (va_upd_reg64 rR12 va_x_r12
(va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRsi va_x_rsi (va_upd_reg64 rRdi va_x_rdi (va_upd_mem
va_x_mem va_s0))))))))))))))))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 7 7 /\ Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 inb /\ (va_get_xmm 9
va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM,
va_get_xmm 14 va_sM) == map2_six_of #quad32 #quad32 #quad32 plain ctrs (fun (p:quad32)
(c:quad32) -> Vale.Def.Types_s.quad32_xor p (Vale.AES.AES_s.aes_encrypt_LE alg key_words c)) /\
va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_reg64 rRdi va_sM ==
va_get_reg64 rRdi va_s0 + 96 /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96 /\
va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_sM == Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) /\
(let ctr = Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_orig `op_Modulus` 256 in ctr + 6 <
256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM,
va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 0 ctr_orig (va_get_xmm 15
va_sM))) ==> va_k va_sM (())))
val va_wpProof_Loop6x_final : alg:algorithm -> iv_b:buffer128 -> scratch_b:buffer128 ->
key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> ctr_orig:quad32 ->
init:quad32_6 -> ctrs:quad32_6 -> plain:quad32_6 -> inb:quad32 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop6x_final alg iv_b scratch_b key_words round_keys
keys_b ctr_orig init ctrs plain inb va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_final alg) ([va_Mod_mem_heaplet
3; va_Mod_flags; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11;
va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm
2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11;
va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop6x_final (alg:algorithm) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (ctr_orig:quad32) (init:quad32_6)
(ctrs:quad32_6) (plain:quad32_6) (inb:quad32) : (va_quickCode unit (va_code_Loop6x_final alg)) =
(va_QProc (va_code_Loop6x_final alg) ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 15;
va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRsi; va_Mod_reg64
rRdi; va_Mod_mem]) (va_wp_Loop6x_final alg iv_b scratch_b key_words round_keys keys_b ctr_orig
init ctrs plain inb) (va_wpProof_Loop6x_final alg iv_b scratch_b key_words round_keys keys_b
ctr_orig init ctrs plain inb))
//--
//-- Loop6x_save_output
val va_code_Loop6x_save_output : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop6x_save_output : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop6x_save_output : va_b0:va_code -> va_s0:va_state -> count:nat -> out_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop6x_save_output ()) va_s0 /\ va_get_ok va_s0 /\
(avx_enabled /\ sse_enabled /\ Vale.X64.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rRsi va_s0 - 96) out_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0)
Secret)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) (count `op_Multiply` 6 + 0) (count `op_Multiply` 6 + 5) /\
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 6 va_sM) out_b) 0 (6 `op_Multiply` count) == FStar.Seq.Base.slice
#Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 6 va_s0) out_b) 0
(6 `op_Multiply` count) /\ (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0,
va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == make_six_of #quad32 (fun
(i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read out_b (count `op_Multiply` 6 + i)
(va_get_mem_heaplet 6 va_sM)) /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM,
va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == (Vale.Def.Types_s.quad32_xor
(va_get_xmm 1 va_sM) (va_get_xmm 15 va_sM), va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm
6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM)) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_mem_heaplet 6 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm
12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0)))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Transformers.Transform.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESGCM_expected_code.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
count: Prims.nat ->
out_b: Vale.X64.Memory.buffer128 ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Vale.X64.Memory.buffer128",
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.X64.CPU_Features_s.avx_enabled",
"Vale.X64.CPU_Features_s.sse_enabled",
"Vale.X64.Decls.validDstAddrsOffset128",
"Vale.X64.Decls.va_get_mem_heaplet",
"Prims.op_Subtraction",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rRsi",
"Prims.op_Multiply",
"Vale.X64.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Secret",
"Prims.l_Forall",
"Vale.X64.InsBasic.vale_heap",
"Vale.X64.Decls.quad32",
"Vale.X64.Flags.t",
"Prims.l_imp",
"Vale.X64.Decls.modifies_buffer_specific128",
"Prims.op_Addition",
"Prims.eq2",
"FStar.Seq.Base.seq",
"FStar.Seq.Base.slice",
"Vale.X64.Decls.buffer128_as_seq",
"FStar.Pervasives.Native.tuple6",
"FStar.Pervasives.Native.Mktuple6",
"Vale.X64.Decls.va_get_xmm",
"Vale.AES.X64.AESopt.make_six_of",
"Vale.X64.Decls.va_int_range",
"Vale.X64.Decls.buffer128_read",
"Vale.Def.Types_s.quad32",
"Vale.Def.Types_s.quad32_xor",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_mem_heaplet",
"Vale.X64.Decls.va_upd_xmm",
"Vale.X64.Decls.va_upd_mem"
] | [] | false | false | false | true | true | let va_wp_Loop6x_save_output
(count: nat)
(out_b: buffer128)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_get_ok va_s0 /\
(avx_enabled /\ sse_enabled /\
Vale.X64.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 6 va_s0)
(va_get_reg64 rRsi va_s0 - 96)
out_b
(count `op_Multiply` 6)
6
(va_get_mem_layout va_s0)
Secret) /\
(forall (va_x_mem: vale_heap)
(va_x_xmm9: quad32)
(va_x_xmm10: quad32)
(va_x_xmm11: quad32)
(va_x_xmm12: quad32)
(va_x_xmm13: quad32)
(va_x_xmm14: quad32)
(va_x_heap6: vale_heap)
(va_x_efl: Vale.X64.Flags.t).
let va_sM =
va_upd_flags va_x_efl
(va_upd_mem_heaplet 6
va_x_heap6
(va_upd_xmm 14
va_x_xmm14
(va_upd_xmm 13
va_x_xmm13
(va_upd_xmm 12
va_x_xmm12
(va_upd_xmm 11
va_x_xmm11
(va_upd_xmm 10
va_x_xmm10
(va_upd_xmm 9 va_x_xmm9 (va_upd_mem va_x_mem va_s0))))))))
in
va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 out_b
(va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM)
(count `op_Multiply` 6 + 0)
(count `op_Multiply` 6 + 5) /\
FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 6 va_sM) out_b)
0
(6 `op_Multiply` count) ==
FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 6 va_s0) out_b)
0
(6 `op_Multiply` count) /\
(va_get_xmm 9 va_s0,
va_get_xmm 10 va_s0,
va_get_xmm 11 va_s0,
va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0,
va_get_xmm 14 va_s0) ==
make_six_of #quad32
(fun (i: (va_int_range 0 5)) ->
Vale.X64.Decls.buffer128_read out_b
(count `op_Multiply` 6 + i)
(va_get_mem_heaplet 6 va_sM)) /\
(va_get_xmm 9 va_sM,
va_get_xmm 10 va_sM,
va_get_xmm 11 va_sM,
va_get_xmm 12 va_sM,
va_get_xmm 13 va_sM,
va_get_xmm 14 va_sM) ==
(Vale.Def.Types_s.quad32_xor (va_get_xmm 1 va_sM) (va_get_xmm 15 va_sM),
va_get_xmm 0 va_sM,
va_get_xmm 5 va_sM,
va_get_xmm 6 va_sM,
va_get_xmm 7 va_sM,
va_get_xmm 3 va_sM)) ==>
va_k va_sM (()))) | false |
RW.fst | RW.flows | val flows : idx -> idx -> Type0 | val flows : idx -> idx -> Type0 | let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 16,
"end_line": 19,
"start_col": 0,
"start_line": 16
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | i1: RW.idx -> i2: RW.idx -> Type0 | Prims.Tot | [
"total"
] | [] | [
"RW.idx",
"FStar.Pervasives.Native.Mktuple2",
"Prims.l_False",
"Prims.l_True"
] | [] | false | false | false | true | true | let flows i1 i2 =
| match i1, i2 with
| RW, RO -> False
| _, _ -> True | false |
RW.fst | RW.ro_post | val ro_post: #a: _ -> post: (H.heap -> st_post a) -> H.heap -> st_post a | val ro_post: #a: _ -> post: (H.heap -> st_post a) -> H.heap -> st_post a | let ro_post #a (post : H.heap -> st_post a) : H.heap -> st_post a =
fun h0 x h1 -> post h0 x h1 /\ h1 == h0 | {
"file_name": "examples/layeredeffects/RW.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 41,
"end_line": 52,
"start_col": 0,
"start_line": 51
} | module RW
#set-options "--print_effect_args"
module H = FStar.Heap
open FStar.Tactics.V2
open FStar.Universe
open FStar.ST
type idx =
| RO
| RW
// cannot make this prop
val flows : idx -> idx -> Type0
let flows i1 i2 =
match i1, i2 with
| RW, RO -> False
| _, _ -> True
// fails later if we use this refinement
//val join : i1:idx -> i2:idx -> r:idx{flows i1 r /\ flows i2 r}
val join : i1:idx -> i2:idx -> idx
let join i1 i2 =
match i1, i2 with
| RO, RO -> RO
| _, _ -> RW
// GM: Force a type equality by SMT
let coerce #a #b (x:a{a == b}) : b = x
// unfold
// let rowp #a (wp : st_wp a) : st_wp a =
// fun p h0 -> wp (fun x h1 -> h0 == h1 ==> p x h1) h0
//
// let st_monotonic #a (wp : st_wp a) : Type =
// forall p1 p2 h0. (forall x h1. p1 x h1 ==> p2 x h1) ==> wp p1 h0 ==> wp p2 h0
//
// let test_ro
// (#wp:_{st_monotonic wp})
// (f : unit -> STATE int (rowp wp))
// : ST int (fun h0 -> wp (fun _ _ -> True) h0) (fun _ _ _ -> True)
// = let h0 = get ()in
// let _ = f () in
// let h1 = get ()in
// assert (h0 == h1);
// 42
// this can be seen as a lifting from RO postconditions to RW postconditions | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.Heap.fst.checked"
],
"interface_file": false,
"source_file": "RW.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Universe",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Heap",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | post: (_: FStar.Monotonic.Heap.heap -> FStar.ST.st_post a) -> _: FStar.Monotonic.Heap.heap
-> FStar.ST.st_post a | Prims.Tot | [
"total"
] | [] | [
"FStar.Monotonic.Heap.heap",
"FStar.ST.st_post",
"Prims.l_True",
"Prims.l_and",
"Prims.eq2"
] | [] | false | false | false | true | false | let ro_post #a (post: (H.heap -> st_post a)) : H.heap -> st_post a =
| fun h0 x h1 -> post h0 x h1 /\ h1 == h0 | false |
Vale.AES.X64.AESopt.fsti | Vale.AES.X64.AESopt.va_quick_Loop6x_partial | val va_quick_Loop6x_partial
(alg: algorithm)
(h_LE y_prev: quad32)
(data: (seq quad32))
(count in0_count: nat)
(iv_b in0_b in_b scratch_b: buffer128)
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(ctr_BE: quad32)
: (va_quickCode quad32_6 (va_code_Loop6x_partial alg)) | val va_quick_Loop6x_partial
(alg: algorithm)
(h_LE y_prev: quad32)
(data: (seq quad32))
(count in0_count: nat)
(iv_b in0_b in_b scratch_b: buffer128)
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(ctr_BE: quad32)
: (va_quickCode quad32_6 (va_code_Loop6x_partial alg)) | let va_quick_Loop6x_partial (alg:algorithm) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(count:nat) (in0_count:nat) (iv_b:buffer128) (in0_b:buffer128) (in_b:buffer128)
(scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128)
(hkeys_b:buffer128) (ctr_BE:quad32) : (va_quickCode quad32_6 (va_code_Loop6x_partial alg)) =
(va_QProc (va_code_Loop6x_partial alg) ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet
2; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10;
va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm
3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64
rR11; va_Mod_reg64 rRbx; va_Mod_mem]) (va_wp_Loop6x_partial alg h_LE y_prev data count
in0_count iv_b in0_b in_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE)
(va_wpProof_Loop6x_partial alg h_LE y_prev data count in0_count iv_b in0_b in_b scratch_b
key_words round_keys keys_b hkeys_b ctr_BE)) | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 48,
"end_line": 646,
"start_col": 0,
"start_line": 635
} | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let aes_reqs0
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ pclmulqdq_enabled /\ avx_enabled /\
alg = AES_128 /\
//(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
buffer128_as_seq heap0 keys_b == round_keys
let aes_reqs_offset
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ avx_enabled /\ pclmulqdq_enabled /\
(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
s128 heap0 keys_b == round_keys
let six_of (a:Type0) = a & a & a & a & a & a
let quad32_6 = six_of quad32
unfold let make_six_of (#a:Type0) (f:(n:nat{n < 6}) -> GTot a) : GTot (six_of a) =
(f 0, f 1, f 2, f 3, f 4, f 5)
unfold let map_six_of (#a #b:Type0) (x:six_of a) (f:a -> GTot b) : GTot (six_of b) =
let (x0, x1, x2, x3, x4, x5) = x in
(f x0, f x1, f x2, f x3, f x4, f x5)
unfold let map2_six_of (#a #b #c:Type0) (x:six_of a) (y:six_of b) (f:a -> b -> GTot c) : GTot (six_of c) =
let (x0, x1, x2, x3, x4, x5) = x in
let (y0, y1, y2, y3, y4, y5) = y in
(f x0 y0, f x1 y1, f x2 y2, f x3 y3, f x4 y4, f x5 y5)
let rounds_opaque_6 (init:quad32_6) (round_keys:seq quad32) (rnd:nat{rnd < length round_keys}) : GTot quad32_6 =
map_six_of init (fun x -> eval_rounds x round_keys rnd)
let xor_reverse_inc32lite_6 (n i0:int) (ctr_BE rndkey:quad32) : GTot quad32_6 =
make_six_of (fun i ->
let r = reverse_bytes_quad32 (inc32lite ctr_BE (i0 + i)) in
if i < n then quad32_xor r rndkey else r)
//let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
// count * 6 + 6 <= length s /\ (
// let data = slice s (count * 6) (count * 6 + 6) in
// z3 == reverse_bytes_quad32 (index data 5) /\
// scratch_b_blocks true true scratch_b 8 5 heap3 data)
let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
count * 6 + 6 <= length s /\ (
let data = slice s (count * 6) (count * 6 + 6) in
z3 == reverse_bytes_quad32 (index data 5) /\
buffer128_read scratch_b 3 heap3 == reverse_bytes_quad32 (index data 4) /\
buffer128_read scratch_b 4 heap3 == reverse_bytes_quad32 (index data 3) /\
buffer128_read scratch_b 5 heap3 == reverse_bytes_quad32 (index data 2) /\
buffer128_read scratch_b 6 heap3 == reverse_bytes_quad32 (index data 1) /\
buffer128_read scratch_b 7 heap3 == reverse_bytes_quad32 (index data 0))
//-- Load_two_lsb
val va_code_Load_two_lsb : dst:va_operand_xmm -> Tot va_code
val va_codegen_success_Load_two_lsb : dst:va_operand_xmm -> Tot va_pbool
val va_lemma_Load_two_lsb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_two_lsb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@ va_qattr]
let va_wp_Load_two_lsb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 ==> va_k va_sM (())))
val va_wpProof_Load_two_lsb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_two_lsb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_two_lsb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Load_two_lsb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_two_lsb dst)) =
(va_QProc (va_code_Load_two_lsb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_two_lsb dst) (va_wpProof_Load_two_lsb dst))
//--
//-- Load_one_lsb
val va_code_Load_one_lsb : dst:va_operand_xmm -> Tot va_code
val va_codegen_success_Load_one_lsb : dst:va_operand_xmm -> Tot va_pbool
val va_lemma_Load_one_lsb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_one_lsb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@ va_qattr]
let va_wp_Load_one_lsb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 ==> va_k va_sM (())))
val va_wpProof_Load_one_lsb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_one_lsb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_one_lsb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Load_one_lsb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_one_lsb dst)) =
(va_QProc (va_code_Load_one_lsb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_one_lsb dst) (va_wpProof_Load_one_lsb dst))
//--
//-- Loop6x_final
val va_code_Loop6x_final : alg:algorithm -> Tot va_code
val va_codegen_success_Loop6x_final : alg:algorithm -> Tot va_pbool
val va_lemma_Loop6x_final : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> iv_b:buffer128 ->
scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
ctr_orig:quad32 -> init:quad32_6 -> ctrs:quad32_6 -> plain:quad32_6 -> inb:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop6x_final alg) va_s0 /\ va_get_ok va_s0 /\
(sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validDstAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0)
Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\ va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\
aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0
va_s0) (va_get_mem_layout va_s0) /\ init == map_six_of #quad32 #quad32 ctrs (fun (c:quad32) ->
Vale.Def.Types_s.quad32_xor c (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0)) /\
(va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm
13 va_s0, va_get_xmm 14 va_s0) == rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg
- 1) /\ va_get_reg64 rR13 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64
inb) /\ va_get_reg64 rR12 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64
inb) /\ (let rk = FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in
(va_get_xmm 2 va_s0, va_get_xmm 0 va_s0, va_get_xmm 5 va_s0, va_get_xmm 6 va_s0, va_get_xmm 7
va_s0, va_get_xmm 3 va_s0) == map_six_of #quad32 #quad32 plain (fun (p:quad32) ->
Vale.Def.Types_s.quad32_xor rk p) /\ Vale.X64.Decls.buffer128_read scratch_b 8
(va_get_mem_heaplet 3 va_s0) == Vale.Def.Types_s.reverse_bytes_quad32 ctr_orig))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 7 7 /\ Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 inb /\ (va_get_xmm 9
va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM,
va_get_xmm 14 va_sM) == map2_six_of #quad32 #quad32 #quad32 plain ctrs (fun (p:quad32)
(c:quad32) -> Vale.Def.Types_s.quad32_xor p (Vale.AES.AES_s.aes_encrypt_LE alg key_words c)) /\
va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_reg64 rRdi va_sM ==
va_get_reg64 rRdi va_s0 + 96 /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96 /\
va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_sM == Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) /\
(let ctr = Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_orig `op_Modulus` 256 in ctr + 6 <
256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM,
va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 0 ctr_orig (va_get_xmm 15
va_sM))) /\ va_state_eq va_sM (va_update_mem_heaplet 3 va_sM (va_update_flags va_sM
(va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM
(va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 7 va_sM
(va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12
va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Loop6x_final (alg:algorithm) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (ctr_orig:quad32) (init:quad32_6)
(ctrs:quad32_6) (plain:quad32_6) (inb:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0))
: Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 2 va_s0)
(va_get_reg64 rR8 va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0)
scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\
va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\ aes_reqs_offset alg key_words round_keys keys_b
(va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ init ==
map_six_of #quad32 #quad32 ctrs (fun (c:quad32) -> Vale.Def.Types_s.quad32_xor c
(FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0)) /\ (va_get_xmm 9 va_s0,
va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm
14 va_s0) == rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64
rR13 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 inb) /\ va_get_reg64
rR12 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 inb) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_s0,
va_get_xmm 0 va_s0, va_get_xmm 5 va_s0, va_get_xmm 6 va_s0, va_get_xmm 7 va_s0, va_get_xmm 3
va_s0) == map_six_of #quad32 #quad32 plain (fun (p:quad32) -> Vale.Def.Types_s.quad32_xor rk p)
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) ==
Vale.Def.Types_s.reverse_bytes_quad32 ctr_orig)) /\ (forall (va_x_mem:vale_heap)
(va_x_rdi:nat64) (va_x_rsi:nat64) (va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm5:quad32)
(va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32)
(va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32)
(va_x_xmm15:quad32) (va_x_efl:Vale.X64.Flags.t) (va_x_heap3:vale_heap) . let va_sM =
va_upd_mem_heaplet 3 va_x_heap3 (va_upd_flags va_x_efl (va_upd_xmm 15 va_x_xmm15 (va_upd_xmm 14
va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11
(va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6
va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1
va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR13 va_x_r13 (va_upd_reg64 rR12 va_x_r12
(va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRsi va_x_rsi (va_upd_reg64 rRdi va_x_rdi (va_upd_mem
va_x_mem va_s0))))))))))))))))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 7 7 /\ Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 inb /\ (va_get_xmm 9
va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM,
va_get_xmm 14 va_sM) == map2_six_of #quad32 #quad32 #quad32 plain ctrs (fun (p:quad32)
(c:quad32) -> Vale.Def.Types_s.quad32_xor p (Vale.AES.AES_s.aes_encrypt_LE alg key_words c)) /\
va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_reg64 rRdi va_sM ==
va_get_reg64 rRdi va_s0 + 96 /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96 /\
va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_sM == Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) /\
(let ctr = Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_orig `op_Modulus` 256 in ctr + 6 <
256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM,
va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 0 ctr_orig (va_get_xmm 15
va_sM))) ==> va_k va_sM (())))
val va_wpProof_Loop6x_final : alg:algorithm -> iv_b:buffer128 -> scratch_b:buffer128 ->
key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> ctr_orig:quad32 ->
init:quad32_6 -> ctrs:quad32_6 -> plain:quad32_6 -> inb:quad32 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop6x_final alg iv_b scratch_b key_words round_keys
keys_b ctr_orig init ctrs plain inb va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_final alg) ([va_Mod_mem_heaplet
3; va_Mod_flags; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11;
va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm
2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11;
va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop6x_final (alg:algorithm) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (ctr_orig:quad32) (init:quad32_6)
(ctrs:quad32_6) (plain:quad32_6) (inb:quad32) : (va_quickCode unit (va_code_Loop6x_final alg)) =
(va_QProc (va_code_Loop6x_final alg) ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 15;
va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRsi; va_Mod_reg64
rRdi; va_Mod_mem]) (va_wp_Loop6x_final alg iv_b scratch_b key_words round_keys keys_b ctr_orig
init ctrs plain inb) (va_wpProof_Loop6x_final alg iv_b scratch_b key_words round_keys keys_b
ctr_orig init ctrs plain inb))
//--
//-- Loop6x_save_output
val va_code_Loop6x_save_output : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop6x_save_output : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop6x_save_output : va_b0:va_code -> va_s0:va_state -> count:nat -> out_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop6x_save_output ()) va_s0 /\ va_get_ok va_s0 /\
(avx_enabled /\ sse_enabled /\ Vale.X64.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rRsi va_s0 - 96) out_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0)
Secret)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) (count `op_Multiply` 6 + 0) (count `op_Multiply` 6 + 5) /\
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 6 va_sM) out_b) 0 (6 `op_Multiply` count) == FStar.Seq.Base.slice
#Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 6 va_s0) out_b) 0
(6 `op_Multiply` count) /\ (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0,
va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == make_six_of #quad32 (fun
(i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read out_b (count `op_Multiply` 6 + i)
(va_get_mem_heaplet 6 va_sM)) /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM,
va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == (Vale.Def.Types_s.quad32_xor
(va_get_xmm 1 va_sM) (va_get_xmm 15 va_sM), va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm
6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM)) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_mem_heaplet 6 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm
12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0))))))))))))
[@ va_qattr]
let va_wp_Loop6x_save_output (count:nat) (out_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit
-> Type0)) : Type0 =
(va_get_ok va_s0 /\ (avx_enabled /\ sse_enabled /\ Vale.X64.Decls.validDstAddrsOffset128
(va_get_mem_heaplet 6 va_s0) (va_get_reg64 rRsi va_s0 - 96) out_b (count `op_Multiply` 6) 6
(va_get_mem_layout va_s0) Secret) /\ (forall (va_x_mem:vale_heap) (va_x_xmm9:quad32)
(va_x_xmm10:quad32) (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32)
(va_x_xmm14:quad32) (va_x_heap6:vale_heap) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_mem_heaplet 6 va_x_heap6 (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13
va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10 va_x_xmm10
(va_upd_xmm 9 va_x_xmm9 (va_upd_mem va_x_mem va_s0)))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) (count `op_Multiply` 6 + 0) (count `op_Multiply` 6 + 5) /\
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 6 va_sM) out_b) 0 (6 `op_Multiply` count) == FStar.Seq.Base.slice
#Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 6 va_s0) out_b) 0
(6 `op_Multiply` count) /\ (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0,
va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == make_six_of #quad32 (fun
(i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read out_b (count `op_Multiply` 6 + i)
(va_get_mem_heaplet 6 va_sM)) /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM,
va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == (Vale.Def.Types_s.quad32_xor
(va_get_xmm 1 va_sM) (va_get_xmm 15 va_sM), va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm
6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM)) ==> va_k va_sM (())))
val va_wpProof_Loop6x_save_output : count:nat -> out_b:buffer128 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop6x_save_output count out_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_save_output ()) ([va_Mod_flags;
va_Mod_mem_heaplet 6; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm
10; va_Mod_xmm 9; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop6x_save_output (count:nat) (out_b:buffer128) : (va_quickCode unit
(va_code_Loop6x_save_output ())) =
(va_QProc (va_code_Loop6x_save_output ()) ([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_xmm 14;
va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_mem])
(va_wp_Loop6x_save_output count out_b) (va_wpProof_Loop6x_save_output count out_b))
//--
//-- Loop6x_partial
val va_code_untransformedoriginal_Loop6x_partial : alg:algorithm -> Tot va_code
val va_codegen_success_untransformedoriginal_Loop6x_partial : alg:algorithm -> Tot va_pbool
val va_lemma_untransformedoriginal_Loop6x_partial : va_b0:va_code -> va_s0:va_state ->
alg:algorithm -> h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32) -> count:nat -> in0_count:nat
-> iv_b:buffer128 -> in0_b:buffer128 -> in_b:buffer128 -> scratch_b:buffer128 -> key_words:(seq
nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE:quad32
-> Ghost (va_state & va_fuel & quad32_6)
(requires (va_require_total va_b0 (va_code_untransformedoriginal_Loop6x_partial alg) va_s0 /\
va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in sse_enabled
/\ movbe_enabled /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0
16777216 /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 6 va_s0) (va_get_reg64 rR14 va_s0) in0_b (in0_count `op_Multiply` 6) 6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp
va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64
/\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 15 va_s0 ==
FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx
va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9
va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256
==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15
va_s0)) /\ FStar.Seq.Base.length #quad32 data == 6 /\ hkeys_b_powers hkeys_b
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\
scratch_b_data true true scratch_b 8 5 (va_get_mem_heaplet 3 va_s0) (va_get_mem_layout va_s0)
(va_get_reg64 rRbp va_s0) data /\ va_get_xmm 7 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data 5) /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_s0))) == prev)))
(ensures (fun (va_sM, va_fM, init) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in
Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 1 8 /\ Vale.X64.Decls.modifies_buffer_specific128 iv_b
(va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) 0 0 /\ (0 <= va_get_reg64 rRbx va_sM
/\ va_get_reg64 rRbx va_sM < 256) /\ va_get_reg64 rRbx va_sM ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256
/\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM,
va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys
(Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64 rR13 va_sM ==
Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ va_get_reg64 rR12 va_sM ==
Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_sM,
va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3
va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor rk
(Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)))
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\
Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 5) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 3
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 4) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 4 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 3) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 5
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 2) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 6 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 1) (va_get_mem_heaplet 6 va_s0)) /\ init == make_six_of #quad32 (fun
(n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE n)) (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys
0)) /\ (let eventual_Xi = add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_sM)))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)) in
eventual_Xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data))))) /\ va_state_eq va_sM (va_update_flags
va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM (va_update_xmm 15 va_sM
(va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM
(va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM
(va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM
(va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13
va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))))
val va_transform_Loop6x_partial : alg:algorithm -> Tot va_transformation_result
val va_code_Loop6x_partial : alg:algorithm -> Tot va_code
val va_codegen_success_Loop6x_partial : alg:algorithm -> Tot va_pbool
val va_lemma_Loop6x_partial : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> h_LE:quad32 ->
y_prev:quad32 -> data:(seq quad32) -> count:nat -> in0_count:nat -> iv_b:buffer128 ->
in0_b:buffer128 -> in_b:buffer128 -> scratch_b:buffer128 -> key_words:(seq nat32) ->
round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE:quad32
-> Ghost (va_state & va_fuel & quad32_6)
(requires (va_require_total va_b0 (va_code_Loop6x_partial alg) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in sse_enabled
/\ movbe_enabled /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0
16777216 /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 6 va_s0) (va_get_reg64 rR14 va_s0) in0_b (in0_count `op_Multiply` 6) 6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp
va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64
/\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 15 va_s0 ==
FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx
va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9
va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256
==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15
va_s0)) /\ FStar.Seq.Base.length #quad32 data == 6 /\ hkeys_b_powers hkeys_b
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\
scratch_b_data true true scratch_b 8 5 (va_get_mem_heaplet 3 va_s0) (va_get_mem_layout va_s0)
(va_get_reg64 rRbp va_s0) data /\ va_get_xmm 7 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data 5) /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_s0))) == prev)))
(ensures (fun (va_sM, va_fM, init) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in
Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 1 8 /\ Vale.X64.Decls.modifies_buffer_specific128 iv_b
(va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) 0 0 /\ (0 <= va_get_reg64 rRbx va_sM
/\ va_get_reg64 rRbx va_sM < 256) /\ va_get_reg64 rRbx va_sM ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256
/\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM,
va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys
(Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64 rR13 va_sM ==
Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ va_get_reg64 rR12 va_sM ==
Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_sM,
va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3
va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor rk
(Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)))
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\
Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 5) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 3
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 4) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 4 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 3) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 5
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 2) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 6 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 1) (va_get_mem_heaplet 6 va_s0)) /\ init == make_six_of #quad32 (fun
(n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE n)) (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys
0)) /\ (let eventual_Xi = add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_sM)))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)) in
eventual_Xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data))))) /\ va_state_eq va_sM (va_update_flags
va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM (va_update_xmm 15 va_sM
(va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM
(va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM
(va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM
(va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13
va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Loop6x_partial (alg:algorithm) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(count:nat) (in0_count:nat) (iv_b:buffer128) (in0_b:buffer128) (in_b:buffer128)
(scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128)
(hkeys_b:buffer128) (ctr_BE:quad32) (va_s0:va_state) (va_k:(va_state -> quad32_6 -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in sse_enabled
/\ movbe_enabled /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0
16777216 /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 6 va_s0) (va_get_reg64 rR14 va_s0) in0_b (in0_count `op_Multiply` 6) 6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp
va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64
/\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 15 va_s0 ==
FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx
va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9
va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256
==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15
va_s0)) /\ FStar.Seq.Base.length #quad32 data == 6 /\ hkeys_b_powers hkeys_b
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\
scratch_b_data true true scratch_b 8 5 (va_get_mem_heaplet 3 va_s0) (va_get_mem_layout va_s0)
(va_get_reg64 rRbp va_s0) data /\ va_get_xmm 7 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data 5) /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_s0))) == prev) /\ (forall (va_x_mem:vale_heap) (va_x_rbx:nat64)
(va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32)
(va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32)
(va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32)
(va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32)
(va_x_xmm15:quad32) (va_x_heap2:vale_heap) (va_x_heap3:vale_heap) (va_x_efl:Vale.X64.Flags.t)
(init:quad32_6) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 3 va_x_heap3
(va_upd_mem_heaplet 2 va_x_heap2 (va_upd_xmm 15 va_x_xmm15 (va_upd_xmm 14 va_x_xmm14
(va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10
va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm
6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm
2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR13 va_x_r13
(va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRbx va_x_rbx (va_upd_mem
va_x_mem va_s0))))))))))))))))))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in Vale.X64.Decls.modifies_buffer_specific128
scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 1 8 /\
Vale.X64.Decls.modifies_buffer_specific128 iv_b (va_get_mem_heaplet 2 va_s0)
(va_get_mem_heaplet 2 va_sM) 0 0 /\ (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM <
256) /\ va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0
(Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256 /\ (va_get_xmm 9 va_sM, va_get_xmm 10
va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) ==
rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64 rR13 va_sM
== Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 (Vale.X64.Decls.buffer128_read
in0_b (in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ va_get_reg64 rR12 va_sM
== Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 (Vale.X64.Decls.buffer128_read
in0_b (in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_sM,
va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3
va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor rk
(Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)))
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\
Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 5) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 3
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 4) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 4 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 3) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 5
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 2) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 6 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 1) (va_get_mem_heaplet 6 va_s0)) /\ init == make_six_of #quad32 (fun
(n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE n)) (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys
0)) /\ (let eventual_Xi = add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_sM)))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)) in
eventual_Xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data))))) ==> va_k va_sM ((init))))
val va_wpProof_Loop6x_partial : alg:algorithm -> h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32)
-> count:nat -> in0_count:nat -> iv_b:buffer128 -> in0_b:buffer128 -> in_b:buffer128 ->
scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128 -> ctr_BE:quad32 -> va_s0:va_state -> va_k:(va_state -> quad32_6 -> Type0)
-> Ghost (va_state & va_fuel & quad32_6)
(requires (va_t_require va_s0 /\ va_wp_Loop6x_partial alg h_LE y_prev data count in0_count iv_b
in0_b in_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_partial alg) ([va_Mod_flags;
va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13;
va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_mem])
va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Transformers.Transform.fsti.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.TypesNative.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.PolyOps.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESGCM_expected_code.fsti.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_helpers.fsti.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.AES.X64.AESopt.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Transformers.Transform",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM_expected_code",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.PolyOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.TypesNative",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
alg: Vale.AES.AES_common_s.algorithm ->
h_LE: Vale.X64.Decls.quad32 ->
y_prev: Vale.X64.Decls.quad32 ->
data: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
count: Prims.nat ->
in0_count: Prims.nat ->
iv_b: Vale.X64.Memory.buffer128 ->
in0_b: Vale.X64.Memory.buffer128 ->
in_b: Vale.X64.Memory.buffer128 ->
scratch_b: Vale.X64.Memory.buffer128 ->
key_words: FStar.Seq.Base.seq Vale.X64.Memory.nat32 ->
round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
keys_b: Vale.X64.Memory.buffer128 ->
hkeys_b: Vale.X64.Memory.buffer128 ->
ctr_BE: Vale.X64.Decls.quad32
-> Vale.X64.QuickCode.va_quickCode Vale.AES.X64.AESopt.quad32_6
(Vale.AES.X64.AESopt.va_code_Loop6x_partial alg) | Prims.Tot | [
"total"
] | [] | [
"Vale.AES.AES_common_s.algorithm",
"Vale.X64.Decls.quad32",
"FStar.Seq.Base.seq",
"Prims.nat",
"Vale.X64.Memory.buffer128",
"Vale.X64.Memory.nat32",
"Vale.X64.QuickCode.va_QProc",
"Vale.AES.X64.AESopt.quad32_6",
"Vale.AES.X64.AESopt.va_code_Loop6x_partial",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_mem_heaplet",
"Vale.X64.QuickCode.va_Mod_xmm",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR13",
"Vale.X64.Machine_s.rR12",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.QuickCode.va_Mod_mem",
"Prims.Nil",
"Vale.AES.X64.AESopt.va_wp_Loop6x_partial",
"Vale.AES.X64.AESopt.va_wpProof_Loop6x_partial",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Loop6x_partial
(alg: algorithm)
(h_LE y_prev: quad32)
(data: (seq quad32))
(count in0_count: nat)
(iv_b in0_b in_b scratch_b: buffer128)
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(ctr_BE: quad32)
: (va_quickCode quad32_6 (va_code_Loop6x_partial alg)) =
| (va_QProc (va_code_Loop6x_partial alg)
([
va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_xmm 15; va_Mod_xmm 14;
va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2;
va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11;
va_Mod_reg64 rRbx; va_Mod_mem
])
(va_wp_Loop6x_partial alg h_LE y_prev data count in0_count iv_b in0_b in_b scratch_b key_words
round_keys keys_b hkeys_b ctr_BE)
(va_wpProof_Loop6x_partial alg h_LE y_prev data count in0_count iv_b in0_b in_b scratch_b
key_words round_keys keys_b hkeys_b ctr_BE)) | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.