effect
stringclasses 48
values | original_source_type
stringlengths 0
23k
| opens_and_abbrevs
listlengths 2
92
| isa_cross_project_example
bool 1
class | source_definition
stringlengths 9
57.9k
| partial_definition
stringlengths 7
23.3k
| is_div
bool 2
classes | is_type
null | is_proof
bool 2
classes | completed_definiton
stringlengths 1
250k
| dependencies
dict | effect_flags
sequencelengths 0
2
| ideal_premises
sequencelengths 0
236
| mutual_with
sequencelengths 0
11
| file_context
stringlengths 0
407k
| interleaved
bool 1
class | is_simply_typed
bool 2
classes | file_name
stringlengths 5
48
| vconfig
dict | is_simple_lemma
null | source_type
stringlengths 10
23k
| proof_features
sequencelengths 0
1
| name
stringlengths 8
95
| source
dict | verbose_type
stringlengths 1
7.42k
| source_range
dict |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
FStar.HyperStack.ST.Stack | val rounds:
#w:lanes
-> st:state w ->
Stack unit
(requires (fun h -> live h st))
(ensures (fun h0 _ h1 -> modifies (loc st) h0 h1 /\
as_seq h1 st == Spec.rounds (as_seq h0 st))) | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loop"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Equiv",
"short_module": "Chacha20Equiv"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Vec",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20.Core32xN",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rounds #w st =
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st | val rounds:
#w:lanes
-> st:state w ->
Stack unit
(requires (fun h -> live h st))
(ensures (fun h0 _ h1 -> modifies (loc st) h0 h1 /\
as_seq h1 st == Spec.rounds (as_seq h0 st)))
let rounds #w st = | true | null | false | double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st | {
"checked_file": "Hacl.Impl.Chacha20.Vec.fst.checked",
"dependencies": [
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntVector.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"Hacl.Spec.Chacha20.Equiv.fst.checked",
"Hacl.Impl.Chacha20.Core32xN.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Chacha20.Vec.fst"
} | [] | [
"Hacl.Impl.Chacha20.Core32xN.lanes",
"Hacl.Impl.Chacha20.Core32xN.state",
"Hacl.Impl.Chacha20.Core32xN.double_round",
"Prims.unit"
] | [] | module Hacl.Impl.Chacha20.Vec
module ST = FStar.HyperStack.ST
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.IntVector
open Hacl.Impl.Chacha20.Core32xN
module Spec = Hacl.Spec.Chacha20.Vec
module Chacha20Equiv = Hacl.Spec.Chacha20.Equiv
module Loop = Lib.LoopCombinators
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 200 --record_options"
//#set-options "--debug Hacl.Impl.Chacha20.Vec --debug_level ExtractNorm"
noextract
val rounds:
#w:lanes
-> st:state w ->
Stack unit
(requires (fun h -> live h st))
(ensures (fun h0 _ h1 -> modifies (loc st) h0 h1 /\
as_seq h1 st == Spec.rounds (as_seq h0 st)))
[@ Meta.Attribute.inline_ ] | false | false | Hacl.Impl.Chacha20.Vec.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val rounds:
#w:lanes
-> st:state w ->
Stack unit
(requires (fun h -> live h st))
(ensures (fun h0 _ h1 -> modifies (loc st) h0 h1 /\
as_seq h1 st == Spec.rounds (as_seq h0 st))) | [] | Hacl.Impl.Chacha20.Vec.rounds | {
"file_name": "code/chacha20/Hacl.Impl.Chacha20.Vec.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | st: Hacl.Impl.Chacha20.Core32xN.state w -> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 17,
"end_line": 41,
"start_col": 2,
"start_line": 32
} |
FStar.HyperStack.ST.Stack | val setup1:
ctx:lbuffer uint32 16ul
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (u32 0)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.setup1 (as_seq h0 k) (as_seq h0 n) (v ctr0))) | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loop"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Equiv",
"short_module": "Chacha20Equiv"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Vec",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20.Core32xN",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let setup1 ctx k n ctr =
let h0 = ST.get() in
recall_contents chacha20_constants Spec.chacha20_constants;
update_sub_f h0 ctx 0ul 4ul
(fun h -> Lib.Sequence.map secret Spec.chacha20_constants)
(fun _ -> mapT 4ul (sub ctx 0ul 4ul) secret chacha20_constants);
let h1 = ST.get() in
update_sub_f h1 ctx 4ul 8ul
(fun h -> Lib.ByteSequence.uints_from_bytes_le (as_seq h k))
(fun _ -> uints_from_bytes_le (sub ctx 4ul 8ul) k);
let h2 = ST.get() in
ctx.(12ul) <- size_to_uint32 ctr;
let h3 = ST.get() in
update_sub_f h3 ctx 13ul 3ul
(fun h -> Lib.ByteSequence.uints_from_bytes_le (as_seq h n))
(fun _ -> uints_from_bytes_le (sub ctx 13ul 3ul) n) | val setup1:
ctx:lbuffer uint32 16ul
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (u32 0)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.setup1 (as_seq h0 k) (as_seq h0 n) (v ctr0)))
let setup1 ctx k n ctr = | true | null | false | let h0 = ST.get () in
recall_contents chacha20_constants Spec.chacha20_constants;
update_sub_f h0
ctx
0ul
4ul
(fun h -> Lib.Sequence.map secret Spec.chacha20_constants)
(fun _ -> mapT 4ul (sub ctx 0ul 4ul) secret chacha20_constants);
let h1 = ST.get () in
update_sub_f h1
ctx
4ul
8ul
(fun h -> Lib.ByteSequence.uints_from_bytes_le (as_seq h k))
(fun _ -> uints_from_bytes_le (sub ctx 4ul 8ul) k);
let h2 = ST.get () in
ctx.(12ul) <- size_to_uint32 ctr;
let h3 = ST.get () in
update_sub_f h3
ctx
13ul
3ul
(fun h -> Lib.ByteSequence.uints_from_bytes_le (as_seq h n))
(fun _ -> uints_from_bytes_le (sub ctx 13ul 3ul) n) | {
"checked_file": "Hacl.Impl.Chacha20.Vec.fst.checked",
"dependencies": [
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntVector.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"Hacl.Spec.Chacha20.Equiv.fst.checked",
"Hacl.Impl.Chacha20.Core32xN.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Chacha20.Vec.fst"
} | [] | [
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint32",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.uint8",
"Lib.IntTypes.size_t",
"Lib.Buffer.update_sub_f",
"FStar.Monotonic.HyperStack.mem",
"Lib.ByteSequence.uints_from_bytes_le",
"Lib.IntTypes.U32",
"Lib.IntTypes.SEC",
"Lib.IntTypes.v",
"Lib.IntTypes.PUB",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"Lib.Sequence.lseq",
"Prims.unit",
"Lib.ByteBuffer.uints_from_bytes_le",
"Lib.Buffer.lbuffer_t",
"Lib.IntTypes.int_t",
"FStar.UInt32.uint_to_t",
"Lib.Buffer.sub",
"FStar.HyperStack.ST.get",
"Lib.Buffer.op_Array_Assignment",
"Lib.IntTypes.size_to_uint32",
"Lib.Sequence.map",
"Lib.IntTypes.secret",
"Hacl.Spec.Chacha20.Vec.chacha20_constants",
"Lib.Buffer.mapT",
"Lib.Buffer.CONST",
"Hacl.Impl.Chacha20.Vec.chacha20_constants",
"FStar.UInt32.t",
"Lib.Buffer.recall_contents"
] | [] | module Hacl.Impl.Chacha20.Vec
module ST = FStar.HyperStack.ST
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.IntVector
open Hacl.Impl.Chacha20.Core32xN
module Spec = Hacl.Spec.Chacha20.Vec
module Chacha20Equiv = Hacl.Spec.Chacha20.Equiv
module Loop = Lib.LoopCombinators
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 200 --record_options"
//#set-options "--debug Hacl.Impl.Chacha20.Vec --debug_level ExtractNorm"
noextract
val rounds:
#w:lanes
-> st:state w ->
Stack unit
(requires (fun h -> live h st))
(ensures (fun h0 _ h1 -> modifies (loc st) h0 h1 /\
as_seq h1 st == Spec.rounds (as_seq h0 st)))
[@ Meta.Attribute.inline_ ]
let rounds #w st =
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st
noextract
val chacha20_core:
#w:lanes
-> k:state w
-> ctx0:state w
-> ctr:size_t{w * v ctr <= max_size_t} ->
Stack unit
(requires (fun h -> live h ctx0 /\ live h k /\ disjoint ctx0 k))
(ensures (fun h0 _ h1 -> modifies (loc k) h0 h1 /\
as_seq h1 k == Spec.chacha20_core (v ctr) (as_seq h0 ctx0)))
[@ Meta.Attribute.specialize ]
let chacha20_core #w k ctx ctr =
copy_state k ctx;
let ctr_u32 = u32 w *! size_to_uint32 ctr in
let cv = vec_load ctr_u32 w in
k.(12ul) <- k.(12ul) +| cv;
rounds k;
sum_state k ctx;
k.(12ul) <- k.(12ul) +| cv
val chacha20_constants:
b:glbuffer size_t 4ul{recallable b /\ witnessed b Spec.Chacha20.chacha20_constants}
let chacha20_constants =
[@ inline_let]
let l = [Spec.c0;Spec.c1;Spec.c2;Spec.c3] in
assert_norm(List.Tot.length l == 4);
createL_global l
inline_for_extraction noextract
val setup1:
ctx:lbuffer uint32 16ul
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (u32 0)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\ | false | false | Hacl.Impl.Chacha20.Vec.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val setup1:
ctx:lbuffer uint32 16ul
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (u32 0)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.setup1 (as_seq h0 k) (as_seq h0 n) (v ctr0))) | [] | Hacl.Impl.Chacha20.Vec.setup1 | {
"file_name": "code/chacha20/Hacl.Impl.Chacha20.Vec.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
ctx: Lib.Buffer.lbuffer Lib.IntTypes.uint32 16ul ->
k: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul ->
n: Lib.Buffer.lbuffer Lib.IntTypes.uint8 12ul ->
ctr0: Lib.IntTypes.size_t
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 55,
"end_line": 101,
"start_col": 24,
"start_line": 86
} |
FStar.HyperStack.ST.Stack | val chacha20_init:
#w:lanes
-> ctx:state w
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (vec_zero U32 w)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.chacha20_init (as_seq h0 k) (as_seq h0 n) (v ctr0))) | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loop"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Equiv",
"short_module": "Chacha20Equiv"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Vec",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20.Core32xN",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let chacha20_init #w ctx k n ctr =
push_frame();
let ctx1 = create 16ul (u32 0) in
setup1 ctx1 k n ctr;
let h0 = ST.get() in
mapT 16ul ctx (Spec.vec_load_i w) ctx1;
let ctr = vec_counter U32 w in
let c12 = ctx.(12ul) in
ctx.(12ul) <- c12 +| ctr;
pop_frame() | val chacha20_init:
#w:lanes
-> ctx:state w
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (vec_zero U32 w)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.chacha20_init (as_seq h0 k) (as_seq h0 n) (v ctr0)))
let chacha20_init #w ctx k n ctr = | true | null | false | push_frame ();
let ctx1 = create 16ul (u32 0) in
setup1 ctx1 k n ctr;
let h0 = ST.get () in
mapT 16ul ctx (Spec.vec_load_i w) ctx1;
let ctr = vec_counter U32 w in
let c12 = ctx.(12ul) in
ctx.(12ul) <- c12 +| ctr;
pop_frame () | {
"checked_file": "Hacl.Impl.Chacha20.Vec.fst.checked",
"dependencies": [
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntVector.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"Hacl.Spec.Chacha20.Equiv.fst.checked",
"Hacl.Impl.Chacha20.Core32xN.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Chacha20.Vec.fst"
} | [] | [
"Hacl.Impl.Chacha20.Core32xN.lanes",
"Hacl.Impl.Chacha20.Core32xN.state",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.size_t",
"FStar.HyperStack.ST.pop_frame",
"Prims.unit",
"Lib.Buffer.op_Array_Assignment",
"Hacl.Impl.Chacha20.Core32xN.uint32xN",
"Lib.IntVector.op_Plus_Bar",
"Lib.IntTypes.U32",
"Lib.Buffer.op_Array_Access",
"Lib.Buffer.MUT",
"Lib.IntVector.vec_t",
"Prims.eq2",
"Lib.Sequence.lseq",
"Lib.IntTypes.int_t",
"Lib.IntTypes.SEC",
"Lib.IntVector.vec_v",
"Lib.Sequence.createi",
"Lib.IntTypes.mk_int",
"Lib.IntVector.vec_counter",
"Lib.Buffer.mapT",
"Lib.IntTypes.uint32",
"Hacl.Spec.Chacha20.Vec.vec_load_i",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Hacl.Impl.Chacha20.Vec.setup1",
"Lib.Buffer.lbuffer_t",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.create",
"Lib.IntTypes.u32",
"FStar.HyperStack.ST.push_frame"
] | [] | module Hacl.Impl.Chacha20.Vec
module ST = FStar.HyperStack.ST
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.IntVector
open Hacl.Impl.Chacha20.Core32xN
module Spec = Hacl.Spec.Chacha20.Vec
module Chacha20Equiv = Hacl.Spec.Chacha20.Equiv
module Loop = Lib.LoopCombinators
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 200 --record_options"
//#set-options "--debug Hacl.Impl.Chacha20.Vec --debug_level ExtractNorm"
noextract
val rounds:
#w:lanes
-> st:state w ->
Stack unit
(requires (fun h -> live h st))
(ensures (fun h0 _ h1 -> modifies (loc st) h0 h1 /\
as_seq h1 st == Spec.rounds (as_seq h0 st)))
[@ Meta.Attribute.inline_ ]
let rounds #w st =
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st
noextract
val chacha20_core:
#w:lanes
-> k:state w
-> ctx0:state w
-> ctr:size_t{w * v ctr <= max_size_t} ->
Stack unit
(requires (fun h -> live h ctx0 /\ live h k /\ disjoint ctx0 k))
(ensures (fun h0 _ h1 -> modifies (loc k) h0 h1 /\
as_seq h1 k == Spec.chacha20_core (v ctr) (as_seq h0 ctx0)))
[@ Meta.Attribute.specialize ]
let chacha20_core #w k ctx ctr =
copy_state k ctx;
let ctr_u32 = u32 w *! size_to_uint32 ctr in
let cv = vec_load ctr_u32 w in
k.(12ul) <- k.(12ul) +| cv;
rounds k;
sum_state k ctx;
k.(12ul) <- k.(12ul) +| cv
val chacha20_constants:
b:glbuffer size_t 4ul{recallable b /\ witnessed b Spec.Chacha20.chacha20_constants}
let chacha20_constants =
[@ inline_let]
let l = [Spec.c0;Spec.c1;Spec.c2;Spec.c3] in
assert_norm(List.Tot.length l == 4);
createL_global l
inline_for_extraction noextract
val setup1:
ctx:lbuffer uint32 16ul
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (u32 0)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.setup1 (as_seq h0 k) (as_seq h0 n) (v ctr0)))
let setup1 ctx k n ctr =
let h0 = ST.get() in
recall_contents chacha20_constants Spec.chacha20_constants;
update_sub_f h0 ctx 0ul 4ul
(fun h -> Lib.Sequence.map secret Spec.chacha20_constants)
(fun _ -> mapT 4ul (sub ctx 0ul 4ul) secret chacha20_constants);
let h1 = ST.get() in
update_sub_f h1 ctx 4ul 8ul
(fun h -> Lib.ByteSequence.uints_from_bytes_le (as_seq h k))
(fun _ -> uints_from_bytes_le (sub ctx 4ul 8ul) k);
let h2 = ST.get() in
ctx.(12ul) <- size_to_uint32 ctr;
let h3 = ST.get() in
update_sub_f h3 ctx 13ul 3ul
(fun h -> Lib.ByteSequence.uints_from_bytes_le (as_seq h n))
(fun _ -> uints_from_bytes_le (sub ctx 13ul 3ul) n)
inline_for_extraction noextract
val chacha20_init:
#w:lanes
-> ctx:state w
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (vec_zero U32 w)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.chacha20_init (as_seq h0 k) (as_seq h0 n) (v ctr0)))
[@ Meta.Attribute.specialize ] | false | false | Hacl.Impl.Chacha20.Vec.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val chacha20_init:
#w:lanes
-> ctx:state w
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (vec_zero U32 w)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.chacha20_init (as_seq h0 k) (as_seq h0 n) (v ctr0))) | [] | Hacl.Impl.Chacha20.Vec.chacha20_init | {
"file_name": "code/chacha20/Hacl.Impl.Chacha20.Vec.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
ctx: Hacl.Impl.Chacha20.Core32xN.state w ->
k: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul ->
n: Lib.Buffer.lbuffer Lib.IntTypes.uint8 12ul ->
ctr0: Lib.IntTypes.size_t
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 13,
"end_line": 128,
"start_col": 2,
"start_line": 120
} |
FStar.HyperStack.ST.Stack | val chacha20_encrypt_last:
#w:lanes
-> ctx:state w
-> len:size_t{v len < w * 64}
-> out:lbuffer uint8 len
-> incr:size_t{w * v incr <= max_size_t}
-> text:lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
disjoint out ctx /\ disjoint text ctx))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_last (as_seq h0 ctx) (v incr) (v len) (as_seq h0 text))) | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loop"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Equiv",
"short_module": "Chacha20Equiv"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Vec",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20.Core32xN",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let chacha20_encrypt_last #w ctx len out incr text =
push_frame();
let plain = create (size w *! size 64) (u8 0) in
update_sub plain 0ul len text;
chacha20_encrypt_block ctx plain incr plain;
copy out (sub plain 0ul len);
pop_frame() | val chacha20_encrypt_last:
#w:lanes
-> ctx:state w
-> len:size_t{v len < w * 64}
-> out:lbuffer uint8 len
-> incr:size_t{w * v incr <= max_size_t}
-> text:lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
disjoint out ctx /\ disjoint text ctx))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_last (as_seq h0 ctx) (v incr) (v len) (as_seq h0 text)))
let chacha20_encrypt_last #w ctx len out incr text = | true | null | false | push_frame ();
let plain = create (size w *! size 64) (u8 0) in
update_sub plain 0ul len text;
chacha20_encrypt_block ctx plain incr plain;
copy out (sub plain 0ul len);
pop_frame () | {
"checked_file": "Hacl.Impl.Chacha20.Vec.fst.checked",
"dependencies": [
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntVector.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"Hacl.Spec.Chacha20.Equiv.fst.checked",
"Hacl.Impl.Chacha20.Core32xN.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Chacha20.Vec.fst"
} | [] | [
"Hacl.Impl.Chacha20.Core32xN.lanes",
"Hacl.Impl.Chacha20.Core32xN.state",
"Lib.IntTypes.size_t",
"Prims.b2t",
"Prims.op_LessThan",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"FStar.Mul.op_Star",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"Prims.op_LessThanOrEqual",
"Lib.IntTypes.max_size_t",
"FStar.HyperStack.ST.pop_frame",
"Prims.unit",
"Lib.Buffer.copy",
"Lib.Buffer.MUT",
"Lib.Buffer.lbuffer_t",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.sub",
"Lib.IntTypes.op_Star_Bang",
"Lib.IntTypes.size",
"FStar.UInt32.__uint_to_t",
"Hacl.Impl.Chacha20.Vec.chacha20_encrypt_block",
"Lib.Buffer.update_sub",
"Lib.IntTypes.mul",
"Lib.IntTypes.mk_int",
"Lib.Buffer.create",
"Lib.IntTypes.u8",
"FStar.HyperStack.ST.push_frame"
] | [] | module Hacl.Impl.Chacha20.Vec
module ST = FStar.HyperStack.ST
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.IntVector
open Hacl.Impl.Chacha20.Core32xN
module Spec = Hacl.Spec.Chacha20.Vec
module Chacha20Equiv = Hacl.Spec.Chacha20.Equiv
module Loop = Lib.LoopCombinators
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 200 --record_options"
//#set-options "--debug Hacl.Impl.Chacha20.Vec --debug_level ExtractNorm"
noextract
val rounds:
#w:lanes
-> st:state w ->
Stack unit
(requires (fun h -> live h st))
(ensures (fun h0 _ h1 -> modifies (loc st) h0 h1 /\
as_seq h1 st == Spec.rounds (as_seq h0 st)))
[@ Meta.Attribute.inline_ ]
let rounds #w st =
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st
noextract
val chacha20_core:
#w:lanes
-> k:state w
-> ctx0:state w
-> ctr:size_t{w * v ctr <= max_size_t} ->
Stack unit
(requires (fun h -> live h ctx0 /\ live h k /\ disjoint ctx0 k))
(ensures (fun h0 _ h1 -> modifies (loc k) h0 h1 /\
as_seq h1 k == Spec.chacha20_core (v ctr) (as_seq h0 ctx0)))
[@ Meta.Attribute.specialize ]
let chacha20_core #w k ctx ctr =
copy_state k ctx;
let ctr_u32 = u32 w *! size_to_uint32 ctr in
let cv = vec_load ctr_u32 w in
k.(12ul) <- k.(12ul) +| cv;
rounds k;
sum_state k ctx;
k.(12ul) <- k.(12ul) +| cv
val chacha20_constants:
b:glbuffer size_t 4ul{recallable b /\ witnessed b Spec.Chacha20.chacha20_constants}
let chacha20_constants =
[@ inline_let]
let l = [Spec.c0;Spec.c1;Spec.c2;Spec.c3] in
assert_norm(List.Tot.length l == 4);
createL_global l
inline_for_extraction noextract
val setup1:
ctx:lbuffer uint32 16ul
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (u32 0)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.setup1 (as_seq h0 k) (as_seq h0 n) (v ctr0)))
let setup1 ctx k n ctr =
let h0 = ST.get() in
recall_contents chacha20_constants Spec.chacha20_constants;
update_sub_f h0 ctx 0ul 4ul
(fun h -> Lib.Sequence.map secret Spec.chacha20_constants)
(fun _ -> mapT 4ul (sub ctx 0ul 4ul) secret chacha20_constants);
let h1 = ST.get() in
update_sub_f h1 ctx 4ul 8ul
(fun h -> Lib.ByteSequence.uints_from_bytes_le (as_seq h k))
(fun _ -> uints_from_bytes_le (sub ctx 4ul 8ul) k);
let h2 = ST.get() in
ctx.(12ul) <- size_to_uint32 ctr;
let h3 = ST.get() in
update_sub_f h3 ctx 13ul 3ul
(fun h -> Lib.ByteSequence.uints_from_bytes_le (as_seq h n))
(fun _ -> uints_from_bytes_le (sub ctx 13ul 3ul) n)
inline_for_extraction noextract
val chacha20_init:
#w:lanes
-> ctx:state w
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (vec_zero U32 w)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.chacha20_init (as_seq h0 k) (as_seq h0 n) (v ctr0)))
[@ Meta.Attribute.specialize ]
let chacha20_init #w ctx k n ctr =
push_frame();
let ctx1 = create 16ul (u32 0) in
setup1 ctx1 k n ctr;
let h0 = ST.get() in
mapT 16ul ctx (Spec.vec_load_i w) ctx1;
let ctr = vec_counter U32 w in
let c12 = ctx.(12ul) in
ctx.(12ul) <- c12 +| ctr;
pop_frame()
noextract
val chacha20_encrypt_block:
#w:lanes
-> ctx:state w
-> out:lbuffer uint8 (size w *! 64ul)
-> incr:size_t{w * v incr <= max_size_t}
-> text:lbuffer uint8 (size w *! 64ul) ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
disjoint out ctx /\ disjoint text ctx /\ eq_or_disjoint text out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_block (as_seq h0 ctx) (v incr) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_encrypt_block #w ctx out incr text =
push_frame();
let k = create 16ul (vec_zero U32 w) in
chacha20_core k ctx incr;
transpose k;
xor_block out k text;
pop_frame()
noextract
val chacha20_encrypt_last:
#w:lanes
-> ctx:state w
-> len:size_t{v len < w * 64}
-> out:lbuffer uint8 len
-> incr:size_t{w * v incr <= max_size_t}
-> text:lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
disjoint out ctx /\ disjoint text ctx))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_last (as_seq h0 ctx) (v incr) (v len) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ] | false | false | Hacl.Impl.Chacha20.Vec.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val chacha20_encrypt_last:
#w:lanes
-> ctx:state w
-> len:size_t{v len < w * 64}
-> out:lbuffer uint8 len
-> incr:size_t{w * v incr <= max_size_t}
-> text:lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
disjoint out ctx /\ disjoint text ctx))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_last (as_seq h0 ctx) (v incr) (v len) (as_seq h0 text))) | [] | Hacl.Impl.Chacha20.Vec.chacha20_encrypt_last | {
"file_name": "code/chacha20/Hacl.Impl.Chacha20.Vec.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
ctx: Hacl.Impl.Chacha20.Core32xN.state w ->
len: Lib.IntTypes.size_t{Lib.IntTypes.v len < w * 64} ->
out: Lib.Buffer.lbuffer Lib.IntTypes.uint8 len ->
incr: Lib.IntTypes.size_t{w * Lib.IntTypes.v incr <= Lib.IntTypes.max_size_t} ->
text: Lib.Buffer.lbuffer Lib.IntTypes.uint8 len
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 13,
"end_line": 171,
"start_col": 2,
"start_line": 166
} |
FStar.HyperStack.ST.Stack | val chacha20_encrypt_block:
#w:lanes
-> ctx:state w
-> out:lbuffer uint8 (size w *! 64ul)
-> incr:size_t{w * v incr <= max_size_t}
-> text:lbuffer uint8 (size w *! 64ul) ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
disjoint out ctx /\ disjoint text ctx /\ eq_or_disjoint text out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_block (as_seq h0 ctx) (v incr) (as_seq h0 text))) | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loop"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Equiv",
"short_module": "Chacha20Equiv"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Vec",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20.Core32xN",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let chacha20_encrypt_block #w ctx out incr text =
push_frame();
let k = create 16ul (vec_zero U32 w) in
chacha20_core k ctx incr;
transpose k;
xor_block out k text;
pop_frame() | val chacha20_encrypt_block:
#w:lanes
-> ctx:state w
-> out:lbuffer uint8 (size w *! 64ul)
-> incr:size_t{w * v incr <= max_size_t}
-> text:lbuffer uint8 (size w *! 64ul) ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
disjoint out ctx /\ disjoint text ctx /\ eq_or_disjoint text out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_block (as_seq h0 ctx) (v incr) (as_seq h0 text)))
let chacha20_encrypt_block #w ctx out incr text = | true | null | false | push_frame ();
let k = create 16ul (vec_zero U32 w) in
chacha20_core k ctx incr;
transpose k;
xor_block out k text;
pop_frame () | {
"checked_file": "Hacl.Impl.Chacha20.Vec.fst.checked",
"dependencies": [
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntVector.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"Hacl.Spec.Chacha20.Equiv.fst.checked",
"Hacl.Impl.Chacha20.Core32xN.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Chacha20.Vec.fst"
} | [] | [
"Hacl.Impl.Chacha20.Core32xN.lanes",
"Hacl.Impl.Chacha20.Core32xN.state",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"Lib.IntTypes.op_Star_Bang",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.IntTypes.size",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.size_t",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.Mul.op_Star",
"Lib.IntTypes.v",
"Lib.IntTypes.max_size_t",
"FStar.HyperStack.ST.pop_frame",
"Prims.unit",
"Hacl.Impl.Chacha20.Core32xN.xor_block",
"Hacl.Impl.Chacha20.Core32xN.transpose",
"Hacl.Impl.Chacha20.Vec.chacha20_core",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"Hacl.Impl.Chacha20.Core32xN.uint32xN",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.create",
"Lib.IntVector.vec_zero",
"FStar.HyperStack.ST.push_frame"
] | [] | module Hacl.Impl.Chacha20.Vec
module ST = FStar.HyperStack.ST
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.IntVector
open Hacl.Impl.Chacha20.Core32xN
module Spec = Hacl.Spec.Chacha20.Vec
module Chacha20Equiv = Hacl.Spec.Chacha20.Equiv
module Loop = Lib.LoopCombinators
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 200 --record_options"
//#set-options "--debug Hacl.Impl.Chacha20.Vec --debug_level ExtractNorm"
noextract
val rounds:
#w:lanes
-> st:state w ->
Stack unit
(requires (fun h -> live h st))
(ensures (fun h0 _ h1 -> modifies (loc st) h0 h1 /\
as_seq h1 st == Spec.rounds (as_seq h0 st)))
[@ Meta.Attribute.inline_ ]
let rounds #w st =
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st
noextract
val chacha20_core:
#w:lanes
-> k:state w
-> ctx0:state w
-> ctr:size_t{w * v ctr <= max_size_t} ->
Stack unit
(requires (fun h -> live h ctx0 /\ live h k /\ disjoint ctx0 k))
(ensures (fun h0 _ h1 -> modifies (loc k) h0 h1 /\
as_seq h1 k == Spec.chacha20_core (v ctr) (as_seq h0 ctx0)))
[@ Meta.Attribute.specialize ]
let chacha20_core #w k ctx ctr =
copy_state k ctx;
let ctr_u32 = u32 w *! size_to_uint32 ctr in
let cv = vec_load ctr_u32 w in
k.(12ul) <- k.(12ul) +| cv;
rounds k;
sum_state k ctx;
k.(12ul) <- k.(12ul) +| cv
val chacha20_constants:
b:glbuffer size_t 4ul{recallable b /\ witnessed b Spec.Chacha20.chacha20_constants}
let chacha20_constants =
[@ inline_let]
let l = [Spec.c0;Spec.c1;Spec.c2;Spec.c3] in
assert_norm(List.Tot.length l == 4);
createL_global l
inline_for_extraction noextract
val setup1:
ctx:lbuffer uint32 16ul
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (u32 0)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.setup1 (as_seq h0 k) (as_seq h0 n) (v ctr0)))
let setup1 ctx k n ctr =
let h0 = ST.get() in
recall_contents chacha20_constants Spec.chacha20_constants;
update_sub_f h0 ctx 0ul 4ul
(fun h -> Lib.Sequence.map secret Spec.chacha20_constants)
(fun _ -> mapT 4ul (sub ctx 0ul 4ul) secret chacha20_constants);
let h1 = ST.get() in
update_sub_f h1 ctx 4ul 8ul
(fun h -> Lib.ByteSequence.uints_from_bytes_le (as_seq h k))
(fun _ -> uints_from_bytes_le (sub ctx 4ul 8ul) k);
let h2 = ST.get() in
ctx.(12ul) <- size_to_uint32 ctr;
let h3 = ST.get() in
update_sub_f h3 ctx 13ul 3ul
(fun h -> Lib.ByteSequence.uints_from_bytes_le (as_seq h n))
(fun _ -> uints_from_bytes_le (sub ctx 13ul 3ul) n)
inline_for_extraction noextract
val chacha20_init:
#w:lanes
-> ctx:state w
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (vec_zero U32 w)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.chacha20_init (as_seq h0 k) (as_seq h0 n) (v ctr0)))
[@ Meta.Attribute.specialize ]
let chacha20_init #w ctx k n ctr =
push_frame();
let ctx1 = create 16ul (u32 0) in
setup1 ctx1 k n ctr;
let h0 = ST.get() in
mapT 16ul ctx (Spec.vec_load_i w) ctx1;
let ctr = vec_counter U32 w in
let c12 = ctx.(12ul) in
ctx.(12ul) <- c12 +| ctr;
pop_frame()
noextract
val chacha20_encrypt_block:
#w:lanes
-> ctx:state w
-> out:lbuffer uint8 (size w *! 64ul)
-> incr:size_t{w * v incr <= max_size_t}
-> text:lbuffer uint8 (size w *! 64ul) ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
disjoint out ctx /\ disjoint text ctx /\ eq_or_disjoint text out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_block (as_seq h0 ctx) (v incr) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ] | false | false | Hacl.Impl.Chacha20.Vec.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val chacha20_encrypt_block:
#w:lanes
-> ctx:state w
-> out:lbuffer uint8 (size w *! 64ul)
-> incr:size_t{w * v incr <= max_size_t}
-> text:lbuffer uint8 (size w *! 64ul) ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
disjoint out ctx /\ disjoint text ctx /\ eq_or_disjoint text out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_block (as_seq h0 ctx) (v incr) (as_seq h0 text))) | [] | Hacl.Impl.Chacha20.Vec.chacha20_encrypt_block | {
"file_name": "code/chacha20/Hacl.Impl.Chacha20.Vec.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
ctx: Hacl.Impl.Chacha20.Core32xN.state w ->
out: Lib.Buffer.lbuffer Lib.IntTypes.uint8 (Lib.IntTypes.size w *! 64ul) ->
incr: Lib.IntTypes.size_t{w * Lib.IntTypes.v incr <= Lib.IntTypes.max_size_t} ->
text: Lib.Buffer.lbuffer Lib.IntTypes.uint8 (Lib.IntTypes.size w *! 64ul)
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 13,
"end_line": 149,
"start_col": 2,
"start_line": 144
} |
FStar.HyperStack.ST.Stack | val chacha20_encrypt_vec:
#w:lanes
-> len:size_t
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len
-> key:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr:size_t ->
Stack unit
(requires (fun h ->
live h key /\ live h n /\ live h text /\ live h out /\ eq_or_disjoint text out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_bytes #w (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 text))) | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loop"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Equiv",
"short_module": "Chacha20Equiv"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Vec",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20.Core32xN",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let chacha20_encrypt_vec #w len out text key n ctr =
push_frame();
let ctx = create_state w in
chacha20_init #w ctx key n ctr;
chacha20_update #w ctx len out text;
pop_frame() | val chacha20_encrypt_vec:
#w:lanes
-> len:size_t
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len
-> key:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr:size_t ->
Stack unit
(requires (fun h ->
live h key /\ live h n /\ live h text /\ live h out /\ eq_or_disjoint text out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_bytes #w (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 text)))
let chacha20_encrypt_vec #w len out text key n ctr = | true | null | false | push_frame ();
let ctx = create_state w in
chacha20_init #w ctx key n ctr;
chacha20_update #w ctx len out text;
pop_frame () | {
"checked_file": "Hacl.Impl.Chacha20.Vec.fst.checked",
"dependencies": [
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntVector.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"Hacl.Spec.Chacha20.Equiv.fst.checked",
"Hacl.Impl.Chacha20.Core32xN.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Chacha20.Vec.fst"
} | [] | [
"Hacl.Impl.Chacha20.Core32xN.lanes",
"Lib.IntTypes.size_t",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.UInt32.__uint_to_t",
"FStar.HyperStack.ST.pop_frame",
"Prims.unit",
"Hacl.Impl.Chacha20.Vec.chacha20_update",
"Hacl.Impl.Chacha20.Vec.chacha20_init",
"Hacl.Impl.Chacha20.Core32xN.state",
"Hacl.Impl.Chacha20.Core32xN.create_state",
"FStar.HyperStack.ST.push_frame"
] | [] | module Hacl.Impl.Chacha20.Vec
module ST = FStar.HyperStack.ST
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.IntVector
open Hacl.Impl.Chacha20.Core32xN
module Spec = Hacl.Spec.Chacha20.Vec
module Chacha20Equiv = Hacl.Spec.Chacha20.Equiv
module Loop = Lib.LoopCombinators
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 200 --record_options"
//#set-options "--debug Hacl.Impl.Chacha20.Vec --debug_level ExtractNorm"
noextract
val rounds:
#w:lanes
-> st:state w ->
Stack unit
(requires (fun h -> live h st))
(ensures (fun h0 _ h1 -> modifies (loc st) h0 h1 /\
as_seq h1 st == Spec.rounds (as_seq h0 st)))
[@ Meta.Attribute.inline_ ]
let rounds #w st =
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st
noextract
val chacha20_core:
#w:lanes
-> k:state w
-> ctx0:state w
-> ctr:size_t{w * v ctr <= max_size_t} ->
Stack unit
(requires (fun h -> live h ctx0 /\ live h k /\ disjoint ctx0 k))
(ensures (fun h0 _ h1 -> modifies (loc k) h0 h1 /\
as_seq h1 k == Spec.chacha20_core (v ctr) (as_seq h0 ctx0)))
[@ Meta.Attribute.specialize ]
let chacha20_core #w k ctx ctr =
copy_state k ctx;
let ctr_u32 = u32 w *! size_to_uint32 ctr in
let cv = vec_load ctr_u32 w in
k.(12ul) <- k.(12ul) +| cv;
rounds k;
sum_state k ctx;
k.(12ul) <- k.(12ul) +| cv
val chacha20_constants:
b:glbuffer size_t 4ul{recallable b /\ witnessed b Spec.Chacha20.chacha20_constants}
let chacha20_constants =
[@ inline_let]
let l = [Spec.c0;Spec.c1;Spec.c2;Spec.c3] in
assert_norm(List.Tot.length l == 4);
createL_global l
inline_for_extraction noextract
val setup1:
ctx:lbuffer uint32 16ul
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (u32 0)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.setup1 (as_seq h0 k) (as_seq h0 n) (v ctr0)))
let setup1 ctx k n ctr =
let h0 = ST.get() in
recall_contents chacha20_constants Spec.chacha20_constants;
update_sub_f h0 ctx 0ul 4ul
(fun h -> Lib.Sequence.map secret Spec.chacha20_constants)
(fun _ -> mapT 4ul (sub ctx 0ul 4ul) secret chacha20_constants);
let h1 = ST.get() in
update_sub_f h1 ctx 4ul 8ul
(fun h -> Lib.ByteSequence.uints_from_bytes_le (as_seq h k))
(fun _ -> uints_from_bytes_le (sub ctx 4ul 8ul) k);
let h2 = ST.get() in
ctx.(12ul) <- size_to_uint32 ctr;
let h3 = ST.get() in
update_sub_f h3 ctx 13ul 3ul
(fun h -> Lib.ByteSequence.uints_from_bytes_le (as_seq h n))
(fun _ -> uints_from_bytes_le (sub ctx 13ul 3ul) n)
inline_for_extraction noextract
val chacha20_init:
#w:lanes
-> ctx:state w
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (vec_zero U32 w)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.chacha20_init (as_seq h0 k) (as_seq h0 n) (v ctr0)))
[@ Meta.Attribute.specialize ]
let chacha20_init #w ctx k n ctr =
push_frame();
let ctx1 = create 16ul (u32 0) in
setup1 ctx1 k n ctr;
let h0 = ST.get() in
mapT 16ul ctx (Spec.vec_load_i w) ctx1;
let ctr = vec_counter U32 w in
let c12 = ctx.(12ul) in
ctx.(12ul) <- c12 +| ctr;
pop_frame()
noextract
val chacha20_encrypt_block:
#w:lanes
-> ctx:state w
-> out:lbuffer uint8 (size w *! 64ul)
-> incr:size_t{w * v incr <= max_size_t}
-> text:lbuffer uint8 (size w *! 64ul) ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
disjoint out ctx /\ disjoint text ctx /\ eq_or_disjoint text out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_block (as_seq h0 ctx) (v incr) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_encrypt_block #w ctx out incr text =
push_frame();
let k = create 16ul (vec_zero U32 w) in
chacha20_core k ctx incr;
transpose k;
xor_block out k text;
pop_frame()
noextract
val chacha20_encrypt_last:
#w:lanes
-> ctx:state w
-> len:size_t{v len < w * 64}
-> out:lbuffer uint8 len
-> incr:size_t{w * v incr <= max_size_t}
-> text:lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
disjoint out ctx /\ disjoint text ctx))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_last (as_seq h0 ctx) (v incr) (v len) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_encrypt_last #w ctx len out incr text =
push_frame();
let plain = create (size w *! size 64) (u8 0) in
update_sub plain 0ul len text;
chacha20_encrypt_block ctx plain incr plain;
copy out (sub plain 0ul len);
pop_frame()
noextract
val chacha20_update:
#w:lanes
-> ctx:state w
-> len:size_t{v len / (w * 64) <= max_size_t}
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
eq_or_disjoint text out /\ disjoint text ctx /\ disjoint out ctx))
(ensures (fun h0 _ h1 -> modifies (loc ctx |+| loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_update (as_seq h0 ctx) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_update #w ctx len out text =
assert_norm (range (v len / v (size w *! 64ul)) U32);
let blocks = len /. (size w *! 64ul) in
let rem = len %. (size w *! 64ul) in
let h0 = ST.get() in
map_blocks h0 len (size w *! 64ul) text out
(fun h -> Spec.chacha20_encrypt_block (as_seq h0 ctx))
(fun h -> Spec.chacha20_encrypt_last (as_seq h0 ctx))
(fun i -> chacha20_encrypt_block ctx (sub out (i *! (size w *! 64ul)) (size w *! 64ul)) i (sub text (i *! (size w *! 64ul)) (size w *! 64ul)))
(fun i -> chacha20_encrypt_last ctx rem (sub out (i *! (size w *! 64ul)) rem) i (sub text (i *! (size w *! 64ul)) rem))
noextract
val chacha20_encrypt_vec:
#w:lanes
-> len:size_t
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len
-> key:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr:size_t ->
Stack unit
(requires (fun h ->
live h key /\ live h n /\ live h text /\ live h out /\ eq_or_disjoint text out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_bytes #w (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ] | false | false | Hacl.Impl.Chacha20.Vec.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val chacha20_encrypt_vec:
#w:lanes
-> len:size_t
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len
-> key:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr:size_t ->
Stack unit
(requires (fun h ->
live h key /\ live h n /\ live h text /\ live h out /\ eq_or_disjoint text out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_bytes #w (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 text))) | [] | Hacl.Impl.Chacha20.Vec.chacha20_encrypt_vec | {
"file_name": "code/chacha20/Hacl.Impl.Chacha20.Vec.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
len: Lib.IntTypes.size_t ->
out: Lib.Buffer.lbuffer Lib.IntTypes.uint8 len ->
text: Lib.Buffer.lbuffer Lib.IntTypes.uint8 len ->
key: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul ->
n: Lib.Buffer.lbuffer Lib.IntTypes.uint8 12ul ->
ctr: Lib.IntTypes.size_t
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 13,
"end_line": 218,
"start_col": 2,
"start_line": 214
} |
FStar.HyperStack.ST.Stack | val chacha20_decrypt_vec:
#w:lanes
-> len:size_t
-> out:lbuffer uint8 len
-> cipher:lbuffer uint8 len
-> key:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr:size_t ->
Stack unit
(requires (fun h ->
live h key /\ live h n /\ live h cipher /\ live h out /\ eq_or_disjoint cipher out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_decrypt_bytes #w (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 cipher))) | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loop"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Equiv",
"short_module": "Chacha20Equiv"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Vec",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20.Core32xN",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let chacha20_decrypt_vec #w len out cipher key n ctr =
push_frame();
let ctx = create_state w in
chacha20_init ctx key n ctr;
chacha20_update ctx len out cipher;
pop_frame() | val chacha20_decrypt_vec:
#w:lanes
-> len:size_t
-> out:lbuffer uint8 len
-> cipher:lbuffer uint8 len
-> key:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr:size_t ->
Stack unit
(requires (fun h ->
live h key /\ live h n /\ live h cipher /\ live h out /\ eq_or_disjoint cipher out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_decrypt_bytes #w (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 cipher)))
let chacha20_decrypt_vec #w len out cipher key n ctr = | true | null | false | push_frame ();
let ctx = create_state w in
chacha20_init ctx key n ctr;
chacha20_update ctx len out cipher;
pop_frame () | {
"checked_file": "Hacl.Impl.Chacha20.Vec.fst.checked",
"dependencies": [
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntVector.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"Hacl.Spec.Chacha20.Equiv.fst.checked",
"Hacl.Impl.Chacha20.Core32xN.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Chacha20.Vec.fst"
} | [] | [
"Hacl.Impl.Chacha20.Core32xN.lanes",
"Lib.IntTypes.size_t",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.UInt32.__uint_to_t",
"FStar.HyperStack.ST.pop_frame",
"Prims.unit",
"Hacl.Impl.Chacha20.Vec.chacha20_update",
"Hacl.Impl.Chacha20.Vec.chacha20_init",
"Hacl.Impl.Chacha20.Core32xN.state",
"Hacl.Impl.Chacha20.Core32xN.create_state",
"FStar.HyperStack.ST.push_frame"
] | [] | module Hacl.Impl.Chacha20.Vec
module ST = FStar.HyperStack.ST
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.IntVector
open Hacl.Impl.Chacha20.Core32xN
module Spec = Hacl.Spec.Chacha20.Vec
module Chacha20Equiv = Hacl.Spec.Chacha20.Equiv
module Loop = Lib.LoopCombinators
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 200 --record_options"
//#set-options "--debug Hacl.Impl.Chacha20.Vec --debug_level ExtractNorm"
noextract
val rounds:
#w:lanes
-> st:state w ->
Stack unit
(requires (fun h -> live h st))
(ensures (fun h0 _ h1 -> modifies (loc st) h0 h1 /\
as_seq h1 st == Spec.rounds (as_seq h0 st)))
[@ Meta.Attribute.inline_ ]
let rounds #w st =
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st
noextract
val chacha20_core:
#w:lanes
-> k:state w
-> ctx0:state w
-> ctr:size_t{w * v ctr <= max_size_t} ->
Stack unit
(requires (fun h -> live h ctx0 /\ live h k /\ disjoint ctx0 k))
(ensures (fun h0 _ h1 -> modifies (loc k) h0 h1 /\
as_seq h1 k == Spec.chacha20_core (v ctr) (as_seq h0 ctx0)))
[@ Meta.Attribute.specialize ]
let chacha20_core #w k ctx ctr =
copy_state k ctx;
let ctr_u32 = u32 w *! size_to_uint32 ctr in
let cv = vec_load ctr_u32 w in
k.(12ul) <- k.(12ul) +| cv;
rounds k;
sum_state k ctx;
k.(12ul) <- k.(12ul) +| cv
val chacha20_constants:
b:glbuffer size_t 4ul{recallable b /\ witnessed b Spec.Chacha20.chacha20_constants}
let chacha20_constants =
[@ inline_let]
let l = [Spec.c0;Spec.c1;Spec.c2;Spec.c3] in
assert_norm(List.Tot.length l == 4);
createL_global l
inline_for_extraction noextract
val setup1:
ctx:lbuffer uint32 16ul
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (u32 0)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.setup1 (as_seq h0 k) (as_seq h0 n) (v ctr0)))
let setup1 ctx k n ctr =
let h0 = ST.get() in
recall_contents chacha20_constants Spec.chacha20_constants;
update_sub_f h0 ctx 0ul 4ul
(fun h -> Lib.Sequence.map secret Spec.chacha20_constants)
(fun _ -> mapT 4ul (sub ctx 0ul 4ul) secret chacha20_constants);
let h1 = ST.get() in
update_sub_f h1 ctx 4ul 8ul
(fun h -> Lib.ByteSequence.uints_from_bytes_le (as_seq h k))
(fun _ -> uints_from_bytes_le (sub ctx 4ul 8ul) k);
let h2 = ST.get() in
ctx.(12ul) <- size_to_uint32 ctr;
let h3 = ST.get() in
update_sub_f h3 ctx 13ul 3ul
(fun h -> Lib.ByteSequence.uints_from_bytes_le (as_seq h n))
(fun _ -> uints_from_bytes_le (sub ctx 13ul 3ul) n)
inline_for_extraction noextract
val chacha20_init:
#w:lanes
-> ctx:state w
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (vec_zero U32 w)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.chacha20_init (as_seq h0 k) (as_seq h0 n) (v ctr0)))
[@ Meta.Attribute.specialize ]
let chacha20_init #w ctx k n ctr =
push_frame();
let ctx1 = create 16ul (u32 0) in
setup1 ctx1 k n ctr;
let h0 = ST.get() in
mapT 16ul ctx (Spec.vec_load_i w) ctx1;
let ctr = vec_counter U32 w in
let c12 = ctx.(12ul) in
ctx.(12ul) <- c12 +| ctr;
pop_frame()
noextract
val chacha20_encrypt_block:
#w:lanes
-> ctx:state w
-> out:lbuffer uint8 (size w *! 64ul)
-> incr:size_t{w * v incr <= max_size_t}
-> text:lbuffer uint8 (size w *! 64ul) ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
disjoint out ctx /\ disjoint text ctx /\ eq_or_disjoint text out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_block (as_seq h0 ctx) (v incr) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_encrypt_block #w ctx out incr text =
push_frame();
let k = create 16ul (vec_zero U32 w) in
chacha20_core k ctx incr;
transpose k;
xor_block out k text;
pop_frame()
noextract
val chacha20_encrypt_last:
#w:lanes
-> ctx:state w
-> len:size_t{v len < w * 64}
-> out:lbuffer uint8 len
-> incr:size_t{w * v incr <= max_size_t}
-> text:lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
disjoint out ctx /\ disjoint text ctx))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_last (as_seq h0 ctx) (v incr) (v len) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_encrypt_last #w ctx len out incr text =
push_frame();
let plain = create (size w *! size 64) (u8 0) in
update_sub plain 0ul len text;
chacha20_encrypt_block ctx plain incr plain;
copy out (sub plain 0ul len);
pop_frame()
noextract
val chacha20_update:
#w:lanes
-> ctx:state w
-> len:size_t{v len / (w * 64) <= max_size_t}
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
eq_or_disjoint text out /\ disjoint text ctx /\ disjoint out ctx))
(ensures (fun h0 _ h1 -> modifies (loc ctx |+| loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_update (as_seq h0 ctx) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_update #w ctx len out text =
assert_norm (range (v len / v (size w *! 64ul)) U32);
let blocks = len /. (size w *! 64ul) in
let rem = len %. (size w *! 64ul) in
let h0 = ST.get() in
map_blocks h0 len (size w *! 64ul) text out
(fun h -> Spec.chacha20_encrypt_block (as_seq h0 ctx))
(fun h -> Spec.chacha20_encrypt_last (as_seq h0 ctx))
(fun i -> chacha20_encrypt_block ctx (sub out (i *! (size w *! 64ul)) (size w *! 64ul)) i (sub text (i *! (size w *! 64ul)) (size w *! 64ul)))
(fun i -> chacha20_encrypt_last ctx rem (sub out (i *! (size w *! 64ul)) rem) i (sub text (i *! (size w *! 64ul)) rem))
noextract
val chacha20_encrypt_vec:
#w:lanes
-> len:size_t
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len
-> key:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr:size_t ->
Stack unit
(requires (fun h ->
live h key /\ live h n /\ live h text /\ live h out /\ eq_or_disjoint text out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_bytes #w (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_encrypt_vec #w len out text key n ctr =
push_frame();
let ctx = create_state w in
chacha20_init #w ctx key n ctr;
chacha20_update #w ctx len out text;
pop_frame()
inline_for_extraction noextract
let chacha20_encrypt_st (w:lanes) =
len:size_t
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len
-> key:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr:size_t{v ctr + w <= max_size_t } ->
Stack unit
(requires fun h ->
live h key /\ live h n /\ live h text /\ live h out /\ eq_or_disjoint text out)
(ensures fun h0 _ h1 ->
modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.Chacha20.chacha20_encrypt_bytes (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 text))
noextract
val chacha20_encrypt: #w:lanes -> chacha20_encrypt_st w
[@ Meta.Attribute.specialize ]
let chacha20_encrypt #w len out text key n ctr =
let h0 = ST.get () in
chacha20_encrypt_vec #w len out text key n ctr;
Chacha20Equiv.lemma_chacha20_vec_equiv #w (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 text)
noextract
val chacha20_decrypt_vec:
#w:lanes
-> len:size_t
-> out:lbuffer uint8 len
-> cipher:lbuffer uint8 len
-> key:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr:size_t ->
Stack unit
(requires (fun h ->
live h key /\ live h n /\ live h cipher /\ live h out /\ eq_or_disjoint cipher out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_decrypt_bytes #w (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 cipher)))
[@ Meta.Attribute.inline_ ] | false | false | Hacl.Impl.Chacha20.Vec.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val chacha20_decrypt_vec:
#w:lanes
-> len:size_t
-> out:lbuffer uint8 len
-> cipher:lbuffer uint8 len
-> key:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr:size_t ->
Stack unit
(requires (fun h ->
live h key /\ live h n /\ live h cipher /\ live h out /\ eq_or_disjoint cipher out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_decrypt_bytes #w (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 cipher))) | [] | Hacl.Impl.Chacha20.Vec.chacha20_decrypt_vec | {
"file_name": "code/chacha20/Hacl.Impl.Chacha20.Vec.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
len: Lib.IntTypes.size_t ->
out: Lib.Buffer.lbuffer Lib.IntTypes.uint8 len ->
cipher: Lib.Buffer.lbuffer Lib.IntTypes.uint8 len ->
key: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul ->
n: Lib.Buffer.lbuffer Lib.IntTypes.uint8 12ul ->
ctr: Lib.IntTypes.size_t
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 13,
"end_line": 263,
"start_col": 2,
"start_line": 259
} |
FStar.HyperStack.ST.Stack | val chacha20_update:
#w:lanes
-> ctx:state w
-> len:size_t{v len / (w * 64) <= max_size_t}
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
eq_or_disjoint text out /\ disjoint text ctx /\ disjoint out ctx))
(ensures (fun h0 _ h1 -> modifies (loc ctx |+| loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_update (as_seq h0 ctx) (as_seq h0 text))) | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loop"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Equiv",
"short_module": "Chacha20Equiv"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Vec",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20.Core32xN",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let chacha20_update #w ctx len out text =
assert_norm (range (v len / v (size w *! 64ul)) U32);
let blocks = len /. (size w *! 64ul) in
let rem = len %. (size w *! 64ul) in
let h0 = ST.get() in
map_blocks h0 len (size w *! 64ul) text out
(fun h -> Spec.chacha20_encrypt_block (as_seq h0 ctx))
(fun h -> Spec.chacha20_encrypt_last (as_seq h0 ctx))
(fun i -> chacha20_encrypt_block ctx (sub out (i *! (size w *! 64ul)) (size w *! 64ul)) i (sub text (i *! (size w *! 64ul)) (size w *! 64ul)))
(fun i -> chacha20_encrypt_last ctx rem (sub out (i *! (size w *! 64ul)) rem) i (sub text (i *! (size w *! 64ul)) rem)) | val chacha20_update:
#w:lanes
-> ctx:state w
-> len:size_t{v len / (w * 64) <= max_size_t}
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
eq_or_disjoint text out /\ disjoint text ctx /\ disjoint out ctx))
(ensures (fun h0 _ h1 -> modifies (loc ctx |+| loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_update (as_seq h0 ctx) (as_seq h0 text)))
let chacha20_update #w ctx len out text = | true | null | false | assert_norm (range (v len / v (size w *! 64ul)) U32);
let blocks = len /. (size w *! 64ul) in
let rem = len %. (size w *! 64ul) in
let h0 = ST.get () in
map_blocks h0
len
(size w *! 64ul)
text
out
(fun h -> Spec.chacha20_encrypt_block (as_seq h0 ctx))
(fun h -> Spec.chacha20_encrypt_last (as_seq h0 ctx))
(fun i ->
chacha20_encrypt_block ctx
(sub out (i *! (size w *! 64ul)) (size w *! 64ul))
i
(sub text (i *! (size w *! 64ul)) (size w *! 64ul)))
(fun i ->
chacha20_encrypt_last ctx
rem
(sub out (i *! (size w *! 64ul)) rem)
i
(sub text (i *! (size w *! 64ul)) rem)) | {
"checked_file": "Hacl.Impl.Chacha20.Vec.fst.checked",
"dependencies": [
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntVector.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"Hacl.Spec.Chacha20.Equiv.fst.checked",
"Hacl.Impl.Chacha20.Core32xN.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Chacha20.Vec.fst"
} | [] | [
"Hacl.Impl.Chacha20.Core32xN.lanes",
"Hacl.Impl.Chacha20.Core32xN.state",
"Lib.IntTypes.size_t",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Division",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"FStar.Mul.op_Star",
"Lib.IntTypes.max_size_t",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"Lib.Buffer.map_blocks",
"Lib.Buffer.MUT",
"Lib.IntTypes.op_Star_Bang",
"Lib.IntTypes.size",
"FStar.UInt32.__uint_to_t",
"FStar.Monotonic.HyperStack.mem",
"Hacl.Spec.Chacha20.Vec.chacha20_encrypt_block",
"Lib.Buffer.as_seq",
"Hacl.Impl.Chacha20.Core32xN.uint32xN",
"Prims.nat",
"Prims.op_LessThan",
"Lib.Sequence.lseq",
"Hacl.Spec.Chacha20.Vec.chacha20_encrypt_last",
"Prims.eq2",
"Prims.int",
"Lib.IntTypes.size_nat",
"Hacl.Impl.Chacha20.Vec.chacha20_encrypt_block",
"Prims.unit",
"Lib.Buffer.lbuffer_t",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.IntTypes.mul",
"Lib.IntTypes.mk_int",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.sub",
"Hacl.Impl.Chacha20.Vec.chacha20_encrypt_last",
"FStar.HyperStack.ST.get",
"Lib.IntTypes.op_Percent_Dot",
"Lib.IntTypes.op_Slash_Dot",
"FStar.Pervasives.assert_norm",
"Lib.IntTypes.range"
] | [] | module Hacl.Impl.Chacha20.Vec
module ST = FStar.HyperStack.ST
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.IntVector
open Hacl.Impl.Chacha20.Core32xN
module Spec = Hacl.Spec.Chacha20.Vec
module Chacha20Equiv = Hacl.Spec.Chacha20.Equiv
module Loop = Lib.LoopCombinators
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 200 --record_options"
//#set-options "--debug Hacl.Impl.Chacha20.Vec --debug_level ExtractNorm"
noextract
val rounds:
#w:lanes
-> st:state w ->
Stack unit
(requires (fun h -> live h st))
(ensures (fun h0 _ h1 -> modifies (loc st) h0 h1 /\
as_seq h1 st == Spec.rounds (as_seq h0 st)))
[@ Meta.Attribute.inline_ ]
let rounds #w st =
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st
noextract
val chacha20_core:
#w:lanes
-> k:state w
-> ctx0:state w
-> ctr:size_t{w * v ctr <= max_size_t} ->
Stack unit
(requires (fun h -> live h ctx0 /\ live h k /\ disjoint ctx0 k))
(ensures (fun h0 _ h1 -> modifies (loc k) h0 h1 /\
as_seq h1 k == Spec.chacha20_core (v ctr) (as_seq h0 ctx0)))
[@ Meta.Attribute.specialize ]
let chacha20_core #w k ctx ctr =
copy_state k ctx;
let ctr_u32 = u32 w *! size_to_uint32 ctr in
let cv = vec_load ctr_u32 w in
k.(12ul) <- k.(12ul) +| cv;
rounds k;
sum_state k ctx;
k.(12ul) <- k.(12ul) +| cv
val chacha20_constants:
b:glbuffer size_t 4ul{recallable b /\ witnessed b Spec.Chacha20.chacha20_constants}
let chacha20_constants =
[@ inline_let]
let l = [Spec.c0;Spec.c1;Spec.c2;Spec.c3] in
assert_norm(List.Tot.length l == 4);
createL_global l
inline_for_extraction noextract
val setup1:
ctx:lbuffer uint32 16ul
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (u32 0)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.setup1 (as_seq h0 k) (as_seq h0 n) (v ctr0)))
let setup1 ctx k n ctr =
let h0 = ST.get() in
recall_contents chacha20_constants Spec.chacha20_constants;
update_sub_f h0 ctx 0ul 4ul
(fun h -> Lib.Sequence.map secret Spec.chacha20_constants)
(fun _ -> mapT 4ul (sub ctx 0ul 4ul) secret chacha20_constants);
let h1 = ST.get() in
update_sub_f h1 ctx 4ul 8ul
(fun h -> Lib.ByteSequence.uints_from_bytes_le (as_seq h k))
(fun _ -> uints_from_bytes_le (sub ctx 4ul 8ul) k);
let h2 = ST.get() in
ctx.(12ul) <- size_to_uint32 ctr;
let h3 = ST.get() in
update_sub_f h3 ctx 13ul 3ul
(fun h -> Lib.ByteSequence.uints_from_bytes_le (as_seq h n))
(fun _ -> uints_from_bytes_le (sub ctx 13ul 3ul) n)
inline_for_extraction noextract
val chacha20_init:
#w:lanes
-> ctx:state w
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (vec_zero U32 w)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.chacha20_init (as_seq h0 k) (as_seq h0 n) (v ctr0)))
[@ Meta.Attribute.specialize ]
let chacha20_init #w ctx k n ctr =
push_frame();
let ctx1 = create 16ul (u32 0) in
setup1 ctx1 k n ctr;
let h0 = ST.get() in
mapT 16ul ctx (Spec.vec_load_i w) ctx1;
let ctr = vec_counter U32 w in
let c12 = ctx.(12ul) in
ctx.(12ul) <- c12 +| ctr;
pop_frame()
noextract
val chacha20_encrypt_block:
#w:lanes
-> ctx:state w
-> out:lbuffer uint8 (size w *! 64ul)
-> incr:size_t{w * v incr <= max_size_t}
-> text:lbuffer uint8 (size w *! 64ul) ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
disjoint out ctx /\ disjoint text ctx /\ eq_or_disjoint text out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_block (as_seq h0 ctx) (v incr) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_encrypt_block #w ctx out incr text =
push_frame();
let k = create 16ul (vec_zero U32 w) in
chacha20_core k ctx incr;
transpose k;
xor_block out k text;
pop_frame()
noextract
val chacha20_encrypt_last:
#w:lanes
-> ctx:state w
-> len:size_t{v len < w * 64}
-> out:lbuffer uint8 len
-> incr:size_t{w * v incr <= max_size_t}
-> text:lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
disjoint out ctx /\ disjoint text ctx))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_last (as_seq h0 ctx) (v incr) (v len) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_encrypt_last #w ctx len out incr text =
push_frame();
let plain = create (size w *! size 64) (u8 0) in
update_sub plain 0ul len text;
chacha20_encrypt_block ctx plain incr plain;
copy out (sub plain 0ul len);
pop_frame()
noextract
val chacha20_update:
#w:lanes
-> ctx:state w
-> len:size_t{v len / (w * 64) <= max_size_t}
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
eq_or_disjoint text out /\ disjoint text ctx /\ disjoint out ctx))
(ensures (fun h0 _ h1 -> modifies (loc ctx |+| loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_update (as_seq h0 ctx) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ] | false | false | Hacl.Impl.Chacha20.Vec.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val chacha20_update:
#w:lanes
-> ctx:state w
-> len:size_t{v len / (w * 64) <= max_size_t}
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
eq_or_disjoint text out /\ disjoint text ctx /\ disjoint out ctx))
(ensures (fun h0 _ h1 -> modifies (loc ctx |+| loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_update (as_seq h0 ctx) (as_seq h0 text))) | [] | Hacl.Impl.Chacha20.Vec.chacha20_update | {
"file_name": "code/chacha20/Hacl.Impl.Chacha20.Vec.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
ctx: Hacl.Impl.Chacha20.Core32xN.state w ->
len: Lib.IntTypes.size_t{Lib.IntTypes.v len / (w * 64) <= Lib.IntTypes.max_size_t} ->
out: Lib.Buffer.lbuffer Lib.IntTypes.uint8 len ->
text: Lib.Buffer.lbuffer Lib.IntTypes.uint8 len
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 123,
"end_line": 196,
"start_col": 2,
"start_line": 188
} |
FStar.Pervasives.Lemma | val lemma_prod_bounds (dst_hi dst_lo x y:nat64) : Lemma
(requires pow2_64 * dst_hi + dst_lo == x * y)
(ensures dst_hi < pow2_64 - 1 /\
(dst_hi < pow2_64 - 2 \/ dst_lo <= 1)
) | [
{
"abbrev": false,
"full_module": "Vale.Curve25519.Fast_lemmas_internal",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Curve25519.Fast_defs",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let lemma_prod_bounds (dst_hi dst_lo x y:nat64) : Lemma
(requires pow2_64 * dst_hi + dst_lo == x * y)
(ensures dst_hi < pow2_64 - 1 /\
(dst_hi < pow2_64 - 2 \/ dst_lo <= 1)
)
=
let result = x * y in
FStar.Math.Lemmas.lemma_div_mod result pow2_64;
//assert (result = pow2_64 * (result / pow2_64) + result % pow2_64);
//assert (result % pow2_64 == dst_lo);
//assert (result / pow2_64 == dst_hi);
lemma_mul_bound64 x y;
() | val lemma_prod_bounds (dst_hi dst_lo x y:nat64) : Lemma
(requires pow2_64 * dst_hi + dst_lo == x * y)
(ensures dst_hi < pow2_64 - 1 /\
(dst_hi < pow2_64 - 2 \/ dst_lo <= 1)
)
let lemma_prod_bounds (dst_hi dst_lo x y: nat64)
: Lemma (requires pow2_64 * dst_hi + dst_lo == x * y)
(ensures dst_hi < pow2_64 - 1 /\ (dst_hi < pow2_64 - 2 \/ dst_lo <= 1)) = | false | null | true | let result = x * y in
FStar.Math.Lemmas.lemma_div_mod result pow2_64;
lemma_mul_bound64 x y;
() | {
"checked_file": "Vale.Curve25519.Fast_lemmas_external.fst.checked",
"dependencies": [
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Curve25519.Fast_lemmas_internal.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Curve25519.Fast_lemmas_external.fst"
} | [
"lemma"
] | [
"Vale.Def.Types_s.nat64",
"Prims.unit",
"Vale.Curve25519.Fast_lemmas_internal.lemma_mul_bound64",
"FStar.Math.Lemmas.lemma_div_mod",
"Vale.Def.Words_s.pow2_64",
"Prims.int",
"FStar.Mul.op_Star",
"Prims.eq2",
"Prims.op_Addition",
"Prims.squash",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.op_Subtraction",
"Prims.l_or",
"Prims.op_LessThanOrEqual",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Vale.Curve25519.Fast_lemmas_external
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Mul
open Vale.Curve25519.Fast_lemmas_internal
let lemma_overflow (dst_hi dst_lo addend:nat64) (old_overflow:bit) : Lemma
(requires dst_hi < pow2_64 - 1 /\
(dst_hi < pow2_64 - 2 \/ dst_lo <= 1) /\
addend < pow2_64 - 1 /\
(old_overflow = 0 \/ addend < pow2_64 - 2))
(ensures dst_hi < pow2_64 - 2 \/ dst_lo + addend + old_overflow < pow2_64)
=
()
let lemma_prod_bounds (dst_hi dst_lo x y:nat64) : Lemma
(requires pow2_64 * dst_hi + dst_lo == x * y)
(ensures dst_hi < pow2_64 - 1 /\
(dst_hi < pow2_64 - 2 \/ dst_lo <= 1) | false | false | Vale.Curve25519.Fast_lemmas_external.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lemma_prod_bounds (dst_hi dst_lo x y:nat64) : Lemma
(requires pow2_64 * dst_hi + dst_lo == x * y)
(ensures dst_hi < pow2_64 - 1 /\
(dst_hi < pow2_64 - 2 \/ dst_lo <= 1)
) | [] | Vale.Curve25519.Fast_lemmas_external.lemma_prod_bounds | {
"file_name": "vale/code/crypto/ecc/curve25519/Vale.Curve25519.Fast_lemmas_external.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
dst_hi: Vale.Def.Types_s.nat64 ->
dst_lo: Vale.Def.Types_s.nat64 ->
x: Vale.Def.Types_s.nat64 ->
y: Vale.Def.Types_s.nat64
-> FStar.Pervasives.Lemma (requires Vale.Def.Words_s.pow2_64 * dst_hi + dst_lo == x * y)
(ensures
dst_hi < Vale.Def.Words_s.pow2_64 - 1 /\
(dst_hi < Vale.Def.Words_s.pow2_64 - 2 \/ dst_lo <= 1)) | {
"end_col": 4,
"end_line": 30,
"start_col": 3,
"start_line": 23
} |
Prims.Tot | [
{
"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
}
] | false | let size_pos = x:size_t{v x > 0} | let size_pos = | false | null | false | x: size_t{v x > 0} | {
"checked_file": "Hacl.Impl.FFDHE.fst.checked",
"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"
} | [
"total"
] | [
"Lib.IntTypes.size_t",
"Prims.b2t",
"Prims.op_GreaterThan",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB"
] | [] | 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" | false | true | Hacl.Impl.FFDHE.fst | {
"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"
} | null | val size_pos : Type0 | [] | Hacl.Impl.FFDHE.size_pos | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 32,
"end_line": 32,
"start_col": 15,
"start_line": 32
} |
|
Prims.Tot | val ffdhe_len (a: S.ffdhe_alg) : x: size_pos{v x = S.ffdhe_len a} | [
{
"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
}
] | false | 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 | val ffdhe_len (a: S.ffdhe_alg) : x: size_pos{v x = S.ffdhe_len a}
let ffdhe_len (a: S.ffdhe_alg) : x: size_pos{v x = S.ffdhe_len a} = | false | null | false | allow_inversion S.ffdhe_alg;
match a with
| S.FFDHE2048 -> 256ul
| S.FFDHE3072 -> 384ul
| S.FFDHE4096 -> 512ul
| S.FFDHE6144 -> 768ul
| S.FFDHE8192 -> 1024ul | {
"checked_file": "Hacl.Impl.FFDHE.fst.checked",
"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"
} | [
"total"
] | [
"Spec.FFDHE.ffdhe_alg",
"FStar.UInt32.__uint_to_t",
"Hacl.Impl.FFDHE.size_pos",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Lib.IntTypes.U32",
"Prims.l_and",
"Prims.op_GreaterThan",
"Prims.op_LessThanOrEqual",
"Lib.IntTypes.max_size_t",
"Lib.IntTypes.v",
"Lib.IntTypes.PUB",
"Spec.FFDHE.ffdhe_len",
"Prims.unit",
"FStar.Pervasives.allow_inversion"
] | [] | 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] | false | false | Hacl.Impl.FFDHE.fst | {
"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"
} | null | val ffdhe_len (a: S.ffdhe_alg) : x: size_pos{v x = S.ffdhe_len a} | [] | Hacl.Impl.FFDHE.ffdhe_len | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Spec.FFDHE.ffdhe_alg -> x: Hacl.Impl.FFDHE.size_pos{Lib.IntTypes.v x = Spec.FFDHE.ffdhe_len a} | {
"end_col": 25,
"end_line": 42,
"start_col": 2,
"start_line": 36
} |
Prims.Tot | [
{
"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
}
] | false | 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)) | let ffdhe_precomp_p_st (t: limb_t) (a: S.ffdhe_alg) (len: size_pos) (ke: BE.exp t) = | false | null | false | 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)) | {
"checked_file": "Hacl.Impl.FFDHE.fst.checked",
"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"
} | [
"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",
"Prims.unit",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_and",
"Lib.Buffer.live",
"Lib.Buffer.MUT",
"Hacl.Bignum.Definitions.limb",
"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.Buffer.modifies",
"Lib.Buffer.loc",
"Hacl.Impl.FFDHE.ffdhe_precomp_inv",
"Lib.Buffer.as_seq",
"Lib.IntTypes.int_t",
"Prims.op_Subtraction",
"Prims.pow2",
"Prims.op_Multiply",
"Lib.IntTypes.mk_int",
"Hacl.Bignum.Definitions.blocks"
] | [] | 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 | false | false | Hacl.Impl.FFDHE.fst | {
"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"
} | null | val ffdhe_precomp_p_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 | [] | Hacl.Impl.FFDHE.ffdhe_precomp_p_st | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
t: Hacl.Bignum.Definitions.limb_t ->
a: Spec.FFDHE.ffdhe_alg ->
len: Hacl.Impl.FFDHE.size_pos ->
ke: Hacl.Bignum.Exponentiation.exp t
-> Type0 | {
"end_col": 56,
"end_line": 133,
"start_col": 80,
"start_line": 124
} |
|
Prims.Tot | [
{
"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
}
] | false | 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))) | let ffdhe_bn_from_g_st (t: limb_t) (a: S.ffdhe_alg) (len: size_pos) = | false | null | false | 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))) | {
"checked_file": "Hacl.Impl.FFDHE.fst.checked",
"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"
} | [
"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",
"Prims.unit",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_and",
"Lib.Buffer.live",
"Lib.Buffer.MUT",
"Hacl.Bignum.Definitions.limb",
"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",
"Lib.Sequence.lseq",
"Lib.Buffer.as_seq",
"Lib.Sequence.create",
"Lib.IntTypes.uint",
"Lib.IntTypes.SEC",
"Lib.Buffer.modifies",
"Lib.Buffer.loc",
"Prims.nat",
"Hacl.Bignum.Definitions.bn_v",
"Lib.ByteSequence.nat_from_bytes_be",
"Spec.FFDHE.__proj__Mk_ffdhe_params__item__ffdhe_g",
"Spec.FFDHE.get_ffdhe_params"
] | [] | 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 | false | true | Hacl.Impl.FFDHE.fst | {
"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"
} | null | val ffdhe_bn_from_g_st : t: Hacl.Bignum.Definitions.limb_t -> a: Spec.FFDHE.ffdhe_alg -> len: Hacl.Impl.FFDHE.size_pos
-> Type0 | [] | Hacl.Impl.FFDHE.ffdhe_bn_from_g_st | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | t: Hacl.Bignum.Definitions.limb_t -> a: Spec.FFDHE.ffdhe_alg -> len: Hacl.Impl.FFDHE.size_pos
-> Type0 | {
"end_col": 94,
"end_line": 86,
"start_col": 2,
"start_line": 78
} |
|
FStar.HyperStack.ST.Stack | 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)) | [
{
"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
}
] | false | 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)) | 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 = | true | null | false | 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)) | {
"checked_file": "Hacl.Impl.FFDHE.fst.checked",
"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"
} | [] | [
"Spec.FFDHE.ffdhe_alg",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"Hacl.Impl.FFDHE.ffdhe_len",
"Lib.ByteSequence.nat_from_intseq_be_public_to_secret",
"Lib.IntTypes.U8",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Spec.FFDHE.__proj__Mk_ffdhe_params__item__ffdhe_p",
"Spec.FFDHE.get_ffdhe_params",
"Prims.unit",
"Lib.Buffer.mapT",
"Lib.Buffer.CONST",
"Lib.IntTypes.pub_uint8",
"Lib.IntTypes.secret",
"Hacl.Impl.FFDHE.size_pos",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Prims.l_and",
"Prims.op_GreaterThan",
"Prims.op_LessThanOrEqual",
"Prims.op_Subtraction",
"Prims.pow2",
"Spec.FFDHE.ffdhe_len",
"Lib.Buffer.recall_contents",
"Lib.Buffer.lbuffer_t",
"Lib.IntTypes.int_t",
"Prims.eq2",
"LowStar.ConstBuffer.qual",
"LowStar.ConstBuffer.qual_of",
"LowStar.ConstBuffer.IMMUTABLE",
"Lib.Buffer.witnessed",
"Lib.Buffer.recallable",
"Hacl.Impl.FFDHE.get_ffdhe_p"
] | [] | 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)) | false | false | Hacl.Impl.FFDHE.fst | {
"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"
} | null | 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)) | [] | Hacl.Impl.FFDHE.ffdhe_p_to_ps | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Spec.FFDHE.ffdhe_alg -> p_s: Lib.Buffer.lbuffer Lib.IntTypes.uint8 (Hacl.Impl.FFDHE.ffdhe_len a)
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 102,
"end_line": 73,
"start_col": 25,
"start_line": 68
} |
Prims.Tot | [
{
"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
}
] | false | 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)) | let ffdhe_check_pk_st (t: limb_t) (a: S.ffdhe_alg) (len: size_pos) = | false | null | false | 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)) | {
"checked_file": "Hacl.Impl.FFDHE.fst.checked",
"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"
} | [
"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"
] | [] | 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 () | false | true | Hacl.Impl.FFDHE.fst | {
"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"
} | null | val ffdhe_check_pk_st : t: Hacl.Bignum.Definitions.limb_t -> a: Spec.FFDHE.ffdhe_alg -> len: Hacl.Impl.FFDHE.size_pos
-> Type0 | [] | Hacl.Impl.FFDHE.ffdhe_check_pk_st | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | t: Hacl.Bignum.Definitions.limb_t -> a: Spec.FFDHE.ffdhe_alg -> len: Hacl.Impl.FFDHE.size_pos
-> Type0 | {
"end_col": 95,
"end_line": 361,
"start_col": 65,
"start_line": 350
} |
|
Prims.Tot | [
{
"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
}
] | false | 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))))) | let new_ffdhe_precomp_p_st (t: limb_t) (a: S.ffdhe_alg) (len: size_pos) (ke: BE.exp t) = | false | null | false | 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))))) | {
"checked_file": "Hacl.Impl.FFDHE.fst.checked",
"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"
} | [
"total"
] | [
"Hacl.Bignum.Definitions.limb_t",
"Spec.FFDHE.ffdhe_alg",
"Hacl.Impl.FFDHE.size_pos",
"Hacl.Bignum.Exponentiation.exp",
"FStar.Monotonic.HyperHeap.rid",
"LowStar.Buffer.buffer",
"Hacl.Bignum.Definitions.limb",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_and",
"FStar.HyperStack.ST.is_eternal_region",
"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",
"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",
"Prims.l_imp",
"LowStar.Monotonic.Buffer.modifies",
"LowStar.Monotonic.Buffer.loc_none",
"Prims.op_Negation",
"LowStar.Monotonic.Buffer.g_is_null",
"LowStar.Buffer.trivial_preorder",
"FStar.UInt32.t",
"LowStar.Monotonic.Buffer.len",
"Lib.IntTypes.op_Plus_Bang",
"LowStar.Monotonic.Buffer.fresh_loc",
"LowStar.Monotonic.Buffer.loc_buffer",
"LowStar.Monotonic.Buffer.loc_includes",
"LowStar.Monotonic.Buffer.loc_region_only",
"Hacl.Impl.FFDHE.ffdhe_precomp_inv",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"Hacl.Bignum.Definitions.lbignum",
"Lib.IntTypes.int_t",
"Prims.op_Subtraction",
"Prims.pow2",
"Prims.op_Multiply",
"Lib.IntTypes.mk_int",
"Hacl.Bignum.Definitions.blocks"
] | [] | 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 () | false | false | Hacl.Impl.FFDHE.fst | {
"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"
} | null | val new_ffdhe_precomp_p_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 | [] | Hacl.Impl.FFDHE.new_ffdhe_precomp_p_st | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
t: Hacl.Bignum.Definitions.limb_t ->
a: Spec.FFDHE.ffdhe_alg ->
len: Hacl.Impl.FFDHE.size_pos ->
ke: Hacl.Bignum.Exponentiation.exp t
-> Type0 | {
"end_col": 86,
"end_line": 179,
"start_col": 84,
"start_line": 165
} |
|
Prims.Tot | [
{
"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
}
] | false | 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)) | let ffdhe_secret_to_public_st (t: limb_t) (a: S.ffdhe_alg) (len: size_pos) (ke: BE.exp t) = | false | null | false | 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)) | {
"checked_file": "Hacl.Impl.FFDHE.fst.checked",
"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"
} | [
"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"
] | [] | 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 | false | false | Hacl.Impl.FFDHE.fst | {
"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"
} | null | 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 | [] | Hacl.Impl.FFDHE.ffdhe_secret_to_public_st | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
t: Hacl.Bignum.Definitions.limb_t ->
a: Spec.FFDHE.ffdhe_alg ->
len: Hacl.Impl.FFDHE.size_pos ->
ke: Hacl.Bignum.Exponentiation.exp t
-> Type0 | {
"end_col": 62,
"end_line": 325,
"start_col": 4,
"start_line": 315
} |
|
Prims.Tot | [
{
"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
}
] | false | 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 | 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))
= | false | null | false | 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 | {
"checked_file": "Hacl.Impl.FFDHE.fst.checked",
"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"
} | [
"total"
] | [
"Hacl.Bignum.Definitions.limb_t",
"Lib.IntTypes.size_nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"Lib.IntTypes.max_size_t",
"Spec.FFDHE.ffdhe_alg",
"Hacl.Spec.Bignum.Definitions.lbignum",
"Prims.eq2",
"Prims.nat",
"Hacl.Spec.Bignum.Definitions.bn_v",
"Lib.ByteSequence.nat_from_bytes_be",
"Lib.IntTypes.PUB",
"Spec.FFDHE.__proj__Mk_ffdhe_params__item__ffdhe_p",
"Spec.FFDHE.get_ffdhe_params",
"Prims.int",
"Prims.op_Modulus",
"Prims.pow2",
"FStar.Mul.op_Star",
"Lib.IntTypes.bits",
"Lib.Sequence.lseq",
"Hacl.Spec.Bignum.Definitions.limb",
"FStar.Seq.Base.seq",
"Lib.Sequence.to_seq",
"FStar.Seq.Base.slice",
"Prims.l_Forall",
"Prims.l_or",
"FStar.Seq.Base.index",
"Lib.Sequence.index",
"Lib.Sequence.sub",
"Prims.logical"
] | [] | 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}) | false | false | Hacl.Impl.FFDHE.fst | {
"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"
} | null | val ffdhe_precomp_inv : a: Spec.FFDHE.ffdhe_alg -> p_r2_n: Hacl.Spec.Bignum.Definitions.lbignum t (len + len)
-> Prims.logical | [] | Hacl.Impl.FFDHE.ffdhe_precomp_inv | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Spec.FFDHE.ffdhe_alg -> p_r2_n: Hacl.Spec.Bignum.Definitions.lbignum t (len + len)
-> Prims.logical | {
"end_col": 74,
"end_line": 120,
"start_col": 2,
"start_line": 116
} |
|
Prims.Tot | [
{
"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
}
] | false | 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)) | let ffdhe_secret_to_public_precomp_st (t: limb_t) (a: S.ffdhe_alg) (len: size_pos) (ke: BE.exp t) = | false | null | false | 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)) | {
"checked_file": "Hacl.Impl.FFDHE.fst.checked",
"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"
} | [
"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",
"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.Sequence.seq",
"Prims.nat",
"FStar.Seq.Base.length",
"Spec.FFDHE.ffdhe_secret_to_public",
"Lib.IntTypes.int_t",
"Prims.op_Subtraction",
"Prims.pow2",
"Prims.op_Multiply",
"Lib.IntTypes.mk_int",
"Hacl.Bignum.Definitions.blocks"
] | [] | 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 | false | false | Hacl.Impl.FFDHE.fst | {
"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"
} | null | val ffdhe_secret_to_public_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 | [] | Hacl.Impl.FFDHE.ffdhe_secret_to_public_precomp_st | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
t: Hacl.Bignum.Definitions.limb_t ->
a: Spec.FFDHE.ffdhe_alg ->
len: Hacl.Impl.FFDHE.size_pos ->
ke: Hacl.Bignum.Exponentiation.exp t
-> Type0 | {
"end_col": 62,
"end_line": 283,
"start_col": 95,
"start_line": 269
} |
|
Prims.Tot | val 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} | [
{
"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
}
] | false | 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 | val 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}
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} = | false | null | false | 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 | {
"checked_file": "Hacl.Impl.FFDHE.fst.checked",
"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"
} | [
"total"
] | [
"Spec.FFDHE.ffdhe_alg",
"Hacl.Impl.FFDHE.Constants.ffdhe_p2048",
"Hacl.Impl.FFDHE.Constants.ffdhe_p3072",
"Hacl.Impl.FFDHE.Constants.ffdhe_p4096",
"Hacl.Impl.FFDHE.Constants.ffdhe_p6144",
"Hacl.Impl.FFDHE.Constants.ffdhe_p8192",
"Lib.Buffer.glbuffer",
"Lib.IntTypes.pub_uint8",
"Hacl.Impl.FFDHE.ffdhe_len",
"Prims.l_and",
"Lib.Buffer.witnessed",
"Spec.FFDHE.__proj__Mk_ffdhe_params__item__ffdhe_p",
"Spec.FFDHE.get_ffdhe_params",
"Lib.Buffer.recallable",
"Lib.Buffer.CONST",
"Prims.unit",
"FStar.Pervasives.allow_inversion"
] | [] | 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} | false | false | Hacl.Impl.FFDHE.fst | {
"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"
} | null | val 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} | [] | Hacl.Impl.FFDHE.get_ffdhe_p | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Spec.FFDHE.ffdhe_alg
-> x:
Lib.Buffer.glbuffer Lib.IntTypes.pub_uint8 (Hacl.Impl.FFDHE.ffdhe_len a)
{ Lib.Buffer.witnessed x (Mk_ffdhe_params?.ffdhe_p (Spec.FFDHE.get_ffdhe_params a)) /\
Lib.Buffer.recallable x } | {
"end_col": 30,
"end_line": 55,
"start_col": 2,
"start_line": 49
} |
Prims.Tot | 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 | [
{
"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
}
] | false | 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 | 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 = | false | null | false | 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
(let open B in 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
(let open B in modifies_only_not_unused_in loc_none h0 h2);
res | {
"checked_file": "Hacl.Impl.FFDHE.fst.checked",
"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"
} | [
"total"
] | [
"Hacl.Bignum.Definitions.limb_t",
"Spec.FFDHE.ffdhe_alg",
"Hacl.Impl.FFDHE.size_pos",
"Hacl.Bignum.Exponentiation.exp",
"Hacl.Impl.FFDHE.ffdhe_precomp_p_st",
"FStar.Monotonic.HyperHeap.rid",
"LowStar.Buffer.buffer",
"Hacl.Bignum.Definitions.limb",
"Prims.bool",
"Prims.unit",
"LowStar.Monotonic.Buffer.modifies_only_not_unused_in",
"LowStar.Monotonic.Buffer.loc_none",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Hacl.Bignum.Definitions.lbignum",
"Lib.IntTypes.add",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Prims._assert",
"Prims.eq2",
"Prims.int",
"LowStar.Monotonic.Buffer.length",
"LowStar.Buffer.trivial_preorder",
"Prims.op_Addition",
"Lib.IntTypes.v",
"Lib.Buffer.buffer_t",
"Lib.Buffer.MUT",
"FStar.UInt32.t",
"LowStar.Monotonic.Buffer.len",
"Lib.IntTypes.op_Plus_Bang",
"LowStar.Monotonic.Buffer.is_null",
"LowStar.Monotonic.Buffer.mbuffer",
"Prims.l_imp",
"Prims.b2t",
"Prims.op_Negation",
"LowStar.Monotonic.Buffer.g_is_null",
"Prims.l_and",
"Prims.nat",
"FStar.UInt32.v",
"LowStar.Monotonic.Buffer.frameOf",
"LowStar.Monotonic.Buffer.freeable",
"LowStar.Monotonic.Buffer.mmalloc_partial",
"Lib.IntTypes.uint",
"Lib.IntTypes.SEC",
"LowStar.Monotonic.Buffer.lmbuffer_or_null",
"Prims.op_GreaterThan",
"Lib.IntTypes.int_t",
"Prims.l_or",
"Lib.IntTypes.range",
"Prims.op_LessThanOrEqual",
"Prims.op_Subtraction",
"Prims.pow2",
"Prims.op_Multiply",
"Lib.IntTypes.mk_int",
"Lib.IntTypes.numbytes",
"Hacl.Spec.Bignum.Definitions.blocks",
"Hacl.Bignum.Definitions.blocks",
"Lib.IntTypes.size"
] | [] | 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 | false | false | Hacl.Impl.FFDHE.fst | {
"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"
} | null | 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 | [] | Hacl.Impl.FFDHE.new_ffdhe_precomp_p | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
a: Spec.FFDHE.ffdhe_alg ->
len: Hacl.Impl.FFDHE.size_pos ->
ke: Hacl.Bignum.Exponentiation.exp t ->
ffdhe_precomp_p: Hacl.Impl.FFDHE.ffdhe_precomp_p_st t a len ke
-> Hacl.Impl.FFDHE.new_ffdhe_precomp_p_st t a len ke | {
"end_col": 7,
"end_line": 208,
"start_col": 55,
"start_line": 191
} |
Prims.Tot | [
{
"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
}
] | false | 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)) | let ffdhe_shared_secret_st (t: limb_t) (a: S.ffdhe_alg) (len: size_pos) (ke: BE.exp t) = | false | null | false | 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)
) | {
"checked_file": "Hacl.Impl.FFDHE.fst.checked",
"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"
} | [
"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",
"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",
"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.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"
] | [] | 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 | false | false | Hacl.Impl.FFDHE.fst | {
"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"
} | null | val ffdhe_shared_secret_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 | [] | Hacl.Impl.FFDHE.ffdhe_shared_secret_st | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
t: Hacl.Bignum.Definitions.limb_t ->
a: Spec.FFDHE.ffdhe_alg ->
len: Hacl.Impl.FFDHE.size_pos ->
ke: Hacl.Bignum.Exponentiation.exp t
-> Type0 | {
"end_col": 93,
"end_line": 460,
"start_col": 4,
"start_line": 447
} |
|
Prims.Tot | [
{
"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
}
] | false | 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)) | let ffdhe_shared_secret_precomp_st (t: limb_t) (a: S.ffdhe_alg) (len: size_pos) (ke: BE.exp t) = | false | null | false | 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)
) | {
"checked_file": "Hacl.Impl.FFDHE.fst.checked",
"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"
} | [
"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"
] | [] | 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 | false | false | Hacl.Impl.FFDHE.fst | {
"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"
} | null | 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 | [] | Hacl.Impl.FFDHE.ffdhe_shared_secret_precomp_st | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
t: Hacl.Bignum.Definitions.limb_t ->
a: Spec.FFDHE.ffdhe_alg ->
len: Hacl.Impl.FFDHE.size_pos ->
ke: Hacl.Bignum.Exponentiation.exp t
-> Type0 | {
"end_col": 93,
"end_line": 412,
"start_col": 92,
"start_line": 395
} |
|
Prims.Tot | 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 | [
{
"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
}
] | 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 () | 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 = | false | null | false | 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": "Hacl.Impl.FFDHE.fst.checked",
"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"
} | [
"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"
] | [] | 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 | false | false | Hacl.Impl.FFDHE.fst | {
"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"
} | null | 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 | [] | Hacl.Impl.FFDHE.ffdhe_secret_to_public | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
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 | {
"end_col": 14,
"end_line": 346,
"start_col": 2,
"start_line": 340
} |
Prims.Tot | [
{
"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
}
] | false | 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)) | let ffdhe_compute_exp_st (t: limb_t) (a: S.ffdhe_alg) (len: size_pos) (ke: BE.exp t) = | false | null | false | 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)) | {
"checked_file": "Hacl.Impl.FFDHE.fst.checked",
"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"
} | [
"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"
] | [] | 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 | false | false | Hacl.Impl.FFDHE.fst | {
"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"
} | null | 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 | [] | Hacl.Impl.FFDHE.ffdhe_compute_exp_st | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
t: Hacl.Bignum.Definitions.limb_t ->
a: Spec.FFDHE.ffdhe_alg ->
len: Hacl.Impl.FFDHE.size_pos ->
ke: Hacl.Bignum.Exponentiation.exp t
-> Type0 | {
"end_col": 57,
"end_line": 231,
"start_col": 82,
"start_line": 212
} |
|
Prims.Tot | 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 | [
{
"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
}
] | 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 | 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 = | false | null | false | 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 | {
"checked_file": "Hacl.Impl.FFDHE.fst.checked",
"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"
} | [
"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"
] | [] | 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 | false | false | Hacl.Impl.FFDHE.fst | {
"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"
} | null | 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 | [] | Hacl.Impl.FFDHE.ffdhe_shared_secret | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
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 | {
"end_col": 3,
"end_line": 480,
"start_col": 2,
"start_line": 474
} |
Prims.Tot | val ffdhe_bn_from_g: #t:limb_t -> a:S.ffdhe_alg -> len:size_pos -> ffdhe_bn_from_g_st t a len | [
{
"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
}
] | 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 () | 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 = | false | null | false | 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 () | {
"checked_file": "Hacl.Impl.FFDHE.fst.checked",
"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"
} | [
"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"
] | [] | 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 | false | false | Hacl.Impl.FFDHE.fst | {
"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"
} | null | val ffdhe_bn_from_g: #t:limb_t -> a:S.ffdhe_alg -> len:size_pos -> ffdhe_bn_from_g_st t a len | [] | Hacl.Impl.FFDHE.ffdhe_bn_from_g | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Spec.FFDHE.ffdhe_alg -> len: Hacl.Impl.FFDHE.size_pos
-> Hacl.Impl.FFDHE.ffdhe_bn_from_g_st t a len | {
"end_col": 14,
"end_line": 110,
"start_col": 2,
"start_line": 92
} |
Prims.Tot | 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 | [
{
"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
}
] | 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 () | 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 = | false | null | false | 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 () | {
"checked_file": "Hacl.Impl.FFDHE.fst.checked",
"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"
} | [
"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"
] | [] | 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 | false | false | Hacl.Impl.FFDHE.fst | {
"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"
} | null | 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 | [] | Hacl.Impl.FFDHE.ffdhe_precomp_p | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | 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 | {
"end_col": 14,
"end_line": 161,
"start_col": 2,
"start_line": 145
} |
Prims.Tot | val ffdhe_check_pk: #t:limb_t -> a:S.ffdhe_alg -> len:size_pos -> ffdhe_check_pk_st t a len | [
{
"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
}
] | 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 | 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 = | false | null | false | 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": "Hacl.Impl.FFDHE.fst.checked",
"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"
} | [
"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"
] | [] | 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 | false | false | Hacl.Impl.FFDHE.fst | {
"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"
} | null | val ffdhe_check_pk: #t:limb_t -> a:S.ffdhe_alg -> len:size_pos -> ffdhe_check_pk_st t a len | [] | Hacl.Impl.FFDHE.ffdhe_check_pk | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Spec.FFDHE.ffdhe_alg -> len: Hacl.Impl.FFDHE.size_pos
-> Hacl.Impl.FFDHE.ffdhe_check_pk_st t a len | {
"end_col": 3,
"end_line": 391,
"start_col": 2,
"start_line": 367
} |
Prims.Tot | 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 | [
{
"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
}
] | false | let ffdhe_secret_to_public_precomp #t a len ke ffdhe_compute_exp p_r2_n sk pk =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let g_n = create nLen (uint #t #SEC 0) in
ffdhe_bn_from_g a len g_n;
let sk_n = create nLen (uint #t #SEC 0) in
let h0 = ST.get () in
BN.bn_from_bytes_be len sk sk_n;
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 sk);
S.ffdhe_g2_lemma ();
S.ffdhe_p_lemma a;
ffdhe_compute_exp p_r2_n sk_n g_n pk;
pop_frame () | 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 = | false | null | false | 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": "Hacl.Impl.FFDHE.fst.checked",
"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"
} | [
"total"
] | [
"Hacl.Bignum.Definitions.limb_t",
"Spec.FFDHE.ffdhe_alg",
"Hacl.Impl.FFDHE.size_pos",
"Hacl.Bignum.Exponentiation.exp",
"Hacl.Impl.FFDHE.ffdhe_compute_exp_st",
"Hacl.Bignum.Definitions.lbignum",
"Lib.IntTypes.op_Plus_Bang",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Hacl.Bignum.Definitions.blocks",
"Lib.IntTypes.size",
"Lib.IntTypes.numbytes",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.HyperStack.ST.pop_frame",
"Prims.unit",
"Spec.FFDHE.ffdhe_p_lemma",
"Spec.FFDHE.ffdhe_g2_lemma",
"Hacl.Spec.Bignum.bn_from_bytes_be_lemma",
"Lib.IntTypes.v",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"Hacl.Bignum.bn_from_bytes_be",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Lib.Buffer.lbuffer_t",
"Hacl.Bignum.Definitions.limb",
"Lib.Buffer.create",
"Lib.IntTypes.uint",
"Lib.IntTypes.SEC",
"Hacl.Impl.FFDHE.ffdhe_bn_from_g",
"Lib.IntTypes.int_t",
"Prims.eq2",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Prims.l_and",
"Prims.b2t",
"Prims.op_GreaterThan",
"Prims.op_LessThanOrEqual",
"Prims.op_Subtraction",
"Prims.pow2",
"Prims.op_Multiply",
"Lib.IntTypes.mk_int",
"Hacl.Spec.Bignum.Definitions.blocks",
"FStar.HyperStack.ST.push_frame"
] | [] | 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 | false | false | Hacl.Impl.FFDHE.fst | {
"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"
} | null | 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 | [] | Hacl.Impl.FFDHE.ffdhe_secret_to_public_precomp | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
a: Spec.FFDHE.ffdhe_alg ->
len: Hacl.Impl.FFDHE.size_pos ->
ke: Hacl.Bignum.Exponentiation.exp t ->
ffdhe_compute_exp: Hacl.Impl.FFDHE.ffdhe_compute_exp_st t a len ke
-> Hacl.Impl.FFDHE.ffdhe_secret_to_public_precomp_st t a len ke | {
"end_col": 14,
"end_line": 310,
"start_col": 2,
"start_line": 297
} |
Prims.Tot | 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 | [
{
"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
}
] | false | let ffdhe_compute_exp #t a len ke p_r2_n sk_n b_n res =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let r2_n = sub p_r2_n nLen nLen in
let res_n = create nLen (uint #t #SEC 0) in
let h1 = ST.get () in
S.ffdhe_p_lemma a;
assert_norm (pow2 4 = 16);
assert_norm (pow2 10 = 1024);
Math.Lemmas.pow2_plus 4 10;
Math.Lemmas.pow2_lt_compat 32 14;
SD.bn_eval_bound #t (as_seq h1 sk_n) (v nLen);
BE.mk_bn_mod_exp_precompr2 nLen ke.BE.exp_ct_precomp p_n r2_n b_n (size (bits t) *! nLen) sk_n res_n; //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 () | 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 = | false | null | false | push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let r2_n = sub p_r2_n nLen nLen in
let res_n = create nLen (uint #t #SEC 0) in
let h1 = ST.get () in
S.ffdhe_p_lemma a;
assert_norm (pow2 4 = 16);
assert_norm (pow2 10 = 1024);
Math.Lemmas.pow2_plus 4 10;
Math.Lemmas.pow2_lt_compat 32 14;
SD.bn_eval_bound #t (as_seq h1 sk_n) (v nLen);
BE.mk_bn_mod_exp_precompr2 nLen ke.BE.exp_ct_precomp p_n r2_n b_n (size (bits t) *! nLen) sk_n res_n;
let h2 = ST.get () in
BN.bn_to_bytes_be len res_n res;
SB.bn_to_bytes_be_lemma (v len) (as_seq h2 res_n);
pop_frame () | {
"checked_file": "Hacl.Impl.FFDHE.fst.checked",
"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"
} | [
"total"
] | [
"Hacl.Bignum.Definitions.limb_t",
"Spec.FFDHE.ffdhe_alg",
"Hacl.Impl.FFDHE.size_pos",
"Hacl.Bignum.Exponentiation.exp",
"Hacl.Bignum.Definitions.lbignum",
"Lib.IntTypes.op_Plus_Bang",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Hacl.Bignum.Definitions.blocks",
"Lib.IntTypes.size",
"Lib.IntTypes.numbytes",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.HyperStack.ST.pop_frame",
"Prims.unit",
"Hacl.Spec.Bignum.bn_to_bytes_be_lemma",
"Lib.IntTypes.v",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"Hacl.Bignum.Definitions.limb",
"Hacl.Bignum.bn_to_bytes_be",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Hacl.Bignum.Exponentiation.mk_bn_mod_exp_precompr2",
"Hacl.Bignum.Exponentiation.__proj__Mkexp__item__exp_ct_precomp",
"Lib.IntTypes.op_Star_Bang",
"Lib.IntTypes.bits",
"Hacl.Spec.Bignum.Definitions.bn_eval_bound",
"FStar.Math.Lemmas.pow2_lt_compat",
"FStar.Math.Lemmas.pow2_plus",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.pow2",
"Spec.FFDHE.ffdhe_p_lemma",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.create",
"Lib.IntTypes.uint",
"Lib.IntTypes.SEC",
"Lib.Buffer.sub",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.int_t",
"Prims.eq2",
"Prims.l_or",
"Lib.IntTypes.range",
"Prims.l_and",
"Prims.op_GreaterThan",
"Prims.op_LessThanOrEqual",
"Prims.op_Subtraction",
"Prims.op_Multiply",
"Lib.IntTypes.mk_int",
"Hacl.Spec.Bignum.Definitions.blocks",
"FStar.HyperStack.ST.push_frame"
] | [] | 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 | false | false | Hacl.Impl.FFDHE.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | 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 | [] | Hacl.Impl.FFDHE.ffdhe_compute_exp | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Spec.FFDHE.ffdhe_alg -> len: Hacl.Impl.FFDHE.size_pos -> ke: Hacl.Bignum.Exponentiation.exp t
-> Hacl.Impl.FFDHE.ffdhe_compute_exp_st t a len ke | {
"end_col": 14,
"end_line": 264,
"start_col": 2,
"start_line": 244
} |
Prims.Tot | 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 | [
{
"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
}
] | false | let ffdhe_shared_secret_precomp #t a len ke ffdhe_check_pk ffdhe_compute_exp p_r2_n sk pk ss =
push_frame ();
let nLen = blocks len (size (numbytes t)) in
let p_n = sub p_r2_n 0ul nLen in
let sk_n = create nLen (uint #t #SEC 0) in
let pk_n = create nLen (uint #t #SEC 0) in
let h0 = ST.get () in
BN.bn_from_bytes_be len sk sk_n;
BN.bn_from_bytes_be len pk pk_n;
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 sk);
SB.bn_from_bytes_be_lemma #t (v len) (as_seq h0 pk);
S.ffdhe_p_lemma a;
let m = ffdhe_check_pk pk_n p_n in
if Hacl.Bignum.Base.unsafe_bool_of_limb m then
ffdhe_compute_exp p_r2_n sk_n pk_n ss;
pop_frame ();
m | 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 = | false | null | false | 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 | {
"checked_file": "Hacl.Impl.FFDHE.fst.checked",
"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"
} | [
"total"
] | [
"Hacl.Bignum.Definitions.limb_t",
"Spec.FFDHE.ffdhe_alg",
"Hacl.Impl.FFDHE.size_pos",
"Hacl.Bignum.Exponentiation.exp",
"Hacl.Impl.FFDHE.ffdhe_check_pk_st",
"Hacl.Impl.FFDHE.ffdhe_compute_exp_st",
"Hacl.Bignum.Definitions.lbignum",
"Lib.IntTypes.op_Plus_Bang",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Hacl.Bignum.Definitions.blocks",
"Lib.IntTypes.size",
"Lib.IntTypes.numbytes",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"Hacl.Bignum.Definitions.limb",
"Prims.unit",
"FStar.HyperStack.ST.pop_frame",
"Hacl.Spec.Bignum.Base.unsafe_bool_of_limb",
"Prims.bool",
"Spec.FFDHE.ffdhe_p_lemma",
"Hacl.Spec.Bignum.bn_from_bytes_be_lemma",
"Lib.IntTypes.v",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"Hacl.Bignum.bn_from_bytes_be",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.create",
"Lib.IntTypes.uint",
"Lib.IntTypes.SEC",
"Lib.Buffer.sub",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.int_t",
"Prims.eq2",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Prims.l_and",
"Prims.b2t",
"Prims.op_GreaterThan",
"Prims.op_LessThanOrEqual",
"Prims.op_Subtraction",
"Prims.pow2",
"Prims.op_Multiply",
"Lib.IntTypes.mk_int",
"Hacl.Spec.Bignum.Definitions.blocks",
"FStar.HyperStack.ST.push_frame"
] | [] | 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 | false | false | Hacl.Impl.FFDHE.fst | {
"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"
} | null | 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 | [] | Hacl.Impl.FFDHE.ffdhe_shared_secret_precomp | {
"file_name": "code/ffdhe/Hacl.Impl.FFDHE.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
a: Spec.FFDHE.ffdhe_alg ->
len: Hacl.Impl.FFDHE.size_pos ->
ke: Hacl.Bignum.Exponentiation.exp t ->
ffdhe_check_pk: Hacl.Impl.FFDHE.ffdhe_check_pk_st t a len ->
ffdhe_compute_exp: Hacl.Impl.FFDHE.ffdhe_compute_exp_st t a len ke
-> Hacl.Impl.FFDHE.ffdhe_shared_secret_precomp_st t a len ke | {
"end_col": 3,
"end_line": 442,
"start_col": 2,
"start_line": 426
} |
Prims.Tot | val va_wp_Load_one_lsb (dst: va_operand_xmm) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 | [
{
"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
}
] | false | 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_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 = | false | null | false | (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 (()))) | {
"checked_file": "Vale.AES.X64.AESopt.fsti.checked",
"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"
} | [
"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"
] | [] | 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)) : | false | true | Vale.AES.X64.AESopt.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_wp_Load_one_lsb (dst: va_operand_xmm) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 | [] | Vale.AES.X64.AESopt.va_wp_Load_one_lsb | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
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 | {
"end_col": 88,
"end_line": 151,
"start_col": 2,
"start_line": 148
} |
Prims.Tot | [
{
"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
}
] | false | let six_of (a:Type0) = a & a & a & a & a & a | let six_of (a: Type0) = | false | null | false | a & a & a & a & a & a | {
"checked_file": "Vale.AES.X64.AESopt.fsti.checked",
"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"
} | [
"total"
] | [
"FStar.Pervasives.Native.tuple6"
] | [] | 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 | false | true | Vale.AES.X64.AESopt.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val six_of : a: Type0 -> Type0 | [] | Vale.AES.X64.AESopt.six_of | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Type0 -> Type0 | {
"end_col": 44,
"end_line": 62,
"start_col": 23,
"start_line": 62
} |
|
Prims.GTot | val rounds_opaque_6 (init: quad32_6) (round_keys: seq quad32) (rnd: nat{rnd < length round_keys})
: GTot quad32_6 | [
{
"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
}
] | false | 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) | val rounds_opaque_6 (init: quad32_6) (round_keys: seq quad32) (rnd: nat{rnd < length round_keys})
: GTot quad32_6
let rounds_opaque_6 (init: quad32_6) (round_keys: seq quad32) (rnd: nat{rnd < length round_keys})
: GTot quad32_6 = | false | null | false | map_six_of init (fun x -> eval_rounds x round_keys rnd) | {
"checked_file": "Vale.AES.X64.AESopt.fsti.checked",
"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"
} | [
"sometrivial"
] | [
"Vale.AES.X64.AESopt.quad32_6",
"FStar.Seq.Base.seq",
"Vale.X64.Decls.quad32",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Seq.Base.length",
"Vale.AES.X64.AESopt.map_six_of",
"Vale.Def.Types_s.quad32",
"Vale.AES.AES_s.eval_rounds"
] | [] | 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) | false | false | Vale.AES.X64.AESopt.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val rounds_opaque_6 (init: quad32_6) (round_keys: seq quad32) (rnd: nat{rnd < length round_keys})
: GTot quad32_6 | [] | Vale.AES.X64.AESopt.rounds_opaque_6 | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
init: Vale.AES.X64.AESopt.quad32_6 ->
round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
rnd: Prims.nat{rnd < FStar.Seq.Base.length round_keys}
-> Prims.GTot Vale.AES.X64.AESopt.quad32_6 | {
"end_col": 57,
"end_line": 76,
"start_col": 2,
"start_line": 76
} |
Prims.GTot | val make_six_of (#a: Type0) (f: (n: nat{n < 6} -> GTot a)) : GTot (six_of a) | [
{
"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
}
] | false | 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) | val make_six_of (#a: Type0) (f: (n: nat{n < 6} -> GTot a)) : GTot (six_of a)
let make_six_of (#a: Type0) (f: (n: nat{n < 6} -> GTot a)) : GTot (six_of a) = | false | null | false | (f 0, f 1, f 2, f 3, f 4, f 5) | {
"checked_file": "Vale.AES.X64.AESopt.fsti.checked",
"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"
} | [
"sometrivial"
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Pervasives.Native.Mktuple6",
"Vale.AES.X64.AESopt.six_of"
] | [] | 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 | false | false | Vale.AES.X64.AESopt.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val make_six_of (#a: Type0) (f: (n: nat{n < 6} -> GTot a)) : GTot (six_of a) | [] | Vale.AES.X64.AESopt.make_six_of | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | f: (n: Prims.nat{n < 6} -> Prims.GTot a) -> Prims.GTot (Vale.AES.X64.AESopt.six_of a) | {
"end_col": 32,
"end_line": 66,
"start_col": 2,
"start_line": 66
} |
Prims.Tot | val va_wp_Load_two_lsb (dst: va_operand_xmm) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 | [
{
"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
}
] | false | 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_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 = | false | null | false | (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 (()))) | {
"checked_file": "Vale.AES.X64.AESopt.fsti.checked",
"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"
} | [
"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"
] | [] | 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)) : | false | true | Vale.AES.X64.AESopt.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_wp_Load_two_lsb (dst: va_operand_xmm) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 | [] | Vale.AES.X64.AESopt.va_wp_Load_two_lsb | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
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 | {
"end_col": 88,
"end_line": 118,
"start_col": 2,
"start_line": 115
} |
Prims.GTot | val xor_reverse_inc32lite_6 (n i0: int) (ctr_BE rndkey: quad32) : GTot quad32_6 | [
{
"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
}
] | 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) | 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 = | false | null | false | 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) | {
"checked_file": "Vale.AES.X64.AESopt.fsti.checked",
"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"
} | [
"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"
] | [] | 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) | false | false | Vale.AES.X64.AESopt.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val xor_reverse_inc32lite_6 (n i0: int) (ctr_BE rndkey: quad32) : GTot quad32_6 | [] | Vale.AES.X64.AESopt.xor_reverse_inc32lite_6 | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | 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 | {
"end_col": 45,
"end_line": 81,
"start_col": 2,
"start_line": 79
} |
Prims.GTot | val map_six_of (#a #b: Type0) (x: six_of a) (f: (a -> GTot b)) : GTot (six_of b) | [
{
"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
}
] | false | 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) | val map_six_of (#a #b: Type0) (x: six_of a) (f: (a -> GTot b)) : GTot (six_of b)
let map_six_of (#a #b: Type0) (x: six_of a) (f: (a -> GTot b)) : GTot (six_of b) = | false | null | false | let x0, x1, x2, x3, x4, x5 = x in
(f x0, f x1, f x2, f x3, f x4, f x5) | {
"checked_file": "Vale.AES.X64.AESopt.fsti.checked",
"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"
} | [
"sometrivial"
] | [
"Vale.AES.X64.AESopt.six_of",
"FStar.Pervasives.Native.Mktuple6"
] | [] | 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) = | false | false | Vale.AES.X64.AESopt.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val map_six_of (#a #b: Type0) (x: six_of a) (f: (a -> GTot b)) : GTot (six_of b) | [] | Vale.AES.X64.AESopt.map_six_of | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Vale.AES.X64.AESopt.six_of a -> f: (_: a -> Prims.GTot b)
-> Prims.GTot (Vale.AES.X64.AESopt.six_of b) | {
"end_col": 38,
"end_line": 69,
"start_col": 84,
"start_line": 67
} |
Prims.Tot | [
{
"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
}
] | false | let quad32_6 = six_of quad32 | let quad32_6 = | false | null | false | six_of quad32 | {
"checked_file": "Vale.AES.X64.AESopt.fsti.checked",
"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"
} | [
"total"
] | [
"Vale.AES.X64.AESopt.six_of",
"Vale.X64.Decls.quad32"
] | [] | 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 | false | true | Vale.AES.X64.AESopt.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val quad32_6 : Type0 | [] | Vale.AES.X64.AESopt.quad32_6 | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 28,
"end_line": 63,
"start_col": 15,
"start_line": 63
} |
|
Prims.GTot | 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) | [
{
"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
}
] | 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) | 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) = | false | null | false | 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) | {
"checked_file": "Vale.AES.X64.AESopt.fsti.checked",
"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"
} | [
"sometrivial"
] | [
"Vale.AES.X64.AESopt.six_of",
"FStar.Pervasives.Native.Mktuple6"
] | [] | 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 | false | false | Vale.AES.X64.AESopt.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val map2_six_of (#a #b #c: Type0) (x: six_of a) (y: six_of b) (f: (a -> b -> GTot c))
: GTot (six_of c) | [] | Vale.AES.X64.AESopt.map2_six_of | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
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) | {
"end_col": 56,
"end_line": 73,
"start_col": 106,
"start_line": 70
} |
Prims.Tot | 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 | [
{
"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
}
] | 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 | 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 = | false | null | false | 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 | {
"checked_file": "Vale.AES.X64.AESopt.fsti.checked",
"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"
} | [
"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"
] | [] | 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 | false | true | Vale.AES.X64.AESopt.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val 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 | [] | Vale.AES.X64.AESopt.aes_reqs_offset | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
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 | {
"end_col": 33,
"end_line": 60,
"start_col": 2,
"start_line": 54
} |
Prims.Tot | 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 | [
{
"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
}
] | 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 /\
//(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 | 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 = | false | null | false | 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 | {
"checked_file": "Vale.AES.X64.AESopt.fsti.checked",
"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"
} | [
"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"
] | [] | 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 | false | true | Vale.AES.X64.AESopt.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val 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 | [] | Vale.AES.X64.AESopt.aes_reqs0 | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
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 | {
"end_col": 45,
"end_line": 48,
"start_col": 2,
"start_line": 41
} |
Prims.Tot | val scratch_reqs (scratch_b: buffer128) (count: nat) (heap3: vale_heap) (s: seq quad32) (z3: quad32)
: prop0 | [
{
"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
}
] | 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)) | 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 = | false | null | false | 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)) | {
"checked_file": "Vale.AES.X64.AESopt.fsti.checked",
"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"
} | [
"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"
] | [] | 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) | false | true | Vale.AES.X64.AESopt.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val scratch_reqs (scratch_b: buffer128) (count: nat) (heap3: vale_heap) (s: seq quad32) (z3: quad32)
: prop0 | [] | Vale.AES.X64.AESopt.scratch_reqs | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
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 | {
"end_col": 76,
"end_line": 97,
"start_col": 2,
"start_line": 90
} |
Prims.Tot | val va_quick_Load_one_lsb (dst: va_operand_xmm) : (va_quickCode unit (va_code_Load_one_lsb dst)) | [
{
"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
}
] | 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)) | 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)) = | false | null | false | (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)) | {
"checked_file": "Vale.AES.X64.AESopt.fsti.checked",
"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"
} | [
"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"
] | [] | 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] | false | false | Vale.AES.X64.AESopt.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_quick_Load_one_lsb (dst: va_operand_xmm) : (va_quickCode unit (va_code_Load_one_lsb dst)) | [] | Vale.AES.X64.AESopt.va_quick_Load_one_lsb | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | dst: Vale.X64.Decls.va_operand_xmm
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.AES.X64.AESopt.va_code_Load_one_lsb dst) | {
"end_col": 59,
"end_line": 162,
"start_col": 2,
"start_line": 161
} |
Prims.Tot | val va_quick_Load_two_lsb (dst: va_operand_xmm) : (va_quickCode unit (va_code_Load_two_lsb dst)) | [
{
"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
}
] | 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)) | 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)) = | false | null | false | (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)) | {
"checked_file": "Vale.AES.X64.AESopt.fsti.checked",
"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"
} | [
"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"
] | [] | 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] | false | false | Vale.AES.X64.AESopt.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_quick_Load_two_lsb (dst: va_operand_xmm) : (va_quickCode unit (va_code_Load_two_lsb dst)) | [] | Vale.AES.X64.AESopt.va_quick_Load_two_lsb | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | dst: Vale.X64.Decls.va_operand_xmm
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.AES.X64.AESopt.va_code_Load_two_lsb dst) | {
"end_col": 59,
"end_line": 129,
"start_col": 2,
"start_line": 128
} |
Prims.Tot | 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)) | [
{
"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
}
] | false | 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)) | 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 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)) = | false | null | false | (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)) | {
"checked_file": "Vale.AES.X64.AESopt.fsti.checked",
"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"
} | [
"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"
] | [] | 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) | false | false | Vale.AES.X64.AESopt.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_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)) | [] | Vale.AES.X64.AESopt.va_quick_Loop6x_final | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
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) | {
"end_col": 34,
"end_line": 283,
"start_col": 2,
"start_line": 277
} |
Prims.Tot | val va_quick_Loop6x_save_output (count: nat) (out_b: buffer128)
: (va_quickCode unit (va_code_Loop6x_save_output ())) | [
{
"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
}
] | 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)) | 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 ())) = | false | null | false | (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)) | {
"checked_file": "Vale.AES.X64.AESopt.fsti.checked",
"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"
} | [
"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"
] | [] | 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 | false | false | Vale.AES.X64.AESopt.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_quick_Loop6x_save_output (count: nat) (out_b: buffer128)
: (va_quickCode unit (va_code_Loop6x_save_output ())) | [] | Vale.AES.X64.AESopt.va_quick_Loop6x_save_output | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | 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 ()) | {
"end_col": 87,
"end_line": 349,
"start_col": 2,
"start_line": 347
} |
Prims.Tot | val va_wp_Loop6x_save_output
(count: nat)
(out_b: buffer128)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | [
{
"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
}
] | false | 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_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 = | false | null | false | (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 (()))) | {
"checked_file": "Vale.AES.X64.AESopt.fsti.checked",
"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"
} | [
"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"
] | [] | 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 | false | true | Vale.AES.X64.AESopt.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_wp_Loop6x_save_output
(count: nat)
(out_b: buffer128)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | [] | Vale.AES.X64.AESopt.va_wp_Loop6x_save_output | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
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 | {
"end_col": 75,
"end_line": 335,
"start_col": 2,
"start_line": 316
} |
Prims.Tot | 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)) | [
{
"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
}
] | false | 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)) | 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 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)) = | false | null | false | (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)) | {
"checked_file": "Vale.AES.X64.AESopt.fsti.checked",
"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"
} | [
"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"
] | [] | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let aes_reqs0
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ pclmulqdq_enabled /\ avx_enabled /\
alg = AES_128 /\
//(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
buffer128_as_seq heap0 keys_b == round_keys
let aes_reqs_offset
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ avx_enabled /\ pclmulqdq_enabled /\
(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
s128 heap0 keys_b == round_keys
let six_of (a:Type0) = a & a & a & a & a & a
let quad32_6 = six_of quad32
unfold let make_six_of (#a:Type0) (f:(n:nat{n < 6}) -> GTot a) : GTot (six_of a) =
(f 0, f 1, f 2, f 3, f 4, f 5)
unfold let map_six_of (#a #b:Type0) (x:six_of a) (f:a -> GTot b) : GTot (six_of b) =
let (x0, x1, x2, x3, x4, x5) = x in
(f x0, f x1, f x2, f x3, f x4, f x5)
unfold let map2_six_of (#a #b #c:Type0) (x:six_of a) (y:six_of b) (f:a -> b -> GTot c) : GTot (six_of c) =
let (x0, x1, x2, x3, x4, x5) = x in
let (y0, y1, y2, y3, y4, y5) = y in
(f x0 y0, f x1 y1, f x2 y2, f x3 y3, f x4 y4, f x5 y5)
let rounds_opaque_6 (init:quad32_6) (round_keys:seq quad32) (rnd:nat{rnd < length round_keys}) : GTot quad32_6 =
map_six_of init (fun x -> eval_rounds x round_keys rnd)
let xor_reverse_inc32lite_6 (n i0:int) (ctr_BE rndkey:quad32) : GTot quad32_6 =
make_six_of (fun i ->
let r = reverse_bytes_quad32 (inc32lite ctr_BE (i0 + i)) in
if i < n then quad32_xor r rndkey else r)
//let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
// count * 6 + 6 <= length s /\ (
// let data = slice s (count * 6) (count * 6 + 6) in
// z3 == reverse_bytes_quad32 (index data 5) /\
// scratch_b_blocks true true scratch_b 8 5 heap3 data)
let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
count * 6 + 6 <= length s /\ (
let data = slice s (count * 6) (count * 6 + 6) in
z3 == reverse_bytes_quad32 (index data 5) /\
buffer128_read scratch_b 3 heap3 == reverse_bytes_quad32 (index data 4) /\
buffer128_read scratch_b 4 heap3 == reverse_bytes_quad32 (index data 3) /\
buffer128_read scratch_b 5 heap3 == reverse_bytes_quad32 (index data 2) /\
buffer128_read scratch_b 6 heap3 == reverse_bytes_quad32 (index data 1) /\
buffer128_read scratch_b 7 heap3 == reverse_bytes_quad32 (index data 0))
//-- Load_two_lsb
val va_code_Load_two_lsb : dst:va_operand_xmm -> Tot va_code
val va_codegen_success_Load_two_lsb : dst:va_operand_xmm -> Tot va_pbool
val va_lemma_Load_two_lsb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_two_lsb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@ va_qattr]
let va_wp_Load_two_lsb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 ==> va_k va_sM (())))
val va_wpProof_Load_two_lsb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_two_lsb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_two_lsb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Load_two_lsb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_two_lsb dst)) =
(va_QProc (va_code_Load_two_lsb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_two_lsb dst) (va_wpProof_Load_two_lsb dst))
//--
//-- Load_one_lsb
val va_code_Load_one_lsb : dst:va_operand_xmm -> Tot va_code
val va_codegen_success_Load_one_lsb : dst:va_operand_xmm -> Tot va_pbool
val va_lemma_Load_one_lsb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_one_lsb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@ va_qattr]
let va_wp_Load_one_lsb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 ==> va_k va_sM (())))
val va_wpProof_Load_one_lsb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_one_lsb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_one_lsb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Load_one_lsb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_one_lsb dst)) =
(va_QProc (va_code_Load_one_lsb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_one_lsb dst) (va_wpProof_Load_one_lsb dst))
//--
//-- Loop6x_final
val va_code_Loop6x_final : alg:algorithm -> Tot va_code
val va_codegen_success_Loop6x_final : alg:algorithm -> Tot va_pbool
val va_lemma_Loop6x_final : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> iv_b:buffer128 ->
scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
ctr_orig:quad32 -> init:quad32_6 -> ctrs:quad32_6 -> plain:quad32_6 -> inb:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop6x_final alg) va_s0 /\ va_get_ok va_s0 /\
(sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validDstAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0)
Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\ va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\
aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0
va_s0) (va_get_mem_layout va_s0) /\ init == map_six_of #quad32 #quad32 ctrs (fun (c:quad32) ->
Vale.Def.Types_s.quad32_xor c (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0)) /\
(va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm
13 va_s0, va_get_xmm 14 va_s0) == rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg
- 1) /\ va_get_reg64 rR13 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64
inb) /\ va_get_reg64 rR12 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64
inb) /\ (let rk = FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in
(va_get_xmm 2 va_s0, va_get_xmm 0 va_s0, va_get_xmm 5 va_s0, va_get_xmm 6 va_s0, va_get_xmm 7
va_s0, va_get_xmm 3 va_s0) == map_six_of #quad32 #quad32 plain (fun (p:quad32) ->
Vale.Def.Types_s.quad32_xor rk p) /\ Vale.X64.Decls.buffer128_read scratch_b 8
(va_get_mem_heaplet 3 va_s0) == Vale.Def.Types_s.reverse_bytes_quad32 ctr_orig))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 7 7 /\ Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 inb /\ (va_get_xmm 9
va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM,
va_get_xmm 14 va_sM) == map2_six_of #quad32 #quad32 #quad32 plain ctrs (fun (p:quad32)
(c:quad32) -> Vale.Def.Types_s.quad32_xor p (Vale.AES.AES_s.aes_encrypt_LE alg key_words c)) /\
va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_reg64 rRdi va_sM ==
va_get_reg64 rRdi va_s0 + 96 /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96 /\
va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_sM == Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) /\
(let ctr = Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_orig `op_Modulus` 256 in ctr + 6 <
256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM,
va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 0 ctr_orig (va_get_xmm 15
va_sM))) /\ va_state_eq va_sM (va_update_mem_heaplet 3 va_sM (va_update_flags va_sM
(va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM
(va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 7 va_sM
(va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12
va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Loop6x_final (alg:algorithm) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (ctr_orig:quad32) (init:quad32_6)
(ctrs:quad32_6) (plain:quad32_6) (inb:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0))
: Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 2 va_s0)
(va_get_reg64 rR8 va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0)
scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\
va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\ aes_reqs_offset alg key_words round_keys keys_b
(va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ init ==
map_six_of #quad32 #quad32 ctrs (fun (c:quad32) -> Vale.Def.Types_s.quad32_xor c
(FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0)) /\ (va_get_xmm 9 va_s0,
va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm
14 va_s0) == rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64
rR13 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 inb) /\ va_get_reg64
rR12 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 inb) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_s0,
va_get_xmm 0 va_s0, va_get_xmm 5 va_s0, va_get_xmm 6 va_s0, va_get_xmm 7 va_s0, va_get_xmm 3
va_s0) == map_six_of #quad32 #quad32 plain (fun (p:quad32) -> Vale.Def.Types_s.quad32_xor rk p)
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) ==
Vale.Def.Types_s.reverse_bytes_quad32 ctr_orig)) /\ (forall (va_x_mem:vale_heap)
(va_x_rdi:nat64) (va_x_rsi:nat64) (va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm5:quad32)
(va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32)
(va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32)
(va_x_xmm15:quad32) (va_x_efl:Vale.X64.Flags.t) (va_x_heap3:vale_heap) . let va_sM =
va_upd_mem_heaplet 3 va_x_heap3 (va_upd_flags va_x_efl (va_upd_xmm 15 va_x_xmm15 (va_upd_xmm 14
va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11
(va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6
va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1
va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR13 va_x_r13 (va_upd_reg64 rR12 va_x_r12
(va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRsi va_x_rsi (va_upd_reg64 rRdi va_x_rdi (va_upd_mem
va_x_mem va_s0))))))))))))))))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 7 7 /\ Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 inb /\ (va_get_xmm 9
va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM,
va_get_xmm 14 va_sM) == map2_six_of #quad32 #quad32 #quad32 plain ctrs (fun (p:quad32)
(c:quad32) -> Vale.Def.Types_s.quad32_xor p (Vale.AES.AES_s.aes_encrypt_LE alg key_words c)) /\
va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_reg64 rRdi va_sM ==
va_get_reg64 rRdi va_s0 + 96 /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96 /\
va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_sM == Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) /\
(let ctr = Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_orig `op_Modulus` 256 in ctr + 6 <
256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM,
va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 0 ctr_orig (va_get_xmm 15
va_sM))) ==> va_k va_sM (())))
val va_wpProof_Loop6x_final : alg:algorithm -> iv_b:buffer128 -> scratch_b:buffer128 ->
key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> ctr_orig:quad32 ->
init:quad32_6 -> ctrs:quad32_6 -> plain:quad32_6 -> inb:quad32 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop6x_final alg iv_b scratch_b key_words round_keys
keys_b ctr_orig init ctrs plain inb va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_final alg) ([va_Mod_mem_heaplet
3; va_Mod_flags; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11;
va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm
2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11;
va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop6x_final (alg:algorithm) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (ctr_orig:quad32) (init:quad32_6)
(ctrs:quad32_6) (plain:quad32_6) (inb:quad32) : (va_quickCode unit (va_code_Loop6x_final alg)) =
(va_QProc (va_code_Loop6x_final alg) ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 15;
va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRsi; va_Mod_reg64
rRdi; va_Mod_mem]) (va_wp_Loop6x_final alg iv_b scratch_b key_words round_keys keys_b ctr_orig
init ctrs plain inb) (va_wpProof_Loop6x_final alg iv_b scratch_b key_words round_keys keys_b
ctr_orig init ctrs plain inb))
//--
//-- Loop6x_save_output
val va_code_Loop6x_save_output : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop6x_save_output : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop6x_save_output : va_b0:va_code -> va_s0:va_state -> count:nat -> out_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop6x_save_output ()) va_s0 /\ va_get_ok va_s0 /\
(avx_enabled /\ sse_enabled /\ Vale.X64.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rRsi va_s0 - 96) out_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0)
Secret)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) (count `op_Multiply` 6 + 0) (count `op_Multiply` 6 + 5) /\
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 6 va_sM) out_b) 0 (6 `op_Multiply` count) == FStar.Seq.Base.slice
#Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 6 va_s0) out_b) 0
(6 `op_Multiply` count) /\ (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0,
va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == make_six_of #quad32 (fun
(i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read out_b (count `op_Multiply` 6 + i)
(va_get_mem_heaplet 6 va_sM)) /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM,
va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == (Vale.Def.Types_s.quad32_xor
(va_get_xmm 1 va_sM) (va_get_xmm 15 va_sM), va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm
6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM)) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_mem_heaplet 6 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm
12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0))))))))))))
[@ va_qattr]
let va_wp_Loop6x_save_output (count:nat) (out_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit
-> Type0)) : Type0 =
(va_get_ok va_s0 /\ (avx_enabled /\ sse_enabled /\ Vale.X64.Decls.validDstAddrsOffset128
(va_get_mem_heaplet 6 va_s0) (va_get_reg64 rRsi va_s0 - 96) out_b (count `op_Multiply` 6) 6
(va_get_mem_layout va_s0) Secret) /\ (forall (va_x_mem:vale_heap) (va_x_xmm9:quad32)
(va_x_xmm10:quad32) (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32)
(va_x_xmm14:quad32) (va_x_heap6:vale_heap) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_mem_heaplet 6 va_x_heap6 (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13
va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10 va_x_xmm10
(va_upd_xmm 9 va_x_xmm9 (va_upd_mem va_x_mem va_s0)))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) (count `op_Multiply` 6 + 0) (count `op_Multiply` 6 + 5) /\
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 6 va_sM) out_b) 0 (6 `op_Multiply` count) == FStar.Seq.Base.slice
#Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 6 va_s0) out_b) 0
(6 `op_Multiply` count) /\ (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0,
va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == make_six_of #quad32 (fun
(i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read out_b (count `op_Multiply` 6 + i)
(va_get_mem_heaplet 6 va_sM)) /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM,
va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == (Vale.Def.Types_s.quad32_xor
(va_get_xmm 1 va_sM) (va_get_xmm 15 va_sM), va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm
6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM)) ==> va_k va_sM (())))
val va_wpProof_Loop6x_save_output : count:nat -> out_b:buffer128 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop6x_save_output count out_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_save_output ()) ([va_Mod_flags;
va_Mod_mem_heaplet 6; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm
10; va_Mod_xmm 9; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop6x_save_output (count:nat) (out_b:buffer128) : (va_quickCode unit
(va_code_Loop6x_save_output ())) =
(va_QProc (va_code_Loop6x_save_output ()) ([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_xmm 14;
va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_mem])
(va_wp_Loop6x_save_output count out_b) (va_wpProof_Loop6x_save_output count out_b))
//--
//-- Loop6x_partial
val va_code_untransformedoriginal_Loop6x_partial : alg:algorithm -> Tot va_code
val va_codegen_success_untransformedoriginal_Loop6x_partial : alg:algorithm -> Tot va_pbool
val va_lemma_untransformedoriginal_Loop6x_partial : va_b0:va_code -> va_s0:va_state ->
alg:algorithm -> h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32) -> count:nat -> in0_count:nat
-> iv_b:buffer128 -> in0_b:buffer128 -> in_b:buffer128 -> scratch_b:buffer128 -> key_words:(seq
nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE:quad32
-> Ghost (va_state & va_fuel & quad32_6)
(requires (va_require_total va_b0 (va_code_untransformedoriginal_Loop6x_partial alg) va_s0 /\
va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in sse_enabled
/\ movbe_enabled /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0
16777216 /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 6 va_s0) (va_get_reg64 rR14 va_s0) in0_b (in0_count `op_Multiply` 6) 6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp
va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64
/\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 15 va_s0 ==
FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx
va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9
va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256
==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15
va_s0)) /\ FStar.Seq.Base.length #quad32 data == 6 /\ hkeys_b_powers hkeys_b
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\
scratch_b_data true true scratch_b 8 5 (va_get_mem_heaplet 3 va_s0) (va_get_mem_layout va_s0)
(va_get_reg64 rRbp va_s0) data /\ va_get_xmm 7 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data 5) /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_s0))) == prev)))
(ensures (fun (va_sM, va_fM, init) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in
Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 1 8 /\ Vale.X64.Decls.modifies_buffer_specific128 iv_b
(va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) 0 0 /\ (0 <= va_get_reg64 rRbx va_sM
/\ va_get_reg64 rRbx va_sM < 256) /\ va_get_reg64 rRbx va_sM ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256
/\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM,
va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys
(Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64 rR13 va_sM ==
Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ va_get_reg64 rR12 va_sM ==
Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_sM,
va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3
va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor rk
(Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)))
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\
Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 5) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 3
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 4) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 4 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 3) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 5
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 2) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 6 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 1) (va_get_mem_heaplet 6 va_s0)) /\ init == make_six_of #quad32 (fun
(n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE n)) (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys
0)) /\ (let eventual_Xi = add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_sM)))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)) in
eventual_Xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data))))) /\ va_state_eq va_sM (va_update_flags
va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM (va_update_xmm 15 va_sM
(va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM
(va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM
(va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM
(va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13
va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))))
val va_transform_Loop6x_partial : alg:algorithm -> Tot va_transformation_result
val va_code_Loop6x_partial : alg:algorithm -> Tot va_code
val va_codegen_success_Loop6x_partial : alg:algorithm -> Tot va_pbool
val va_lemma_Loop6x_partial : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> h_LE:quad32 ->
y_prev:quad32 -> data:(seq quad32) -> count:nat -> in0_count:nat -> iv_b:buffer128 ->
in0_b:buffer128 -> in_b:buffer128 -> scratch_b:buffer128 -> key_words:(seq nat32) ->
round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE:quad32
-> Ghost (va_state & va_fuel & quad32_6)
(requires (va_require_total va_b0 (va_code_Loop6x_partial alg) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in sse_enabled
/\ movbe_enabled /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0
16777216 /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 6 va_s0) (va_get_reg64 rR14 va_s0) in0_b (in0_count `op_Multiply` 6) 6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp
va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64
/\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 15 va_s0 ==
FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx
va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9
va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256
==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15
va_s0)) /\ FStar.Seq.Base.length #quad32 data == 6 /\ hkeys_b_powers hkeys_b
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\
scratch_b_data true true scratch_b 8 5 (va_get_mem_heaplet 3 va_s0) (va_get_mem_layout va_s0)
(va_get_reg64 rRbp va_s0) data /\ va_get_xmm 7 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data 5) /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_s0))) == prev)))
(ensures (fun (va_sM, va_fM, init) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in
Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 1 8 /\ Vale.X64.Decls.modifies_buffer_specific128 iv_b
(va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) 0 0 /\ (0 <= va_get_reg64 rRbx va_sM
/\ va_get_reg64 rRbx va_sM < 256) /\ va_get_reg64 rRbx va_sM ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256
/\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM,
va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys
(Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64 rR13 va_sM ==
Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ va_get_reg64 rR12 va_sM ==
Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_sM,
va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3
va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor rk
(Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)))
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\
Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 5) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 3
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 4) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 4 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 3) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 5
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 2) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 6 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 1) (va_get_mem_heaplet 6 va_s0)) /\ init == make_six_of #quad32 (fun
(n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE n)) (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys
0)) /\ (let eventual_Xi = add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_sM)))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)) in
eventual_Xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data))))) /\ va_state_eq va_sM (va_update_flags
va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM (va_update_xmm 15 va_sM
(va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM
(va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM
(va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM
(va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13
va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Loop6x_partial (alg:algorithm) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(count:nat) (in0_count:nat) (iv_b:buffer128) (in0_b:buffer128) (in_b:buffer128)
(scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128)
(hkeys_b:buffer128) (ctr_BE:quad32) (va_s0:va_state) (va_k:(va_state -> quad32_6 -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in sse_enabled
/\ movbe_enabled /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0
16777216 /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 6 va_s0) (va_get_reg64 rR14 va_s0) in0_b (in0_count `op_Multiply` 6) 6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp
va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64
/\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 15 va_s0 ==
FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx
va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9
va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256
==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15
va_s0)) /\ FStar.Seq.Base.length #quad32 data == 6 /\ hkeys_b_powers hkeys_b
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\
scratch_b_data true true scratch_b 8 5 (va_get_mem_heaplet 3 va_s0) (va_get_mem_layout va_s0)
(va_get_reg64 rRbp va_s0) data /\ va_get_xmm 7 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data 5) /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_s0))) == prev) /\ (forall (va_x_mem:vale_heap) (va_x_rbx:nat64)
(va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32)
(va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32)
(va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32)
(va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32)
(va_x_xmm15:quad32) (va_x_heap2:vale_heap) (va_x_heap3:vale_heap) (va_x_efl:Vale.X64.Flags.t)
(init:quad32_6) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 3 va_x_heap3
(va_upd_mem_heaplet 2 va_x_heap2 (va_upd_xmm 15 va_x_xmm15 (va_upd_xmm 14 va_x_xmm14
(va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10
va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm
6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm
2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR13 va_x_r13
(va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRbx va_x_rbx (va_upd_mem
va_x_mem va_s0))))))))))))))))))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in Vale.X64.Decls.modifies_buffer_specific128
scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 1 8 /\
Vale.X64.Decls.modifies_buffer_specific128 iv_b (va_get_mem_heaplet 2 va_s0)
(va_get_mem_heaplet 2 va_sM) 0 0 /\ (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM <
256) /\ va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0
(Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256 /\ (va_get_xmm 9 va_sM, va_get_xmm 10
va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) ==
rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64 rR13 va_sM
== Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 (Vale.X64.Decls.buffer128_read
in0_b (in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ va_get_reg64 rR12 va_sM
== Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 (Vale.X64.Decls.buffer128_read
in0_b (in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_sM,
va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3
va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor rk
(Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)))
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\
Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 5) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 3
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 4) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 4 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 3) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 5
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 2) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 6 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 1) (va_get_mem_heaplet 6 va_s0)) /\ init == make_six_of #quad32 (fun
(n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE n)) (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys
0)) /\ (let eventual_Xi = add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_sM)))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)) in
eventual_Xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data))))) ==> va_k va_sM ((init))))
val va_wpProof_Loop6x_partial : alg:algorithm -> h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32)
-> count:nat -> in0_count:nat -> iv_b:buffer128 -> in0_b:buffer128 -> in_b:buffer128 ->
scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128 -> ctr_BE:quad32 -> va_s0:va_state -> va_k:(va_state -> quad32_6 -> Type0)
-> Ghost (va_state & va_fuel & quad32_6)
(requires (va_t_require va_s0 /\ va_wp_Loop6x_partial alg h_LE y_prev data count in0_count iv_b
in0_b in_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_partial alg) ([va_Mod_flags;
va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13;
va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_mem])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop6x_partial (alg:algorithm) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(count:nat) (in0_count:nat) (iv_b:buffer128) (in0_b:buffer128) (in_b:buffer128)
(scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) | false | false | Vale.AES.X64.AESopt.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_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)) | [] | Vale.AES.X64.AESopt.va_quick_Loop6x_partial | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
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) | {
"end_col": 48,
"end_line": 646,
"start_col": 2,
"start_line": 639
} |
Prims.Tot | 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 | [
{
"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
}
] | false | 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_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 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 = | false | null | false | (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 (()))) | {
"checked_file": "Vale.AES.X64.AESopt.fsti.checked",
"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"
} | [
"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"
] | [] | 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)) | false | true | Vale.AES.X64.AESopt.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_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 | [] | Vale.AES.X64.AESopt.va_wp_Loop6x_final | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
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 | {
"end_col": 34,
"end_line": 259,
"start_col": 2,
"start_line": 217
} |
Prims.Tot | val va_quick_Loop6x
(alg: algorithm)
(h_LE y_orig y_prev: quad32)
(count: nat)
(iv_b in0_b in_b out_b scratch_b: buffer128)
(plain_quads: (seq quad32))
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(ctr_BE_orig ctr_BE: quad32)
: (va_quickCode quad32 (va_code_Loop6x alg)) | [
{
"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
}
] | false | let va_quick_Loop6x (alg:algorithm) (h_LE:quad32) (y_orig:quad32) (y_prev:quad32) (count:nat)
(iv_b:buffer128) (in0_b:buffer128) (in_b:buffer128) (out_b:buffer128) (scratch_b:buffer128)
(plain_quads:(seq quad32)) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128)
(hkeys_b:buffer128) (ctr_BE_orig:quad32) (ctr_BE:quad32) : (va_quickCode quad32 (va_code_Loop6x
alg)) =
(va_QProc (va_code_Loop6x alg) ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2;
va_Mod_mem_heaplet 6; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm
11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR14;
va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_reg64 rRdx;
va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_mem]) (va_wp_Loop6x alg h_LE y_orig y_prev count
iv_b in0_b in_b out_b scratch_b plain_quads key_words round_keys keys_b hkeys_b ctr_BE_orig
ctr_BE) (va_wpProof_Loop6x alg h_LE y_orig y_prev count iv_b in0_b in_b out_b scratch_b
plain_quads key_words round_keys keys_b hkeys_b ctr_BE_orig ctr_BE)) | val va_quick_Loop6x
(alg: algorithm)
(h_LE y_orig y_prev: quad32)
(count: nat)
(iv_b in0_b in_b out_b scratch_b: buffer128)
(plain_quads: (seq quad32))
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(ctr_BE_orig ctr_BE: quad32)
: (va_quickCode quad32 (va_code_Loop6x alg))
let va_quick_Loop6x
(alg: algorithm)
(h_LE y_orig y_prev: quad32)
(count: nat)
(iv_b in0_b in_b out_b scratch_b: buffer128)
(plain_quads: (seq quad32))
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(ctr_BE_orig ctr_BE: quad32)
: (va_quickCode quad32 (va_code_Loop6x alg)) = | false | null | false | (va_QProc (va_code_Loop6x alg)
([
va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 6;
va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10;
va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4;
va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR14; va_Mod_reg64 rR13;
va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_reg64 rRdx;
va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_mem
])
(va_wp_Loop6x alg h_LE y_orig y_prev count iv_b in0_b in_b out_b scratch_b plain_quads key_words
round_keys keys_b hkeys_b ctr_BE_orig ctr_BE)
(va_wpProof_Loop6x alg h_LE y_orig y_prev count iv_b in0_b in_b out_b scratch_b plain_quads
key_words round_keys keys_b hkeys_b ctr_BE_orig ctr_BE)) | {
"checked_file": "Vale.AES.X64.AESopt.fsti.checked",
"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"
} | [
"total"
] | [
"Vale.AES.AES_common_s.algorithm",
"Vale.X64.Decls.quad32",
"Prims.nat",
"Vale.X64.Memory.buffer128",
"FStar.Seq.Base.seq",
"Vale.X64.Memory.nat32",
"Vale.X64.QuickCode.va_QProc",
"Vale.AES.X64.AESopt.va_code_Loop6x",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_mem_heaplet",
"Vale.X64.QuickCode.va_Mod_xmm",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR14",
"Vale.X64.Machine_s.rR13",
"Vale.X64.Machine_s.rR12",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRsi",
"Vale.X64.Machine_s.rRdi",
"Vale.X64.QuickCode.va_Mod_mem",
"Prims.Nil",
"Vale.AES.X64.AESopt.va_wp_Loop6x",
"Vale.AES.X64.AESopt.va_wpProof_Loop6x",
"Vale.X64.QuickCode.va_quickCode"
] | [] | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let aes_reqs0
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ pclmulqdq_enabled /\ avx_enabled /\
alg = AES_128 /\
//(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
buffer128_as_seq heap0 keys_b == round_keys
let aes_reqs_offset
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ avx_enabled /\ pclmulqdq_enabled /\
(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
s128 heap0 keys_b == round_keys
let six_of (a:Type0) = a & a & a & a & a & a
let quad32_6 = six_of quad32
unfold let make_six_of (#a:Type0) (f:(n:nat{n < 6}) -> GTot a) : GTot (six_of a) =
(f 0, f 1, f 2, f 3, f 4, f 5)
unfold let map_six_of (#a #b:Type0) (x:six_of a) (f:a -> GTot b) : GTot (six_of b) =
let (x0, x1, x2, x3, x4, x5) = x in
(f x0, f x1, f x2, f x3, f x4, f x5)
unfold let map2_six_of (#a #b #c:Type0) (x:six_of a) (y:six_of b) (f:a -> b -> GTot c) : GTot (six_of c) =
let (x0, x1, x2, x3, x4, x5) = x in
let (y0, y1, y2, y3, y4, y5) = y in
(f x0 y0, f x1 y1, f x2 y2, f x3 y3, f x4 y4, f x5 y5)
let rounds_opaque_6 (init:quad32_6) (round_keys:seq quad32) (rnd:nat{rnd < length round_keys}) : GTot quad32_6 =
map_six_of init (fun x -> eval_rounds x round_keys rnd)
let xor_reverse_inc32lite_6 (n i0:int) (ctr_BE rndkey:quad32) : GTot quad32_6 =
make_six_of (fun i ->
let r = reverse_bytes_quad32 (inc32lite ctr_BE (i0 + i)) in
if i < n then quad32_xor r rndkey else r)
//let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
// count * 6 + 6 <= length s /\ (
// let data = slice s (count * 6) (count * 6 + 6) in
// z3 == reverse_bytes_quad32 (index data 5) /\
// scratch_b_blocks true true scratch_b 8 5 heap3 data)
let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
count * 6 + 6 <= length s /\ (
let data = slice s (count * 6) (count * 6 + 6) in
z3 == reverse_bytes_quad32 (index data 5) /\
buffer128_read scratch_b 3 heap3 == reverse_bytes_quad32 (index data 4) /\
buffer128_read scratch_b 4 heap3 == reverse_bytes_quad32 (index data 3) /\
buffer128_read scratch_b 5 heap3 == reverse_bytes_quad32 (index data 2) /\
buffer128_read scratch_b 6 heap3 == reverse_bytes_quad32 (index data 1) /\
buffer128_read scratch_b 7 heap3 == reverse_bytes_quad32 (index data 0))
//-- Load_two_lsb
val va_code_Load_two_lsb : dst:va_operand_xmm -> Tot va_code
val va_codegen_success_Load_two_lsb : dst:va_operand_xmm -> Tot va_pbool
val va_lemma_Load_two_lsb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_two_lsb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@ va_qattr]
let va_wp_Load_two_lsb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 ==> va_k va_sM (())))
val va_wpProof_Load_two_lsb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_two_lsb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_two_lsb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Load_two_lsb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_two_lsb dst)) =
(va_QProc (va_code_Load_two_lsb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_two_lsb dst) (va_wpProof_Load_two_lsb dst))
//--
//-- Load_one_lsb
val va_code_Load_one_lsb : dst:va_operand_xmm -> Tot va_code
val va_codegen_success_Load_one_lsb : dst:va_operand_xmm -> Tot va_pbool
val va_lemma_Load_one_lsb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_one_lsb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@ va_qattr]
let va_wp_Load_one_lsb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 ==> va_k va_sM (())))
val va_wpProof_Load_one_lsb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_one_lsb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_one_lsb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Load_one_lsb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_one_lsb dst)) =
(va_QProc (va_code_Load_one_lsb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_one_lsb dst) (va_wpProof_Load_one_lsb dst))
//--
//-- Loop6x_final
val va_code_Loop6x_final : alg:algorithm -> Tot va_code
val va_codegen_success_Loop6x_final : alg:algorithm -> Tot va_pbool
val va_lemma_Loop6x_final : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> iv_b:buffer128 ->
scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
ctr_orig:quad32 -> init:quad32_6 -> ctrs:quad32_6 -> plain:quad32_6 -> inb:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop6x_final alg) va_s0 /\ va_get_ok va_s0 /\
(sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validDstAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0)
Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\ va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\
aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0
va_s0) (va_get_mem_layout va_s0) /\ init == map_six_of #quad32 #quad32 ctrs (fun (c:quad32) ->
Vale.Def.Types_s.quad32_xor c (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0)) /\
(va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm
13 va_s0, va_get_xmm 14 va_s0) == rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg
- 1) /\ va_get_reg64 rR13 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64
inb) /\ va_get_reg64 rR12 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64
inb) /\ (let rk = FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in
(va_get_xmm 2 va_s0, va_get_xmm 0 va_s0, va_get_xmm 5 va_s0, va_get_xmm 6 va_s0, va_get_xmm 7
va_s0, va_get_xmm 3 va_s0) == map_six_of #quad32 #quad32 plain (fun (p:quad32) ->
Vale.Def.Types_s.quad32_xor rk p) /\ Vale.X64.Decls.buffer128_read scratch_b 8
(va_get_mem_heaplet 3 va_s0) == Vale.Def.Types_s.reverse_bytes_quad32 ctr_orig))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 7 7 /\ Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 inb /\ (va_get_xmm 9
va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM,
va_get_xmm 14 va_sM) == map2_six_of #quad32 #quad32 #quad32 plain ctrs (fun (p:quad32)
(c:quad32) -> Vale.Def.Types_s.quad32_xor p (Vale.AES.AES_s.aes_encrypt_LE alg key_words c)) /\
va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_reg64 rRdi va_sM ==
va_get_reg64 rRdi va_s0 + 96 /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96 /\
va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_sM == Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) /\
(let ctr = Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_orig `op_Modulus` 256 in ctr + 6 <
256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM,
va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 0 ctr_orig (va_get_xmm 15
va_sM))) /\ va_state_eq va_sM (va_update_mem_heaplet 3 va_sM (va_update_flags va_sM
(va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM
(va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 7 va_sM
(va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12
va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Loop6x_final (alg:algorithm) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (ctr_orig:quad32) (init:quad32_6)
(ctrs:quad32_6) (plain:quad32_6) (inb:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0))
: Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 2 va_s0)
(va_get_reg64 rR8 va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0)
scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\
va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\ aes_reqs_offset alg key_words round_keys keys_b
(va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ init ==
map_six_of #quad32 #quad32 ctrs (fun (c:quad32) -> Vale.Def.Types_s.quad32_xor c
(FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0)) /\ (va_get_xmm 9 va_s0,
va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm
14 va_s0) == rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64
rR13 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 inb) /\ va_get_reg64
rR12 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 inb) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_s0,
va_get_xmm 0 va_s0, va_get_xmm 5 va_s0, va_get_xmm 6 va_s0, va_get_xmm 7 va_s0, va_get_xmm 3
va_s0) == map_six_of #quad32 #quad32 plain (fun (p:quad32) -> Vale.Def.Types_s.quad32_xor rk p)
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) ==
Vale.Def.Types_s.reverse_bytes_quad32 ctr_orig)) /\ (forall (va_x_mem:vale_heap)
(va_x_rdi:nat64) (va_x_rsi:nat64) (va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm5:quad32)
(va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32)
(va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32)
(va_x_xmm15:quad32) (va_x_efl:Vale.X64.Flags.t) (va_x_heap3:vale_heap) . let va_sM =
va_upd_mem_heaplet 3 va_x_heap3 (va_upd_flags va_x_efl (va_upd_xmm 15 va_x_xmm15 (va_upd_xmm 14
va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11
(va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6
va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1
va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR13 va_x_r13 (va_upd_reg64 rR12 va_x_r12
(va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRsi va_x_rsi (va_upd_reg64 rRdi va_x_rdi (va_upd_mem
va_x_mem va_s0))))))))))))))))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 7 7 /\ Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 inb /\ (va_get_xmm 9
va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM,
va_get_xmm 14 va_sM) == map2_six_of #quad32 #quad32 #quad32 plain ctrs (fun (p:quad32)
(c:quad32) -> Vale.Def.Types_s.quad32_xor p (Vale.AES.AES_s.aes_encrypt_LE alg key_words c)) /\
va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_reg64 rRdi va_sM ==
va_get_reg64 rRdi va_s0 + 96 /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96 /\
va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_sM == Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) /\
(let ctr = Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_orig `op_Modulus` 256 in ctr + 6 <
256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM,
va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 0 ctr_orig (va_get_xmm 15
va_sM))) ==> va_k va_sM (())))
val va_wpProof_Loop6x_final : alg:algorithm -> iv_b:buffer128 -> scratch_b:buffer128 ->
key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> ctr_orig:quad32 ->
init:quad32_6 -> ctrs:quad32_6 -> plain:quad32_6 -> inb:quad32 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop6x_final alg iv_b scratch_b key_words round_keys
keys_b ctr_orig init ctrs plain inb va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_final alg) ([va_Mod_mem_heaplet
3; va_Mod_flags; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11;
va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm
2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11;
va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop6x_final (alg:algorithm) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (ctr_orig:quad32) (init:quad32_6)
(ctrs:quad32_6) (plain:quad32_6) (inb:quad32) : (va_quickCode unit (va_code_Loop6x_final alg)) =
(va_QProc (va_code_Loop6x_final alg) ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 15;
va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRsi; va_Mod_reg64
rRdi; va_Mod_mem]) (va_wp_Loop6x_final alg iv_b scratch_b key_words round_keys keys_b ctr_orig
init ctrs plain inb) (va_wpProof_Loop6x_final alg iv_b scratch_b key_words round_keys keys_b
ctr_orig init ctrs plain inb))
//--
//-- Loop6x_save_output
val va_code_Loop6x_save_output : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop6x_save_output : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop6x_save_output : va_b0:va_code -> va_s0:va_state -> count:nat -> out_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop6x_save_output ()) va_s0 /\ va_get_ok va_s0 /\
(avx_enabled /\ sse_enabled /\ Vale.X64.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rRsi va_s0 - 96) out_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0)
Secret)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) (count `op_Multiply` 6 + 0) (count `op_Multiply` 6 + 5) /\
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 6 va_sM) out_b) 0 (6 `op_Multiply` count) == FStar.Seq.Base.slice
#Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 6 va_s0) out_b) 0
(6 `op_Multiply` count) /\ (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0,
va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == make_six_of #quad32 (fun
(i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read out_b (count `op_Multiply` 6 + i)
(va_get_mem_heaplet 6 va_sM)) /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM,
va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == (Vale.Def.Types_s.quad32_xor
(va_get_xmm 1 va_sM) (va_get_xmm 15 va_sM), va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm
6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM)) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_mem_heaplet 6 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm
12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0))))))))))))
[@ va_qattr]
let va_wp_Loop6x_save_output (count:nat) (out_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit
-> Type0)) : Type0 =
(va_get_ok va_s0 /\ (avx_enabled /\ sse_enabled /\ Vale.X64.Decls.validDstAddrsOffset128
(va_get_mem_heaplet 6 va_s0) (va_get_reg64 rRsi va_s0 - 96) out_b (count `op_Multiply` 6) 6
(va_get_mem_layout va_s0) Secret) /\ (forall (va_x_mem:vale_heap) (va_x_xmm9:quad32)
(va_x_xmm10:quad32) (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32)
(va_x_xmm14:quad32) (va_x_heap6:vale_heap) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_mem_heaplet 6 va_x_heap6 (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13
va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10 va_x_xmm10
(va_upd_xmm 9 va_x_xmm9 (va_upd_mem va_x_mem va_s0)))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) (count `op_Multiply` 6 + 0) (count `op_Multiply` 6 + 5) /\
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 6 va_sM) out_b) 0 (6 `op_Multiply` count) == FStar.Seq.Base.slice
#Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 6 va_s0) out_b) 0
(6 `op_Multiply` count) /\ (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0,
va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == make_six_of #quad32 (fun
(i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read out_b (count `op_Multiply` 6 + i)
(va_get_mem_heaplet 6 va_sM)) /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM,
va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == (Vale.Def.Types_s.quad32_xor
(va_get_xmm 1 va_sM) (va_get_xmm 15 va_sM), va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm
6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM)) ==> va_k va_sM (())))
val va_wpProof_Loop6x_save_output : count:nat -> out_b:buffer128 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop6x_save_output count out_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_save_output ()) ([va_Mod_flags;
va_Mod_mem_heaplet 6; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm
10; va_Mod_xmm 9; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop6x_save_output (count:nat) (out_b:buffer128) : (va_quickCode unit
(va_code_Loop6x_save_output ())) =
(va_QProc (va_code_Loop6x_save_output ()) ([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_xmm 14;
va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_mem])
(va_wp_Loop6x_save_output count out_b) (va_wpProof_Loop6x_save_output count out_b))
//--
//-- Loop6x_partial
val va_code_untransformedoriginal_Loop6x_partial : alg:algorithm -> Tot va_code
val va_codegen_success_untransformedoriginal_Loop6x_partial : alg:algorithm -> Tot va_pbool
val va_lemma_untransformedoriginal_Loop6x_partial : va_b0:va_code -> va_s0:va_state ->
alg:algorithm -> h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32) -> count:nat -> in0_count:nat
-> iv_b:buffer128 -> in0_b:buffer128 -> in_b:buffer128 -> scratch_b:buffer128 -> key_words:(seq
nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE:quad32
-> Ghost (va_state & va_fuel & quad32_6)
(requires (va_require_total va_b0 (va_code_untransformedoriginal_Loop6x_partial alg) va_s0 /\
va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in sse_enabled
/\ movbe_enabled /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0
16777216 /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 6 va_s0) (va_get_reg64 rR14 va_s0) in0_b (in0_count `op_Multiply` 6) 6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp
va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64
/\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 15 va_s0 ==
FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx
va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9
va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256
==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15
va_s0)) /\ FStar.Seq.Base.length #quad32 data == 6 /\ hkeys_b_powers hkeys_b
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\
scratch_b_data true true scratch_b 8 5 (va_get_mem_heaplet 3 va_s0) (va_get_mem_layout va_s0)
(va_get_reg64 rRbp va_s0) data /\ va_get_xmm 7 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data 5) /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_s0))) == prev)))
(ensures (fun (va_sM, va_fM, init) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in
Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 1 8 /\ Vale.X64.Decls.modifies_buffer_specific128 iv_b
(va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) 0 0 /\ (0 <= va_get_reg64 rRbx va_sM
/\ va_get_reg64 rRbx va_sM < 256) /\ va_get_reg64 rRbx va_sM ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256
/\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM,
va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys
(Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64 rR13 va_sM ==
Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ va_get_reg64 rR12 va_sM ==
Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_sM,
va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3
va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor rk
(Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)))
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\
Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 5) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 3
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 4) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 4 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 3) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 5
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 2) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 6 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 1) (va_get_mem_heaplet 6 va_s0)) /\ init == make_six_of #quad32 (fun
(n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE n)) (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys
0)) /\ (let eventual_Xi = add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_sM)))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)) in
eventual_Xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data))))) /\ va_state_eq va_sM (va_update_flags
va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM (va_update_xmm 15 va_sM
(va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM
(va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM
(va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM
(va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13
va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))))
val va_transform_Loop6x_partial : alg:algorithm -> Tot va_transformation_result
val va_code_Loop6x_partial : alg:algorithm -> Tot va_code
val va_codegen_success_Loop6x_partial : alg:algorithm -> Tot va_pbool
val va_lemma_Loop6x_partial : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> h_LE:quad32 ->
y_prev:quad32 -> data:(seq quad32) -> count:nat -> in0_count:nat -> iv_b:buffer128 ->
in0_b:buffer128 -> in_b:buffer128 -> scratch_b:buffer128 -> key_words:(seq nat32) ->
round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE:quad32
-> Ghost (va_state & va_fuel & quad32_6)
(requires (va_require_total va_b0 (va_code_Loop6x_partial alg) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in sse_enabled
/\ movbe_enabled /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0
16777216 /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 6 va_s0) (va_get_reg64 rR14 va_s0) in0_b (in0_count `op_Multiply` 6) 6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp
va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64
/\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 15 va_s0 ==
FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx
va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9
va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256
==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15
va_s0)) /\ FStar.Seq.Base.length #quad32 data == 6 /\ hkeys_b_powers hkeys_b
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\
scratch_b_data true true scratch_b 8 5 (va_get_mem_heaplet 3 va_s0) (va_get_mem_layout va_s0)
(va_get_reg64 rRbp va_s0) data /\ va_get_xmm 7 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data 5) /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_s0))) == prev)))
(ensures (fun (va_sM, va_fM, init) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in
Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 1 8 /\ Vale.X64.Decls.modifies_buffer_specific128 iv_b
(va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) 0 0 /\ (0 <= va_get_reg64 rRbx va_sM
/\ va_get_reg64 rRbx va_sM < 256) /\ va_get_reg64 rRbx va_sM ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256
/\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM,
va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys
(Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64 rR13 va_sM ==
Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ va_get_reg64 rR12 va_sM ==
Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_sM,
va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3
va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor rk
(Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)))
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\
Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 5) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 3
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 4) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 4 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 3) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 5
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 2) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 6 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 1) (va_get_mem_heaplet 6 va_s0)) /\ init == make_six_of #quad32 (fun
(n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE n)) (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys
0)) /\ (let eventual_Xi = add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_sM)))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)) in
eventual_Xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data))))) /\ va_state_eq va_sM (va_update_flags
va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM (va_update_xmm 15 va_sM
(va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM
(va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM
(va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM
(va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13
va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Loop6x_partial (alg:algorithm) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(count:nat) (in0_count:nat) (iv_b:buffer128) (in0_b:buffer128) (in_b:buffer128)
(scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128)
(hkeys_b:buffer128) (ctr_BE:quad32) (va_s0:va_state) (va_k:(va_state -> quad32_6 -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in sse_enabled
/\ movbe_enabled /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0
16777216 /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 6 va_s0) (va_get_reg64 rR14 va_s0) in0_b (in0_count `op_Multiply` 6) 6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp
va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64
/\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 15 va_s0 ==
FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx
va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9
va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256
==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15
va_s0)) /\ FStar.Seq.Base.length #quad32 data == 6 /\ hkeys_b_powers hkeys_b
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\
scratch_b_data true true scratch_b 8 5 (va_get_mem_heaplet 3 va_s0) (va_get_mem_layout va_s0)
(va_get_reg64 rRbp va_s0) data /\ va_get_xmm 7 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data 5) /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_s0))) == prev) /\ (forall (va_x_mem:vale_heap) (va_x_rbx:nat64)
(va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32)
(va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32)
(va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32)
(va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32)
(va_x_xmm15:quad32) (va_x_heap2:vale_heap) (va_x_heap3:vale_heap) (va_x_efl:Vale.X64.Flags.t)
(init:quad32_6) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 3 va_x_heap3
(va_upd_mem_heaplet 2 va_x_heap2 (va_upd_xmm 15 va_x_xmm15 (va_upd_xmm 14 va_x_xmm14
(va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10
va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm
6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm
2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR13 va_x_r13
(va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRbx va_x_rbx (va_upd_mem
va_x_mem va_s0))))))))))))))))))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in Vale.X64.Decls.modifies_buffer_specific128
scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 1 8 /\
Vale.X64.Decls.modifies_buffer_specific128 iv_b (va_get_mem_heaplet 2 va_s0)
(va_get_mem_heaplet 2 va_sM) 0 0 /\ (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM <
256) /\ va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0
(Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256 /\ (va_get_xmm 9 va_sM, va_get_xmm 10
va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) ==
rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64 rR13 va_sM
== Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 (Vale.X64.Decls.buffer128_read
in0_b (in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ va_get_reg64 rR12 va_sM
== Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 (Vale.X64.Decls.buffer128_read
in0_b (in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_sM,
va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3
va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor rk
(Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)))
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\
Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 5) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 3
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 4) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 4 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 3) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 5
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 2) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 6 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 1) (va_get_mem_heaplet 6 va_s0)) /\ init == make_six_of #quad32 (fun
(n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE n)) (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys
0)) /\ (let eventual_Xi = add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_sM)))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)) in
eventual_Xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data))))) ==> va_k va_sM ((init))))
val va_wpProof_Loop6x_partial : alg:algorithm -> h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32)
-> count:nat -> in0_count:nat -> iv_b:buffer128 -> in0_b:buffer128 -> in_b:buffer128 ->
scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128 -> ctr_BE:quad32 -> va_s0:va_state -> va_k:(va_state -> quad32_6 -> Type0)
-> Ghost (va_state & va_fuel & quad32_6)
(requires (va_t_require va_s0 /\ va_wp_Loop6x_partial alg h_LE y_prev data count in0_count iv_b
in0_b in_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_partial alg) ([va_Mod_flags;
va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13;
va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_mem])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop6x_partial (alg:algorithm) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(count:nat) (in0_count:nat) (iv_b:buffer128) (in0_b:buffer128) (in_b:buffer128)
(scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128)
(hkeys_b:buffer128) (ctr_BE:quad32) : (va_quickCode quad32_6 (va_code_Loop6x_partial alg)) =
(va_QProc (va_code_Loop6x_partial alg) ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet
2; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10;
va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm
3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64
rR11; va_Mod_reg64 rRbx; va_Mod_mem]) (va_wp_Loop6x_partial alg h_LE y_prev data count
in0_count iv_b in0_b in_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE)
(va_wpProof_Loop6x_partial alg h_LE y_prev data count in0_count iv_b in0_b in_b scratch_b
key_words round_keys keys_b hkeys_b ctr_BE))
//--
#reset-options "--z3rlimit 50"
//-- Loop6x
val va_code_Loop6x : alg:algorithm -> Tot va_code
val va_codegen_success_Loop6x : alg:algorithm -> Tot va_pbool
val va_lemma_Loop6x : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> h_LE:quad32 ->
y_orig:quad32 -> y_prev:quad32 -> count:nat -> iv_b:buffer128 -> in0_b:buffer128 ->
in_b:buffer128 -> out_b:buffer128 -> scratch_b:buffer128 -> plain_quads:(seq quad32) ->
key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 ->
ctr_BE_orig:quad32 -> ctr_BE:quad32
-> Ghost (va_state & va_fuel & quad32)
(requires (va_require_total va_b0 (va_code_Loop6x alg) va_s0 /\ va_get_ok va_s0 /\ (sse_enabled
/\ movbe_enabled /\ count >= 2 /\ va_get_reg64 rRdx va_s0 >= 6 /\ va_get_xmm 2 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8 va_s0) iv_b 1
(va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rR14 va_s0) in0_b ((count - 1) `op_Multiply` 6) 6 (va_get_mem_layout
va_s0) Secret /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6 va_s0)
(va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 6 va_s0) (va_get_reg64 rRsi va_s0)
out_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0)
scratch_b 9 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ Vale.AES.GCTR.partial_seq_agreement plain_quads (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_s0) in_b) (count `op_Multiply` 6) (count `op_Multiply` 6 + 6) /\
(Vale.X64.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ in0_b == out_b /\
va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\ va_get_reg64 rR14 va_s0 + 96 < pow2_64 /\
va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\ aes_reqs_offset alg key_words round_keys keys_b
(va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm
15 va_s0 == FStar.Seq.Base.index #quad32 round_keys 0 /\ pclmulqdq_enabled /\ h_LE ==
Vale.AES.AES_s.aes_encrypt_LE alg key_words (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0
0 0 0) /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0)
hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ scratch_reqs scratch_b (count - 2)
(va_get_mem_heaplet 3 va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in0_b)
(va_get_xmm 7 va_s0) /\ y_prev == Vale.AES.GHash.ghash_incremental0 h_LE y_orig
(FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0)
in0_b) 0 ((count - 2) `op_Multiply` 6)) /\ y_prev == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 (add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8
va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_s0))))) /\ count `op_Multiply` 6 + 6 < pow2_32 /\ ctr_BE ==
Vale.AES.GCTR.inc32lite ctr_BE_orig (count `op_Multiply` 6) /\ va_get_xmm 2 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx
va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9
va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256
==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15
va_s0)) /\ Vale.AES.GCTR.gctr_partial alg (6 `op_Multiply` count) plain_quads
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) out_b) key_words ctr_BE_orig)))
(ensures (fun (va_sM, va_fM, y_new) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ ((va_get_reg64 rRdx va_sM > 0 ==> Vale.X64.Decls.modifies_buffer_specific128 out_b
(va_get_mem_heaplet 6 va_s0) (va_get_mem_heaplet 6 va_sM) (count `op_Multiply` 6 + 0) (count
`op_Multiply` 6 + 5)) /\ (va_get_reg64 rRdx va_sM == 0 ==> va_get_mem_heaplet 6 va_sM ==
va_get_mem_heaplet 6 va_s0) /\ Vale.X64.Decls.modifies_buffer_specific128 scratch_b
(va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 1 8 /\
Vale.X64.Decls.modifies_buffer_specific128 iv_b (va_get_mem_heaplet 2 va_s0)
(va_get_mem_heaplet 2 va_sM) 0 0 /\ va_get_reg64 rRdx va_sM == va_get_reg64 rRdx va_s0 - 6 /\
va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0 + 96 /\ va_get_reg64 rR14 va_sM ==
va_get_reg64 rR14 va_s0 + 96 /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96 /\
va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_sM ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\ (let z3' = (if
(va_get_reg64 rRdx va_sM = 0) then va_get_xmm 7 va_sM else
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 10)) in (va_get_reg64
rRbx va_sM + 6 < 256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM,
va_get_xmm 6 va_sM, z3', va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 6 ctr_BE (va_get_xmm
15 va_sM)) /\ va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0
(Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256 /\ (va_get_reg64 rRdx va_sM == 0 ==>
Vale.AES.GCTR.gctr_registers (va_get_xmm 9 va_sM) (va_get_xmm 10 va_sM) (va_get_xmm 11 va_sM)
(va_get_xmm 12 va_sM) (va_get_xmm 13 va_sM) (va_get_xmm 14 va_sM) plain_quads alg key_words
ctr_BE_orig count) /\ (let inout4' = (if (va_get_reg64 rRbx va_sM + 6 < 256) then
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 10) else va_get_xmm 13
va_sM) in (va_get_reg64 rRdx va_sM > 0 ==> (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm
11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) ==
(Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite
ctr_BE 6)) (va_get_xmm 15 va_sM), va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM,
inout4', va_get_xmm 3 va_sM)) /\ (va_get_reg64 rRdx va_sM > 0 ==> make_six_of
#Vale.X64.Decls.quad32 (fun (i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read out_b
(count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)) == make_six_of #Vale.X64.Decls.quad32
(fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.X64.Decls.buffer128_read in_b
(count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_s0)) (Vale.AES.GCTR.aes_encrypt_BE alg
key_words (Vale.AES.GCTR.inc32lite ctr_BE i)))) /\ (va_get_reg64 rRdx va_sM > 0 ==>
Vale.AES.GCTR.gctr_partial alg (6 `op_Multiply` (count + 1)) plain_quads (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_sM) out_b) key_words ctr_BE_orig) /\ y_new ==
Vale.AES.GHash.ghash_incremental0 h_LE y_orig (FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) in0_b) 0 ((count - 1) `op_Multiply` 6)) /\
(va_get_reg64 rRdx va_sM > 0 ==> y_new == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 (add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8
va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_sM)))))) /\ (va_get_reg64 rRdx va_sM == 0 ==> va_get_xmm 8 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 y_new) /\ (va_get_reg64 rRdx va_sM > 0 ==> scratch_reqs
scratch_b (count - 1) (va_get_mem_heaplet 3 va_sM) (Vale.X64.Decls.s128 (va_get_mem_heaplet 6
va_s0) in0_b) (va_get_xmm 7 va_sM)) /\ (va_get_reg64 rRdx va_sM == 0 ==> scratch_reqs scratch_b
(count - 1) (va_get_mem_heaplet 3 va_sM) (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0)
in0_b) (Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM)))))) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet
2 va_sM (va_update_mem_heaplet 6 va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM
(va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM
(va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM
(va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13
va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Loop6x (alg:algorithm) (h_LE:quad32) (y_orig:quad32) (y_prev:quad32) (count:nat)
(iv_b:buffer128) (in0_b:buffer128) (in_b:buffer128) (out_b:buffer128) (scratch_b:buffer128)
(plain_quads:(seq quad32)) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128)
(hkeys_b:buffer128) (ctr_BE_orig:quad32) (ctr_BE:quad32) (va_s0:va_state) (va_k:(va_state ->
quad32 -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ movbe_enabled /\ count >= 2 /\ va_get_reg64 rRdx va_s0 >= 6
/\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8 va_s0) iv_b 1
(va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rR14 va_s0) in0_b ((count - 1) `op_Multiply` 6) 6 (va_get_mem_layout
va_s0) Secret /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6 va_s0)
(va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 6 va_s0) (va_get_reg64 rRsi va_s0)
out_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0)
scratch_b 9 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ Vale.AES.GCTR.partial_seq_agreement plain_quads (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_s0) in_b) (count `op_Multiply` 6) (count `op_Multiply` 6 + 6) /\
(Vale.X64.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ in0_b == out_b /\
va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\ va_get_reg64 rR14 va_s0 + 96 < pow2_64 /\
va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\ aes_reqs_offset alg key_words round_keys keys_b
(va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm
15 va_s0 == FStar.Seq.Base.index #quad32 round_keys 0 /\ pclmulqdq_enabled /\ h_LE ==
Vale.AES.AES_s.aes_encrypt_LE alg key_words (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0
0 0 0) /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0)
hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ scratch_reqs scratch_b (count - 2)
(va_get_mem_heaplet 3 va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in0_b)
(va_get_xmm 7 va_s0) /\ y_prev == Vale.AES.GHash.ghash_incremental0 h_LE y_orig
(FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0)
in0_b) 0 ((count - 2) `op_Multiply` 6)) /\ y_prev == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 (add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8
va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_s0))))) /\ count `op_Multiply` 6 + 6 < pow2_32 /\ ctr_BE ==
Vale.AES.GCTR.inc32lite ctr_BE_orig (count `op_Multiply` 6) /\ va_get_xmm 2 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx
va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9
va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256
==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15
va_s0)) /\ Vale.AES.GCTR.gctr_partial alg (6 `op_Multiply` count) plain_quads
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) out_b) key_words ctr_BE_orig) /\ (forall
(va_x_mem:vale_heap) (va_x_rdi:nat64) (va_x_rsi:nat64) (va_x_rdx:nat64) (va_x_rbx:nat64)
(va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64) (va_x_r14:nat64) (va_x_xmm0:quad32)
(va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32)
(va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32)
(va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32)
(va_x_xmm15:quad32) (va_x_heap6:vale_heap) (va_x_heap2:vale_heap) (va_x_heap3:vale_heap)
(va_x_efl:Vale.X64.Flags.t) (y_new:quad32) . let va_sM = va_upd_flags va_x_efl
(va_upd_mem_heaplet 3 va_x_heap3 (va_upd_mem_heaplet 2 va_x_heap2 (va_upd_mem_heaplet 6
va_x_heap6 (va_upd_xmm 15 va_x_xmm15 (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13 va_x_xmm13
(va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9
va_x_xmm9 (va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5
va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1
va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR14 va_x_r14 (va_upd_reg64 rR13 va_x_r13
(va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRsi va_x_rsi (va_upd_reg64 rRdi va_x_rdi (va_upd_mem
va_x_mem va_s0)))))))))))))))))))))))))))) in va_get_ok va_sM /\ ((va_get_reg64 rRdx va_sM > 0
==> Vale.X64.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) (count `op_Multiply` 6 + 0) (count `op_Multiply` 6 + 5)) /\
(va_get_reg64 rRdx va_sM == 0 ==> va_get_mem_heaplet 6 va_sM == va_get_mem_heaplet 6 va_s0) /\
Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 1 8 /\ Vale.X64.Decls.modifies_buffer_specific128 iv_b
(va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) 0 0 /\ va_get_reg64 rRdx va_sM ==
va_get_reg64 rRdx va_s0 - 6 /\ va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0 + 96 /\
va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0 + 96 /\ va_get_reg64 rRsi va_sM ==
va_get_reg64 rRsi va_s0 + 96 /\ va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys
0 /\ va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6)
/\ (let z3' = va_if (va_get_reg64 rRdx va_sM = 0) (fun _ -> va_get_xmm 7 va_sM) (fun _ ->
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 10)) in (va_get_reg64
rRbx va_sM + 6 < 256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM,
va_get_xmm 6 va_sM, z3', va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 6 ctr_BE (va_get_xmm
15 va_sM)) /\ va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0
(Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256 /\ (va_get_reg64 rRdx va_sM == 0 ==>
Vale.AES.GCTR.gctr_registers (va_get_xmm 9 va_sM) (va_get_xmm 10 va_sM) (va_get_xmm 11 va_sM)
(va_get_xmm 12 va_sM) (va_get_xmm 13 va_sM) (va_get_xmm 14 va_sM) plain_quads alg key_words
ctr_BE_orig count) /\ (let inout4' = va_if (va_get_reg64 rRbx va_sM + 6 < 256) (fun _ ->
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 10)) (fun _ -> va_get_xmm
13 va_sM) in (va_get_reg64 rRdx va_sM > 0 ==> (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM,
va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) ==
(Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite
ctr_BE 6)) (va_get_xmm 15 va_sM), va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM,
inout4', va_get_xmm 3 va_sM)) /\ (va_get_reg64 rRdx va_sM > 0 ==> make_six_of
#Vale.X64.Decls.quad32 (fun (i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read out_b
(count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)) == make_six_of #Vale.X64.Decls.quad32
(fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.X64.Decls.buffer128_read in_b
(count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_s0)) (Vale.AES.GCTR.aes_encrypt_BE alg
key_words (Vale.AES.GCTR.inc32lite ctr_BE i)))) /\ (va_get_reg64 rRdx va_sM > 0 ==>
Vale.AES.GCTR.gctr_partial alg (6 `op_Multiply` (count + 1)) plain_quads (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_sM) out_b) key_words ctr_BE_orig) /\ y_new ==
Vale.AES.GHash.ghash_incremental0 h_LE y_orig (FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) in0_b) 0 ((count - 1) `op_Multiply` 6)) /\
(va_get_reg64 rRdx va_sM > 0 ==> y_new == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 (add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8
va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_sM)))))) /\ (va_get_reg64 rRdx va_sM == 0 ==> va_get_xmm 8 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 y_new) /\ (va_get_reg64 rRdx va_sM > 0 ==> scratch_reqs
scratch_b (count - 1) (va_get_mem_heaplet 3 va_sM) (Vale.X64.Decls.s128 (va_get_mem_heaplet 6
va_s0) in0_b) (va_get_xmm 7 va_sM)) /\ (va_get_reg64 rRdx va_sM == 0 ==> scratch_reqs scratch_b
(count - 1) (va_get_mem_heaplet 3 va_sM) (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0)
in0_b) (Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM)))))) ==> va_k
va_sM ((y_new))))
val va_wpProof_Loop6x : alg:algorithm -> h_LE:quad32 -> y_orig:quad32 -> y_prev:quad32 -> count:nat
-> iv_b:buffer128 -> in0_b:buffer128 -> in_b:buffer128 -> out_b:buffer128 -> scratch_b:buffer128
-> plain_quads:(seq quad32) -> key_words:(seq nat32) -> round_keys:(seq quad32) ->
keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE_orig:quad32 -> ctr_BE:quad32 -> va_s0:va_state ->
va_k:(va_state -> quad32 -> Type0)
-> Ghost (va_state & va_fuel & quad32)
(requires (va_t_require va_s0 /\ va_wp_Loop6x alg h_LE y_orig y_prev count iv_b in0_b in_b out_b
scratch_b plain_quads key_words round_keys keys_b hkeys_b ctr_BE_orig ctr_BE va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x alg) ([va_Mod_flags;
va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 6; va_Mod_xmm 15; va_Mod_xmm 14;
va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11;
va_Mod_reg64 rRbx; va_Mod_reg64 rRdx; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_mem]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop6x (alg:algorithm) (h_LE:quad32) (y_orig:quad32) (y_prev:quad32) (count:nat)
(iv_b:buffer128) (in0_b:buffer128) (in_b:buffer128) (out_b:buffer128) (scratch_b:buffer128)
(plain_quads:(seq quad32)) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128)
(hkeys_b:buffer128) (ctr_BE_orig:quad32) (ctr_BE:quad32) : (va_quickCode quad32 (va_code_Loop6x | false | false | Vale.AES.X64.AESopt.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_quick_Loop6x
(alg: algorithm)
(h_LE y_orig y_prev: quad32)
(count: nat)
(iv_b in0_b in_b out_b scratch_b: buffer128)
(plain_quads: (seq quad32))
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(ctr_BE_orig ctr_BE: quad32)
: (va_quickCode quad32 (va_code_Loop6x alg)) | [] | Vale.AES.X64.AESopt.va_quick_Loop6x | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
alg: Vale.AES.AES_common_s.algorithm ->
h_LE: Vale.X64.Decls.quad32 ->
y_orig: Vale.X64.Decls.quad32 ->
y_prev: Vale.X64.Decls.quad32 ->
count: Prims.nat ->
iv_b: Vale.X64.Memory.buffer128 ->
in0_b: Vale.X64.Memory.buffer128 ->
in_b: Vale.X64.Memory.buffer128 ->
out_b: Vale.X64.Memory.buffer128 ->
scratch_b: Vale.X64.Memory.buffer128 ->
plain_quads: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
key_words: FStar.Seq.Base.seq Vale.X64.Memory.nat32 ->
round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
keys_b: Vale.X64.Memory.buffer128 ->
hkeys_b: Vale.X64.Memory.buffer128 ->
ctr_BE_orig: Vale.X64.Decls.quad32 ->
ctr_BE: Vale.X64.Decls.quad32
-> Vale.X64.QuickCode.va_quickCode Vale.X64.Decls.quad32 (Vale.AES.X64.AESopt.va_code_Loop6x alg) | {
"end_col": 72,
"end_line": 896,
"start_col": 2,
"start_line": 888
} |
Prims.Tot | val va_wp_Loop6x_partial
(alg: algorithm)
(h_LE y_prev: quad32)
(data: (seq quad32))
(count in0_count: nat)
(iv_b in0_b in_b scratch_b: buffer128)
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(ctr_BE: quad32)
(va_s0: va_state)
(va_k: (va_state -> quad32_6 -> Type0))
: Type0 | [
{
"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
}
] | false | 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_wp_Loop6x_partial
(alg: algorithm)
(h_LE y_prev: quad32)
(data: (seq quad32))
(count in0_count: nat)
(iv_b in0_b in_b scratch_b: buffer128)
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(ctr_BE: quad32)
(va_s0: va_state)
(va_k: (va_state -> quad32_6 -> Type0))
: Type0
let va_wp_Loop6x_partial
(alg: algorithm)
(h_LE y_prev: quad32)
(data: (seq quad32))
(count in0_count: nat)
(iv_b in0_b in_b scratch_b: buffer128)
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(ctr_BE: quad32)
(va_s0: va_state)
(va_k: (va_state -> quad32_6 -> Type0))
: Type0 = | false | null | false | (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)))) | {
"checked_file": "Vale.AES.X64.AESopt.fsti.checked",
"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"
} | [
"total"
] | [
"Vale.AES.AES_common_s.algorithm",
"Vale.X64.Decls.quad32",
"FStar.Seq.Base.seq",
"Prims.nat",
"Vale.X64.Memory.buffer128",
"Vale.X64.Memory.nat32",
"Vale.X64.Decls.va_state",
"Vale.AES.X64.AESopt.quad32_6",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.X64.CPU_Features_s.sse_enabled",
"Vale.X64.CPU_Features_s.movbe_enabled",
"Prims.eq2",
"Vale.Def.Words_s.four",
"Vale.Def.Types_s.nat32",
"Vale.X64.Decls.va_get_xmm",
"Vale.Def.Words_s.Mkfour",
"Vale.X64.Decls.validDstAddrs128",
"Vale.X64.Decls.va_get_mem_heaplet",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rR8",
"Vale.X64.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Public",
"Vale.X64.Decls.validSrcAddrsOffset128",
"Vale.X64.Machine_s.rR14",
"Prims.op_Multiply",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.X64.Machine_s.rRdi",
"Vale.X64.Machine_s.rRbp",
"Prims.op_LessThan",
"Prims.op_Addition",
"Vale.X64.Machine_s.pow2_64",
"Vale.AES.X64.AESopt.aes_reqs_offset",
"Vale.X64.Machine_s.rRcx",
"FStar.Seq.Base.index",
"Vale.Def.Types_s.quad32",
"Vale.Def.Types_s.reverse_bytes_quad32",
"Vale.AES.GCTR.inc32lite",
"Prims.int",
"Vale.X64.Machine_s.rRbx",
"Prims.op_Modulus",
"Vale.Def.Words_s.__proj__Mkfour__item__lo0",
"Vale.Def.Types_s.quad32_xor",
"Prims.l_imp",
"FStar.Pervasives.Native.tuple6",
"FStar.Pervasives.Native.Mktuple6",
"Vale.AES.X64.AESopt.xor_reverse_inc32lite_6",
"FStar.Seq.Base.length",
"Vale.AES.X64.AESopt2.hkeys_b_powers",
"Prims.op_Subtraction",
"Vale.X64.Machine_s.rR9",
"Vale.AES.X64.AESopt2.scratch_b_data",
"Vale.AES.X64.AESopt2.va_subscript_FStar__Seq__Base__seq",
"Vale.Math.Poly2_s.poly",
"Vale.Math.Poly2_s.add",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Vale.X64.Decls.buffer128_read",
"Prims.l_Forall",
"Vale.X64.InsBasic.vale_heap",
"Vale.X64.Memory.nat64",
"Vale.X64.Flags.t",
"Vale.X64.Decls.modifies_buffer_specific128",
"Prims.op_LessThanOrEqual",
"Vale.AES.X64.AESopt.rounds_opaque_6",
"Vale.AES.AES_common_s.nr",
"Vale.Def.Types_s.nat64",
"Vale.X64.Machine_s.rR13",
"Vale.Def.Types_s.reverse_bytes_nat64",
"Vale.Arch.Types.hi64",
"Vale.X64.Machine_s.rR12",
"Vale.Arch.Types.lo64",
"Vale.AES.X64.AESopt.make_six_of",
"Vale.X64.Decls.va_int_range",
"Vale.AES.X64.AESopt.six_of",
"Vale.AES.GHash.ghash_incremental",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_mem_heaplet",
"Vale.X64.Decls.va_upd_xmm",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Decls.va_upd_mem"
] | [] | 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)) : | false | true | Vale.AES.X64.AESopt.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_wp_Loop6x_partial
(alg: algorithm)
(h_LE y_prev: quad32)
(data: (seq quad32))
(count in0_count: nat)
(iv_b in0_b in_b scratch_b: buffer128)
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(ctr_BE: quad32)
(va_s0: va_state)
(va_k: (va_state -> quad32_6 -> Type0))
: Type0 | [] | Vale.AES.X64.AESopt.va_wp_Loop6x_partial | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
alg: Vale.AES.AES_common_s.algorithm ->
h_LE: Vale.X64.Decls.quad32 ->
y_prev: Vale.X64.Decls.quad32 ->
data: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
count: Prims.nat ->
in0_count: Prims.nat ->
iv_b: Vale.X64.Memory.buffer128 ->
in0_b: Vale.X64.Memory.buffer128 ->
in_b: Vale.X64.Memory.buffer128 ->
scratch_b: Vale.X64.Memory.buffer128 ->
key_words: FStar.Seq.Base.seq Vale.X64.Memory.nat32 ->
round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
keys_b: Vale.X64.Memory.buffer128 ->
hkeys_b: Vale.X64.Memory.buffer128 ->
ctr_BE: Vale.X64.Decls.quad32 ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Vale.AES.X64.AESopt.quad32_6 -> Type0)
-> Type0 | {
"end_col": 85,
"end_line": 619,
"start_col": 2,
"start_line": 538
} |
Prims.Tot | val va_wp_Loop6x
(alg: algorithm)
(h_LE y_orig y_prev: quad32)
(count: nat)
(iv_b in0_b in_b out_b scratch_b: buffer128)
(plain_quads: (seq quad32))
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(ctr_BE_orig ctr_BE: quad32)
(va_s0: va_state)
(va_k: (va_state -> quad32 -> Type0))
: Type0 | [
{
"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
}
] | false | let va_wp_Loop6x (alg:algorithm) (h_LE:quad32) (y_orig:quad32) (y_prev:quad32) (count:nat)
(iv_b:buffer128) (in0_b:buffer128) (in_b:buffer128) (out_b:buffer128) (scratch_b:buffer128)
(plain_quads:(seq quad32)) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128)
(hkeys_b:buffer128) (ctr_BE_orig:quad32) (ctr_BE:quad32) (va_s0:va_state) (va_k:(va_state ->
quad32 -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ movbe_enabled /\ count >= 2 /\ va_get_reg64 rRdx va_s0 >= 6
/\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8 va_s0) iv_b 1
(va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rR14 va_s0) in0_b ((count - 1) `op_Multiply` 6) 6 (va_get_mem_layout
va_s0) Secret /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6 va_s0)
(va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 6 va_s0) (va_get_reg64 rRsi va_s0)
out_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0)
scratch_b 9 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ Vale.AES.GCTR.partial_seq_agreement plain_quads (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_s0) in_b) (count `op_Multiply` 6) (count `op_Multiply` 6 + 6) /\
(Vale.X64.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ in0_b == out_b /\
va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\ va_get_reg64 rR14 va_s0 + 96 < pow2_64 /\
va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\ aes_reqs_offset alg key_words round_keys keys_b
(va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm
15 va_s0 == FStar.Seq.Base.index #quad32 round_keys 0 /\ pclmulqdq_enabled /\ h_LE ==
Vale.AES.AES_s.aes_encrypt_LE alg key_words (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0
0 0 0) /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0)
hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ scratch_reqs scratch_b (count - 2)
(va_get_mem_heaplet 3 va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in0_b)
(va_get_xmm 7 va_s0) /\ y_prev == Vale.AES.GHash.ghash_incremental0 h_LE y_orig
(FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0)
in0_b) 0 ((count - 2) `op_Multiply` 6)) /\ y_prev == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 (add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8
va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_s0))))) /\ count `op_Multiply` 6 + 6 < pow2_32 /\ ctr_BE ==
Vale.AES.GCTR.inc32lite ctr_BE_orig (count `op_Multiply` 6) /\ va_get_xmm 2 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx
va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9
va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256
==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15
va_s0)) /\ Vale.AES.GCTR.gctr_partial alg (6 `op_Multiply` count) plain_quads
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) out_b) key_words ctr_BE_orig) /\ (forall
(va_x_mem:vale_heap) (va_x_rdi:nat64) (va_x_rsi:nat64) (va_x_rdx:nat64) (va_x_rbx:nat64)
(va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64) (va_x_r14:nat64) (va_x_xmm0:quad32)
(va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32)
(va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32)
(va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32)
(va_x_xmm15:quad32) (va_x_heap6:vale_heap) (va_x_heap2:vale_heap) (va_x_heap3:vale_heap)
(va_x_efl:Vale.X64.Flags.t) (y_new:quad32) . let va_sM = va_upd_flags va_x_efl
(va_upd_mem_heaplet 3 va_x_heap3 (va_upd_mem_heaplet 2 va_x_heap2 (va_upd_mem_heaplet 6
va_x_heap6 (va_upd_xmm 15 va_x_xmm15 (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13 va_x_xmm13
(va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9
va_x_xmm9 (va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5
va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1
va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR14 va_x_r14 (va_upd_reg64 rR13 va_x_r13
(va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRbx va_x_rbx
(va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRsi va_x_rsi (va_upd_reg64 rRdi va_x_rdi (va_upd_mem
va_x_mem va_s0)))))))))))))))))))))))))))) in va_get_ok va_sM /\ ((va_get_reg64 rRdx va_sM > 0
==> Vale.X64.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) (count `op_Multiply` 6 + 0) (count `op_Multiply` 6 + 5)) /\
(va_get_reg64 rRdx va_sM == 0 ==> va_get_mem_heaplet 6 va_sM == va_get_mem_heaplet 6 va_s0) /\
Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 1 8 /\ Vale.X64.Decls.modifies_buffer_specific128 iv_b
(va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) 0 0 /\ va_get_reg64 rRdx va_sM ==
va_get_reg64 rRdx va_s0 - 6 /\ va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0 + 96 /\
va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0 + 96 /\ va_get_reg64 rRsi va_sM ==
va_get_reg64 rRsi va_s0 + 96 /\ va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys
0 /\ va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6)
/\ (let z3' = va_if (va_get_reg64 rRdx va_sM = 0) (fun _ -> va_get_xmm 7 va_sM) (fun _ ->
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 10)) in (va_get_reg64
rRbx va_sM + 6 < 256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM,
va_get_xmm 6 va_sM, z3', va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 6 ctr_BE (va_get_xmm
15 va_sM)) /\ va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0
(Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256 /\ (va_get_reg64 rRdx va_sM == 0 ==>
Vale.AES.GCTR.gctr_registers (va_get_xmm 9 va_sM) (va_get_xmm 10 va_sM) (va_get_xmm 11 va_sM)
(va_get_xmm 12 va_sM) (va_get_xmm 13 va_sM) (va_get_xmm 14 va_sM) plain_quads alg key_words
ctr_BE_orig count) /\ (let inout4' = va_if (va_get_reg64 rRbx va_sM + 6 < 256) (fun _ ->
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 10)) (fun _ -> va_get_xmm
13 va_sM) in (va_get_reg64 rRdx va_sM > 0 ==> (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM,
va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) ==
(Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite
ctr_BE 6)) (va_get_xmm 15 va_sM), va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM,
inout4', va_get_xmm 3 va_sM)) /\ (va_get_reg64 rRdx va_sM > 0 ==> make_six_of
#Vale.X64.Decls.quad32 (fun (i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read out_b
(count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)) == make_six_of #Vale.X64.Decls.quad32
(fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.X64.Decls.buffer128_read in_b
(count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_s0)) (Vale.AES.GCTR.aes_encrypt_BE alg
key_words (Vale.AES.GCTR.inc32lite ctr_BE i)))) /\ (va_get_reg64 rRdx va_sM > 0 ==>
Vale.AES.GCTR.gctr_partial alg (6 `op_Multiply` (count + 1)) plain_quads (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_sM) out_b) key_words ctr_BE_orig) /\ y_new ==
Vale.AES.GHash.ghash_incremental0 h_LE y_orig (FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) in0_b) 0 ((count - 1) `op_Multiply` 6)) /\
(va_get_reg64 rRdx va_sM > 0 ==> y_new == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 (add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8
va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_sM)))))) /\ (va_get_reg64 rRdx va_sM == 0 ==> va_get_xmm 8 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 y_new) /\ (va_get_reg64 rRdx va_sM > 0 ==> scratch_reqs
scratch_b (count - 1) (va_get_mem_heaplet 3 va_sM) (Vale.X64.Decls.s128 (va_get_mem_heaplet 6
va_s0) in0_b) (va_get_xmm 7 va_sM)) /\ (va_get_reg64 rRdx va_sM == 0 ==> scratch_reqs scratch_b
(count - 1) (va_get_mem_heaplet 3 va_sM) (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0)
in0_b) (Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM)))))) ==> va_k
va_sM ((y_new)))) | val va_wp_Loop6x
(alg: algorithm)
(h_LE y_orig y_prev: quad32)
(count: nat)
(iv_b in0_b in_b out_b scratch_b: buffer128)
(plain_quads: (seq quad32))
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(ctr_BE_orig ctr_BE: quad32)
(va_s0: va_state)
(va_k: (va_state -> quad32 -> Type0))
: Type0
let va_wp_Loop6x
(alg: algorithm)
(h_LE y_orig y_prev: quad32)
(count: nat)
(iv_b in0_b in_b out_b scratch_b: buffer128)
(plain_quads: (seq quad32))
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(ctr_BE_orig ctr_BE: quad32)
(va_s0: va_state)
(va_k: (va_state -> quad32 -> Type0))
: Type0 = | false | null | false | (va_get_ok va_s0 /\
(sse_enabled /\ movbe_enabled /\ count >= 2 /\ va_get_reg64 rRdx va_s0 >= 6 /\
va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0)
(va_get_reg64 rR8 va_s0)
iv_b
1
(va_get_mem_layout va_s0)
Public /\
Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6 va_s0)
(va_get_reg64 rR14 va_s0)
in0_b
((count - 1) `op_Multiply` 6)
6
(va_get_mem_layout va_s0)
Secret /\
Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6 va_s0)
(va_get_reg64 rRdi va_s0)
in_b
(count `op_Multiply` 6)
6
(va_get_mem_layout va_s0)
Secret /\
Vale.X64.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 6 va_s0)
(va_get_reg64 rRsi va_s0)
out_b
(count `op_Multiply` 6)
6
(va_get_mem_layout va_s0)
Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0)
(va_get_reg64 rRbp va_s0)
scratch_b
9
(va_get_mem_layout va_s0)
Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg64 rR9 va_s0 - 32)
hkeys_b
8
(va_get_mem_layout va_s0)
Secret /\
Vale.AES.GCTR.partial_seq_agreement plain_quads
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in_b)
(count `op_Multiply` 6)
(count `op_Multiply` 6 + 6) /\
(Vale.X64.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ in0_b == out_b /\
va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\ va_get_reg64 rR14 va_s0 + 96 < pow2_64 /\
va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\
aes_reqs_offset alg
key_words
round_keys
keys_b
(va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0)
(va_get_mem_layout va_s0) /\ va_get_xmm 15 va_s0 == FStar.Seq.Base.index #quad32 round_keys 0 /\
pclmulqdq_enabled /\
h_LE ==
Vale.AES.AES_s.aes_encrypt_LE alg
key_words
(Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0) /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\
scratch_reqs scratch_b
(count - 2)
(va_get_mem_heaplet 3 va_s0)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in0_b)
(va_get_xmm 7 va_s0) /\
y_prev ==
Vale.AES.GHash.ghash_incremental0 h_LE
y_orig
(FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in0_b)
0
((count - 2) `op_Multiply` 6)) /\
y_prev ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.Math.Poly2.Bits_s.to_quad32 (add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0))
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b
1
(va_get_mem_heaplet 3 va_s0))))) /\ count `op_Multiply` 6 + 6 < pow2_32 /\
ctr_BE == Vale.AES.GCTR.inc32lite ctr_BE_orig (count `op_Multiply` 6) /\
va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\
va_get_reg64 rRbx va_s0 == (Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE) `op_Modulus` 256 /\
va_get_xmm 9 va_s0 ==
Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE
0))
(va_get_xmm 15 va_s0) /\
(va_get_reg64 rRbx va_s0 + 6 < 256 ==>
(va_get_xmm 9 va_s0,
va_get_xmm 10 va_s0,
va_get_xmm 11 va_s0,
va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0,
va_get_xmm 14 va_s0) ==
xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15 va_s0)) /\
Vale.AES.GCTR.gctr_partial alg
(6 `op_Multiply` count)
plain_quads
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) out_b)
key_words
ctr_BE_orig) /\
(forall (va_x_mem: vale_heap) (va_x_rdi: nat64) (va_x_rsi: nat64) (va_x_rdx: nat64)
(va_x_rbx: nat64) (va_x_r11: nat64) (va_x_r12: nat64) (va_x_r13: nat64) (va_x_r14: nat64)
(va_x_xmm0: quad32) (va_x_xmm1: quad32) (va_x_xmm2: quad32) (va_x_xmm3: quad32)
(va_x_xmm4: quad32) (va_x_xmm5: quad32) (va_x_xmm6: quad32) (va_x_xmm7: quad32)
(va_x_xmm8: quad32) (va_x_xmm9: quad32) (va_x_xmm10: quad32) (va_x_xmm11: quad32)
(va_x_xmm12: quad32) (va_x_xmm13: quad32) (va_x_xmm14: quad32) (va_x_xmm15: quad32)
(va_x_heap6: vale_heap) (va_x_heap2: vale_heap) (va_x_heap3: vale_heap)
(va_x_efl: Vale.X64.Flags.t) (y_new: quad32).
let va_sM =
va_upd_flags va_x_efl
(va_upd_mem_heaplet 3
va_x_heap3
(va_upd_mem_heaplet 2
va_x_heap2
(va_upd_mem_heaplet 6
va_x_heap6
(va_upd_xmm 15
va_x_xmm15
(va_upd_xmm 14
va_x_xmm14
(va_upd_xmm 13
va_x_xmm13
(va_upd_xmm 12
va_x_xmm12
(va_upd_xmm 11
va_x_xmm11
(va_upd_xmm 10
va_x_xmm10
(va_upd_xmm 9
va_x_xmm9
(va_upd_xmm 8
va_x_xmm8
(va_upd_xmm 7
va_x_xmm7
(va_upd_xmm 6
va_x_xmm6
(va_upd_xmm 5
va_x_xmm5
(va_upd_xmm 4
va_x_xmm4
(va_upd_xmm 3
va_x_xmm3
(va_upd_xmm 2
va_x_xmm2
(va_upd_xmm 1
va_x_xmm1
(va_upd_xmm 0
va_x_xmm0
(va_upd_reg64 rR14
va_x_r14
(va_upd_reg64
rR13
va_x_r13
(va_upd_reg64
rR12
va_x_r12
(va_upd_reg64
rR11
va_x_r11
(
va_upd_reg64
rRbx
va_x_rbx
(
va_upd_reg64
rRdx
va_x_rdx
(
va_upd_reg64
rRsi
va_x_rsi
(
va_upd_reg64
rRdi
va_x_rdi
(
va_upd_mem
va_x_mem
va_s0
)
)
)
)
)
))
))))))))))
)))))))))))
in
va_get_ok va_sM /\
((va_get_reg64 rRdx va_sM > 0 ==>
Vale.X64.Decls.modifies_buffer_specific128 out_b
(va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM)
(count `op_Multiply` 6 + 0)
(count `op_Multiply` 6 + 5)) /\
(va_get_reg64 rRdx va_sM == 0 ==> va_get_mem_heaplet 6 va_sM == va_get_mem_heaplet 6 va_s0) /\
Vale.X64.Decls.modifies_buffer_specific128 scratch_b
(va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM)
1
8 /\
Vale.X64.Decls.modifies_buffer_specific128 iv_b
(va_get_mem_heaplet 2 va_s0)
(va_get_mem_heaplet 2 va_sM)
0
0 /\ va_get_reg64 rRdx va_sM == va_get_reg64 rRdx va_s0 - 6 /\
va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0 + 96 /\
va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0 + 96 /\
va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96 /\
va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0 /\
va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\
(let z3' =
va_if (va_get_reg64 rRdx va_sM = 0)
(fun _ -> va_get_xmm 7 va_sM)
(fun _ -> Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 10))
in
(va_get_reg64 rRbx va_sM + 6 < 256 ==>
(va_get_xmm 1 va_sM,
va_get_xmm 0 va_sM,
va_get_xmm 5 va_sM,
va_get_xmm 6 va_sM,
z3',
va_get_xmm 3 va_sM) ==
xor_reverse_inc32lite_6 0 6 ctr_BE (va_get_xmm 15 va_sM)) /\
va_get_reg64 rRbx va_sM ==
(Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6))
`op_Modulus`
256 /\
(va_get_reg64 rRdx va_sM == 0 ==>
Vale.AES.GCTR.gctr_registers (va_get_xmm 9 va_sM) (va_get_xmm 10 va_sM)
(va_get_xmm 11 va_sM) (va_get_xmm 12 va_sM) (va_get_xmm 13 va_sM)
(va_get_xmm 14 va_sM) plain_quads alg key_words ctr_BE_orig count) /\
(let inout4' =
va_if (va_get_reg64 rRbx va_sM + 6 < 256)
(fun _ -> Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 10))
(fun _ -> va_get_xmm 13 va_sM)
in
(va_get_reg64 rRdx va_sM > 0 ==>
(va_get_xmm 9 va_sM,
va_get_xmm 10 va_sM,
va_get_xmm 11 va_sM,
va_get_xmm 12 va_sM,
va_get_xmm 13 va_sM,
va_get_xmm 14 va_sM) ==
(Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite
ctr_BE
6))
(va_get_xmm 15 va_sM),
va_get_xmm 0 va_sM,
va_get_xmm 5 va_sM,
va_get_xmm 6 va_sM,
inout4',
va_get_xmm 3 va_sM)) /\
(va_get_reg64 rRdx va_sM > 0 ==>
make_six_of #Vale.X64.Decls.quad32
(fun (i: (va_int_range 0 5)) ->
Vale.X64.Decls.buffer128_read out_b
(count `op_Multiply` 6 + i)
(va_get_mem_heaplet 6 va_sM)) ==
make_six_of #Vale.X64.Decls.quad32
(fun (i: (va_int_range 0 5)) ->
Vale.Def.Types_s.quad32_xor (Vale.X64.Decls.buffer128_read in_b
(count `op_Multiply` 6 + i)
(va_get_mem_heaplet 6 va_s0))
(Vale.AES.GCTR.aes_encrypt_BE alg key_words (Vale.AES.GCTR.inc32lite ctr_BE i)
))) /\
(va_get_reg64 rRdx va_sM > 0 ==>
Vale.AES.GCTR.gctr_partial alg
(6 `op_Multiply` (count + 1))
plain_quads
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) out_b)
key_words
ctr_BE_orig) /\
y_new ==
Vale.AES.GHash.ghash_incremental0 h_LE
y_orig
(FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) in0_b)
0
((count - 1) `op_Multiply` 6)) /\
(va_get_reg64 rRdx va_sM > 0 ==>
y_new ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.Math.Poly2.Bits_s.to_quad32 (add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_sM))
(Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b
1
(va_get_mem_heaplet 3 va_sM)))))) /\
(va_get_reg64 rRdx va_sM == 0 ==>
va_get_xmm 8 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 y_new) /\
(va_get_reg64 rRdx va_sM > 0 ==>
scratch_reqs scratch_b
(count - 1)
(va_get_mem_heaplet 3 va_sM)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in0_b)
(va_get_xmm 7 va_sM)) /\
(va_get_reg64 rRdx va_sM == 0 ==>
scratch_reqs scratch_b
(count - 1)
(va_get_mem_heaplet 3 va_sM)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in0_b)
(Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM)))))) ==>
va_k va_sM ((y_new)))) | {
"checked_file": "Vale.AES.X64.AESopt.fsti.checked",
"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"
} | [
"total"
] | [
"Vale.AES.AES_common_s.algorithm",
"Vale.X64.Decls.quad32",
"Prims.nat",
"Vale.X64.Memory.buffer128",
"FStar.Seq.Base.seq",
"Vale.X64.Memory.nat32",
"Vale.X64.Decls.va_state",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.X64.CPU_Features_s.sse_enabled",
"Vale.X64.CPU_Features_s.movbe_enabled",
"Prims.op_GreaterThanOrEqual",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rRdx",
"Prims.eq2",
"Vale.Def.Words_s.four",
"Vale.Def.Types_s.nat32",
"Vale.X64.Decls.va_get_xmm",
"Vale.Def.Words_s.Mkfour",
"Vale.X64.Decls.validDstAddrs128",
"Vale.X64.Decls.va_get_mem_heaplet",
"Vale.X64.Machine_s.rR8",
"Vale.X64.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Public",
"Vale.X64.Decls.validSrcAddrsOffset128",
"Vale.X64.Machine_s.rR14",
"Prims.op_Multiply",
"Prims.op_Subtraction",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.X64.Machine_s.rRdi",
"Vale.X64.Decls.validDstAddrsOffset128",
"Vale.X64.Machine_s.rRsi",
"Vale.X64.Machine_s.rRbp",
"Vale.X64.Decls.validSrcAddrs128",
"Vale.X64.Machine_s.rR9",
"Vale.AES.GCTR.partial_seq_agreement",
"Vale.X64.Decls.s128",
"Prims.op_Addition",
"Prims.l_or",
"Vale.X64.Decls.buffers_disjoint128",
"Prims.op_LessThan",
"Vale.X64.Machine_s.pow2_64",
"Vale.AES.X64.AESopt.aes_reqs_offset",
"Vale.X64.Machine_s.rRcx",
"FStar.Seq.Base.index",
"Vale.X64.CPU_Features_s.pclmulqdq_enabled",
"Vale.Def.Types_s.quad32",
"Vale.AES.AES_s.aes_encrypt_LE",
"Vale.AES.GHash.hkeys_reqs_priv",
"Vale.Def.Types_s.reverse_bytes_quad32",
"Vale.AES.X64.AESopt.scratch_reqs",
"Vale.AES.GHash.ghash_incremental0",
"FStar.Seq.Base.slice",
"Vale.Math.Poly2.Bits_s.to_quad32",
"Vale.Math.Poly2_s.add",
"Vale.Math.Poly2.Bits_s.of_quad32",
"Vale.X64.Decls.buffer128_read",
"Vale.X64.Machine_s.pow2_32",
"Vale.AES.GCTR.inc32lite",
"Prims.int",
"Vale.X64.Machine_s.rRbx",
"Prims.op_Modulus",
"Vale.Def.Words_s.__proj__Mkfour__item__lo0",
"Vale.Def.Types_s.quad32_xor",
"Prims.l_imp",
"FStar.Pervasives.Native.tuple6",
"FStar.Pervasives.Native.Mktuple6",
"Vale.AES.X64.AESopt.xor_reverse_inc32lite_6",
"Vale.AES.GCTR.gctr_partial",
"Prims.l_Forall",
"Vale.X64.InsBasic.vale_heap",
"Vale.X64.Memory.nat64",
"Vale.X64.Flags.t",
"Prims.op_GreaterThan",
"Vale.X64.Decls.modifies_buffer_specific128",
"Vale.X64.Decls.vale_heap",
"Vale.AES.GCTR.gctr_registers",
"Vale.AES.X64.AESopt.six_of",
"Vale.AES.X64.AESopt.make_six_of",
"Vale.X64.Decls.va_int_range",
"Vale.AES.GCTR.aes_encrypt_BE",
"Vale.X64.Decls.va_if",
"Prims.unit",
"Prims.l_not",
"Prims.op_Equality",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_mem_heaplet",
"Vale.X64.Decls.va_upd_xmm",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rR13",
"Vale.X64.Machine_s.rR12",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Decls.va_upd_mem"
] | [] | module Vale.AES.X64.AESopt
open FStar.Mul
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open Vale.Def.Words_s
open Vale.Def.Types_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.AES_helpers
//open Vale.Poly1305.Math // For lemma_poly_bits64()
open Vale.AES.GCM_helpers
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.Arch.TypesNative
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2_s
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.AES.GHash
open Vale.AES.X64.PolyOps
open Vale.AES.X64.AESopt2
open Vale.AES.X64.AESGCM_expected_code
open Vale.Transformers.Transform
open FStar.Mul
let aes_reqs0
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ pclmulqdq_enabled /\ avx_enabled /\
alg = AES_128 /\
//(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
buffer128_as_seq heap0 keys_b == round_keys
let aes_reqs_offset
(alg:algorithm) (key:seq nat32) (round_keys:seq quad32) (keys_b:buffer128)
(key_ptr:int) (heap0:vale_heap) (layout:vale_heap_layout) : prop0
=
aesni_enabled /\ avx_enabled /\ pclmulqdq_enabled /\
(alg = AES_128 || alg = AES_256) /\
is_aes_key_LE alg key /\
length(round_keys) == nr(alg) + 1 /\
round_keys == key_to_round_keys_LE alg key /\
validSrcAddrsOffset128 heap0 key_ptr keys_b 8 (nr alg + 1 - 8) layout Secret /\
s128 heap0 keys_b == round_keys
let six_of (a:Type0) = a & a & a & a & a & a
let quad32_6 = six_of quad32
unfold let make_six_of (#a:Type0) (f:(n:nat{n < 6}) -> GTot a) : GTot (six_of a) =
(f 0, f 1, f 2, f 3, f 4, f 5)
unfold let map_six_of (#a #b:Type0) (x:six_of a) (f:a -> GTot b) : GTot (six_of b) =
let (x0, x1, x2, x3, x4, x5) = x in
(f x0, f x1, f x2, f x3, f x4, f x5)
unfold let map2_six_of (#a #b #c:Type0) (x:six_of a) (y:six_of b) (f:a -> b -> GTot c) : GTot (six_of c) =
let (x0, x1, x2, x3, x4, x5) = x in
let (y0, y1, y2, y3, y4, y5) = y in
(f x0 y0, f x1 y1, f x2 y2, f x3 y3, f x4 y4, f x5 y5)
let rounds_opaque_6 (init:quad32_6) (round_keys:seq quad32) (rnd:nat{rnd < length round_keys}) : GTot quad32_6 =
map_six_of init (fun x -> eval_rounds x round_keys rnd)
let xor_reverse_inc32lite_6 (n i0:int) (ctr_BE rndkey:quad32) : GTot quad32_6 =
make_six_of (fun i ->
let r = reverse_bytes_quad32 (inc32lite ctr_BE (i0 + i)) in
if i < n then quad32_xor r rndkey else r)
//let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
// count * 6 + 6 <= length s /\ (
// let data = slice s (count * 6) (count * 6 + 6) in
// z3 == reverse_bytes_quad32 (index data 5) /\
// scratch_b_blocks true true scratch_b 8 5 heap3 data)
let scratch_reqs (scratch_b:buffer128) (count:nat) (heap3:vale_heap) (s:seq quad32) (z3:quad32) : prop0 =
count * 6 + 6 <= length s /\ (
let data = slice s (count * 6) (count * 6 + 6) in
z3 == reverse_bytes_quad32 (index data 5) /\
buffer128_read scratch_b 3 heap3 == reverse_bytes_quad32 (index data 4) /\
buffer128_read scratch_b 4 heap3 == reverse_bytes_quad32 (index data 3) /\
buffer128_read scratch_b 5 heap3 == reverse_bytes_quad32 (index data 2) /\
buffer128_read scratch_b 6 heap3 == reverse_bytes_quad32 (index data 1) /\
buffer128_read scratch_b 7 heap3 == reverse_bytes_quad32 (index data 0))
//-- Load_two_lsb
val va_code_Load_two_lsb : dst:va_operand_xmm -> Tot va_code
val va_codegen_success_Load_two_lsb : dst:va_operand_xmm -> Tot va_pbool
val va_lemma_Load_two_lsb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_two_lsb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@ va_qattr]
let va_wp_Load_two_lsb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 2 0 0 0 ==> va_k va_sM (())))
val va_wpProof_Load_two_lsb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_two_lsb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_two_lsb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Load_two_lsb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_two_lsb dst)) =
(va_QProc (va_code_Load_two_lsb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_two_lsb dst) (va_wpProof_Load_two_lsb dst))
//--
//-- Load_one_lsb
val va_code_Load_one_lsb : dst:va_operand_xmm -> Tot va_code
val va_codegen_success_Load_one_lsb : dst:va_operand_xmm -> Tot va_pbool
val va_lemma_Load_one_lsb : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Load_one_lsb dst) va_s0 /\ va_is_dst_xmm dst va_s0 /\
va_get_ok va_s0 /\ sse_enabled))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\ va_state_eq
va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM
(va_update_operand_xmm dst va_sM va_s0))))))
[@ va_qattr]
let va_wp_Load_one_lsb (dst:va_operand_xmm) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_dst_xmm dst va_s0 /\ va_get_ok va_s0 /\ sse_enabled /\ (forall (va_x_dst:va_value_xmm)
(va_x_r11:nat64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_reg64
rR11 va_x_r11 (va_upd_operand_xmm dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_eval_xmm va_sM
dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 ==> va_k va_sM (())))
val va_wpProof_Load_one_lsb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Load_one_lsb dst va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_one_lsb dst) ([va_Mod_flags;
va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Load_one_lsb (dst:va_operand_xmm) : (va_quickCode unit (va_code_Load_one_lsb dst)) =
(va_QProc (va_code_Load_one_lsb dst) ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst])
(va_wp_Load_one_lsb dst) (va_wpProof_Load_one_lsb dst))
//--
//-- Loop6x_final
val va_code_Loop6x_final : alg:algorithm -> Tot va_code
val va_codegen_success_Loop6x_final : alg:algorithm -> Tot va_pbool
val va_lemma_Loop6x_final : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> iv_b:buffer128 ->
scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
ctr_orig:quad32 -> init:quad32_6 -> ctrs:quad32_6 -> plain:quad32_6 -> inb:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop6x_final alg) va_s0 /\ va_get_ok va_s0 /\
(sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validDstAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0)
Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\ va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\
aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0
va_s0) (va_get_mem_layout va_s0) /\ init == map_six_of #quad32 #quad32 ctrs (fun (c:quad32) ->
Vale.Def.Types_s.quad32_xor c (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0)) /\
(va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm
13 va_s0, va_get_xmm 14 va_s0) == rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg
- 1) /\ va_get_reg64 rR13 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64
inb) /\ va_get_reg64 rR12 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64
inb) /\ (let rk = FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in
(va_get_xmm 2 va_s0, va_get_xmm 0 va_s0, va_get_xmm 5 va_s0, va_get_xmm 6 va_s0, va_get_xmm 7
va_s0, va_get_xmm 3 va_s0) == map_six_of #quad32 #quad32 plain (fun (p:quad32) ->
Vale.Def.Types_s.quad32_xor rk p) /\ Vale.X64.Decls.buffer128_read scratch_b 8
(va_get_mem_heaplet 3 va_s0) == Vale.Def.Types_s.reverse_bytes_quad32 ctr_orig))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 7 7 /\ Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 inb /\ (va_get_xmm 9
va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM,
va_get_xmm 14 va_sM) == map2_six_of #quad32 #quad32 #quad32 plain ctrs (fun (p:quad32)
(c:quad32) -> Vale.Def.Types_s.quad32_xor p (Vale.AES.AES_s.aes_encrypt_LE alg key_words c)) /\
va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_reg64 rRdi va_sM ==
va_get_reg64 rRdi va_s0 + 96 /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96 /\
va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_sM == Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) /\
(let ctr = Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_orig `op_Modulus` 256 in ctr + 6 <
256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM,
va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 0 ctr_orig (va_get_xmm 15
va_sM))) /\ va_state_eq va_sM (va_update_mem_heaplet 3 va_sM (va_update_flags va_sM
(va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM
(va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 7 va_sM
(va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12
va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Loop6x_final (alg:algorithm) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (ctr_orig:quad32) (init:quad32_6)
(ctrs:quad32_6) (plain:quad32_6) (inb:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0))
: Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 2 va_s0)
(va_get_reg64 rR8 va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0)
scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\
va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\ aes_reqs_offset alg key_words round_keys keys_b
(va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ init ==
map_six_of #quad32 #quad32 ctrs (fun (c:quad32) -> Vale.Def.Types_s.quad32_xor c
(FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys 0)) /\ (va_get_xmm 9 va_s0,
va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm
14 va_s0) == rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64
rR13 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 inb) /\ va_get_reg64
rR12 va_s0 == Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 inb) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_s0,
va_get_xmm 0 va_s0, va_get_xmm 5 va_s0, va_get_xmm 6 va_s0, va_get_xmm 7 va_s0, va_get_xmm 3
va_s0) == map_six_of #quad32 #quad32 plain (fun (p:quad32) -> Vale.Def.Types_s.quad32_xor rk p)
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) ==
Vale.Def.Types_s.reverse_bytes_quad32 ctr_orig)) /\ (forall (va_x_mem:vale_heap)
(va_x_rdi:nat64) (va_x_rsi:nat64) (va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm5:quad32)
(va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32)
(va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32)
(va_x_xmm15:quad32) (va_x_efl:Vale.X64.Flags.t) (va_x_heap3:vale_heap) . let va_sM =
va_upd_mem_heaplet 3 va_x_heap3 (va_upd_flags va_x_efl (va_upd_xmm 15 va_x_xmm15 (va_upd_xmm 14
va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11
(va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6
va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1
va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR13 va_x_r13 (va_upd_reg64 rR12 va_x_r12
(va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRsi va_x_rsi (va_upd_reg64 rRdi va_x_rdi (va_upd_mem
va_x_mem va_s0))))))))))))))))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 7 7 /\ Vale.X64.Decls.buffer128_read scratch_b 7
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32 inb /\ (va_get_xmm 9
va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM,
va_get_xmm 14 va_sM) == map2_six_of #quad32 #quad32 #quad32 plain ctrs (fun (p:quad32)
(c:quad32) -> Vale.Def.Types_s.quad32_xor p (Vale.AES.AES_s.aes_encrypt_LE alg key_words c)) /\
va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_reg64 rRdi va_sM ==
va_get_reg64 rRdi va_s0 + 96 /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96 /\
va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
va_get_xmm 1 va_sM == Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_s0) /\
(let ctr = Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_orig `op_Modulus` 256 in ctr + 6 <
256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM,
va_get_xmm 7 va_sM, va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 0 ctr_orig (va_get_xmm 15
va_sM))) ==> va_k va_sM (())))
val va_wpProof_Loop6x_final : alg:algorithm -> iv_b:buffer128 -> scratch_b:buffer128 ->
key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> ctr_orig:quad32 ->
init:quad32_6 -> ctrs:quad32_6 -> plain:quad32_6 -> inb:quad32 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop6x_final alg iv_b scratch_b key_words round_keys
keys_b ctr_orig init ctrs plain inb va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_final alg) ([va_Mod_mem_heaplet
3; va_Mod_flags; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11;
va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm
2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11;
va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop6x_final (alg:algorithm) (iv_b:buffer128) (scratch_b:buffer128) (key_words:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (ctr_orig:quad32) (init:quad32_6)
(ctrs:quad32_6) (plain:quad32_6) (inb:quad32) : (va_quickCode unit (va_code_Loop6x_final alg)) =
(va_QProc (va_code_Loop6x_final alg) ([va_Mod_mem_heaplet 3; va_Mod_flags; va_Mod_xmm 15;
va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRsi; va_Mod_reg64
rRdi; va_Mod_mem]) (va_wp_Loop6x_final alg iv_b scratch_b key_words round_keys keys_b ctr_orig
init ctrs plain inb) (va_wpProof_Loop6x_final alg iv_b scratch_b key_words round_keys keys_b
ctr_orig init ctrs plain inb))
//--
//-- Loop6x_save_output
val va_code_Loop6x_save_output : va_dummy:unit -> Tot va_code
val va_codegen_success_Loop6x_save_output : va_dummy:unit -> Tot va_pbool
val va_lemma_Loop6x_save_output : va_b0:va_code -> va_s0:va_state -> count:nat -> out_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop6x_save_output ()) va_s0 /\ va_get_ok va_s0 /\
(avx_enabled /\ sse_enabled /\ Vale.X64.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rRsi va_s0 - 96) out_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0)
Secret)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) (count `op_Multiply` 6 + 0) (count `op_Multiply` 6 + 5) /\
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 6 va_sM) out_b) 0 (6 `op_Multiply` count) == FStar.Seq.Base.slice
#Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 6 va_s0) out_b) 0
(6 `op_Multiply` count) /\ (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0,
va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == make_six_of #quad32 (fun
(i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read out_b (count `op_Multiply` 6 + i)
(va_get_mem_heaplet 6 va_sM)) /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM,
va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == (Vale.Def.Types_s.quad32_xor
(va_get_xmm 1 va_sM) (va_get_xmm 15 va_sM), va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm
6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM)) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_mem_heaplet 6 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm
12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_ok
va_sM (va_update_mem va_sM va_s0))))))))))))
[@ va_qattr]
let va_wp_Loop6x_save_output (count:nat) (out_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit
-> Type0)) : Type0 =
(va_get_ok va_s0 /\ (avx_enabled /\ sse_enabled /\ Vale.X64.Decls.validDstAddrsOffset128
(va_get_mem_heaplet 6 va_s0) (va_get_reg64 rRsi va_s0 - 96) out_b (count `op_Multiply` 6) 6
(va_get_mem_layout va_s0) Secret) /\ (forall (va_x_mem:vale_heap) (va_x_xmm9:quad32)
(va_x_xmm10:quad32) (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32)
(va_x_xmm14:quad32) (va_x_heap6:vale_heap) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_mem_heaplet 6 va_x_heap6 (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13
va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10 va_x_xmm10
(va_upd_xmm 9 va_x_xmm9 (va_upd_mem va_x_mem va_s0)))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer_specific128 out_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) (count `op_Multiply` 6 + 0) (count `op_Multiply` 6 + 5) /\
FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq
(va_get_mem_heaplet 6 va_sM) out_b) 0 (6 `op_Multiply` count) == FStar.Seq.Base.slice
#Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 6 va_s0) out_b) 0
(6 `op_Multiply` count) /\ (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0,
va_get_xmm 12 va_s0, va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == make_six_of #quad32 (fun
(i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read out_b (count `op_Multiply` 6 + i)
(va_get_mem_heaplet 6 va_sM)) /\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM,
va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == (Vale.Def.Types_s.quad32_xor
(va_get_xmm 1 va_sM) (va_get_xmm 15 va_sM), va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm
6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3 va_sM)) ==> va_k va_sM (())))
val va_wpProof_Loop6x_save_output : count:nat -> out_b:buffer128 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop6x_save_output count out_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_save_output ()) ([va_Mod_flags;
va_Mod_mem_heaplet 6; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm
10; va_Mod_xmm 9; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop6x_save_output (count:nat) (out_b:buffer128) : (va_quickCode unit
(va_code_Loop6x_save_output ())) =
(va_QProc (va_code_Loop6x_save_output ()) ([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_xmm 14;
va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_mem])
(va_wp_Loop6x_save_output count out_b) (va_wpProof_Loop6x_save_output count out_b))
//--
//-- Loop6x_partial
val va_code_untransformedoriginal_Loop6x_partial : alg:algorithm -> Tot va_code
val va_codegen_success_untransformedoriginal_Loop6x_partial : alg:algorithm -> Tot va_pbool
val va_lemma_untransformedoriginal_Loop6x_partial : va_b0:va_code -> va_s0:va_state ->
alg:algorithm -> h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32) -> count:nat -> in0_count:nat
-> iv_b:buffer128 -> in0_b:buffer128 -> in_b:buffer128 -> scratch_b:buffer128 -> key_words:(seq
nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE:quad32
-> Ghost (va_state & va_fuel & quad32_6)
(requires (va_require_total va_b0 (va_code_untransformedoriginal_Loop6x_partial alg) va_s0 /\
va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in sse_enabled
/\ movbe_enabled /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0
16777216 /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 6 va_s0) (va_get_reg64 rR14 va_s0) in0_b (in0_count `op_Multiply` 6) 6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp
va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64
/\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 15 va_s0 ==
FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx
va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9
va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256
==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15
va_s0)) /\ FStar.Seq.Base.length #quad32 data == 6 /\ hkeys_b_powers hkeys_b
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\
scratch_b_data true true scratch_b 8 5 (va_get_mem_heaplet 3 va_s0) (va_get_mem_layout va_s0)
(va_get_reg64 rRbp va_s0) data /\ va_get_xmm 7 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data 5) /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_s0))) == prev)))
(ensures (fun (va_sM, va_fM, init) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in
Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 1 8 /\ Vale.X64.Decls.modifies_buffer_specific128 iv_b
(va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) 0 0 /\ (0 <= va_get_reg64 rRbx va_sM
/\ va_get_reg64 rRbx va_sM < 256) /\ va_get_reg64 rRbx va_sM ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256
/\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM,
va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys
(Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64 rR13 va_sM ==
Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ va_get_reg64 rR12 va_sM ==
Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_sM,
va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3
va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor rk
(Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)))
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\
Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 5) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 3
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 4) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 4 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 3) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 5
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 2) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 6 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 1) (va_get_mem_heaplet 6 va_s0)) /\ init == make_six_of #quad32 (fun
(n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE n)) (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys
0)) /\ (let eventual_Xi = add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_sM)))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)) in
eventual_Xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data))))) /\ va_state_eq va_sM (va_update_flags
va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM (va_update_xmm 15 va_sM
(va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM
(va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM
(va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM
(va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13
va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))))
val va_transform_Loop6x_partial : alg:algorithm -> Tot va_transformation_result
val va_code_Loop6x_partial : alg:algorithm -> Tot va_code
val va_codegen_success_Loop6x_partial : alg:algorithm -> Tot va_pbool
val va_lemma_Loop6x_partial : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> h_LE:quad32 ->
y_prev:quad32 -> data:(seq quad32) -> count:nat -> in0_count:nat -> iv_b:buffer128 ->
in0_b:buffer128 -> in_b:buffer128 -> scratch_b:buffer128 -> key_words:(seq nat32) ->
round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> ctr_BE:quad32
-> Ghost (va_state & va_fuel & quad32_6)
(requires (va_require_total va_b0 (va_code_Loop6x_partial alg) va_s0 /\ va_get_ok va_s0 /\ (let
(h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in sse_enabled
/\ movbe_enabled /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0
16777216 /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 6 va_s0) (va_get_reg64 rR14 va_s0) in0_b (in0_count `op_Multiply` 6) 6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp
va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64
/\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 15 va_s0 ==
FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx
va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9
va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256
==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15
va_s0)) /\ FStar.Seq.Base.length #quad32 data == 6 /\ hkeys_b_powers hkeys_b
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\
scratch_b_data true true scratch_b 8 5 (va_get_mem_heaplet 3 va_s0) (va_get_mem_layout va_s0)
(va_get_reg64 rRbp va_s0) data /\ va_get_xmm 7 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data 5) /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_s0))) == prev)))
(ensures (fun (va_sM, va_fM, init) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in
Vale.X64.Decls.modifies_buffer_specific128 scratch_b (va_get_mem_heaplet 3 va_s0)
(va_get_mem_heaplet 3 va_sM) 1 8 /\ Vale.X64.Decls.modifies_buffer_specific128 iv_b
(va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) 0 0 /\ (0 <= va_get_reg64 rRbx va_sM
/\ va_get_reg64 rRbx va_sM < 256) /\ va_get_reg64 rRbx va_sM ==
Vale.Def.Words_s.__proj__Mkfour__item__lo0 (Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256
/\ (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM,
va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) == rounds_opaque_6 init round_keys
(Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64 rR13 va_sM ==
Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ va_get_reg64 rR12 va_sM ==
Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 (Vale.X64.Decls.buffer128_read in0_b
(in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_sM,
va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3
va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor rk
(Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)))
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\
Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 5) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 3
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 4) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 4 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 3) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 5
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 2) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 6 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 1) (va_get_mem_heaplet 6 va_s0)) /\ init == make_six_of #quad32 (fun
(n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE n)) (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys
0)) /\ (let eventual_Xi = add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_sM)))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)) in
eventual_Xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data))))) /\ va_state_eq va_sM (va_update_flags
va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM (va_update_xmm 15 va_sM
(va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM
(va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM
(va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM
(va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR13
va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Loop6x_partial (alg:algorithm) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(count:nat) (in0_count:nat) (iv_b:buffer128) (in0_b:buffer128) (in_b:buffer128)
(scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128)
(hkeys_b:buffer128) (ctr_BE:quad32) (va_s0:va_state) (va_k:(va_state -> quad32_6 -> Type0)) :
Type0 =
(va_get_ok va_s0 /\ (let (h:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let (prev:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in sse_enabled
/\ movbe_enabled /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0
16777216 /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8
va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 6 va_s0) (va_get_reg64 rR14 va_s0) in0_b (in0_count `op_Multiply` 6) 6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp
va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRdi va_s0 + 96 < pow2_64
/\ aes_reqs_offset alg key_words round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm 15 va_s0 ==
FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx
va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9
va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256
==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15
va_s0)) /\ FStar.Seq.Base.length #quad32 data == 6 /\ hkeys_b_powers hkeys_b
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) (va_get_reg64 rR9 va_s0 - 32) h /\
scratch_b_data true true scratch_b 8 5 (va_get_mem_heaplet 3 va_s0) (va_get_mem_layout va_s0)
(va_get_reg64 rRbp va_s0) data /\ va_get_xmm 7 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(va_subscript_FStar__Seq__Base__seq data 5) /\ add (add (Vale.Math.Poly2.Bits_s.of_quad32
(va_get_xmm 8 va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_s0))) == prev) /\ (forall (va_x_mem:vale_heap) (va_x_rbx:nat64)
(va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32)
(va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32)
(va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32)
(va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32)
(va_x_xmm15:quad32) (va_x_heap2:vale_heap) (va_x_heap3:vale_heap) (va_x_efl:Vale.X64.Flags.t)
(init:quad32_6) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 3 va_x_heap3
(va_upd_mem_heaplet 2 va_x_heap2 (va_upd_xmm 15 va_x_xmm15 (va_upd_xmm 14 va_x_xmm14
(va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10
va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm
6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm
2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR13 va_x_r13
(va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRbx va_x_rbx (va_upd_mem
va_x_mem va_s0))))))))))))))))))))))) in va_get_ok va_sM /\ (let (h:Vale.Math.Poly2_s.poly) =
Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) in let
(prev:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32
(Vale.Def.Types_s.reverse_bytes_quad32 y_prev) in Vale.X64.Decls.modifies_buffer_specific128
scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 1 8 /\
Vale.X64.Decls.modifies_buffer_specific128 iv_b (va_get_mem_heaplet 2 va_s0)
(va_get_mem_heaplet 2 va_sM) 0 0 /\ (0 <= va_get_reg64 rRbx va_sM /\ va_get_reg64 rRbx va_sM <
256) /\ va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0
(Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256 /\ (va_get_xmm 9 va_sM, va_get_xmm 10
va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) ==
rounds_opaque_6 init round_keys (Vale.AES.AES_common_s.nr alg - 1) /\ va_get_reg64 rR13 va_sM
== Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.hi64 (Vale.X64.Decls.buffer128_read
in0_b (in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ va_get_reg64 rR12 va_sM
== Vale.Def.Types_s.reverse_bytes_nat64 (Vale.Arch.Types.lo64 (Vale.X64.Decls.buffer128_read
in0_b (in0_count `op_Multiply` 6 + 0) (va_get_mem_heaplet 6 va_sM))) /\ (let rk =
FStar.Seq.Base.index #quad32 round_keys (Vale.AES.AES_common_s.nr alg) in (va_get_xmm 2 va_sM,
va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM, va_get_xmm 7 va_sM, va_get_xmm 3
va_sM) == make_six_of #quad32 (fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor rk
(Vale.X64.Decls.buffer128_read in_b (count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)))
/\ Vale.X64.Decls.buffer128_read scratch_b 8 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\
Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 5) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 3
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 4) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 4 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 3) (va_get_mem_heaplet 6 va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 5
(va_get_mem_heaplet 3 va_sM) == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read in0_b (in0_count `op_Multiply` 6 + 2) (va_get_mem_heaplet 6
va_s0)) /\ Vale.X64.Decls.buffer128_read scratch_b 6 (va_get_mem_heaplet 3 va_sM) ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read in0_b (in0_count
`op_Multiply` 6 + 1) (va_get_mem_heaplet 6 va_s0)) /\ init == make_six_of #quad32 (fun
(n:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE n)) (FStar.Seq.Base.index #Vale.Def.Types_s.quad32 round_keys
0)) /\ (let eventual_Xi = add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8 va_sM))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_sM)))) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)) in
eventual_Xi == Vale.Math.Poly2.Bits_s.of_quad32 (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental h_LE y_prev data))))) ==> va_k va_sM ((init))))
val va_wpProof_Loop6x_partial : alg:algorithm -> h_LE:quad32 -> y_prev:quad32 -> data:(seq quad32)
-> count:nat -> in0_count:nat -> iv_b:buffer128 -> in0_b:buffer128 -> in_b:buffer128 ->
scratch_b:buffer128 -> key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128 -> ctr_BE:quad32 -> va_s0:va_state -> va_k:(va_state -> quad32_6 -> Type0)
-> Ghost (va_state & va_fuel & quad32_6)
(requires (va_t_require va_s0 /\ va_wp_Loop6x_partial alg h_LE y_prev data count in0_count iv_b
in0_b in_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop6x_partial alg) ([va_Mod_flags;
va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13;
va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rRbx; va_Mod_mem])
va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Loop6x_partial (alg:algorithm) (h_LE:quad32) (y_prev:quad32) (data:(seq quad32))
(count:nat) (in0_count:nat) (iv_b:buffer128) (in0_b:buffer128) (in_b:buffer128)
(scratch_b:buffer128) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128)
(hkeys_b:buffer128) (ctr_BE:quad32) : (va_quickCode quad32_6 (va_code_Loop6x_partial alg)) =
(va_QProc (va_code_Loop6x_partial alg) ([va_Mod_flags; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet
2; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10;
va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm
3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64
rR11; va_Mod_reg64 rRbx; va_Mod_mem]) (va_wp_Loop6x_partial alg h_LE y_prev data count
in0_count iv_b in0_b in_b scratch_b key_words round_keys keys_b hkeys_b ctr_BE)
(va_wpProof_Loop6x_partial alg h_LE y_prev data count in0_count iv_b in0_b in_b scratch_b
key_words round_keys keys_b hkeys_b ctr_BE))
//--
#reset-options "--z3rlimit 50"
//-- Loop6x
val va_code_Loop6x : alg:algorithm -> Tot va_code
val va_codegen_success_Loop6x : alg:algorithm -> Tot va_pbool
val va_lemma_Loop6x : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> h_LE:quad32 ->
y_orig:quad32 -> y_prev:quad32 -> count:nat -> iv_b:buffer128 -> in0_b:buffer128 ->
in_b:buffer128 -> out_b:buffer128 -> scratch_b:buffer128 -> plain_quads:(seq quad32) ->
key_words:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 ->
ctr_BE_orig:quad32 -> ctr_BE:quad32
-> Ghost (va_state & va_fuel & quad32)
(requires (va_require_total va_b0 (va_code_Loop6x alg) va_s0 /\ va_get_ok va_s0 /\ (sse_enabled
/\ movbe_enabled /\ count >= 2 /\ va_get_reg64 rRdx va_s0 >= 6 /\ va_get_xmm 2 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8 va_s0) iv_b 1
(va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6
va_s0) (va_get_reg64 rR14 va_s0) in0_b ((count - 1) `op_Multiply` 6) 6 (va_get_mem_layout
va_s0) Secret /\ Vale.X64.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 6 va_s0)
(va_get_reg64 rRdi va_s0) in_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrsOffset128 (va_get_mem_heaplet 6 va_s0) (va_get_reg64 rRsi va_s0)
out_b (count `op_Multiply` 6) 6 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0)
scratch_b 9 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ Vale.AES.GCTR.partial_seq_agreement plain_quads (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_s0) in_b) (count `op_Multiply` 6) (count `op_Multiply` 6 + 6) /\
(Vale.X64.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ in0_b == out_b /\
va_get_reg64 rRdi va_s0 + 96 < pow2_64 /\ va_get_reg64 rR14 va_s0 + 96 < pow2_64 /\
va_get_reg64 rRsi va_s0 + 96 < pow2_64 /\ aes_reqs_offset alg key_words round_keys keys_b
(va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ va_get_xmm
15 va_s0 == FStar.Seq.Base.index #quad32 round_keys 0 /\ pclmulqdq_enabled /\ h_LE ==
Vale.AES.AES_s.aes_encrypt_LE alg key_words (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0
0 0 0) /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0)
hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ scratch_reqs scratch_b (count - 2)
(va_get_mem_heaplet 3 va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in0_b)
(va_get_xmm 7 va_s0) /\ y_prev == Vale.AES.GHash.ghash_incremental0 h_LE y_orig
(FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0)
in0_b) 0 ((count - 2) `op_Multiply` 6)) /\ y_prev == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 (add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8
va_s0)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_s0)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_s0))))) /\ count `op_Multiply` 6 + 6 < pow2_32 /\ ctr_BE ==
Vale.AES.GCTR.inc32lite ctr_BE_orig (count `op_Multiply` 6) /\ va_get_xmm 2 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 0) /\ va_get_reg64 rRbx
va_s0 == Vale.Def.Words_s.__proj__Mkfour__item__lo0 ctr_BE `op_Modulus` 256 /\ va_get_xmm 9
va_s0 == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GCTR.inc32lite ctr_BE 0)) (va_get_xmm 15 va_s0) /\ (va_get_reg64 rRbx va_s0 + 6 < 256
==> (va_get_xmm 9 va_s0, va_get_xmm 10 va_s0, va_get_xmm 11 va_s0, va_get_xmm 12 va_s0,
va_get_xmm 13 va_s0, va_get_xmm 14 va_s0) == xor_reverse_inc32lite_6 1 0 ctr_BE (va_get_xmm 15
va_s0)) /\ Vale.AES.GCTR.gctr_partial alg (6 `op_Multiply` count) plain_quads
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) out_b) key_words ctr_BE_orig)))
(ensures (fun (va_sM, va_fM, y_new) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM
/\ ((va_get_reg64 rRdx va_sM > 0 ==> Vale.X64.Decls.modifies_buffer_specific128 out_b
(va_get_mem_heaplet 6 va_s0) (va_get_mem_heaplet 6 va_sM) (count `op_Multiply` 6 + 0) (count
`op_Multiply` 6 + 5)) /\ (va_get_reg64 rRdx va_sM == 0 ==> va_get_mem_heaplet 6 va_sM ==
va_get_mem_heaplet 6 va_s0) /\ Vale.X64.Decls.modifies_buffer_specific128 scratch_b
(va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) 1 8 /\
Vale.X64.Decls.modifies_buffer_specific128 iv_b (va_get_mem_heaplet 2 va_s0)
(va_get_mem_heaplet 2 va_sM) 0 0 /\ va_get_reg64 rRdx va_sM == va_get_reg64 rRdx va_s0 - 6 /\
va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0 + 96 /\ va_get_reg64 rR14 va_sM ==
va_get_reg64 rR14 va_s0 + 96 /\ va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 96 /\
va_get_xmm 15 va_sM == FStar.Seq.Base.index #quad32 round_keys 0 /\ va_get_xmm 2 va_sM ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\ va_get_xmm 1 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 6) /\ (let z3' = (if
(va_get_reg64 rRdx va_sM = 0) then va_get_xmm 7 va_sM else
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 10)) in (va_get_reg64
rRbx va_sM + 6 < 256 ==> (va_get_xmm 1 va_sM, va_get_xmm 0 va_sM, va_get_xmm 5 va_sM,
va_get_xmm 6 va_sM, z3', va_get_xmm 3 va_sM) == xor_reverse_inc32lite_6 0 6 ctr_BE (va_get_xmm
15 va_sM)) /\ va_get_reg64 rRbx va_sM == Vale.Def.Words_s.__proj__Mkfour__item__lo0
(Vale.AES.GCTR.inc32lite ctr_BE 6) `op_Modulus` 256 /\ (va_get_reg64 rRdx va_sM == 0 ==>
Vale.AES.GCTR.gctr_registers (va_get_xmm 9 va_sM) (va_get_xmm 10 va_sM) (va_get_xmm 11 va_sM)
(va_get_xmm 12 va_sM) (va_get_xmm 13 va_sM) (va_get_xmm 14 va_sM) plain_quads alg key_words
ctr_BE_orig count) /\ (let inout4' = (if (va_get_reg64 rRbx va_sM + 6 < 256) then
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 10) else va_get_xmm 13
va_sM) in (va_get_reg64 rRdx va_sM > 0 ==> (va_get_xmm 9 va_sM, va_get_xmm 10 va_sM, va_get_xmm
11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm 14 va_sM) ==
(Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite
ctr_BE 6)) (va_get_xmm 15 va_sM), va_get_xmm 0 va_sM, va_get_xmm 5 va_sM, va_get_xmm 6 va_sM,
inout4', va_get_xmm 3 va_sM)) /\ (va_get_reg64 rRdx va_sM > 0 ==> make_six_of
#Vale.X64.Decls.quad32 (fun (i:(va_int_range 0 5)) -> Vale.X64.Decls.buffer128_read out_b
(count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_sM)) == make_six_of #Vale.X64.Decls.quad32
(fun (i:(va_int_range 0 5)) -> Vale.Def.Types_s.quad32_xor (Vale.X64.Decls.buffer128_read in_b
(count `op_Multiply` 6 + i) (va_get_mem_heaplet 6 va_s0)) (Vale.AES.GCTR.aes_encrypt_BE alg
key_words (Vale.AES.GCTR.inc32lite ctr_BE i)))) /\ (va_get_reg64 rRdx va_sM > 0 ==>
Vale.AES.GCTR.gctr_partial alg (6 `op_Multiply` (count + 1)) plain_quads (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_sM) out_b) key_words ctr_BE_orig) /\ y_new ==
Vale.AES.GHash.ghash_incremental0 h_LE y_orig (FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) in0_b) 0 ((count - 1) `op_Multiply` 6)) /\
(va_get_reg64 rRdx va_sM > 0 ==> y_new == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.Math.Poly2.Bits_s.to_quad32 (add (add (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 8
va_sM)) (Vale.Math.Poly2.Bits_s.of_quad32 (va_get_xmm 4 va_sM)))
(Vale.Math.Poly2.Bits_s.of_quad32 (Vale.X64.Decls.buffer128_read scratch_b 1
(va_get_mem_heaplet 3 va_sM)))))) /\ (va_get_reg64 rRdx va_sM == 0 ==> va_get_xmm 8 va_sM ==
Vale.Def.Types_s.reverse_bytes_quad32 y_new) /\ (va_get_reg64 rRdx va_sM > 0 ==> scratch_reqs
scratch_b (count - 1) (va_get_mem_heaplet 3 va_sM) (Vale.X64.Decls.s128 (va_get_mem_heaplet 6
va_s0) in0_b) (va_get_xmm 7 va_sM)) /\ (va_get_reg64 rRdx va_sM == 0 ==> scratch_reqs scratch_b
(count - 1) (va_get_mem_heaplet 3 va_sM) (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0)
in0_b) (Vale.X64.Decls.buffer128_read scratch_b 2 (va_get_mem_heaplet 3 va_sM)))))) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet
2 va_sM (va_update_mem_heaplet 6 va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM
(va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM
(va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM
(va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM
(va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13
va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))))))))))))
[@ va_qattr]
let va_wp_Loop6x (alg:algorithm) (h_LE:quad32) (y_orig:quad32) (y_prev:quad32) (count:nat)
(iv_b:buffer128) (in0_b:buffer128) (in_b:buffer128) (out_b:buffer128) (scratch_b:buffer128)
(plain_quads:(seq quad32)) (key_words:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128)
(hkeys_b:buffer128) (ctr_BE_orig:quad32) (ctr_BE:quad32) (va_s0:va_state) (va_k:(va_state -> | false | true | Vale.AES.X64.AESopt.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_wp_Loop6x
(alg: algorithm)
(h_LE y_orig y_prev: quad32)
(count: nat)
(iv_b in0_b in_b out_b scratch_b: buffer128)
(plain_quads: (seq quad32))
(key_words: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(ctr_BE_orig ctr_BE: quad32)
(va_s0: va_state)
(va_k: (va_state -> quad32 -> Type0))
: Type0 | [] | Vale.AES.X64.AESopt.va_wp_Loop6x | {
"file_name": "obj/Vale.AES.X64.AESopt.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
alg: Vale.AES.AES_common_s.algorithm ->
h_LE: Vale.X64.Decls.quad32 ->
y_orig: Vale.X64.Decls.quad32 ->
y_prev: Vale.X64.Decls.quad32 ->
count: Prims.nat ->
iv_b: Vale.X64.Memory.buffer128 ->
in0_b: Vale.X64.Memory.buffer128 ->
in_b: Vale.X64.Memory.buffer128 ->
out_b: Vale.X64.Memory.buffer128 ->
scratch_b: Vale.X64.Memory.buffer128 ->
plain_quads: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
key_words: FStar.Seq.Base.seq Vale.X64.Memory.nat32 ->
round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
keys_b: Vale.X64.Memory.buffer128 ->
hkeys_b: Vale.X64.Memory.buffer128 ->
ctr_BE_orig: Vale.X64.Decls.quad32 ->
ctr_BE: Vale.X64.Decls.quad32 ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Vale.X64.Decls.quad32 -> Type0)
-> Type0 | {
"end_col": 21,
"end_line": 865,
"start_col": 2,
"start_line": 764
} |
Prims.Tot | 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)) | [
{
"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
}
] | 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 | 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 = | false | null | false | 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 | {
"checked_file": "LowParse.Tot.DER.fst.checked",
"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"
} | [
"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"
] | [] | 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 | false | false | LowParse.Tot.DER.fst | {
"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"
} | null | 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)) | [] | LowParse.Tot.DER.parse_bounded_der_length32 | {
"file_name": "src/lowparse/LowParse.Tot.DER.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
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) | {
"end_col": 41,
"end_line": 76,
"start_col": 2,
"start_line": 75
} |
Prims.Tot | 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)) | [
{
"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
}
] | false | let serialize_bounded_der_length32
min max
= serialize_ext
_
(serialize_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 = | false | null | false | serialize_ext _ (serialize_bounded_der_length32 min max) _ | {
"checked_file": "LowParse.Tot.DER.fst.checked",
"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"
} | [
"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"
] | [] | 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))
let serialize_bounded_der_length32 | false | false | LowParse.Tot.DER.fst | {
"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"
} | null | 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)) | [] | LowParse.Tot.DER.serialize_bounded_der_length32 | {
"file_name": "src/lowparse/LowParse.Tot.DER.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
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) | {
"end_col": 5,
"end_line": 88,
"start_col": 2,
"start_line": 85
} |
Prims.Pure | 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)) | [
{
"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
}
] | 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 | 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)) = | false | null | false | 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 | {
"checked_file": "LowParse.Tot.DER.fst.checked",
"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"
} | [] | [
"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"
] | [] | 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
)) | false | false | LowParse.Tot.DER.fst | {
"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"
} | null | 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)) | [] | LowParse.Tot.DER.parse_bounded_der_length32_bare | {
"file_name": "src/lowparse/LowParse.Tot.DER.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
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)) | {
"end_col": 11,
"end_line": 65,
"start_col": 3,
"start_line": 51
} |
Prims.Pure | 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)) | [
{
"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
}
] | 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 | 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)) = | false | null | false | 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": "LowParse.Tot.DER.fst.checked",
"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"
} | [] | [
"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"
] | [] | 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
)) | false | false | LowParse.Tot.DER.fst | {
"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"
} | null | 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)) | [] | LowParse.Tot.DER.parse_der_length_payload32_bare | {
"file_name": "src/lowparse/LowParse.Tot.DER.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
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)) | {
"end_col": 17,
"end_line": 39,
"start_col": 4,
"start_line": 17
} |
Prims.Tot | val st_comp_with_pre (st: st_comp) (pre: term) : st_comp | [
{
"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
}
] | false | let st_comp_with_pre (st:st_comp) (pre:term) : st_comp = { st with pre } | val st_comp_with_pre (st: st_comp) (pre: term) : st_comp
let st_comp_with_pre (st: st_comp) (pre: term) : st_comp = | false | null | false | { st with pre = pre } | {
"checked_file": "Pulse.Typing.Combinators.fsti.checked",
"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"
} | [
"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"
] | [] | module Pulse.Typing.Combinators
module L = FStar.List.Tot
module T = FStar.Tactics.V2
open FStar.List.Tot
open Pulse.Syntax
open Pulse.Typing | false | true | Pulse.Typing.Combinators.fsti | {
"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"
} | null | val st_comp_with_pre (st: st_comp) (pre: term) : st_comp | [] | Pulse.Typing.Combinators.st_comp_with_pre | {
"file_name": "lib/steel/pulse/Pulse.Typing.Combinators.fsti",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | st: Pulse.Syntax.Base.st_comp -> pre: Pulse.Syntax.Base.term -> Pulse.Syntax.Base.st_comp | {
"end_col": 70,
"end_line": 9,
"start_col": 59,
"start_line": 9
} |
Prims.Tot | val nvar_as_binder (x: nvar) (t: term) : binder | [
{
"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
}
] | false | let nvar_as_binder (x:nvar) (t:term) : binder =
{binder_ty=t;binder_ppname=fst x} | val nvar_as_binder (x: nvar) (t: term) : binder
let nvar_as_binder (x: nvar) (t: term) : binder = | false | null | false | { binder_ty = t; binder_ppname = fst x } | {
"checked_file": "Pulse.Typing.Combinators.fsti.checked",
"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"
} | [
"total"
] | [
"Pulse.Syntax.Base.nvar",
"Pulse.Syntax.Base.term",
"Pulse.Syntax.Base.Mkbinder",
"FStar.Pervasives.Native.fst",
"Pulse.Syntax.Base.ppname",
"Pulse.Syntax.Base.var",
"Pulse.Syntax.Base.binder"
] | [] | 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 } | false | true | Pulse.Typing.Combinators.fsti | {
"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"
} | null | val nvar_as_binder (x: nvar) (t: term) : binder | [] | Pulse.Typing.Combinators.nvar_as_binder | {
"file_name": "lib/steel/pulse/Pulse.Typing.Combinators.fsti",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | x: Pulse.Syntax.Base.nvar -> t: Pulse.Syntax.Base.term -> Pulse.Syntax.Base.binder | {
"end_col": 34,
"end_line": 12,
"start_col": 3,
"start_line": 12
} |
Prims.Tot | [
{
"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
}
] | false | let frame_of #g #ctxt #req (f:frame_for_req_in_ctxt g ctxt req) =
let (| frame, _, _ |) = f in frame | let frame_of #g #ctxt #req (f: frame_for_req_in_ctxt g ctxt req) = | false | null | false | let (| frame , _ , _ |) = f in
frame | {
"checked_file": "Pulse.Typing.Combinators.fsti.checked",
"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"
} | [
"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"
] | [] | 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 =
{binder_ty=t;binder_ppname=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)
: T.TacH (t:st_term &
c:comp_st { st_comp_of_comp c == st_comp_with_pre (st_comp_of_comp c2) pre } &
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:st_comp) (x:var { fresh_wrt x g (freevars s2.post) })
(post_hint:post_hint_opt g { comp_post_matches_hint (C_ST s2) post_hint })
: T.Tac (universe_of g s2.res s2.u &
tot_typing (push_binding g x ppname_default s2.res) (open_term_nv s2.post (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) | false | false | Pulse.Typing.Combinators.fsti | {
"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"
} | null | val frame_of : f: Pulse.Typing.Combinators.frame_for_req_in_ctxt g ctxt req -> Pulse.Syntax.Base.term | [] | Pulse.Typing.Combinators.frame_of | {
"file_name": "lib/steel/pulse/Pulse.Typing.Combinators.fsti",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | f: Pulse.Typing.Combinators.frame_for_req_in_ctxt g ctxt req -> Pulse.Syntax.Base.term | {
"end_col": 36,
"end_line": 63,
"start_col": 65,
"start_line": 62
} |
|
Prims.Tot | [
{
"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
}
] | false | let frame_for_req_in_ctxt (g:env) (ctxt:term) (req:term)
= (frame:term &
tot_typing g frame tm_vprop &
vprop_equiv g (tm_star req frame) ctxt) | let frame_for_req_in_ctxt (g: env) (ctxt req: term) = | false | null | false | (frame: term & tot_typing g frame tm_vprop & vprop_equiv g (tm_star req frame) ctxt) | {
"checked_file": "Pulse.Typing.Combinators.fsti.checked",
"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"
} | [
"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"
] | [] | 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 =
{binder_ty=t;binder_ppname=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)
: T.TacH (t:st_term &
c:comp_st { st_comp_of_comp c == st_comp_with_pre (st_comp_of_comp c2) pre } &
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:st_comp) (x:var { fresh_wrt x g (freevars s2.post) })
(post_hint:post_hint_opt g { comp_post_matches_hint (C_ST s2) post_hint })
: T.Tac (universe_of g s2.res s2.u &
tot_typing (push_binding g x ppname_default s2.res) (open_term_nv s2.post (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' | false | true | Pulse.Typing.Combinators.fsti | {
"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"
} | null | val frame_for_req_in_ctxt : g: Pulse.Typing.Env.env -> ctxt: Pulse.Syntax.Base.term -> req: Pulse.Syntax.Base.term -> Type0 | [] | Pulse.Typing.Combinators.frame_for_req_in_ctxt | {
"file_name": "lib/steel/pulse/Pulse.Typing.Combinators.fsti",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | g: Pulse.Typing.Env.env -> ctxt: Pulse.Syntax.Base.term -> req: Pulse.Syntax.Base.term -> Type0 | {
"end_col": 45,
"end_line": 60,
"start_col": 5,
"start_line": 58
} |
|
Prims.Tot | val vprop_as_list (vp: term) : list term | [
{
"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
}
] | false | let rec vprop_as_list (vp:term)
: list term
= match vp.t with
| Tm_Emp -> []
| Tm_Star vp0 vp1 -> vprop_as_list vp0 @ vprop_as_list vp1
| _ -> [vp] | val vprop_as_list (vp: term) : list term
let rec vprop_as_list (vp: term) : list term = | false | null | false | match vp.t with
| Tm_Emp -> []
| Tm_Star vp0 vp1 -> vprop_as_list vp0 @ vprop_as_list vp1
| _ -> [vp] | {
"checked_file": "Pulse.Typing.Combinators.fsti.checked",
"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"
} | [
"total"
] | [
"Pulse.Syntax.Base.term",
"Pulse.Syntax.Base.__proj__Mkterm__item__t",
"Prims.Nil",
"FStar.List.Tot.Base.op_At",
"Pulse.Typing.Combinators.vprop_as_list",
"Pulse.Syntax.Base.term'",
"Prims.Cons",
"Prims.list"
] | [] | 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 =
{binder_ty=t;binder_ppname=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)
: T.TacH (t:st_term &
c:comp_st { st_comp_of_comp c == st_comp_with_pre (st_comp_of_comp c2) pre } &
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:st_comp) (x:var { fresh_wrt x g (freevars s2.post) })
(post_hint:post_hint_opt g { comp_post_matches_hint (C_ST s2) post_hint })
: T.Tac (universe_of g s2.res s2.u &
tot_typing (push_binding g x ppname_default s2.res) (open_term_nv s2.post (v_as_nv x)) tm_vprop)
val add_frame (#g:env) (#t:st_term) (#c:comp_st) (t_typing:st_typing g t c)
(#frame:vprop)
(frame_typing:tot_typing g frame tm_vprop)
: t':st_term &
c':comp_st { c' == add_frame c frame } &
st_typing g t' c'
let frame_for_req_in_ctxt (g:env) (ctxt:term) (req:term)
= (frame:term &
tot_typing g frame tm_vprop &
vprop_equiv g (tm_star req frame) ctxt)
let frame_of #g #ctxt #req (f:frame_for_req_in_ctxt g ctxt req) =
let (| frame, _, _ |) = f in frame
val apply_frame (#g:env)
(#t:st_term)
(#ctxt:term)
(ctxt_typing: tot_typing g ctxt tm_vprop)
(#c:comp { stateful_comp c })
(t_typing: st_typing g t c)
(frame_t:frame_for_req_in_ctxt g ctxt (comp_pre c))
: Tot (c':comp_st { comp_pre c' == ctxt /\
comp_res c' == comp_res c /\
comp_u c' == comp_u c /\
comp_post c' == tm_star (comp_post c) (frame_of frame_t) } &
st_typing g t c')
type st_typing_in_ctxt (g:env) (ctxt:vprop) (post_hint:post_hint_opt g) =
t:st_term &
c:comp_st { comp_pre c == ctxt /\ comp_post_matches_hint c post_hint } &
st_typing g t c
let rec vprop_as_list (vp:term) | false | true | Pulse.Typing.Combinators.fsti | {
"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"
} | null | val vprop_as_list (vp: term) : list term | [
"recursion"
] | Pulse.Typing.Combinators.vprop_as_list | {
"file_name": "lib/steel/pulse/Pulse.Typing.Combinators.fsti",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | vp: Pulse.Syntax.Base.term -> Prims.list Pulse.Syntax.Base.term | {
"end_col": 15,
"end_line": 88,
"start_col": 4,
"start_line": 85
} |
Prims.Tot | val list_as_vprop (vps: list term) : term | [
{
"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
}
] | false | let rec list_as_vprop (vps:list term)
: term
= match vps with
| [] -> tm_emp
| hd::tl -> tm_star hd (list_as_vprop tl) | val list_as_vprop (vps: list term) : term
let rec list_as_vprop (vps: list term) : term = | false | null | false | match vps with
| [] -> tm_emp
| hd :: tl -> tm_star hd (list_as_vprop tl) | {
"checked_file": "Pulse.Typing.Combinators.fsti.checked",
"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"
} | [
"total"
] | [
"Prims.list",
"Pulse.Syntax.Base.term",
"Pulse.Syntax.Base.tm_emp",
"Pulse.Syntax.Base.tm_star",
"Pulse.Typing.Combinators.list_as_vprop"
] | [] | 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 =
{binder_ty=t;binder_ppname=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)
: T.TacH (t:st_term &
c:comp_st { st_comp_of_comp c == st_comp_with_pre (st_comp_of_comp c2) pre } &
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:st_comp) (x:var { fresh_wrt x g (freevars s2.post) })
(post_hint:post_hint_opt g { comp_post_matches_hint (C_ST s2) post_hint })
: T.Tac (universe_of g s2.res s2.u &
tot_typing (push_binding g x ppname_default s2.res) (open_term_nv s2.post (v_as_nv x)) tm_vprop)
val add_frame (#g:env) (#t:st_term) (#c:comp_st) (t_typing:st_typing g t c)
(#frame:vprop)
(frame_typing:tot_typing g frame tm_vprop)
: t':st_term &
c':comp_st { c' == add_frame c frame } &
st_typing g t' c'
let frame_for_req_in_ctxt (g:env) (ctxt:term) (req:term)
= (frame:term &
tot_typing g frame tm_vprop &
vprop_equiv g (tm_star req frame) ctxt)
let frame_of #g #ctxt #req (f:frame_for_req_in_ctxt g ctxt req) =
let (| frame, _, _ |) = f in frame
val apply_frame (#g:env)
(#t:st_term)
(#ctxt:term)
(ctxt_typing: tot_typing g ctxt tm_vprop)
(#c:comp { stateful_comp c })
(t_typing: st_typing g t c)
(frame_t:frame_for_req_in_ctxt g ctxt (comp_pre c))
: Tot (c':comp_st { comp_pre c' == ctxt /\
comp_res c' == comp_res c /\
comp_u c' == comp_u c /\
comp_post c' == tm_star (comp_post c) (frame_of frame_t) } &
st_typing g t c')
type st_typing_in_ctxt (g:env) (ctxt:vprop) (post_hint:post_hint_opt g) =
t:st_term &
c:comp_st { comp_pre c == ctxt /\ comp_post_matches_hint c post_hint } &
st_typing g t c
let rec vprop_as_list (vp:term)
: list term
= match vp.t with
| Tm_Emp -> []
| Tm_Star vp0 vp1 -> vprop_as_list vp0 @ vprop_as_list vp1
| _ -> [vp]
let rec list_as_vprop (vps:list term) | false | true | Pulse.Typing.Combinators.fsti | {
"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"
} | null | val list_as_vprop (vps: list term) : term | [
"recursion"
] | Pulse.Typing.Combinators.list_as_vprop | {
"file_name": "lib/steel/pulse/Pulse.Typing.Combinators.fsti",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | vps: Prims.list Pulse.Syntax.Base.term -> Pulse.Syntax.Base.term | {
"end_col": 45,
"end_line": 94,
"start_col": 4,
"start_line": 92
} |
Prims.Tot | [
{
"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
}
] | false | let and_qn = ["Prims"; "l_and"] | let and_qn = | false | null | false | ["Prims"; "l_and"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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 | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val and_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.and_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 37,
"end_line": 24,
"start_col": 19,
"start_line": 24
} |
|
Prims.Tot | [
{
"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
}
] | false | let add_qn = ["Prims"; "op_Addition"] | let add_qn = | false | null | false | ["Prims"; "op_Addition"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val add_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.add_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 43,
"end_line": 46,
"start_col": 19,
"start_line": 46
} |
|
Prims.Tot | [
{
"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
}
] | false | let prop_qn = ["Prims"; "prop"] | let prop_qn = | false | null | false | ["Prims"; "prop"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val prop_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.prop_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 36,
"end_line": 36,
"start_col": 19,
"start_line": 36
} |
|
Prims.Tot | [
{
"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
}
] | false | let unit_lid = ["Prims"; "unit"] | let unit_lid = | false | null | false | ["Prims"; "unit"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val unit_lid : Prims.list Prims.string | [] | FStar.Reflection.Const.unit_lid | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 36,
"end_line": 43,
"start_col": 19,
"start_line": 43
} |
|
Prims.Tot | [
{
"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
}
] | false | let true_qn = ["Prims"; "l_True"] | let true_qn = | false | null | false | ["Prims"; "l_True"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val true_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.true_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 38,
"end_line": 30,
"start_col": 19,
"start_line": 30
} |
|
Prims.Tot | [
{
"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
}
] | false | let gte_qn = ["Prims"; "op_GreaterThanOrEqual"] | let gte_qn = | false | null | false | ["Prims"; "op_GreaterThanOrEqual"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val gte_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.gte_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 53,
"end_line": 55,
"start_col": 19,
"start_line": 55
} |
|
Prims.Tot | [
{
"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
}
] | false | let forall_qn = ["Prims"; "l_Forall"] | let forall_qn = | false | null | false | ["Prims"; "l_Forall"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val forall_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.forall_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 40,
"end_line": 33,
"start_col": 19,
"start_line": 33
} |
|
Prims.Tot | [
{
"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
}
] | false | let mod_qn = ["Prims"; "op_Modulus"] | let mod_qn = | false | null | false | ["Prims"; "op_Modulus"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val mod_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.mod_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 42,
"end_line": 56,
"start_col": 19,
"start_line": 56
} |
|
Prims.Tot | [
{
"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
}
] | false | let lte_qn = ["Prims"; "op_LessThanOrEqual"] | let lte_qn = | false | null | false | ["Prims"; "op_LessThanOrEqual"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val lte_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.lte_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 50,
"end_line": 53,
"start_col": 19,
"start_line": 53
} |
|
Prims.Tot | [
{
"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
}
] | false | let eq2_qn = ["Prims"; "eq2"] | let eq2_qn = | false | null | false | ["Prims"; "eq2"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val eq2_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.eq2_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 35,
"end_line": 28,
"start_col": 19,
"start_line": 28
} |
|
Prims.Tot | [
{
"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
}
] | false | let exists_qn = ["Prims"; "l_Exists"] | let exists_qn = | false | null | false | ["Prims"; "l_Exists"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val exists_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.exists_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 40,
"end_line": 34,
"start_col": 19,
"start_line": 34
} |
|
Prims.Tot | [
{
"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
}
] | false | let mult'_qn = ["FStar"; "Mul"; "op_Star"] | let mult'_qn = | false | null | false | ["FStar"; "Mul"; "op_Star"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val mult'_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.mult'_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 46,
"end_line": 50,
"start_col": 19,
"start_line": 50
} |
|
Prims.Tot | [
{
"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
}
] | false | let div_qn = ["Prims"; "op_Division"] | let div_qn = | false | null | false | ["Prims"; "op_Division"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val div_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.div_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 43,
"end_line": 51,
"start_col": 19,
"start_line": 51
} |
|
Prims.Tot | [
{
"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
}
] | false | let minus_qn = ["Prims"; "op_Subtraction"] | let minus_qn = | false | null | false | ["Prims"; "op_Subtraction"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val minus_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.minus_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 46,
"end_line": 48,
"start_col": 19,
"start_line": 48
} |
|
Prims.Tot | [
{
"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
}
] | false | let int_lid = ["Prims"; "int"] | let int_lid = | false | null | false | ["Prims"; "int"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val int_lid : Prims.list Prims.string | [] | FStar.Reflection.Const.int_lid | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 35,
"end_line": 41,
"start_col": 19,
"start_line": 41
} |
|
Prims.Tot | [
{
"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
}
] | false | let mktuple2_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple2"] | let mktuple2_qn = | false | null | false | ["FStar"; "Pervasives"; "Native"; "Mktuple2"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val mktuple2_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.mktuple2_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 64,
"end_line": 61,
"start_col": 19,
"start_line": 61
} |
|
Prims.Tot | [
{
"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
}
] | false | let cons_qn = ["Prims"; "Cons"] | let cons_qn = | false | null | false | ["Prims"; "Cons"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val cons_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.cons_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 36,
"end_line": 59,
"start_col": 19,
"start_line": 59
} |
|
Prims.Tot | [
{
"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
}
] | false | let or_qn = ["Prims"; "l_or"] | let or_qn = | false | null | false | ["Prims"; "l_or"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val or_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.or_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 36,
"end_line": 25,
"start_col": 19,
"start_line": 25
} |
|
Prims.Tot | [
{
"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
}
] | false | let b2t_qn = ["Prims"; "b2t"] | let b2t_qn = | false | null | false | ["Prims"; "b2t"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val b2t_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.b2t_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 35,
"end_line": 32,
"start_col": 19,
"start_line": 32
} |
|
Prims.Tot | [
{
"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
}
] | false | let eq1_qn = ["Prims"; "eq"] | let eq1_qn = | false | null | false | ["Prims"; "eq"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val eq1_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.eq1_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 34,
"end_line": 29,
"start_col": 19,
"start_line": 29
} |
|
Prims.Tot | [
{
"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
}
] | false | let squash_qn = ["Prims"; "squash"] | let squash_qn = | false | null | false | ["Prims"; "squash"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val squash_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.squash_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 38,
"end_line": 35,
"start_col": 19,
"start_line": 35
} |
|
Prims.Tot | [
{
"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
}
] | false | let bool_false_qn = ["Prims"; "false"] | let bool_false_qn = | false | null | false | ["Prims"; "false"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val bool_false_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.bool_false_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 38,
"end_line": 39,
"start_col": 20,
"start_line": 39
} |
|
Prims.Tot | [
{
"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
}
] | false | let iff_qn = ["Prims"; "l_iff"] | let iff_qn = | false | null | false | ["Prims"; "l_iff"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val iff_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.iff_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 37,
"end_line": 27,
"start_col": 19,
"start_line": 27
} |
|
Prims.Tot | [
{
"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
}
] | false | let lt_qn = ["Prims"; "op_LessThan"] | let lt_qn = | false | null | false | ["Prims"; "op_LessThan"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val lt_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.lt_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 43,
"end_line": 52,
"start_col": 19,
"start_line": 52
} |
|
Prims.Tot | [
{
"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
}
] | false | let mktuple3_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple3"] | let mktuple3_qn = | false | null | false | ["FStar"; "Pervasives"; "Native"; "Mktuple3"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val mktuple3_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.mktuple3_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 64,
"end_line": 62,
"start_col": 19,
"start_line": 62
} |
|
Prims.Tot | [
{
"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
}
] | false | let string_lid = ["Prims"; "string"] | let string_lid = | false | null | false | ["Prims"; "string"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val string_lid : Prims.list Prims.string | [] | FStar.Reflection.Const.string_lid | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 38,
"end_line": 44,
"start_col": 19,
"start_line": 44
} |
|
Prims.Tot | [
{
"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
}
] | false | let gt_qn = ["Prims"; "op_GreaterThan"] | let gt_qn = | false | null | false | ["Prims"; "op_GreaterThan"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val gt_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.gt_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 46,
"end_line": 54,
"start_col": 19,
"start_line": 54
} |
|
Prims.Tot | [
{
"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
}
] | false | let mktuple4_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple4"] | let mktuple4_qn = | false | null | false | ["FStar"; "Pervasives"; "Native"; "Mktuple4"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val mktuple4_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.mktuple4_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 64,
"end_line": 63,
"start_col": 19,
"start_line": 63
} |
|
Prims.Tot | [
{
"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
}
] | false | let nil_qn = ["Prims"; "Nil"] | let nil_qn = | false | null | false | ["Prims"; "Nil"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val nil_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.nil_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 35,
"end_line": 58,
"start_col": 19,
"start_line": 58
} |
|
Prims.Tot | [
{
"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
}
] | false | let mktuple5_qn = ["FStar"; "Pervasives"; "Native"; "Mktuple5"] | let mktuple5_qn = | false | null | false | ["FStar"; "Pervasives"; "Native"; "Mktuple5"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val mktuple5_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.mktuple5_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 64,
"end_line": 64,
"start_col": 19,
"start_line": 64
} |
|
Prims.Tot | [
{
"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
}
] | false | let bool_lid = ["Prims"; "bool"] | let bool_lid = | false | null | false | ["Prims"; "bool"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val bool_lid : Prims.list Prims.string | [] | FStar.Reflection.Const.bool_lid | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 36,
"end_line": 42,
"start_col": 19,
"start_line": 42
} |
|
Prims.Tot | [
{
"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
}
] | false | let ladd_qn = ["FStar" ; "UInt" ; "add_mod"] | let ladd_qn = | false | null | false | ["FStar"; "UInt"; "add_mod"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val ladd_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.ladd_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 47,
"end_line": 72,
"start_col": 17,
"start_line": 72
} |
|
Prims.Tot | [
{
"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
}
] | false | let false_qn = ["Prims"; "l_False"] | let false_qn = | false | null | false | ["Prims"; "l_False"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val false_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.false_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 39,
"end_line": 31,
"start_col": 19,
"start_line": 31
} |
|
Prims.Tot | [
{
"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
}
] | false | let bool_true_qn = ["Prims"; "true"] | let bool_true_qn = | false | null | false | ["Prims"; "true"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val bool_true_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.bool_true_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 37,
"end_line": 38,
"start_col": 20,
"start_line": 38
} |
|
Prims.Tot | [
{
"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
}
] | false | let imp_qn = ["Prims"; "l_imp"] | let imp_qn = | false | null | false | ["Prims"; "l_imp"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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 | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val imp_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.imp_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 37,
"end_line": 23,
"start_col": 19,
"start_line": 23
} |
|
Prims.Tot | [
{
"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
}
] | false | let not_qn = ["Prims"; "l_not"] | let not_qn = | false | null | false | ["Prims"; "l_not"] | {
"checked_file": "FStar.Reflection.Const.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Reflection.Const.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | (*
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"] | false | true | FStar.Reflection.Const.fst | {
"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"
} | null | val not_qn : Prims.list Prims.string | [] | FStar.Reflection.Const.not_qn | {
"file_name": "ulib/FStar.Reflection.Const.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | Prims.list Prims.string | {
"end_col": 37,
"end_line": 26,
"start_col": 19,
"start_line": 26
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.