effect
stringclasses 48
values | original_source_type
stringlengths 0
23k
| opens_and_abbrevs
listlengths 2
92
| isa_cross_project_example
bool 1
class | source_definition
stringlengths 9
57.9k
| partial_definition
stringlengths 7
23.3k
| is_div
bool 2
classes | is_type
null | is_proof
bool 2
classes | completed_definiton
stringlengths 1
250k
| dependencies
dict | effect_flags
sequencelengths 0
2
| ideal_premises
sequencelengths 0
236
| mutual_with
sequencelengths 0
11
| file_context
stringlengths 0
407k
| interleaved
bool 1
class | is_simply_typed
bool 2
classes | file_name
stringlengths 5
48
| vconfig
dict | is_simple_lemma
null | source_type
stringlengths 10
23k
| proof_features
sequencelengths 0
1
| name
stringlengths 8
95
| source
dict | verbose_type
stringlengths 1
7.42k
| source_range
dict |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Squaring",
"short_module": "SS"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Multiplication",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Definitions",
"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.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Bignum",
"short_module": null
},
{
"abbrev": 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 bn_sqr_st (t:limb_t) =
aLen:size_t{0 < v aLen /\ v aLen + v aLen <= max_size_t}
-> a:lbignum t aLen
-> res:lbignum t (aLen +! aLen) ->
Stack unit
(requires fun h -> live h a /\ live h res /\ disjoint res a)
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
as_seq h1 res == SS.bn_sqr (as_seq h0 a)) | let bn_sqr_st (t: limb_t) = | false | null | false |
aLen: size_t{0 < v aLen /\ v aLen + v aLen <= max_size_t} ->
a: lbignum t aLen ->
res: lbignum t (aLen +! aLen)
-> Stack unit
(requires fun h -> live h a /\ live h res /\ disjoint res a)
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\ as_seq h1 res == SS.bn_sqr (as_seq h0 a)) | {
"checked_file": "Hacl.Bignum.Multiplication.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Bignum.Squaring.fst.checked",
"Hacl.Spec.Bignum.Multiplication.fst.checked",
"Hacl.Impl.Lib.fst.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Base.fst.checked",
"Hacl.Bignum.Addition.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Bignum.Multiplication.fst"
} | [
"total"
] | [
"Hacl.Bignum.Definitions.limb_t",
"Lib.IntTypes.size_t",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThan",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"Lib.IntTypes.max_size_t",
"Hacl.Bignum.Definitions.lbignum",
"Lib.IntTypes.op_Plus_Bang",
"Prims.unit",
"FStar.Monotonic.HyperStack.mem",
"Lib.Buffer.live",
"Lib.Buffer.MUT",
"Hacl.Bignum.Definitions.limb",
"Lib.Buffer.disjoint",
"Lib.Buffer.modifies",
"Lib.Buffer.loc",
"Prims.eq2",
"Lib.Sequence.seq",
"Prims.l_or",
"Prims.nat",
"FStar.Seq.Base.length",
"Hacl.Spec.Bignum.Definitions.limb",
"Lib.Buffer.as_seq",
"Hacl.Spec.Bignum.Squaring.bn_sqr"
] | [] | module Hacl.Bignum.Multiplication
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Bignum.Definitions
open Hacl.Bignum.Base
open Hacl.Impl.Lib
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module B = LowStar.Buffer
module S = Hacl.Spec.Bignum.Multiplication
module SS = Hacl.Spec.Bignum.Squaring
module Loops = Lib.LoopCombinators
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
val bn_mul1:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> l:limb t
-> res:lbignum t aLen ->
Stack (limb t)
(requires fun h ->
live h a /\ live h res /\ eq_or_disjoint a res)
(ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\
(c_out, as_seq h1 res) == S.bn_mul1 (as_seq h0 a) l)
let bn_mul1 #t aLen a l res =
push_frame ();
let c = create 1ul (uint #t 0) in
[@inline_let]
let refl h i = LSeq.index (as_seq h c) 0 in
[@inline_let]
let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\
B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in
[@inline_let]
let spec h = S.bn_mul1_f (as_seq h a) l in
let h0 = ST.get () in
fill_elems4 h0 aLen res refl footprint spec
(fun i ->
let h1 = ST.get () in
let a_i = a.(i) in
let res_i = sub res i 1ul in
c.(0ul) <- mul_wide_add_st a_i l c.(0ul) res_i;
lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1
);
let c = c.(0ul) in
pop_frame ();
c
inline_for_extraction noextract
val bn_mul1_add_in_place:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> l:limb t
-> res:lbignum t aLen ->
Stack (limb t)
(requires fun h ->
live h a /\ live h res /\ disjoint res a)
(ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\
(c_out, as_seq h1 res) == S.bn_mul1_add_in_place (as_seq h0 a) l (as_seq h0 res))
let bn_mul1_add_in_place #t aLen a l res =
push_frame ();
let c = create 1ul (uint #t 0) in
[@inline_let]
let refl h i = LSeq.index (as_seq h c) 0 in
[@inline_let]
let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\
B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in
[@inline_let]
let spec h = S.bn_mul1_add_in_place_f (as_seq h a) l (as_seq h res) in
let h0 = ST.get () in
fill_elems4 h0 aLen res refl footprint spec
(fun i ->
let a_i = a.(i) in
let res_i = sub res i 1ul in
c.(0ul) <- mul_wide_add2_st a_i l c.(0ul) res_i
);
let c = c.(0ul) in
pop_frame ();
c
inline_for_extraction noextract
val bn_mul1_lshift_add:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> b_j:limb t
-> resLen:size_t
-> j:size_t{v j + v aLen <= v resLen}
-> res:lbignum t resLen ->
Stack (limb t)
(requires fun h -> live h a /\ live h res /\ disjoint res a)
(ensures fun h0 c h1 -> modifies (loc res) h0 h1 /\
(c, as_seq h1 res) == S.bn_mul1_lshift_add (as_seq h0 a) b_j (v j) (as_seq h0 res))
let bn_mul1_lshift_add #t aLen a b_j resLen j res =
let res_j = sub res j aLen in
let h0 = ST.get () in
update_sub_f_carry h0 res j aLen
(fun h -> S.bn_mul1_add_in_place (as_seq h0 a) b_j (as_seq h0 res_j))
(fun _ -> bn_mul1_add_in_place aLen a b_j res_j)
inline_for_extraction noextract
let bn_mul_st (t:limb_t) =
aLen:size_t
-> a:lbignum t aLen
-> bLen:size_t{v aLen + v bLen <= max_size_t}
-> b:lbignum t bLen
-> res:lbignum t (aLen +! bLen) ->
Stack unit
(requires fun h ->
live h a /\ live h b /\ live h res /\
disjoint res a /\ disjoint res b /\ eq_or_disjoint a b)
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
as_seq h1 res == S.bn_mul (as_seq h0 a) (as_seq h0 b))
inline_for_extraction noextract
val bn_mul: #t:limb_t -> bn_mul_st t
let bn_mul #t aLen a bLen b res =
[@inline_let]
let resLen = aLen +! bLen in
memset res (uint #t 0) resLen;
let h0 = ST.get () in
LSeq.eq_intro (LSeq.sub (as_seq h0 res) 0 (v resLen)) (as_seq h0 res);
[@ inline_let]
let spec h = S.bn_mul_ (as_seq h a) (as_seq h b) in
loop1 h0 bLen res spec
(fun j ->
Loops.unfold_repeati (v bLen) (spec h0) (as_seq h0 res) (v j);
let bj = b.(j) in
res.(aLen +! j) <- bn_mul1_lshift_add aLen a bj (aLen +! bLen) j res
)
[@CInline]
let bn_mul_u32 : bn_mul_st U32 = bn_mul
[@CInline]
let bn_mul_u64 : bn_mul_st U64 = bn_mul
inline_for_extraction noextract
let bn_mul_u (#t:limb_t) : bn_mul_st t =
match t with
| U32 -> bn_mul_u32
| U64 -> bn_mul_u64
inline_for_extraction noextract
val bn_sqr_diag:
#t:limb_t
-> aLen:size_t{v aLen + v aLen <= max_size_t}
-> a:lbignum t aLen
-> res:lbignum t (aLen +! aLen) ->
Stack unit
(requires fun h -> live h a /\ live h res /\ disjoint res a /\
as_seq h res == LSeq.create (v aLen + v aLen) (uint #t 0))
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
as_seq h1 res == SS.bn_sqr_diag (as_seq h0 a))
let bn_sqr_diag #t aLen a res =
let h0 = ST.get () in
[@inline_let]
let spec h = SS.bn_sqr_diag_f (as_seq h a) in
loop1 h0 aLen res spec
(fun i ->
Loops.unfold_repeati (v aLen) (spec h0) (as_seq h0 res) (v i);
let (hi, lo) = mul_wide a.(i) a.(i) in
res.(2ul *! i) <- lo;
res.(2ul *! i +! 1ul) <- hi)
// This code is taken from BoringSSL
// https://github.com/google/boringssl/blob/master/crypto/fipsmodule/bn/mul.c#L551
inline_for_extraction noextract | false | true | Hacl.Bignum.Multiplication.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 bn_sqr_st : t: Hacl.Bignum.Definitions.limb_t -> Type0 | [] | Hacl.Bignum.Multiplication.bn_sqr_st | {
"file_name": "code/bignum/Hacl.Bignum.Multiplication.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | t: Hacl.Bignum.Definitions.limb_t -> Type0 | {
"end_col": 45,
"end_line": 204,
"start_col": 4,
"start_line": 198
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Squaring",
"short_module": "SS"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Multiplication",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Definitions",
"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.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Bignum",
"short_module": null
},
{
"abbrev": 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 bn_mul_st (t:limb_t) =
aLen:size_t
-> a:lbignum t aLen
-> bLen:size_t{v aLen + v bLen <= max_size_t}
-> b:lbignum t bLen
-> res:lbignum t (aLen +! bLen) ->
Stack unit
(requires fun h ->
live h a /\ live h b /\ live h res /\
disjoint res a /\ disjoint res b /\ eq_or_disjoint a b)
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
as_seq h1 res == S.bn_mul (as_seq h0 a) (as_seq h0 b)) | let bn_mul_st (t: limb_t) = | false | null | false |
aLen: size_t ->
a: lbignum t aLen ->
bLen: size_t{v aLen + v bLen <= max_size_t} ->
b: lbignum t bLen ->
res: lbignum t (aLen +! bLen)
-> Stack unit
(requires
fun h ->
live h a /\ live h b /\ live h res /\ disjoint res a /\ disjoint res b /\
eq_or_disjoint a b)
(ensures
fun h0 _ h1 ->
modifies (loc res) h0 h1 /\ as_seq h1 res == S.bn_mul (as_seq h0 a) (as_seq h0 b)) | {
"checked_file": "Hacl.Bignum.Multiplication.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Bignum.Squaring.fst.checked",
"Hacl.Spec.Bignum.Multiplication.fst.checked",
"Hacl.Impl.Lib.fst.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Base.fst.checked",
"Hacl.Bignum.Addition.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Bignum.Multiplication.fst"
} | [
"total"
] | [
"Hacl.Bignum.Definitions.limb_t",
"Lib.IntTypes.size_t",
"Hacl.Bignum.Definitions.lbignum",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.IntTypes.max_size_t",
"Lib.IntTypes.op_Plus_Bang",
"Prims.unit",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_and",
"Lib.Buffer.live",
"Lib.Buffer.MUT",
"Hacl.Bignum.Definitions.limb",
"Lib.Buffer.disjoint",
"Lib.Buffer.eq_or_disjoint",
"Lib.Buffer.modifies",
"Lib.Buffer.loc",
"Prims.eq2",
"Lib.Sequence.seq",
"Prims.l_or",
"Prims.nat",
"FStar.Seq.Base.length",
"Hacl.Spec.Bignum.Definitions.limb",
"Lib.Buffer.as_seq",
"Hacl.Spec.Bignum.Multiplication.bn_mul"
] | [] | module Hacl.Bignum.Multiplication
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Bignum.Definitions
open Hacl.Bignum.Base
open Hacl.Impl.Lib
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module B = LowStar.Buffer
module S = Hacl.Spec.Bignum.Multiplication
module SS = Hacl.Spec.Bignum.Squaring
module Loops = Lib.LoopCombinators
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
val bn_mul1:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> l:limb t
-> res:lbignum t aLen ->
Stack (limb t)
(requires fun h ->
live h a /\ live h res /\ eq_or_disjoint a res)
(ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\
(c_out, as_seq h1 res) == S.bn_mul1 (as_seq h0 a) l)
let bn_mul1 #t aLen a l res =
push_frame ();
let c = create 1ul (uint #t 0) in
[@inline_let]
let refl h i = LSeq.index (as_seq h c) 0 in
[@inline_let]
let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\
B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in
[@inline_let]
let spec h = S.bn_mul1_f (as_seq h a) l in
let h0 = ST.get () in
fill_elems4 h0 aLen res refl footprint spec
(fun i ->
let h1 = ST.get () in
let a_i = a.(i) in
let res_i = sub res i 1ul in
c.(0ul) <- mul_wide_add_st a_i l c.(0ul) res_i;
lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1
);
let c = c.(0ul) in
pop_frame ();
c
inline_for_extraction noextract
val bn_mul1_add_in_place:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> l:limb t
-> res:lbignum t aLen ->
Stack (limb t)
(requires fun h ->
live h a /\ live h res /\ disjoint res a)
(ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\
(c_out, as_seq h1 res) == S.bn_mul1_add_in_place (as_seq h0 a) l (as_seq h0 res))
let bn_mul1_add_in_place #t aLen a l res =
push_frame ();
let c = create 1ul (uint #t 0) in
[@inline_let]
let refl h i = LSeq.index (as_seq h c) 0 in
[@inline_let]
let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\
B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in
[@inline_let]
let spec h = S.bn_mul1_add_in_place_f (as_seq h a) l (as_seq h res) in
let h0 = ST.get () in
fill_elems4 h0 aLen res refl footprint spec
(fun i ->
let a_i = a.(i) in
let res_i = sub res i 1ul in
c.(0ul) <- mul_wide_add2_st a_i l c.(0ul) res_i
);
let c = c.(0ul) in
pop_frame ();
c
inline_for_extraction noextract
val bn_mul1_lshift_add:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> b_j:limb t
-> resLen:size_t
-> j:size_t{v j + v aLen <= v resLen}
-> res:lbignum t resLen ->
Stack (limb t)
(requires fun h -> live h a /\ live h res /\ disjoint res a)
(ensures fun h0 c h1 -> modifies (loc res) h0 h1 /\
(c, as_seq h1 res) == S.bn_mul1_lshift_add (as_seq h0 a) b_j (v j) (as_seq h0 res))
let bn_mul1_lshift_add #t aLen a b_j resLen j res =
let res_j = sub res j aLen in
let h0 = ST.get () in
update_sub_f_carry h0 res j aLen
(fun h -> S.bn_mul1_add_in_place (as_seq h0 a) b_j (as_seq h0 res_j))
(fun _ -> bn_mul1_add_in_place aLen a b_j res_j)
inline_for_extraction noextract | false | true | Hacl.Bignum.Multiplication.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 bn_mul_st : t: Hacl.Bignum.Definitions.limb_t -> Type0 | [] | Hacl.Bignum.Multiplication.bn_mul_st | {
"file_name": "code/bignum/Hacl.Bignum.Multiplication.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | t: Hacl.Bignum.Definitions.limb_t -> Type0 | {
"end_col": 58,
"end_line": 134,
"start_col": 4,
"start_line": 124
} |
|
FStar.HyperStack.ST.Stack | val bn_mul1_lshift_add:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> b_j:limb t
-> resLen:size_t
-> j:size_t{v j + v aLen <= v resLen}
-> res:lbignum t resLen ->
Stack (limb t)
(requires fun h -> live h a /\ live h res /\ disjoint res a)
(ensures fun h0 c h1 -> modifies (loc res) h0 h1 /\
(c, as_seq h1 res) == S.bn_mul1_lshift_add (as_seq h0 a) b_j (v j) (as_seq h0 res)) | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Squaring",
"short_module": "SS"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Multiplication",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Definitions",
"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.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Bignum",
"short_module": null
},
{
"abbrev": 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 bn_mul1_lshift_add #t aLen a b_j resLen j res =
let res_j = sub res j aLen in
let h0 = ST.get () in
update_sub_f_carry h0 res j aLen
(fun h -> S.bn_mul1_add_in_place (as_seq h0 a) b_j (as_seq h0 res_j))
(fun _ -> bn_mul1_add_in_place aLen a b_j res_j) | val bn_mul1_lshift_add:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> b_j:limb t
-> resLen:size_t
-> j:size_t{v j + v aLen <= v resLen}
-> res:lbignum t resLen ->
Stack (limb t)
(requires fun h -> live h a /\ live h res /\ disjoint res a)
(ensures fun h0 c h1 -> modifies (loc res) h0 h1 /\
(c, as_seq h1 res) == S.bn_mul1_lshift_add (as_seq h0 a) b_j (v j) (as_seq h0 res))
let bn_mul1_lshift_add #t aLen a b_j resLen j res = | true | null | false | let res_j = sub res j aLen in
let h0 = ST.get () in
update_sub_f_carry h0
res
j
aLen
(fun h -> S.bn_mul1_add_in_place (as_seq h0 a) b_j (as_seq h0 res_j))
(fun _ -> bn_mul1_add_in_place aLen a b_j res_j) | {
"checked_file": "Hacl.Bignum.Multiplication.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Bignum.Squaring.fst.checked",
"Hacl.Spec.Bignum.Multiplication.fst.checked",
"Hacl.Impl.Lib.fst.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Base.fst.checked",
"Hacl.Bignum.Addition.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Bignum.Multiplication.fst"
} | [] | [
"Hacl.Bignum.Definitions.limb_t",
"Lib.IntTypes.size_t",
"Hacl.Bignum.Definitions.lbignum",
"Hacl.Bignum.Definitions.limb",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Hacl.Impl.Lib.update_sub_f_carry",
"Hacl.Spec.Bignum.Definitions.limb",
"FStar.Monotonic.HyperStack.mem",
"Hacl.Spec.Bignum.Multiplication.bn_mul1_add_in_place",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"FStar.Pervasives.Native.tuple2",
"FStar.Seq.Properties.lseq",
"Prims.unit",
"Hacl.Bignum.Multiplication.bn_mul1_add_in_place",
"FStar.HyperStack.ST.get",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.sub"
] | [] | module Hacl.Bignum.Multiplication
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Bignum.Definitions
open Hacl.Bignum.Base
open Hacl.Impl.Lib
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module B = LowStar.Buffer
module S = Hacl.Spec.Bignum.Multiplication
module SS = Hacl.Spec.Bignum.Squaring
module Loops = Lib.LoopCombinators
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
val bn_mul1:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> l:limb t
-> res:lbignum t aLen ->
Stack (limb t)
(requires fun h ->
live h a /\ live h res /\ eq_or_disjoint a res)
(ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\
(c_out, as_seq h1 res) == S.bn_mul1 (as_seq h0 a) l)
let bn_mul1 #t aLen a l res =
push_frame ();
let c = create 1ul (uint #t 0) in
[@inline_let]
let refl h i = LSeq.index (as_seq h c) 0 in
[@inline_let]
let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\
B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in
[@inline_let]
let spec h = S.bn_mul1_f (as_seq h a) l in
let h0 = ST.get () in
fill_elems4 h0 aLen res refl footprint spec
(fun i ->
let h1 = ST.get () in
let a_i = a.(i) in
let res_i = sub res i 1ul in
c.(0ul) <- mul_wide_add_st a_i l c.(0ul) res_i;
lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1
);
let c = c.(0ul) in
pop_frame ();
c
inline_for_extraction noextract
val bn_mul1_add_in_place:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> l:limb t
-> res:lbignum t aLen ->
Stack (limb t)
(requires fun h ->
live h a /\ live h res /\ disjoint res a)
(ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\
(c_out, as_seq h1 res) == S.bn_mul1_add_in_place (as_seq h0 a) l (as_seq h0 res))
let bn_mul1_add_in_place #t aLen a l res =
push_frame ();
let c = create 1ul (uint #t 0) in
[@inline_let]
let refl h i = LSeq.index (as_seq h c) 0 in
[@inline_let]
let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\
B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in
[@inline_let]
let spec h = S.bn_mul1_add_in_place_f (as_seq h a) l (as_seq h res) in
let h0 = ST.get () in
fill_elems4 h0 aLen res refl footprint spec
(fun i ->
let a_i = a.(i) in
let res_i = sub res i 1ul in
c.(0ul) <- mul_wide_add2_st a_i l c.(0ul) res_i
);
let c = c.(0ul) in
pop_frame ();
c
inline_for_extraction noextract
val bn_mul1_lshift_add:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> b_j:limb t
-> resLen:size_t
-> j:size_t{v j + v aLen <= v resLen}
-> res:lbignum t resLen ->
Stack (limb t)
(requires fun h -> live h a /\ live h res /\ disjoint res a)
(ensures fun h0 c h1 -> modifies (loc res) h0 h1 /\
(c, as_seq h1 res) == S.bn_mul1_lshift_add (as_seq h0 a) b_j (v j) (as_seq h0 res)) | false | false | Hacl.Bignum.Multiplication.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 bn_mul1_lshift_add:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> b_j:limb t
-> resLen:size_t
-> j:size_t{v j + v aLen <= v resLen}
-> res:lbignum t resLen ->
Stack (limb t)
(requires fun h -> live h a /\ live h res /\ disjoint res a)
(ensures fun h0 c h1 -> modifies (loc res) h0 h1 /\
(c, as_seq h1 res) == S.bn_mul1_lshift_add (as_seq h0 a) b_j (v j) (as_seq h0 res)) | [] | Hacl.Bignum.Multiplication.bn_mul1_lshift_add | {
"file_name": "code/bignum/Hacl.Bignum.Multiplication.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
aLen: Lib.IntTypes.size_t ->
a: Hacl.Bignum.Definitions.lbignum t aLen ->
b_j: Hacl.Bignum.Definitions.limb t ->
resLen: Lib.IntTypes.size_t ->
j: Lib.IntTypes.size_t{Lib.IntTypes.v j + Lib.IntTypes.v aLen <= Lib.IntTypes.v resLen} ->
res: Hacl.Bignum.Definitions.lbignum t resLen
-> FStar.HyperStack.ST.Stack (Hacl.Bignum.Definitions.limb t) | {
"end_col": 50,
"end_line": 119,
"start_col": 51,
"start_line": 114
} |
FStar.HyperStack.ST.Stack | val bn_mul1:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> l:limb t
-> res:lbignum t aLen ->
Stack (limb t)
(requires fun h ->
live h a /\ live h res /\ eq_or_disjoint a res)
(ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\
(c_out, as_seq h1 res) == S.bn_mul1 (as_seq h0 a) l) | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Squaring",
"short_module": "SS"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Multiplication",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Definitions",
"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.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Bignum",
"short_module": null
},
{
"abbrev": 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 bn_mul1 #t aLen a l res =
push_frame ();
let c = create 1ul (uint #t 0) in
[@inline_let]
let refl h i = LSeq.index (as_seq h c) 0 in
[@inline_let]
let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\
B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in
[@inline_let]
let spec h = S.bn_mul1_f (as_seq h a) l in
let h0 = ST.get () in
fill_elems4 h0 aLen res refl footprint spec
(fun i ->
let h1 = ST.get () in
let a_i = a.(i) in
let res_i = sub res i 1ul in
c.(0ul) <- mul_wide_add_st a_i l c.(0ul) res_i;
lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1
);
let c = c.(0ul) in
pop_frame ();
c | val bn_mul1:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> l:limb t
-> res:lbignum t aLen ->
Stack (limb t)
(requires fun h ->
live h a /\ live h res /\ eq_or_disjoint a res)
(ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\
(c_out, as_seq h1 res) == S.bn_mul1 (as_seq h0 a) l)
let bn_mul1 #t aLen a l res = | true | null | false | push_frame ();
let c = create 1ul (uint #t 0) in
[@@ inline_let ]let refl h i = LSeq.index (as_seq h c) 0 in
[@@ inline_let ]let footprint (i: size_nat{i <= v aLen})
: GTot
(l: B.loc{B.loc_disjoint l (loc res) /\ B.address_liveness_insensitive_locs `B.loc_includes` l})
=
loc c
in
[@@ inline_let ]let spec h = S.bn_mul1_f (as_seq h a) l in
let h0 = ST.get () in
fill_elems4 h0
aLen
res
refl
footprint
spec
(fun i ->
let h1 = ST.get () in
let a_i = a.(i) in
let res_i = sub res i 1ul in
c.(0ul) <- mul_wide_add_st a_i l c.(0ul) res_i;
lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1);
let c = c.(0ul) in
pop_frame ();
c | {
"checked_file": "Hacl.Bignum.Multiplication.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Bignum.Squaring.fst.checked",
"Hacl.Spec.Bignum.Multiplication.fst.checked",
"Hacl.Impl.Lib.fst.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Base.fst.checked",
"Hacl.Bignum.Addition.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Bignum.Multiplication.fst"
} | [] | [
"Hacl.Bignum.Definitions.limb_t",
"Lib.IntTypes.size_t",
"Hacl.Bignum.Definitions.lbignum",
"Hacl.Bignum.Definitions.limb",
"Prims.unit",
"FStar.HyperStack.ST.pop_frame",
"Lib.Buffer.op_Array_Access",
"Lib.Buffer.MUT",
"FStar.UInt32.__uint_to_t",
"Hacl.Impl.Lib.fill_elems4",
"Hacl.Spec.Bignum.Definitions.limb",
"Prims.b2t",
"Prims.op_LessThan",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Hacl.Impl.Lib.lemma_eq_disjoint",
"Lib.Buffer.op_Array_Assignment",
"Hacl.Bignum.Base.mul_wide_add_st",
"Lib.Buffer.lbuffer_t",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.sub",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Prims.nat",
"Prims.op_LessThanOrEqual",
"Prims.op_Subtraction",
"Prims.pow2",
"FStar.Pervasives.Native.tuple2",
"Hacl.Spec.Bignum.Multiplication.bn_mul1_f",
"Lib.Buffer.as_seq",
"LowStar.Monotonic.Buffer.loc",
"Prims.l_and",
"LowStar.Monotonic.Buffer.loc_disjoint",
"Lib.Buffer.loc",
"LowStar.Monotonic.Buffer.loc_includes",
"LowStar.Monotonic.Buffer.address_liveness_insensitive_locs",
"Lib.IntTypes.size_nat",
"Prims.eq2",
"FStar.Seq.Base.index",
"Lib.Sequence.to_seq",
"Lib.Sequence.index",
"Lib.Buffer.create",
"Lib.IntTypes.uint",
"Lib.IntTypes.SEC",
"Lib.Buffer.lbuffer",
"FStar.HyperStack.ST.push_frame"
] | [] | module Hacl.Bignum.Multiplication
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Bignum.Definitions
open Hacl.Bignum.Base
open Hacl.Impl.Lib
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module B = LowStar.Buffer
module S = Hacl.Spec.Bignum.Multiplication
module SS = Hacl.Spec.Bignum.Squaring
module Loops = Lib.LoopCombinators
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
val bn_mul1:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> l:limb t
-> res:lbignum t aLen ->
Stack (limb t)
(requires fun h ->
live h a /\ live h res /\ eq_or_disjoint a res)
(ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\
(c_out, as_seq h1 res) == S.bn_mul1 (as_seq h0 a) l) | false | false | Hacl.Bignum.Multiplication.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 bn_mul1:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> l:limb t
-> res:lbignum t aLen ->
Stack (limb t)
(requires fun h ->
live h a /\ live h res /\ eq_or_disjoint a res)
(ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\
(c_out, as_seq h1 res) == S.bn_mul1 (as_seq h0 a) l) | [] | Hacl.Bignum.Multiplication.bn_mul1 | {
"file_name": "code/bignum/Hacl.Bignum.Multiplication.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
aLen: Lib.IntTypes.size_t ->
a: Hacl.Bignum.Definitions.lbignum t aLen ->
l: Hacl.Bignum.Definitions.limb t ->
res: Hacl.Bignum.Definitions.lbignum t aLen
-> FStar.HyperStack.ST.Stack (Hacl.Bignum.Definitions.limb t) | {
"end_col": 3,
"end_line": 60,
"start_col": 2,
"start_line": 38
} |
FStar.HyperStack.ST.Stack | val bn_sqr_diag:
#t:limb_t
-> aLen:size_t{v aLen + v aLen <= max_size_t}
-> a:lbignum t aLen
-> res:lbignum t (aLen +! aLen) ->
Stack unit
(requires fun h -> live h a /\ live h res /\ disjoint res a /\
as_seq h res == LSeq.create (v aLen + v aLen) (uint #t 0))
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
as_seq h1 res == SS.bn_sqr_diag (as_seq h0 a)) | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Squaring",
"short_module": "SS"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Multiplication",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Definitions",
"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.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Bignum",
"short_module": null
},
{
"abbrev": 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 bn_sqr_diag #t aLen a res =
let h0 = ST.get () in
[@inline_let]
let spec h = SS.bn_sqr_diag_f (as_seq h a) in
loop1 h0 aLen res spec
(fun i ->
Loops.unfold_repeati (v aLen) (spec h0) (as_seq h0 res) (v i);
let (hi, lo) = mul_wide a.(i) a.(i) in
res.(2ul *! i) <- lo;
res.(2ul *! i +! 1ul) <- hi) | val bn_sqr_diag:
#t:limb_t
-> aLen:size_t{v aLen + v aLen <= max_size_t}
-> a:lbignum t aLen
-> res:lbignum t (aLen +! aLen) ->
Stack unit
(requires fun h -> live h a /\ live h res /\ disjoint res a /\
as_seq h res == LSeq.create (v aLen + v aLen) (uint #t 0))
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
as_seq h1 res == SS.bn_sqr_diag (as_seq h0 a))
let bn_sqr_diag #t aLen a res = | true | null | false | let h0 = ST.get () in
[@@ inline_let ]let spec h = SS.bn_sqr_diag_f (as_seq h a) in
loop1 h0
aLen
res
spec
(fun i ->
Loops.unfold_repeati (v aLen) (spec h0) (as_seq h0 res) (v i);
let hi, lo = mul_wide a.(i) a.(i) in
res.(2ul *! i) <- lo;
res.(2ul *! i +! 1ul) <- hi) | {
"checked_file": "Hacl.Bignum.Multiplication.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Bignum.Squaring.fst.checked",
"Hacl.Spec.Bignum.Multiplication.fst.checked",
"Hacl.Impl.Lib.fst.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Base.fst.checked",
"Hacl.Bignum.Addition.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Bignum.Multiplication.fst"
} | [] | [
"Hacl.Bignum.Definitions.limb_t",
"Lib.IntTypes.size_t",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.IntTypes.max_size_t",
"Hacl.Bignum.Definitions.lbignum",
"Lib.IntTypes.op_Plus_Bang",
"Lib.Buffer.loop1",
"Hacl.Bignum.Definitions.limb",
"Prims.op_LessThan",
"Hacl.Spec.Bignum.Definitions.limb",
"Lib.Buffer.op_Array_Assignment",
"Lib.IntTypes.op_Star_Bang",
"FStar.UInt32.__uint_to_t",
"Prims.unit",
"FStar.Pervasives.Native.tuple2",
"Hacl.Spec.Bignum.Base.mul_wide",
"Lib.Buffer.op_Array_Access",
"Lib.Buffer.MUT",
"Lib.LoopCombinators.unfold_repeati",
"Hacl.Spec.Bignum.Definitions.lbignum",
"Lib.Buffer.as_seq",
"FStar.Monotonic.HyperStack.mem",
"Prims.nat",
"Hacl.Spec.Bignum.Squaring.bn_sqr_diag_f",
"FStar.HyperStack.ST.get"
] | [] | module Hacl.Bignum.Multiplication
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Bignum.Definitions
open Hacl.Bignum.Base
open Hacl.Impl.Lib
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module B = LowStar.Buffer
module S = Hacl.Spec.Bignum.Multiplication
module SS = Hacl.Spec.Bignum.Squaring
module Loops = Lib.LoopCombinators
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
val bn_mul1:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> l:limb t
-> res:lbignum t aLen ->
Stack (limb t)
(requires fun h ->
live h a /\ live h res /\ eq_or_disjoint a res)
(ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\
(c_out, as_seq h1 res) == S.bn_mul1 (as_seq h0 a) l)
let bn_mul1 #t aLen a l res =
push_frame ();
let c = create 1ul (uint #t 0) in
[@inline_let]
let refl h i = LSeq.index (as_seq h c) 0 in
[@inline_let]
let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\
B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in
[@inline_let]
let spec h = S.bn_mul1_f (as_seq h a) l in
let h0 = ST.get () in
fill_elems4 h0 aLen res refl footprint spec
(fun i ->
let h1 = ST.get () in
let a_i = a.(i) in
let res_i = sub res i 1ul in
c.(0ul) <- mul_wide_add_st a_i l c.(0ul) res_i;
lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1
);
let c = c.(0ul) in
pop_frame ();
c
inline_for_extraction noextract
val bn_mul1_add_in_place:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> l:limb t
-> res:lbignum t aLen ->
Stack (limb t)
(requires fun h ->
live h a /\ live h res /\ disjoint res a)
(ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\
(c_out, as_seq h1 res) == S.bn_mul1_add_in_place (as_seq h0 a) l (as_seq h0 res))
let bn_mul1_add_in_place #t aLen a l res =
push_frame ();
let c = create 1ul (uint #t 0) in
[@inline_let]
let refl h i = LSeq.index (as_seq h c) 0 in
[@inline_let]
let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\
B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in
[@inline_let]
let spec h = S.bn_mul1_add_in_place_f (as_seq h a) l (as_seq h res) in
let h0 = ST.get () in
fill_elems4 h0 aLen res refl footprint spec
(fun i ->
let a_i = a.(i) in
let res_i = sub res i 1ul in
c.(0ul) <- mul_wide_add2_st a_i l c.(0ul) res_i
);
let c = c.(0ul) in
pop_frame ();
c
inline_for_extraction noextract
val bn_mul1_lshift_add:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> b_j:limb t
-> resLen:size_t
-> j:size_t{v j + v aLen <= v resLen}
-> res:lbignum t resLen ->
Stack (limb t)
(requires fun h -> live h a /\ live h res /\ disjoint res a)
(ensures fun h0 c h1 -> modifies (loc res) h0 h1 /\
(c, as_seq h1 res) == S.bn_mul1_lshift_add (as_seq h0 a) b_j (v j) (as_seq h0 res))
let bn_mul1_lshift_add #t aLen a b_j resLen j res =
let res_j = sub res j aLen in
let h0 = ST.get () in
update_sub_f_carry h0 res j aLen
(fun h -> S.bn_mul1_add_in_place (as_seq h0 a) b_j (as_seq h0 res_j))
(fun _ -> bn_mul1_add_in_place aLen a b_j res_j)
inline_for_extraction noextract
let bn_mul_st (t:limb_t) =
aLen:size_t
-> a:lbignum t aLen
-> bLen:size_t{v aLen + v bLen <= max_size_t}
-> b:lbignum t bLen
-> res:lbignum t (aLen +! bLen) ->
Stack unit
(requires fun h ->
live h a /\ live h b /\ live h res /\
disjoint res a /\ disjoint res b /\ eq_or_disjoint a b)
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
as_seq h1 res == S.bn_mul (as_seq h0 a) (as_seq h0 b))
inline_for_extraction noextract
val bn_mul: #t:limb_t -> bn_mul_st t
let bn_mul #t aLen a bLen b res =
[@inline_let]
let resLen = aLen +! bLen in
memset res (uint #t 0) resLen;
let h0 = ST.get () in
LSeq.eq_intro (LSeq.sub (as_seq h0 res) 0 (v resLen)) (as_seq h0 res);
[@ inline_let]
let spec h = S.bn_mul_ (as_seq h a) (as_seq h b) in
loop1 h0 bLen res spec
(fun j ->
Loops.unfold_repeati (v bLen) (spec h0) (as_seq h0 res) (v j);
let bj = b.(j) in
res.(aLen +! j) <- bn_mul1_lshift_add aLen a bj (aLen +! bLen) j res
)
[@CInline]
let bn_mul_u32 : bn_mul_st U32 = bn_mul
[@CInline]
let bn_mul_u64 : bn_mul_st U64 = bn_mul
inline_for_extraction noextract
let bn_mul_u (#t:limb_t) : bn_mul_st t =
match t with
| U32 -> bn_mul_u32
| U64 -> bn_mul_u64
inline_for_extraction noextract
val bn_sqr_diag:
#t:limb_t
-> aLen:size_t{v aLen + v aLen <= max_size_t}
-> a:lbignum t aLen
-> res:lbignum t (aLen +! aLen) ->
Stack unit
(requires fun h -> live h a /\ live h res /\ disjoint res a /\
as_seq h res == LSeq.create (v aLen + v aLen) (uint #t 0))
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
as_seq h1 res == SS.bn_sqr_diag (as_seq h0 a)) | false | false | Hacl.Bignum.Multiplication.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 bn_sqr_diag:
#t:limb_t
-> aLen:size_t{v aLen + v aLen <= max_size_t}
-> a:lbignum t aLen
-> res:lbignum t (aLen +! aLen) ->
Stack unit
(requires fun h -> live h a /\ live h res /\ disjoint res a /\
as_seq h res == LSeq.create (v aLen + v aLen) (uint #t 0))
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
as_seq h1 res == SS.bn_sqr_diag (as_seq h0 a)) | [] | Hacl.Bignum.Multiplication.bn_sqr_diag | {
"file_name": "code/bignum/Hacl.Bignum.Multiplication.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
aLen: Lib.IntTypes.size_t{Lib.IntTypes.v aLen + Lib.IntTypes.v aLen <= Lib.IntTypes.max_size_t} ->
a: Hacl.Bignum.Definitions.lbignum t aLen ->
res: Hacl.Bignum.Definitions.lbignum t (aLen +! aLen)
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 32,
"end_line": 191,
"start_col": 31,
"start_line": 180
} |
FStar.HyperStack.ST.Stack | val bn_mul1_add_in_place:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> l:limb t
-> res:lbignum t aLen ->
Stack (limb t)
(requires fun h ->
live h a /\ live h res /\ disjoint res a)
(ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\
(c_out, as_seq h1 res) == S.bn_mul1_add_in_place (as_seq h0 a) l (as_seq h0 res)) | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Squaring",
"short_module": "SS"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Multiplication",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Definitions",
"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.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Bignum",
"short_module": null
},
{
"abbrev": 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 bn_mul1_add_in_place #t aLen a l res =
push_frame ();
let c = create 1ul (uint #t 0) in
[@inline_let]
let refl h i = LSeq.index (as_seq h c) 0 in
[@inline_let]
let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\
B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in
[@inline_let]
let spec h = S.bn_mul1_add_in_place_f (as_seq h a) l (as_seq h res) in
let h0 = ST.get () in
fill_elems4 h0 aLen res refl footprint spec
(fun i ->
let a_i = a.(i) in
let res_i = sub res i 1ul in
c.(0ul) <- mul_wide_add2_st a_i l c.(0ul) res_i
);
let c = c.(0ul) in
pop_frame ();
c | val bn_mul1_add_in_place:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> l:limb t
-> res:lbignum t aLen ->
Stack (limb t)
(requires fun h ->
live h a /\ live h res /\ disjoint res a)
(ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\
(c_out, as_seq h1 res) == S.bn_mul1_add_in_place (as_seq h0 a) l (as_seq h0 res))
let bn_mul1_add_in_place #t aLen a l res = | true | null | false | push_frame ();
let c = create 1ul (uint #t 0) in
[@@ inline_let ]let refl h i = LSeq.index (as_seq h c) 0 in
[@@ inline_let ]let footprint (i: size_nat{i <= v aLen})
: GTot
(l: B.loc{B.loc_disjoint l (loc res) /\ B.address_liveness_insensitive_locs `B.loc_includes` l})
=
loc c
in
[@@ inline_let ]let spec h = S.bn_mul1_add_in_place_f (as_seq h a) l (as_seq h res) in
let h0 = ST.get () in
fill_elems4 h0
aLen
res
refl
footprint
spec
(fun i ->
let a_i = a.(i) in
let res_i = sub res i 1ul in
c.(0ul) <- mul_wide_add2_st a_i l c.(0ul) res_i);
let c = c.(0ul) in
pop_frame ();
c | {
"checked_file": "Hacl.Bignum.Multiplication.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Bignum.Squaring.fst.checked",
"Hacl.Spec.Bignum.Multiplication.fst.checked",
"Hacl.Impl.Lib.fst.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Base.fst.checked",
"Hacl.Bignum.Addition.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Bignum.Multiplication.fst"
} | [] | [
"Hacl.Bignum.Definitions.limb_t",
"Lib.IntTypes.size_t",
"Hacl.Bignum.Definitions.lbignum",
"Hacl.Bignum.Definitions.limb",
"Prims.unit",
"FStar.HyperStack.ST.pop_frame",
"Lib.Buffer.op_Array_Access",
"Lib.Buffer.MUT",
"FStar.UInt32.__uint_to_t",
"Hacl.Impl.Lib.fill_elems4",
"Hacl.Spec.Bignum.Definitions.limb",
"Prims.b2t",
"Prims.op_LessThan",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.Buffer.op_Array_Assignment",
"Hacl.Bignum.Base.mul_wide_add2_st",
"Lib.Buffer.lbuffer_t",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.sub",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Prims.nat",
"Prims.op_LessThanOrEqual",
"Prims.op_Subtraction",
"Prims.pow2",
"FStar.Pervasives.Native.tuple2",
"Hacl.Spec.Bignum.Multiplication.bn_mul1_add_in_place_f",
"Lib.Buffer.as_seq",
"LowStar.Monotonic.Buffer.loc",
"Prims.l_and",
"LowStar.Monotonic.Buffer.loc_disjoint",
"Lib.Buffer.loc",
"LowStar.Monotonic.Buffer.loc_includes",
"LowStar.Monotonic.Buffer.address_liveness_insensitive_locs",
"Lib.IntTypes.size_nat",
"Prims.eq2",
"FStar.Seq.Base.index",
"Lib.Sequence.to_seq",
"Lib.Sequence.index",
"Lib.Buffer.create",
"Lib.IntTypes.uint",
"Lib.IntTypes.SEC",
"Lib.Buffer.lbuffer",
"FStar.HyperStack.ST.push_frame"
] | [] | module Hacl.Bignum.Multiplication
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Bignum.Definitions
open Hacl.Bignum.Base
open Hacl.Impl.Lib
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module B = LowStar.Buffer
module S = Hacl.Spec.Bignum.Multiplication
module SS = Hacl.Spec.Bignum.Squaring
module Loops = Lib.LoopCombinators
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
val bn_mul1:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> l:limb t
-> res:lbignum t aLen ->
Stack (limb t)
(requires fun h ->
live h a /\ live h res /\ eq_or_disjoint a res)
(ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\
(c_out, as_seq h1 res) == S.bn_mul1 (as_seq h0 a) l)
let bn_mul1 #t aLen a l res =
push_frame ();
let c = create 1ul (uint #t 0) in
[@inline_let]
let refl h i = LSeq.index (as_seq h c) 0 in
[@inline_let]
let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\
B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in
[@inline_let]
let spec h = S.bn_mul1_f (as_seq h a) l in
let h0 = ST.get () in
fill_elems4 h0 aLen res refl footprint spec
(fun i ->
let h1 = ST.get () in
let a_i = a.(i) in
let res_i = sub res i 1ul in
c.(0ul) <- mul_wide_add_st a_i l c.(0ul) res_i;
lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1
);
let c = c.(0ul) in
pop_frame ();
c
inline_for_extraction noextract
val bn_mul1_add_in_place:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> l:limb t
-> res:lbignum t aLen ->
Stack (limb t)
(requires fun h ->
live h a /\ live h res /\ disjoint res a)
(ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\
(c_out, as_seq h1 res) == S.bn_mul1_add_in_place (as_seq h0 a) l (as_seq h0 res)) | false | false | Hacl.Bignum.Multiplication.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 bn_mul1_add_in_place:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> l:limb t
-> res:lbignum t aLen ->
Stack (limb t)
(requires fun h ->
live h a /\ live h res /\ disjoint res a)
(ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\
(c_out, as_seq h1 res) == S.bn_mul1_add_in_place (as_seq h0 a) l (as_seq h0 res)) | [] | Hacl.Bignum.Multiplication.bn_mul1_add_in_place | {
"file_name": "code/bignum/Hacl.Bignum.Multiplication.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
aLen: Lib.IntTypes.size_t ->
a: Hacl.Bignum.Definitions.lbignum t aLen ->
l: Hacl.Bignum.Definitions.limb t ->
res: Hacl.Bignum.Definitions.lbignum t aLen
-> FStar.HyperStack.ST.Stack (Hacl.Bignum.Definitions.limb t) | {
"end_col": 3,
"end_line": 97,
"start_col": 2,
"start_line": 77
} |
Prims.Tot | val bn_mul: #t:limb_t -> bn_mul_st t | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Squaring",
"short_module": "SS"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Multiplication",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Definitions",
"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.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Bignum",
"short_module": null
},
{
"abbrev": 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 bn_mul #t aLen a bLen b res =
[@inline_let]
let resLen = aLen +! bLen in
memset res (uint #t 0) resLen;
let h0 = ST.get () in
LSeq.eq_intro (LSeq.sub (as_seq h0 res) 0 (v resLen)) (as_seq h0 res);
[@ inline_let]
let spec h = S.bn_mul_ (as_seq h a) (as_seq h b) in
loop1 h0 bLen res spec
(fun j ->
Loops.unfold_repeati (v bLen) (spec h0) (as_seq h0 res) (v j);
let bj = b.(j) in
res.(aLen +! j) <- bn_mul1_lshift_add aLen a bj (aLen +! bLen) j res
) | val bn_mul: #t:limb_t -> bn_mul_st t
let bn_mul #t aLen a bLen b res = | false | null | false | [@@ inline_let ]let resLen = aLen +! bLen in
memset res (uint #t 0) resLen;
let h0 = ST.get () in
LSeq.eq_intro (LSeq.sub (as_seq h0 res) 0 (v resLen)) (as_seq h0 res);
[@@ inline_let ]let spec h = S.bn_mul_ (as_seq h a) (as_seq h b) in
loop1 h0
bLen
res
spec
(fun j ->
Loops.unfold_repeati (v bLen) (spec h0) (as_seq h0 res) (v j);
let bj = b.(j) in
res.(aLen +! j) <- bn_mul1_lshift_add aLen a bj (aLen +! bLen) j res) | {
"checked_file": "Hacl.Bignum.Multiplication.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Bignum.Squaring.fst.checked",
"Hacl.Spec.Bignum.Multiplication.fst.checked",
"Hacl.Impl.Lib.fst.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Base.fst.checked",
"Hacl.Bignum.Addition.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Bignum.Multiplication.fst"
} | [
"total"
] | [
"Hacl.Bignum.Definitions.limb_t",
"Lib.IntTypes.size_t",
"Hacl.Bignum.Definitions.lbignum",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.IntTypes.max_size_t",
"Lib.IntTypes.op_Plus_Bang",
"Lib.Buffer.loop1",
"Hacl.Bignum.Definitions.limb",
"Prims.op_LessThan",
"Lib.Buffer.op_Array_Assignment",
"Prims.unit",
"Hacl.Bignum.Multiplication.bn_mul1_lshift_add",
"Lib.Buffer.op_Array_Access",
"Lib.Buffer.MUT",
"Lib.LoopCombinators.unfold_repeati",
"Hacl.Spec.Bignum.Definitions.lbignum",
"Lib.Buffer.as_seq",
"FStar.Monotonic.HyperStack.mem",
"Prims.nat",
"Prims.op_Subtraction",
"Prims.pow2",
"Hacl.Spec.Bignum.Multiplication.bn_mul_",
"Lib.Sequence.eq_intro",
"Lib.Sequence.sub",
"FStar.HyperStack.ST.get",
"Lib.Buffer.memset",
"Lib.IntTypes.uint",
"Lib.IntTypes.SEC",
"Lib.IntTypes.int_t"
] | [] | module Hacl.Bignum.Multiplication
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Bignum.Definitions
open Hacl.Bignum.Base
open Hacl.Impl.Lib
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module B = LowStar.Buffer
module S = Hacl.Spec.Bignum.Multiplication
module SS = Hacl.Spec.Bignum.Squaring
module Loops = Lib.LoopCombinators
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
val bn_mul1:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> l:limb t
-> res:lbignum t aLen ->
Stack (limb t)
(requires fun h ->
live h a /\ live h res /\ eq_or_disjoint a res)
(ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\
(c_out, as_seq h1 res) == S.bn_mul1 (as_seq h0 a) l)
let bn_mul1 #t aLen a l res =
push_frame ();
let c = create 1ul (uint #t 0) in
[@inline_let]
let refl h i = LSeq.index (as_seq h c) 0 in
[@inline_let]
let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\
B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in
[@inline_let]
let spec h = S.bn_mul1_f (as_seq h a) l in
let h0 = ST.get () in
fill_elems4 h0 aLen res refl footprint spec
(fun i ->
let h1 = ST.get () in
let a_i = a.(i) in
let res_i = sub res i 1ul in
c.(0ul) <- mul_wide_add_st a_i l c.(0ul) res_i;
lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1
);
let c = c.(0ul) in
pop_frame ();
c
inline_for_extraction noextract
val bn_mul1_add_in_place:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> l:limb t
-> res:lbignum t aLen ->
Stack (limb t)
(requires fun h ->
live h a /\ live h res /\ disjoint res a)
(ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\
(c_out, as_seq h1 res) == S.bn_mul1_add_in_place (as_seq h0 a) l (as_seq h0 res))
let bn_mul1_add_in_place #t aLen a l res =
push_frame ();
let c = create 1ul (uint #t 0) in
[@inline_let]
let refl h i = LSeq.index (as_seq h c) 0 in
[@inline_let]
let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\
B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in
[@inline_let]
let spec h = S.bn_mul1_add_in_place_f (as_seq h a) l (as_seq h res) in
let h0 = ST.get () in
fill_elems4 h0 aLen res refl footprint spec
(fun i ->
let a_i = a.(i) in
let res_i = sub res i 1ul in
c.(0ul) <- mul_wide_add2_st a_i l c.(0ul) res_i
);
let c = c.(0ul) in
pop_frame ();
c
inline_for_extraction noextract
val bn_mul1_lshift_add:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> b_j:limb t
-> resLen:size_t
-> j:size_t{v j + v aLen <= v resLen}
-> res:lbignum t resLen ->
Stack (limb t)
(requires fun h -> live h a /\ live h res /\ disjoint res a)
(ensures fun h0 c h1 -> modifies (loc res) h0 h1 /\
(c, as_seq h1 res) == S.bn_mul1_lshift_add (as_seq h0 a) b_j (v j) (as_seq h0 res))
let bn_mul1_lshift_add #t aLen a b_j resLen j res =
let res_j = sub res j aLen in
let h0 = ST.get () in
update_sub_f_carry h0 res j aLen
(fun h -> S.bn_mul1_add_in_place (as_seq h0 a) b_j (as_seq h0 res_j))
(fun _ -> bn_mul1_add_in_place aLen a b_j res_j)
inline_for_extraction noextract
let bn_mul_st (t:limb_t) =
aLen:size_t
-> a:lbignum t aLen
-> bLen:size_t{v aLen + v bLen <= max_size_t}
-> b:lbignum t bLen
-> res:lbignum t (aLen +! bLen) ->
Stack unit
(requires fun h ->
live h a /\ live h b /\ live h res /\
disjoint res a /\ disjoint res b /\ eq_or_disjoint a b)
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
as_seq h1 res == S.bn_mul (as_seq h0 a) (as_seq h0 b))
inline_for_extraction noextract
val bn_mul: #t:limb_t -> bn_mul_st t | false | false | Hacl.Bignum.Multiplication.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 bn_mul: #t:limb_t -> bn_mul_st t | [] | Hacl.Bignum.Multiplication.bn_mul | {
"file_name": "code/bignum/Hacl.Bignum.Multiplication.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.Multiplication.bn_mul_st t | {
"end_col": 3,
"end_line": 153,
"start_col": 2,
"start_line": 139
} |
Prims.Tot | val bn_sqr: #t:limb_t -> bn_sqr_st t | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Squaring",
"short_module": "SS"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Multiplication",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "LSeq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Bignum.Definitions",
"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.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Bignum",
"short_module": null
},
{
"abbrev": 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 bn_sqr #t aLen a res =
push_frame ();
[@inline_let]
let resLen = aLen +! aLen in
memset res (uint #t 0) resLen;
let h0 = ST.get () in
LSeq.eq_intro (LSeq.sub (as_seq h0 res) 0 (v resLen)) (as_seq h0 res);
[@inline_let]
let spec h = SS.bn_sqr_f (as_seq h a) in
loop1 h0 aLen res spec
(fun j ->
Loops.unfold_repeati (v aLen) (spec h0) (as_seq h0 res) (v j);
let ab = sub a 0ul j in
let a_j = a.(j) in
res.(j +! j) <- bn_mul1_lshift_add j ab a_j resLen j res
);
let c0 = Hacl.Bignum.Addition.bn_add_eq_len_u resLen res res res in
LowStar.Ignore.ignore c0;
let tmp = create resLen (uint #t 0) in
bn_sqr_diag aLen a tmp;
let c1 = Hacl.Bignum.Addition.bn_add_eq_len_u resLen res tmp res in
LowStar.Ignore.ignore c1;
pop_frame () | val bn_sqr: #t:limb_t -> bn_sqr_st t
let bn_sqr #t aLen a res = | false | null | false | push_frame ();
[@@ inline_let ]let resLen = aLen +! aLen in
memset res (uint #t 0) resLen;
let h0 = ST.get () in
LSeq.eq_intro (LSeq.sub (as_seq h0 res) 0 (v resLen)) (as_seq h0 res);
[@@ inline_let ]let spec h = SS.bn_sqr_f (as_seq h a) in
loop1 h0
aLen
res
spec
(fun j ->
Loops.unfold_repeati (v aLen) (spec h0) (as_seq h0 res) (v j);
let ab = sub a 0ul j in
let a_j = a.(j) in
res.(j +! j) <- bn_mul1_lshift_add j ab a_j resLen j res);
let c0 = Hacl.Bignum.Addition.bn_add_eq_len_u resLen res res res in
LowStar.Ignore.ignore c0;
let tmp = create resLen (uint #t 0) in
bn_sqr_diag aLen a tmp;
let c1 = Hacl.Bignum.Addition.bn_add_eq_len_u resLen res tmp res in
LowStar.Ignore.ignore c1;
pop_frame () | {
"checked_file": "Hacl.Bignum.Multiplication.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowStar.Ignore.fsti.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Bignum.Squaring.fst.checked",
"Hacl.Spec.Bignum.Multiplication.fst.checked",
"Hacl.Impl.Lib.fst.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Base.fst.checked",
"Hacl.Bignum.Addition.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Bignum.Multiplication.fst"
} | [
"total"
] | [
"Hacl.Bignum.Definitions.limb_t",
"Lib.IntTypes.size_t",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThan",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"Lib.IntTypes.max_size_t",
"Hacl.Bignum.Definitions.lbignum",
"Lib.IntTypes.op_Plus_Bang",
"FStar.HyperStack.ST.pop_frame",
"Prims.unit",
"LowStar.Ignore.ignore",
"Hacl.Spec.Bignum.Base.carry",
"Hacl.Bignum.Addition.bn_add_eq_len_u",
"Hacl.Bignum.Multiplication.bn_sqr_diag",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"Hacl.Bignum.Definitions.limb",
"Lib.Buffer.create",
"Lib.IntTypes.uint",
"Lib.IntTypes.SEC",
"Lib.Buffer.lbuffer",
"Lib.Buffer.loop1",
"Lib.Buffer.op_Array_Assignment",
"Hacl.Bignum.Multiplication.bn_mul1_lshift_add",
"Lib.Buffer.op_Array_Access",
"Lib.Buffer.sub",
"FStar.UInt32.__uint_to_t",
"Lib.LoopCombinators.unfold_repeati",
"Hacl.Spec.Bignum.Definitions.lbignum",
"Lib.Buffer.as_seq",
"FStar.Monotonic.HyperStack.mem",
"Prims.nat",
"Hacl.Spec.Bignum.Squaring.bn_sqr_f",
"Lib.Sequence.eq_intro",
"Lib.Sequence.sub",
"FStar.HyperStack.ST.get",
"Lib.Buffer.memset",
"Lib.IntTypes.int_t",
"FStar.HyperStack.ST.push_frame"
] | [] | module Hacl.Bignum.Multiplication
open FStar.HyperStack
open FStar.HyperStack.ST
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Bignum.Definitions
open Hacl.Bignum.Base
open Hacl.Impl.Lib
module ST = FStar.HyperStack.ST
module LSeq = Lib.Sequence
module B = LowStar.Buffer
module S = Hacl.Spec.Bignum.Multiplication
module SS = Hacl.Spec.Bignum.Squaring
module Loops = Lib.LoopCombinators
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
val bn_mul1:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> l:limb t
-> res:lbignum t aLen ->
Stack (limb t)
(requires fun h ->
live h a /\ live h res /\ eq_or_disjoint a res)
(ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\
(c_out, as_seq h1 res) == S.bn_mul1 (as_seq h0 a) l)
let bn_mul1 #t aLen a l res =
push_frame ();
let c = create 1ul (uint #t 0) in
[@inline_let]
let refl h i = LSeq.index (as_seq h c) 0 in
[@inline_let]
let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\
B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in
[@inline_let]
let spec h = S.bn_mul1_f (as_seq h a) l in
let h0 = ST.get () in
fill_elems4 h0 aLen res refl footprint spec
(fun i ->
let h1 = ST.get () in
let a_i = a.(i) in
let res_i = sub res i 1ul in
c.(0ul) <- mul_wide_add_st a_i l c.(0ul) res_i;
lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1
);
let c = c.(0ul) in
pop_frame ();
c
inline_for_extraction noextract
val bn_mul1_add_in_place:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> l:limb t
-> res:lbignum t aLen ->
Stack (limb t)
(requires fun h ->
live h a /\ live h res /\ disjoint res a)
(ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\
(c_out, as_seq h1 res) == S.bn_mul1_add_in_place (as_seq h0 a) l (as_seq h0 res))
let bn_mul1_add_in_place #t aLen a l res =
push_frame ();
let c = create 1ul (uint #t 0) in
[@inline_let]
let refl h i = LSeq.index (as_seq h c) 0 in
[@inline_let]
let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\
B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in
[@inline_let]
let spec h = S.bn_mul1_add_in_place_f (as_seq h a) l (as_seq h res) in
let h0 = ST.get () in
fill_elems4 h0 aLen res refl footprint spec
(fun i ->
let a_i = a.(i) in
let res_i = sub res i 1ul in
c.(0ul) <- mul_wide_add2_st a_i l c.(0ul) res_i
);
let c = c.(0ul) in
pop_frame ();
c
inline_for_extraction noextract
val bn_mul1_lshift_add:
#t:limb_t
-> aLen:size_t
-> a:lbignum t aLen
-> b_j:limb t
-> resLen:size_t
-> j:size_t{v j + v aLen <= v resLen}
-> res:lbignum t resLen ->
Stack (limb t)
(requires fun h -> live h a /\ live h res /\ disjoint res a)
(ensures fun h0 c h1 -> modifies (loc res) h0 h1 /\
(c, as_seq h1 res) == S.bn_mul1_lshift_add (as_seq h0 a) b_j (v j) (as_seq h0 res))
let bn_mul1_lshift_add #t aLen a b_j resLen j res =
let res_j = sub res j aLen in
let h0 = ST.get () in
update_sub_f_carry h0 res j aLen
(fun h -> S.bn_mul1_add_in_place (as_seq h0 a) b_j (as_seq h0 res_j))
(fun _ -> bn_mul1_add_in_place aLen a b_j res_j)
inline_for_extraction noextract
let bn_mul_st (t:limb_t) =
aLen:size_t
-> a:lbignum t aLen
-> bLen:size_t{v aLen + v bLen <= max_size_t}
-> b:lbignum t bLen
-> res:lbignum t (aLen +! bLen) ->
Stack unit
(requires fun h ->
live h a /\ live h b /\ live h res /\
disjoint res a /\ disjoint res b /\ eq_or_disjoint a b)
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
as_seq h1 res == S.bn_mul (as_seq h0 a) (as_seq h0 b))
inline_for_extraction noextract
val bn_mul: #t:limb_t -> bn_mul_st t
let bn_mul #t aLen a bLen b res =
[@inline_let]
let resLen = aLen +! bLen in
memset res (uint #t 0) resLen;
let h0 = ST.get () in
LSeq.eq_intro (LSeq.sub (as_seq h0 res) 0 (v resLen)) (as_seq h0 res);
[@ inline_let]
let spec h = S.bn_mul_ (as_seq h a) (as_seq h b) in
loop1 h0 bLen res spec
(fun j ->
Loops.unfold_repeati (v bLen) (spec h0) (as_seq h0 res) (v j);
let bj = b.(j) in
res.(aLen +! j) <- bn_mul1_lshift_add aLen a bj (aLen +! bLen) j res
)
[@CInline]
let bn_mul_u32 : bn_mul_st U32 = bn_mul
[@CInline]
let bn_mul_u64 : bn_mul_st U64 = bn_mul
inline_for_extraction noextract
let bn_mul_u (#t:limb_t) : bn_mul_st t =
match t with
| U32 -> bn_mul_u32
| U64 -> bn_mul_u64
inline_for_extraction noextract
val bn_sqr_diag:
#t:limb_t
-> aLen:size_t{v aLen + v aLen <= max_size_t}
-> a:lbignum t aLen
-> res:lbignum t (aLen +! aLen) ->
Stack unit
(requires fun h -> live h a /\ live h res /\ disjoint res a /\
as_seq h res == LSeq.create (v aLen + v aLen) (uint #t 0))
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
as_seq h1 res == SS.bn_sqr_diag (as_seq h0 a))
let bn_sqr_diag #t aLen a res =
let h0 = ST.get () in
[@inline_let]
let spec h = SS.bn_sqr_diag_f (as_seq h a) in
loop1 h0 aLen res spec
(fun i ->
Loops.unfold_repeati (v aLen) (spec h0) (as_seq h0 res) (v i);
let (hi, lo) = mul_wide a.(i) a.(i) in
res.(2ul *! i) <- lo;
res.(2ul *! i +! 1ul) <- hi)
// This code is taken from BoringSSL
// https://github.com/google/boringssl/blob/master/crypto/fipsmodule/bn/mul.c#L551
inline_for_extraction noextract
let bn_sqr_st (t:limb_t) =
aLen:size_t{0 < v aLen /\ v aLen + v aLen <= max_size_t}
-> a:lbignum t aLen
-> res:lbignum t (aLen +! aLen) ->
Stack unit
(requires fun h -> live h a /\ live h res /\ disjoint res a)
(ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\
as_seq h1 res == SS.bn_sqr (as_seq h0 a))
inline_for_extraction noextract
val bn_sqr: #t:limb_t -> bn_sqr_st t | false | false | Hacl.Bignum.Multiplication.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 bn_sqr: #t:limb_t -> bn_sqr_st t | [] | Hacl.Bignum.Multiplication.bn_sqr | {
"file_name": "code/bignum/Hacl.Bignum.Multiplication.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Bignum.Multiplication.bn_sqr_st t | {
"end_col": 14,
"end_line": 233,
"start_col": 2,
"start_line": 209
} |
Prims.Tot | val add_hi_def (#n: nat) (a b: natN n) (c: nat1) : nat1 | [
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Bignum",
"short_module": null
},
{
"abbrev": 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_hi_def (#n:nat) (a b:natN n) (c:nat1) : nat1 =
if a + b + c < n then 0 else 1 | val add_hi_def (#n: nat) (a b: natN n) (c: nat1) : nat1
let add_hi_def (#n: nat) (a b: natN n) (c: nat1) : nat1 = | false | null | false | if a + b + c < n then 0 else 1 | {
"checked_file": "Vale.Bignum.Defs.fsti.checked",
"dependencies": [
"Vale.Def.Words_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Bignum.Defs.fsti"
} | [
"total"
] | [
"Prims.nat",
"Vale.Def.Words_s.natN",
"Vale.Def.Words_s.nat1",
"Prims.op_LessThan",
"Prims.op_Addition",
"Prims.bool"
] | [] | module Vale.Bignum.Defs
open FStar.Mul
open FStar.Seq
open Vale.Def.Words_s
unfold let (.[]) = Seq.index
val lemma_mul_nat_bound (a a' b b':nat) : Lemma
(requires a <= a' /\ b <= b')
(ensures 0 <= a * b /\ a * b <= a' * b')
val lemma_mul_n_bound (#n:nat) (a b:natN n) : Lemma (0 <= a * b /\ a * b <= (n - 1) * (n - 1))
val lemma_mul_div_n_lt (#n:nat) (a b:natN n) : Lemma ((a * b) / n < (if n <= 1 then n else n - 1))
val lemma_mul_div_n (#n:pos) (a b:natN n) : Lemma (0 <= (a * b) / n /\ (a * b) / n < n)
let add_lo_def (#n:nat) (a b:natN n) (c:nat1) : natN n =
let x = a + b + c in
if x < n then x else x - n
val add_lo (#n:nat) (a b:natN n) (c:nat1) : natN n
val reveal_add_lo (#n:nat) (a b:natN n) (c:nat1) : Lemma (add_lo a b c == add_lo_def a b c)
val reveal_add_lo_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n) (c:nat1).{:pattern add_lo a b c} add_lo a b c == add_lo_def a b c) | false | false | Vale.Bignum.Defs.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 add_hi_def (#n: nat) (a b: natN n) (c: nat1) : nat1 | [] | Vale.Bignum.Defs.add_hi_def | {
"file_name": "vale/code/crypto/bignum/Vale.Bignum.Defs.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Vale.Def.Words_s.natN n -> b: Vale.Def.Words_s.natN n -> c: Vale.Def.Words_s.nat1
-> Vale.Def.Words_s.nat1 | {
"end_col": 32,
"end_line": 26,
"start_col": 2,
"start_line": 26
} |
Prims.Tot | val pow_seq (#n: nat) (s: seq (natN n)) : seq int | [
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Bignum",
"short_module": null
},
{
"abbrev": 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 pow_seq (#n:nat) (s:seq (natN n)) : seq int =
init (length s) (fun (i:nat{i < length s}) -> s.[i] * pow_int n i) | val pow_seq (#n: nat) (s: seq (natN n)) : seq int
let pow_seq (#n: nat) (s: seq (natN n)) : seq int = | false | null | false | init (length s) (fun (i: nat{i < length s}) -> s.[ i ] * pow_int n i) | {
"checked_file": "Vale.Bignum.Defs.fsti.checked",
"dependencies": [
"Vale.Def.Words_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Bignum.Defs.fsti"
} | [
"total"
] | [
"Prims.nat",
"FStar.Seq.Base.seq",
"Vale.Def.Words_s.natN",
"FStar.Seq.Base.init",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Mul.op_Star",
"Vale.Bignum.Defs.op_String_Access",
"Vale.Bignum.Defs.pow_int"
] | [] | module Vale.Bignum.Defs
open FStar.Mul
open FStar.Seq
open Vale.Def.Words_s
unfold let (.[]) = Seq.index
val lemma_mul_nat_bound (a a' b b':nat) : Lemma
(requires a <= a' /\ b <= b')
(ensures 0 <= a * b /\ a * b <= a' * b')
val lemma_mul_n_bound (#n:nat) (a b:natN n) : Lemma (0 <= a * b /\ a * b <= (n - 1) * (n - 1))
val lemma_mul_div_n_lt (#n:nat) (a b:natN n) : Lemma ((a * b) / n < (if n <= 1 then n else n - 1))
val lemma_mul_div_n (#n:pos) (a b:natN n) : Lemma (0 <= (a * b) / n /\ (a * b) / n < n)
let add_lo_def (#n:nat) (a b:natN n) (c:nat1) : natN n =
let x = a + b + c in
if x < n then x else x - n
val add_lo (#n:nat) (a b:natN n) (c:nat1) : natN n
val reveal_add_lo (#n:nat) (a b:natN n) (c:nat1) : Lemma (add_lo a b c == add_lo_def a b c)
val reveal_add_lo_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n) (c:nat1).{:pattern add_lo a b c} add_lo a b c == add_lo_def a b c)
let add_hi_def (#n:nat) (a b:natN n) (c:nat1) : nat1 =
if a + b + c < n then 0 else 1
val add_hi (#n:nat) (a b:natN n) (c:nat1) : nat1
val reveal_add_hi (#n:nat) (a b:natN n) (c:nat1) : Lemma (add_hi a b c == add_hi_def a b c)
val reveal_add_hi_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n) (c:nat1).{:pattern add_hi a b c} add_hi a b c == add_hi_def a b c)
let add_lo_hi (#n:pos) (a b:natN n) (c:nat1) : natN n & nat1 =
(add_lo a b c, add_hi a b c)
let mul_lo_def (#n:pos) (a b:natN n) : natN n =
(a * b) % n
val mul_lo (#n:pos) (a b:natN n) : natN n
val reveal_mul_lo (#n:nat) (a b:natN n) : Lemma (mul_lo a b == mul_lo_def a b)
val reveal_mul_lo_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n).{:pattern mul_lo a b} mul_lo a b == mul_lo_def a b)
let mul_hi_def (#n:pos) (a b:natN n) : natN n =
lemma_mul_div_n a b;
(a * b) / n
val mul_hi (#n:pos) (a b:natN n) : natN n
val reveal_mul_hi (#n:nat) (a b:natN n) : Lemma (mul_hi a b == mul_hi_def a b)
val reveal_mul_hi_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n).{:pattern mul_hi a b} mul_hi a b == mul_hi_def a b)
let rec sum_seq_left (s:seq int) (i j:nat) : Pure int
(requires i <= j /\ j <= length s)
(ensures fun _ -> True)
(decreases j)
=
if i = j then 0
else s.[j - 1] + sum_seq_left s i (j - 1)
let rec sum_seq_right (s:seq int) (i j:nat) : Pure int
(requires i <= j /\ j <= length s)
(ensures fun _ -> True)
(decreases (j - i))
=
if i = j then 0
else s.[i] + sum_seq_right s (i + 1) j
let rec pow_int (a:int) (b:nat) : int =
if b = 0 then 1
else a * pow_int a (b - 1) | false | false | Vale.Bignum.Defs.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 pow_seq (#n: nat) (s: seq (natN n)) : seq int | [] | Vale.Bignum.Defs.pow_seq | {
"file_name": "vale/code/crypto/bignum/Vale.Bignum.Defs.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: FStar.Seq.Base.seq (Vale.Def.Words_s.natN n) -> FStar.Seq.Base.seq Prims.int | {
"end_col": 68,
"end_line": 74,
"start_col": 2,
"start_line": 74
} |
Prims.Tot | val sum_pow_seq (#n: nat) (s: seq (natN n)) : int | [
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Bignum",
"short_module": null
},
{
"abbrev": 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 sum_pow_seq (#n:nat) (s:seq (natN n)) : int =
sum_pow_seq_left s (length s) | val sum_pow_seq (#n: nat) (s: seq (natN n)) : int
let sum_pow_seq (#n: nat) (s: seq (natN n)) : int = | false | null | false | sum_pow_seq_left s (length s) | {
"checked_file": "Vale.Bignum.Defs.fsti.checked",
"dependencies": [
"Vale.Def.Words_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Bignum.Defs.fsti"
} | [
"total"
] | [
"Prims.nat",
"FStar.Seq.Base.seq",
"Vale.Def.Words_s.natN",
"Vale.Bignum.Defs.sum_pow_seq_left",
"FStar.Seq.Base.length",
"Prims.int"
] | [] | module Vale.Bignum.Defs
open FStar.Mul
open FStar.Seq
open Vale.Def.Words_s
unfold let (.[]) = Seq.index
val lemma_mul_nat_bound (a a' b b':nat) : Lemma
(requires a <= a' /\ b <= b')
(ensures 0 <= a * b /\ a * b <= a' * b')
val lemma_mul_n_bound (#n:nat) (a b:natN n) : Lemma (0 <= a * b /\ a * b <= (n - 1) * (n - 1))
val lemma_mul_div_n_lt (#n:nat) (a b:natN n) : Lemma ((a * b) / n < (if n <= 1 then n else n - 1))
val lemma_mul_div_n (#n:pos) (a b:natN n) : Lemma (0 <= (a * b) / n /\ (a * b) / n < n)
let add_lo_def (#n:nat) (a b:natN n) (c:nat1) : natN n =
let x = a + b + c in
if x < n then x else x - n
val add_lo (#n:nat) (a b:natN n) (c:nat1) : natN n
val reveal_add_lo (#n:nat) (a b:natN n) (c:nat1) : Lemma (add_lo a b c == add_lo_def a b c)
val reveal_add_lo_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n) (c:nat1).{:pattern add_lo a b c} add_lo a b c == add_lo_def a b c)
let add_hi_def (#n:nat) (a b:natN n) (c:nat1) : nat1 =
if a + b + c < n then 0 else 1
val add_hi (#n:nat) (a b:natN n) (c:nat1) : nat1
val reveal_add_hi (#n:nat) (a b:natN n) (c:nat1) : Lemma (add_hi a b c == add_hi_def a b c)
val reveal_add_hi_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n) (c:nat1).{:pattern add_hi a b c} add_hi a b c == add_hi_def a b c)
let add_lo_hi (#n:pos) (a b:natN n) (c:nat1) : natN n & nat1 =
(add_lo a b c, add_hi a b c)
let mul_lo_def (#n:pos) (a b:natN n) : natN n =
(a * b) % n
val mul_lo (#n:pos) (a b:natN n) : natN n
val reveal_mul_lo (#n:nat) (a b:natN n) : Lemma (mul_lo a b == mul_lo_def a b)
val reveal_mul_lo_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n).{:pattern mul_lo a b} mul_lo a b == mul_lo_def a b)
let mul_hi_def (#n:pos) (a b:natN n) : natN n =
lemma_mul_div_n a b;
(a * b) / n
val mul_hi (#n:pos) (a b:natN n) : natN n
val reveal_mul_hi (#n:nat) (a b:natN n) : Lemma (mul_hi a b == mul_hi_def a b)
val reveal_mul_hi_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n).{:pattern mul_hi a b} mul_hi a b == mul_hi_def a b)
let rec sum_seq_left (s:seq int) (i j:nat) : Pure int
(requires i <= j /\ j <= length s)
(ensures fun _ -> True)
(decreases j)
=
if i = j then 0
else s.[j - 1] + sum_seq_left s i (j - 1)
let rec sum_seq_right (s:seq int) (i j:nat) : Pure int
(requires i <= j /\ j <= length s)
(ensures fun _ -> True)
(decreases (j - i))
=
if i = j then 0
else s.[i] + sum_seq_right s (i + 1) j
let rec pow_int (a:int) (b:nat) : int =
if b = 0 then 1
else a * pow_int a (b - 1)
let pow_seq (#n:nat) (s:seq (natN n)) : seq int =
init (length s) (fun (i:nat{i < length s}) -> s.[i] * pow_int n i)
let sum_pow_seq_left (#n:nat) (s:seq (natN n)) (i:nat{i <= length s}) : int =
sum_seq_left (pow_seq s) 0 i | false | false | Vale.Bignum.Defs.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 sum_pow_seq (#n: nat) (s: seq (natN n)) : int | [] | Vale.Bignum.Defs.sum_pow_seq | {
"file_name": "vale/code/crypto/bignum/Vale.Bignum.Defs.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: FStar.Seq.Base.seq (Vale.Def.Words_s.natN n) -> Prims.int | {
"end_col": 31,
"end_line": 80,
"start_col": 2,
"start_line": 80
} |
Prims.Tot | val add_lo_def (#n: nat) (a b: natN n) (c: nat1) : natN n | [
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Bignum",
"short_module": null
},
{
"abbrev": 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_lo_def (#n:nat) (a b:natN n) (c:nat1) : natN n =
let x = a + b + c in
if x < n then x else x - n | val add_lo_def (#n: nat) (a b: natN n) (c: nat1) : natN n
let add_lo_def (#n: nat) (a b: natN n) (c: nat1) : natN n = | false | null | false | let x = a + b + c in
if x < n then x else x - n | {
"checked_file": "Vale.Bignum.Defs.fsti.checked",
"dependencies": [
"Vale.Def.Words_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Bignum.Defs.fsti"
} | [
"total"
] | [
"Prims.nat",
"Vale.Def.Words_s.natN",
"Vale.Def.Words_s.nat1",
"Prims.op_LessThan",
"Prims.bool",
"Prims.op_Subtraction",
"Prims.int",
"Prims.op_Addition"
] | [] | module Vale.Bignum.Defs
open FStar.Mul
open FStar.Seq
open Vale.Def.Words_s
unfold let (.[]) = Seq.index
val lemma_mul_nat_bound (a a' b b':nat) : Lemma
(requires a <= a' /\ b <= b')
(ensures 0 <= a * b /\ a * b <= a' * b')
val lemma_mul_n_bound (#n:nat) (a b:natN n) : Lemma (0 <= a * b /\ a * b <= (n - 1) * (n - 1))
val lemma_mul_div_n_lt (#n:nat) (a b:natN n) : Lemma ((a * b) / n < (if n <= 1 then n else n - 1))
val lemma_mul_div_n (#n:pos) (a b:natN n) : Lemma (0 <= (a * b) / n /\ (a * b) / n < n) | false | false | Vale.Bignum.Defs.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 add_lo_def (#n: nat) (a b: natN n) (c: nat1) : natN n | [] | Vale.Bignum.Defs.add_lo_def | {
"file_name": "vale/code/crypto/bignum/Vale.Bignum.Defs.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Vale.Def.Words_s.natN n -> b: Vale.Def.Words_s.natN n -> c: Vale.Def.Words_s.nat1
-> Vale.Def.Words_s.natN n | {
"end_col": 28,
"end_line": 18,
"start_col": 56,
"start_line": 16
} |
Prims.Tot | val pow_int (a: int) (b: nat) : int | [
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Bignum",
"short_module": null
},
{
"abbrev": 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 pow_int (a:int) (b:nat) : int =
if b = 0 then 1
else a * pow_int a (b - 1) | val pow_int (a: int) (b: nat) : int
let rec pow_int (a: int) (b: nat) : int = | false | null | false | if b = 0 then 1 else a * pow_int a (b - 1) | {
"checked_file": "Vale.Bignum.Defs.fsti.checked",
"dependencies": [
"Vale.Def.Words_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Bignum.Defs.fsti"
} | [
"total"
] | [
"Prims.int",
"Prims.nat",
"Prims.op_Equality",
"Prims.bool",
"FStar.Mul.op_Star",
"Vale.Bignum.Defs.pow_int",
"Prims.op_Subtraction"
] | [] | module Vale.Bignum.Defs
open FStar.Mul
open FStar.Seq
open Vale.Def.Words_s
unfold let (.[]) = Seq.index
val lemma_mul_nat_bound (a a' b b':nat) : Lemma
(requires a <= a' /\ b <= b')
(ensures 0 <= a * b /\ a * b <= a' * b')
val lemma_mul_n_bound (#n:nat) (a b:natN n) : Lemma (0 <= a * b /\ a * b <= (n - 1) * (n - 1))
val lemma_mul_div_n_lt (#n:nat) (a b:natN n) : Lemma ((a * b) / n < (if n <= 1 then n else n - 1))
val lemma_mul_div_n (#n:pos) (a b:natN n) : Lemma (0 <= (a * b) / n /\ (a * b) / n < n)
let add_lo_def (#n:nat) (a b:natN n) (c:nat1) : natN n =
let x = a + b + c in
if x < n then x else x - n
val add_lo (#n:nat) (a b:natN n) (c:nat1) : natN n
val reveal_add_lo (#n:nat) (a b:natN n) (c:nat1) : Lemma (add_lo a b c == add_lo_def a b c)
val reveal_add_lo_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n) (c:nat1).{:pattern add_lo a b c} add_lo a b c == add_lo_def a b c)
let add_hi_def (#n:nat) (a b:natN n) (c:nat1) : nat1 =
if a + b + c < n then 0 else 1
val add_hi (#n:nat) (a b:natN n) (c:nat1) : nat1
val reveal_add_hi (#n:nat) (a b:natN n) (c:nat1) : Lemma (add_hi a b c == add_hi_def a b c)
val reveal_add_hi_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n) (c:nat1).{:pattern add_hi a b c} add_hi a b c == add_hi_def a b c)
let add_lo_hi (#n:pos) (a b:natN n) (c:nat1) : natN n & nat1 =
(add_lo a b c, add_hi a b c)
let mul_lo_def (#n:pos) (a b:natN n) : natN n =
(a * b) % n
val mul_lo (#n:pos) (a b:natN n) : natN n
val reveal_mul_lo (#n:nat) (a b:natN n) : Lemma (mul_lo a b == mul_lo_def a b)
val reveal_mul_lo_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n).{:pattern mul_lo a b} mul_lo a b == mul_lo_def a b)
let mul_hi_def (#n:pos) (a b:natN n) : natN n =
lemma_mul_div_n a b;
(a * b) / n
val mul_hi (#n:pos) (a b:natN n) : natN n
val reveal_mul_hi (#n:nat) (a b:natN n) : Lemma (mul_hi a b == mul_hi_def a b)
val reveal_mul_hi_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n).{:pattern mul_hi a b} mul_hi a b == mul_hi_def a b)
let rec sum_seq_left (s:seq int) (i j:nat) : Pure int
(requires i <= j /\ j <= length s)
(ensures fun _ -> True)
(decreases j)
=
if i = j then 0
else s.[j - 1] + sum_seq_left s i (j - 1)
let rec sum_seq_right (s:seq int) (i j:nat) : Pure int
(requires i <= j /\ j <= length s)
(ensures fun _ -> True)
(decreases (j - i))
=
if i = j then 0
else s.[i] + sum_seq_right s (i + 1) j | false | true | Vale.Bignum.Defs.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 pow_int (a: int) (b: nat) : int | [
"recursion"
] | Vale.Bignum.Defs.pow_int | {
"file_name": "vale/code/crypto/bignum/Vale.Bignum.Defs.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Prims.int -> b: Prims.nat -> Prims.int | {
"end_col": 28,
"end_line": 71,
"start_col": 2,
"start_line": 70
} |
Prims.Tot | val sum_pow_seq_left (#n: nat) (s: seq (natN n)) (i: nat{i <= length s}) : int | [
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Bignum",
"short_module": null
},
{
"abbrev": 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 sum_pow_seq_left (#n:nat) (s:seq (natN n)) (i:nat{i <= length s}) : int =
sum_seq_left (pow_seq s) 0 i | val sum_pow_seq_left (#n: nat) (s: seq (natN n)) (i: nat{i <= length s}) : int
let sum_pow_seq_left (#n: nat) (s: seq (natN n)) (i: nat{i <= length s}) : int = | false | null | false | sum_seq_left (pow_seq s) 0 i | {
"checked_file": "Vale.Bignum.Defs.fsti.checked",
"dependencies": [
"Vale.Def.Words_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Bignum.Defs.fsti"
} | [
"total"
] | [
"Prims.nat",
"FStar.Seq.Base.seq",
"Vale.Def.Words_s.natN",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.Seq.Base.length",
"Vale.Bignum.Defs.sum_seq_left",
"Vale.Bignum.Defs.pow_seq",
"Prims.int"
] | [] | module Vale.Bignum.Defs
open FStar.Mul
open FStar.Seq
open Vale.Def.Words_s
unfold let (.[]) = Seq.index
val lemma_mul_nat_bound (a a' b b':nat) : Lemma
(requires a <= a' /\ b <= b')
(ensures 0 <= a * b /\ a * b <= a' * b')
val lemma_mul_n_bound (#n:nat) (a b:natN n) : Lemma (0 <= a * b /\ a * b <= (n - 1) * (n - 1))
val lemma_mul_div_n_lt (#n:nat) (a b:natN n) : Lemma ((a * b) / n < (if n <= 1 then n else n - 1))
val lemma_mul_div_n (#n:pos) (a b:natN n) : Lemma (0 <= (a * b) / n /\ (a * b) / n < n)
let add_lo_def (#n:nat) (a b:natN n) (c:nat1) : natN n =
let x = a + b + c in
if x < n then x else x - n
val add_lo (#n:nat) (a b:natN n) (c:nat1) : natN n
val reveal_add_lo (#n:nat) (a b:natN n) (c:nat1) : Lemma (add_lo a b c == add_lo_def a b c)
val reveal_add_lo_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n) (c:nat1).{:pattern add_lo a b c} add_lo a b c == add_lo_def a b c)
let add_hi_def (#n:nat) (a b:natN n) (c:nat1) : nat1 =
if a + b + c < n then 0 else 1
val add_hi (#n:nat) (a b:natN n) (c:nat1) : nat1
val reveal_add_hi (#n:nat) (a b:natN n) (c:nat1) : Lemma (add_hi a b c == add_hi_def a b c)
val reveal_add_hi_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n) (c:nat1).{:pattern add_hi a b c} add_hi a b c == add_hi_def a b c)
let add_lo_hi (#n:pos) (a b:natN n) (c:nat1) : natN n & nat1 =
(add_lo a b c, add_hi a b c)
let mul_lo_def (#n:pos) (a b:natN n) : natN n =
(a * b) % n
val mul_lo (#n:pos) (a b:natN n) : natN n
val reveal_mul_lo (#n:nat) (a b:natN n) : Lemma (mul_lo a b == mul_lo_def a b)
val reveal_mul_lo_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n).{:pattern mul_lo a b} mul_lo a b == mul_lo_def a b)
let mul_hi_def (#n:pos) (a b:natN n) : natN n =
lemma_mul_div_n a b;
(a * b) / n
val mul_hi (#n:pos) (a b:natN n) : natN n
val reveal_mul_hi (#n:nat) (a b:natN n) : Lemma (mul_hi a b == mul_hi_def a b)
val reveal_mul_hi_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n).{:pattern mul_hi a b} mul_hi a b == mul_hi_def a b)
let rec sum_seq_left (s:seq int) (i j:nat) : Pure int
(requires i <= j /\ j <= length s)
(ensures fun _ -> True)
(decreases j)
=
if i = j then 0
else s.[j - 1] + sum_seq_left s i (j - 1)
let rec sum_seq_right (s:seq int) (i j:nat) : Pure int
(requires i <= j /\ j <= length s)
(ensures fun _ -> True)
(decreases (j - i))
=
if i = j then 0
else s.[i] + sum_seq_right s (i + 1) j
let rec pow_int (a:int) (b:nat) : int =
if b = 0 then 1
else a * pow_int a (b - 1)
let pow_seq (#n:nat) (s:seq (natN n)) : seq int =
init (length s) (fun (i:nat{i < length s}) -> s.[i] * pow_int n i) | false | false | Vale.Bignum.Defs.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 sum_pow_seq_left (#n: nat) (s: seq (natN n)) (i: nat{i <= length s}) : int | [] | Vale.Bignum.Defs.sum_pow_seq_left | {
"file_name": "vale/code/crypto/bignum/Vale.Bignum.Defs.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: FStar.Seq.Base.seq (Vale.Def.Words_s.natN n) -> i: Prims.nat{i <= FStar.Seq.Base.length s}
-> Prims.int | {
"end_col": 30,
"end_line": 77,
"start_col": 2,
"start_line": 77
} |
Prims.Pure | val sum_seq_right (s: seq int) (i j: nat)
: Pure int (requires i <= j /\ j <= length s) (ensures fun _ -> True) (decreases (j - i)) | [
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Bignum",
"short_module": null
},
{
"abbrev": 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 sum_seq_right (s:seq int) (i j:nat) : Pure int
(requires i <= j /\ j <= length s)
(ensures fun _ -> True)
(decreases (j - i))
=
if i = j then 0
else s.[i] + sum_seq_right s (i + 1) j | val sum_seq_right (s: seq int) (i j: nat)
: Pure int (requires i <= j /\ j <= length s) (ensures fun _ -> True) (decreases (j - i))
let rec sum_seq_right (s: seq int) (i j: nat)
: Pure int (requires i <= j /\ j <= length s) (ensures fun _ -> True) (decreases (j - i)) = | false | null | false | if i = j then 0 else s.[ i ] + sum_seq_right s (i + 1) j | {
"checked_file": "Vale.Bignum.Defs.fsti.checked",
"dependencies": [
"Vale.Def.Words_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Bignum.Defs.fsti"
} | [
""
] | [
"FStar.Seq.Base.seq",
"Prims.int",
"Prims.nat",
"Prims.op_Equality",
"Prims.bool",
"Prims.op_Addition",
"Vale.Bignum.Defs.op_String_Access",
"Vale.Bignum.Defs.sum_seq_right",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.Seq.Base.length",
"Prims.l_True"
] | [] | module Vale.Bignum.Defs
open FStar.Mul
open FStar.Seq
open Vale.Def.Words_s
unfold let (.[]) = Seq.index
val lemma_mul_nat_bound (a a' b b':nat) : Lemma
(requires a <= a' /\ b <= b')
(ensures 0 <= a * b /\ a * b <= a' * b')
val lemma_mul_n_bound (#n:nat) (a b:natN n) : Lemma (0 <= a * b /\ a * b <= (n - 1) * (n - 1))
val lemma_mul_div_n_lt (#n:nat) (a b:natN n) : Lemma ((a * b) / n < (if n <= 1 then n else n - 1))
val lemma_mul_div_n (#n:pos) (a b:natN n) : Lemma (0 <= (a * b) / n /\ (a * b) / n < n)
let add_lo_def (#n:nat) (a b:natN n) (c:nat1) : natN n =
let x = a + b + c in
if x < n then x else x - n
val add_lo (#n:nat) (a b:natN n) (c:nat1) : natN n
val reveal_add_lo (#n:nat) (a b:natN n) (c:nat1) : Lemma (add_lo a b c == add_lo_def a b c)
val reveal_add_lo_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n) (c:nat1).{:pattern add_lo a b c} add_lo a b c == add_lo_def a b c)
let add_hi_def (#n:nat) (a b:natN n) (c:nat1) : nat1 =
if a + b + c < n then 0 else 1
val add_hi (#n:nat) (a b:natN n) (c:nat1) : nat1
val reveal_add_hi (#n:nat) (a b:natN n) (c:nat1) : Lemma (add_hi a b c == add_hi_def a b c)
val reveal_add_hi_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n) (c:nat1).{:pattern add_hi a b c} add_hi a b c == add_hi_def a b c)
let add_lo_hi (#n:pos) (a b:natN n) (c:nat1) : natN n & nat1 =
(add_lo a b c, add_hi a b c)
let mul_lo_def (#n:pos) (a b:natN n) : natN n =
(a * b) % n
val mul_lo (#n:pos) (a b:natN n) : natN n
val reveal_mul_lo (#n:nat) (a b:natN n) : Lemma (mul_lo a b == mul_lo_def a b)
val reveal_mul_lo_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n).{:pattern mul_lo a b} mul_lo a b == mul_lo_def a b)
let mul_hi_def (#n:pos) (a b:natN n) : natN n =
lemma_mul_div_n a b;
(a * b) / n
val mul_hi (#n:pos) (a b:natN n) : natN n
val reveal_mul_hi (#n:nat) (a b:natN n) : Lemma (mul_hi a b == mul_hi_def a b)
val reveal_mul_hi_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n).{:pattern mul_hi a b} mul_hi a b == mul_hi_def a b)
let rec sum_seq_left (s:seq int) (i j:nat) : Pure int
(requires i <= j /\ j <= length s)
(ensures fun _ -> True)
(decreases j)
=
if i = j then 0
else s.[j - 1] + sum_seq_left s i (j - 1)
let rec sum_seq_right (s:seq int) (i j:nat) : Pure int
(requires i <= j /\ j <= length s)
(ensures fun _ -> True)
(decreases (j - i)) | false | false | Vale.Bignum.Defs.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 sum_seq_right (s: seq int) (i j: nat)
: Pure int (requires i <= j /\ j <= length s) (ensures fun _ -> True) (decreases (j - i)) | [
"recursion"
] | Vale.Bignum.Defs.sum_seq_right | {
"file_name": "vale/code/crypto/bignum/Vale.Bignum.Defs.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: FStar.Seq.Base.seq Prims.int -> i: Prims.nat -> j: Prims.nat -> Prims.Pure Prims.int | {
"end_col": 40,
"end_line": 67,
"start_col": 2,
"start_line": 66
} |
Prims.Pure | val sum_seq_left (s: seq int) (i j: nat)
: Pure int (requires i <= j /\ j <= length s) (ensures fun _ -> True) (decreases j) | [
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Bignum",
"short_module": null
},
{
"abbrev": 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 sum_seq_left (s:seq int) (i j:nat) : Pure int
(requires i <= j /\ j <= length s)
(ensures fun _ -> True)
(decreases j)
=
if i = j then 0
else s.[j - 1] + sum_seq_left s i (j - 1) | val sum_seq_left (s: seq int) (i j: nat)
: Pure int (requires i <= j /\ j <= length s) (ensures fun _ -> True) (decreases j)
let rec sum_seq_left (s: seq int) (i j: nat)
: Pure int (requires i <= j /\ j <= length s) (ensures fun _ -> True) (decreases j) = | false | null | false | if i = j then 0 else s.[ j - 1 ] + sum_seq_left s i (j - 1) | {
"checked_file": "Vale.Bignum.Defs.fsti.checked",
"dependencies": [
"Vale.Def.Words_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Bignum.Defs.fsti"
} | [
""
] | [
"FStar.Seq.Base.seq",
"Prims.int",
"Prims.nat",
"Prims.op_Equality",
"Prims.bool",
"Prims.op_Addition",
"Vale.Bignum.Defs.op_String_Access",
"Prims.op_Subtraction",
"Vale.Bignum.Defs.sum_seq_left",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.Seq.Base.length",
"Prims.l_True"
] | [] | module Vale.Bignum.Defs
open FStar.Mul
open FStar.Seq
open Vale.Def.Words_s
unfold let (.[]) = Seq.index
val lemma_mul_nat_bound (a a' b b':nat) : Lemma
(requires a <= a' /\ b <= b')
(ensures 0 <= a * b /\ a * b <= a' * b')
val lemma_mul_n_bound (#n:nat) (a b:natN n) : Lemma (0 <= a * b /\ a * b <= (n - 1) * (n - 1))
val lemma_mul_div_n_lt (#n:nat) (a b:natN n) : Lemma ((a * b) / n < (if n <= 1 then n else n - 1))
val lemma_mul_div_n (#n:pos) (a b:natN n) : Lemma (0 <= (a * b) / n /\ (a * b) / n < n)
let add_lo_def (#n:nat) (a b:natN n) (c:nat1) : natN n =
let x = a + b + c in
if x < n then x else x - n
val add_lo (#n:nat) (a b:natN n) (c:nat1) : natN n
val reveal_add_lo (#n:nat) (a b:natN n) (c:nat1) : Lemma (add_lo a b c == add_lo_def a b c)
val reveal_add_lo_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n) (c:nat1).{:pattern add_lo a b c} add_lo a b c == add_lo_def a b c)
let add_hi_def (#n:nat) (a b:natN n) (c:nat1) : nat1 =
if a + b + c < n then 0 else 1
val add_hi (#n:nat) (a b:natN n) (c:nat1) : nat1
val reveal_add_hi (#n:nat) (a b:natN n) (c:nat1) : Lemma (add_hi a b c == add_hi_def a b c)
val reveal_add_hi_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n) (c:nat1).{:pattern add_hi a b c} add_hi a b c == add_hi_def a b c)
let add_lo_hi (#n:pos) (a b:natN n) (c:nat1) : natN n & nat1 =
(add_lo a b c, add_hi a b c)
let mul_lo_def (#n:pos) (a b:natN n) : natN n =
(a * b) % n
val mul_lo (#n:pos) (a b:natN n) : natN n
val reveal_mul_lo (#n:nat) (a b:natN n) : Lemma (mul_lo a b == mul_lo_def a b)
val reveal_mul_lo_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n).{:pattern mul_lo a b} mul_lo a b == mul_lo_def a b)
let mul_hi_def (#n:pos) (a b:natN n) : natN n =
lemma_mul_div_n a b;
(a * b) / n
val mul_hi (#n:pos) (a b:natN n) : natN n
val reveal_mul_hi (#n:nat) (a b:natN n) : Lemma (mul_hi a b == mul_hi_def a b)
val reveal_mul_hi_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n).{:pattern mul_hi a b} mul_hi a b == mul_hi_def a b)
let rec sum_seq_left (s:seq int) (i j:nat) : Pure int
(requires i <= j /\ j <= length s)
(ensures fun _ -> True)
(decreases j) | false | false | Vale.Bignum.Defs.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 sum_seq_left (s: seq int) (i j: nat)
: Pure int (requires i <= j /\ j <= length s) (ensures fun _ -> True) (decreases j) | [
"recursion"
] | Vale.Bignum.Defs.sum_seq_left | {
"file_name": "vale/code/crypto/bignum/Vale.Bignum.Defs.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: FStar.Seq.Base.seq Prims.int -> i: Prims.nat -> j: Prims.nat -> Prims.Pure Prims.int | {
"end_col": 43,
"end_line": 59,
"start_col": 2,
"start_line": 58
} |
Prims.Tot | val mul_lo_def (#n: pos) (a b: natN n) : natN n | [
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Bignum",
"short_module": null
},
{
"abbrev": 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 mul_lo_def (#n:pos) (a b:natN n) : natN n =
(a * b) % n | val mul_lo_def (#n: pos) (a b: natN n) : natN n
let mul_lo_def (#n: pos) (a b: natN n) : natN n = | false | null | false | (a * b) % n | {
"checked_file": "Vale.Bignum.Defs.fsti.checked",
"dependencies": [
"Vale.Def.Words_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Bignum.Defs.fsti"
} | [
"total"
] | [
"Prims.pos",
"Vale.Def.Words_s.natN",
"Prims.op_Modulus",
"FStar.Mul.op_Star"
] | [] | module Vale.Bignum.Defs
open FStar.Mul
open FStar.Seq
open Vale.Def.Words_s
unfold let (.[]) = Seq.index
val lemma_mul_nat_bound (a a' b b':nat) : Lemma
(requires a <= a' /\ b <= b')
(ensures 0 <= a * b /\ a * b <= a' * b')
val lemma_mul_n_bound (#n:nat) (a b:natN n) : Lemma (0 <= a * b /\ a * b <= (n - 1) * (n - 1))
val lemma_mul_div_n_lt (#n:nat) (a b:natN n) : Lemma ((a * b) / n < (if n <= 1 then n else n - 1))
val lemma_mul_div_n (#n:pos) (a b:natN n) : Lemma (0 <= (a * b) / n /\ (a * b) / n < n)
let add_lo_def (#n:nat) (a b:natN n) (c:nat1) : natN n =
let x = a + b + c in
if x < n then x else x - n
val add_lo (#n:nat) (a b:natN n) (c:nat1) : natN n
val reveal_add_lo (#n:nat) (a b:natN n) (c:nat1) : Lemma (add_lo a b c == add_lo_def a b c)
val reveal_add_lo_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n) (c:nat1).{:pattern add_lo a b c} add_lo a b c == add_lo_def a b c)
let add_hi_def (#n:nat) (a b:natN n) (c:nat1) : nat1 =
if a + b + c < n then 0 else 1
val add_hi (#n:nat) (a b:natN n) (c:nat1) : nat1
val reveal_add_hi (#n:nat) (a b:natN n) (c:nat1) : Lemma (add_hi a b c == add_hi_def a b c)
val reveal_add_hi_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n) (c:nat1).{:pattern add_hi a b c} add_hi a b c == add_hi_def a b c)
let add_lo_hi (#n:pos) (a b:natN n) (c:nat1) : natN n & nat1 =
(add_lo a b c, add_hi a b c) | false | false | Vale.Bignum.Defs.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 mul_lo_def (#n: pos) (a b: natN n) : natN n | [] | Vale.Bignum.Defs.mul_lo_def | {
"file_name": "vale/code/crypto/bignum/Vale.Bignum.Defs.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Vale.Def.Words_s.natN n -> b: Vale.Def.Words_s.natN n -> Vale.Def.Words_s.natN n | {
"end_col": 13,
"end_line": 37,
"start_col": 2,
"start_line": 37
} |
Prims.Tot | val add_lo_hi (#n: pos) (a b: natN n) (c: nat1) : natN n & nat1 | [
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Bignum",
"short_module": null
},
{
"abbrev": 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_lo_hi (#n:pos) (a b:natN n) (c:nat1) : natN n & nat1 =
(add_lo a b c, add_hi a b c) | val add_lo_hi (#n: pos) (a b: natN n) (c: nat1) : natN n & nat1
let add_lo_hi (#n: pos) (a b: natN n) (c: nat1) : natN n & nat1 = | false | null | false | (add_lo a b c, add_hi a b c) | {
"checked_file": "Vale.Bignum.Defs.fsti.checked",
"dependencies": [
"Vale.Def.Words_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Bignum.Defs.fsti"
} | [
"total"
] | [
"Prims.pos",
"Vale.Def.Words_s.natN",
"Vale.Def.Words_s.nat1",
"FStar.Pervasives.Native.Mktuple2",
"Vale.Bignum.Defs.add_lo",
"Vale.Bignum.Defs.add_hi",
"FStar.Pervasives.Native.tuple2"
] | [] | module Vale.Bignum.Defs
open FStar.Mul
open FStar.Seq
open Vale.Def.Words_s
unfold let (.[]) = Seq.index
val lemma_mul_nat_bound (a a' b b':nat) : Lemma
(requires a <= a' /\ b <= b')
(ensures 0 <= a * b /\ a * b <= a' * b')
val lemma_mul_n_bound (#n:nat) (a b:natN n) : Lemma (0 <= a * b /\ a * b <= (n - 1) * (n - 1))
val lemma_mul_div_n_lt (#n:nat) (a b:natN n) : Lemma ((a * b) / n < (if n <= 1 then n else n - 1))
val lemma_mul_div_n (#n:pos) (a b:natN n) : Lemma (0 <= (a * b) / n /\ (a * b) / n < n)
let add_lo_def (#n:nat) (a b:natN n) (c:nat1) : natN n =
let x = a + b + c in
if x < n then x else x - n
val add_lo (#n:nat) (a b:natN n) (c:nat1) : natN n
val reveal_add_lo (#n:nat) (a b:natN n) (c:nat1) : Lemma (add_lo a b c == add_lo_def a b c)
val reveal_add_lo_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n) (c:nat1).{:pattern add_lo a b c} add_lo a b c == add_lo_def a b c)
let add_hi_def (#n:nat) (a b:natN n) (c:nat1) : nat1 =
if a + b + c < n then 0 else 1
val add_hi (#n:nat) (a b:natN n) (c:nat1) : nat1
val reveal_add_hi (#n:nat) (a b:natN n) (c:nat1) : Lemma (add_hi a b c == add_hi_def a b c)
val reveal_add_hi_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n) (c:nat1).{:pattern add_hi a b c} add_hi a b c == add_hi_def a b c) | false | false | Vale.Bignum.Defs.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 add_lo_hi (#n: pos) (a b: natN n) (c: nat1) : natN n & nat1 | [] | Vale.Bignum.Defs.add_lo_hi | {
"file_name": "vale/code/crypto/bignum/Vale.Bignum.Defs.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Vale.Def.Words_s.natN n -> b: Vale.Def.Words_s.natN n -> c: Vale.Def.Words_s.nat1
-> Vale.Def.Words_s.natN n * Vale.Def.Words_s.nat1 | {
"end_col": 30,
"end_line": 34,
"start_col": 2,
"start_line": 34
} |
Prims.Tot | val mul_hi_def (#n: pos) (a b: natN n) : natN n | [
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Bignum",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Bignum",
"short_module": null
},
{
"abbrev": 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 mul_hi_def (#n:pos) (a b:natN n) : natN n =
lemma_mul_div_n a b;
(a * b) / n | val mul_hi_def (#n: pos) (a b: natN n) : natN n
let mul_hi_def (#n: pos) (a b: natN n) : natN n = | false | null | false | lemma_mul_div_n a b;
(a * b) / n | {
"checked_file": "Vale.Bignum.Defs.fsti.checked",
"dependencies": [
"Vale.Def.Words_s.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Bignum.Defs.fsti"
} | [
"total"
] | [
"Prims.pos",
"Vale.Def.Words_s.natN",
"Prims.op_Division",
"FStar.Mul.op_Star",
"Prims.unit",
"Vale.Bignum.Defs.lemma_mul_div_n"
] | [] | module Vale.Bignum.Defs
open FStar.Mul
open FStar.Seq
open Vale.Def.Words_s
unfold let (.[]) = Seq.index
val lemma_mul_nat_bound (a a' b b':nat) : Lemma
(requires a <= a' /\ b <= b')
(ensures 0 <= a * b /\ a * b <= a' * b')
val lemma_mul_n_bound (#n:nat) (a b:natN n) : Lemma (0 <= a * b /\ a * b <= (n - 1) * (n - 1))
val lemma_mul_div_n_lt (#n:nat) (a b:natN n) : Lemma ((a * b) / n < (if n <= 1 then n else n - 1))
val lemma_mul_div_n (#n:pos) (a b:natN n) : Lemma (0 <= (a * b) / n /\ (a * b) / n < n)
let add_lo_def (#n:nat) (a b:natN n) (c:nat1) : natN n =
let x = a + b + c in
if x < n then x else x - n
val add_lo (#n:nat) (a b:natN n) (c:nat1) : natN n
val reveal_add_lo (#n:nat) (a b:natN n) (c:nat1) : Lemma (add_lo a b c == add_lo_def a b c)
val reveal_add_lo_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n) (c:nat1).{:pattern add_lo a b c} add_lo a b c == add_lo_def a b c)
let add_hi_def (#n:nat) (a b:natN n) (c:nat1) : nat1 =
if a + b + c < n then 0 else 1
val add_hi (#n:nat) (a b:natN n) (c:nat1) : nat1
val reveal_add_hi (#n:nat) (a b:natN n) (c:nat1) : Lemma (add_hi a b c == add_hi_def a b c)
val reveal_add_hi_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n) (c:nat1).{:pattern add_hi a b c} add_hi a b c == add_hi_def a b c)
let add_lo_hi (#n:pos) (a b:natN n) (c:nat1) : natN n & nat1 =
(add_lo a b c, add_hi a b c)
let mul_lo_def (#n:pos) (a b:natN n) : natN n =
(a * b) % n
val mul_lo (#n:pos) (a b:natN n) : natN n
val reveal_mul_lo (#n:nat) (a b:natN n) : Lemma (mul_lo a b == mul_lo_def a b)
val reveal_mul_lo_all (_:unit) : Lemma
(forall (n:nat) (a b:natN n).{:pattern mul_lo a b} mul_lo a b == mul_lo_def a b) | false | false | Vale.Bignum.Defs.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 mul_hi_def (#n: pos) (a b: natN n) : natN n | [] | Vale.Bignum.Defs.mul_hi_def | {
"file_name": "vale/code/crypto/bignum/Vale.Bignum.Defs.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Vale.Def.Words_s.natN n -> b: Vale.Def.Words_s.natN n -> Vale.Def.Words_s.natN n | {
"end_col": 13,
"end_line": 46,
"start_col": 2,
"start_line": 45
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": 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 inttype = t:inttype{unsigned t} | let inttype = | false | null | false | t: inttype{unsigned t} | {
"checked_file": "Lib.IntTypes.Compatibility.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Lib.IntTypes.Compatibility.fst"
} | [
"total"
] | [
"Lib.IntTypes.inttype",
"Prims.b2t",
"Lib.IntTypes.unsigned"
] | [] | module Lib.IntTypes.Compatibility
open Lib.IntTypes
val uint_v_size_lemma: s:size_nat ->
Lemma
(ensures (uint_v (size s) == s))
[SMTPat (uint_v (size s))]
let uint_v_size_lemma s = () | false | true | Lib.IntTypes.Compatibility.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": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val inttype : Type0 | [] | Lib.IntTypes.Compatibility.inttype | {
"file_name": "lib/Lib.IntTypes.Compatibility.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 35,
"end_line": 12,
"start_col": 14,
"start_line": 12
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": 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 zeroes t l = zeros t l | let zeroes t l = | false | null | false | zeros t l | {
"checked_file": "Lib.IntTypes.Compatibility.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Lib.IntTypes.Compatibility.fst"
} | [
"total"
] | [
"Lib.IntTypes.inttype",
"Lib.IntTypes.secrecy_level",
"Lib.IntTypes.zeros",
"Lib.IntTypes.int_t",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Lib.IntTypes.v"
] | [] | module Lib.IntTypes.Compatibility
open Lib.IntTypes
val uint_v_size_lemma: s:size_nat ->
Lemma
(ensures (uint_v (size s) == s))
[SMTPat (uint_v (size s))]
let uint_v_size_lemma s = ()
unfold
let inttype = t:inttype{unsigned t}
val uintv_extensionality:
#t:inttype
-> #l:secrecy_level
-> a:uint_t t l
-> b:uint_t t l
-> Lemma
(requires uint_v a == uint_v b)
(ensures a == b)
let uintv_extensionality #t #l a b = ()
let nat_to_uint (#t:inttype) (#l:secrecy_level) (n:nat{n <= maxint t}) : u:uint_t t l{uint_v u == n} = uint #t #l n | false | false | Lib.IntTypes.Compatibility.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": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val zeroes : t: Lib.IntTypes.inttype -> l: Lib.IntTypes.secrecy_level
-> n: Lib.IntTypes.int_t t l {Lib.IntTypes.v n = 0} | [] | Lib.IntTypes.Compatibility.zeroes | {
"file_name": "lib/Lib.IntTypes.Compatibility.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | t: Lib.IntTypes.inttype -> l: Lib.IntTypes.secrecy_level
-> n: Lib.IntTypes.int_t t l {Lib.IntTypes.v n = 0} | {
"end_col": 26,
"end_line": 26,
"start_col": 17,
"start_line": 26
} |
|
Prims.Tot | val nat_to_uint (#t: inttype) (#l: secrecy_level) (n: nat{n <= maxint t})
: u: uint_t t l {uint_v u == n} | [
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": 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 nat_to_uint (#t:inttype) (#l:secrecy_level) (n:nat{n <= maxint t}) : u:uint_t t l{uint_v u == n} = uint #t #l n | val nat_to_uint (#t: inttype) (#l: secrecy_level) (n: nat{n <= maxint t})
: u: uint_t t l {uint_v u == n}
let nat_to_uint (#t: inttype) (#l: secrecy_level) (n: nat{n <= maxint t})
: u: uint_t t l {uint_v u == n} = | false | null | false | uint #t #l n | {
"checked_file": "Lib.IntTypes.Compatibility.fst.checked",
"dependencies": [
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Lib.IntTypes.Compatibility.fst"
} | [
"total"
] | [
"Lib.IntTypes.Compatibility.inttype",
"Lib.IntTypes.secrecy_level",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Lib.IntTypes.maxint",
"Lib.IntTypes.uint",
"Lib.IntTypes.uint_t",
"Prims.eq2",
"Prims.int",
"Prims.l_or",
"Lib.IntTypes.range",
"Prims.l_and",
"Prims.op_GreaterThanOrEqual",
"Lib.IntTypes.uint_v"
] | [] | module Lib.IntTypes.Compatibility
open Lib.IntTypes
val uint_v_size_lemma: s:size_nat ->
Lemma
(ensures (uint_v (size s) == s))
[SMTPat (uint_v (size s))]
let uint_v_size_lemma s = ()
unfold
let inttype = t:inttype{unsigned t}
val uintv_extensionality:
#t:inttype
-> #l:secrecy_level
-> a:uint_t t l
-> b:uint_t t l
-> Lemma
(requires uint_v a == uint_v b)
(ensures a == b)
let uintv_extensionality #t #l a b = () | false | false | Lib.IntTypes.Compatibility.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": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val nat_to_uint (#t: inttype) (#l: secrecy_level) (n: nat{n <= maxint t})
: u: uint_t t l {uint_v u == n} | [] | Lib.IntTypes.Compatibility.nat_to_uint | {
"file_name": "lib/Lib.IntTypes.Compatibility.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | n: Prims.nat{n <= Lib.IntTypes.maxint t}
-> u11: Lib.IntTypes.uint_t t l {Lib.IntTypes.uint_v u11 == n} | {
"end_col": 115,
"end_line": 24,
"start_col": 103,
"start_line": 24
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Spec.Agile.HKDF",
"short_module": "HKDF"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HMAC",
"short_module": "HMAC"
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"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": "Spec.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.HKDF",
"short_module": null
},
{
"abbrev": 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 test1_len = 42 | let test1_len = | false | null | false | 42 | {
"checked_file": "Spec.HKDF.Test.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"Spec.Agile.HKDF.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.HKDF.Test.fst"
} | [
"total"
] | [] | [] | module Spec.HKDF.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
module HMAC = Spec.Agile.HMAC
module HKDF = Spec.Agile.HKDF
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_hash = Spec.Hash.Definitions.SHA2_256
let test1_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test1_salt : lbytes 13 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy
] in
assert_norm (List.Tot.length l == 13);
of_list l
let test1_info : lbytes 10 =
let l = List.Tot.map u8_from_UInt8 [
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy
] in
assert_norm (List.Tot.length l == 10);
of_list l | false | true | Spec.HKDF.Test.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 test1_len : Prims.int | [] | Spec.HKDF.Test.test1_len | {
"file_name": "specs/tests/Spec.HKDF.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.int | {
"end_col": 18,
"end_line": 46,
"start_col": 16,
"start_line": 46
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Spec.Agile.HKDF",
"short_module": "HKDF"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HMAC",
"short_module": "HMAC"
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"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": "Spec.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.HKDF",
"short_module": null
},
{
"abbrev": 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 test2_len = 82 | let test2_len = | false | null | false | 82 | {
"checked_file": "Spec.HKDF.Test.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"Spec.Agile.HKDF.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.HKDF.Test.fst"
} | [
"total"
] | [] | [] | module Spec.HKDF.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
module HMAC = Spec.Agile.HMAC
module HKDF = Spec.Agile.HKDF
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_hash = Spec.Hash.Definitions.SHA2_256
let test1_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test1_salt : lbytes 13 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy
] in
assert_norm (List.Tot.length l == 13);
of_list l
let test1_info : lbytes 10 =
let l = List.Tot.map u8_from_UInt8 [
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy
] in
assert_norm (List.Tot.length l == 10);
of_list l
let test1_len = 42
let test1_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x07uy; 0x77uy; 0x09uy; 0x36uy; 0x2cuy; 0x2euy; 0x32uy; 0xdfuy;
0x0duy; 0xdcuy; 0x3fuy; 0x0duy; 0xc4uy; 0x7buy; 0xbauy; 0x63uy;
0x90uy; 0xb6uy; 0xc7uy; 0x3buy; 0xb5uy; 0x0fuy; 0x9cuy; 0x31uy;
0x22uy; 0xecuy; 0x84uy; 0x4auy; 0xd7uy; 0xc2uy; 0xb3uy; 0xe5uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test1_expected_okm : lbytes 42 =
let l = List.Tot.map u8_from_UInt8 [
0x3cuy; 0xb2uy; 0x5fuy; 0x25uy; 0xfauy; 0xacuy; 0xd5uy; 0x7auy;
0x90uy; 0x43uy; 0x4fuy; 0x64uy; 0xd0uy; 0x36uy; 0x2fuy; 0x2auy;
0x2duy; 0x2duy; 0x0auy; 0x90uy; 0xcfuy; 0x1auy; 0x5auy; 0x4cuy;
0x5duy; 0xb0uy; 0x2duy; 0x56uy; 0xecuy; 0xc4uy; 0xc5uy; 0xbfuy;
0x34uy; 0x00uy; 0x72uy; 0x08uy; 0xd5uy; 0xb8uy; 0x87uy; 0x18uy;
0x58uy; 0x65uy
] in
assert_norm (List.Tot.length l == 42);
of_list l
/// Test 2
let test2_hash = Spec.Hash.Definitions.SHA2_256
let test2_ikm : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy; 0x0duy; 0x0euy; 0x0fuy;
0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy;
0x18uy; 0x19uy; 0x1auy; 0x1buy; 0x1cuy; 0x1duy; 0x1euy; 0x1fuy;
0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x24uy; 0x25uy; 0x26uy; 0x27uy;
0x28uy; 0x29uy; 0x2auy; 0x2buy; 0x2cuy; 0x2duy; 0x2euy; 0x2fuy;
0x30uy; 0x31uy; 0x32uy; 0x33uy; 0x34uy; 0x35uy; 0x36uy; 0x37uy;
0x38uy; 0x39uy; 0x3auy; 0x3buy; 0x3cuy; 0x3duy; 0x3euy; 0x3fuy;
0x40uy; 0x41uy; 0x42uy; 0x43uy; 0x44uy; 0x45uy; 0x46uy; 0x47uy;
0x48uy; 0x49uy; 0x4auy; 0x4buy; 0x4cuy; 0x4duy; 0x4euy; 0x4fuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_salt : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x60uy; 0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy;
0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy; 0x75uy; 0x76uy; 0x77uy;
0x78uy; 0x79uy; 0x7auy; 0x7buy; 0x7cuy; 0x7duy; 0x7euy; 0x7fuy;
0x80uy; 0x81uy; 0x82uy; 0x83uy; 0x84uy; 0x85uy; 0x86uy; 0x87uy;
0x88uy; 0x89uy; 0x8auy; 0x8buy; 0x8cuy; 0x8duy; 0x8euy; 0x8fuy;
0x90uy; 0x91uy; 0x92uy; 0x93uy; 0x94uy; 0x95uy; 0x96uy; 0x97uy;
0x98uy; 0x99uy; 0x9auy; 0x9buy; 0x9cuy; 0x9duy; 0x9euy; 0x9fuy;
0xa0uy; 0xa1uy; 0xa2uy; 0xa3uy; 0xa4uy; 0xa5uy; 0xa6uy; 0xa7uy;
0xa8uy; 0xa9uy; 0xaauy; 0xabuy; 0xacuy; 0xaduy; 0xaeuy; 0xafuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_info : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0xb0uy; 0xb1uy; 0xb2uy; 0xb3uy; 0xb4uy; 0xb5uy; 0xb6uy; 0xb7uy;
0xb8uy; 0xb9uy; 0xbauy; 0xbbuy; 0xbcuy; 0xbduy; 0xbeuy; 0xbfuy;
0xc0uy; 0xc1uy; 0xc2uy; 0xc3uy; 0xc4uy; 0xc5uy; 0xc6uy; 0xc7uy;
0xc8uy; 0xc9uy; 0xcauy; 0xcbuy; 0xccuy; 0xcduy; 0xceuy; 0xcfuy;
0xd0uy; 0xd1uy; 0xd2uy; 0xd3uy; 0xd4uy; 0xd5uy; 0xd6uy; 0xd7uy;
0xd8uy; 0xd9uy; 0xdauy; 0xdbuy; 0xdcuy; 0xdduy; 0xdeuy; 0xdfuy;
0xe0uy; 0xe1uy; 0xe2uy; 0xe3uy; 0xe4uy; 0xe5uy; 0xe6uy; 0xe7uy;
0xe8uy; 0xe9uy; 0xeauy; 0xebuy; 0xecuy; 0xeduy; 0xeeuy; 0xefuy;
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy; 0xfauy; 0xfbuy; 0xfcuy; 0xfduy; 0xfeuy; 0xffuy
] in
assert_norm (List.Tot.length l == 80);
of_list l | false | true | Spec.HKDF.Test.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 test2_len : Prims.int | [] | Spec.HKDF.Test.test2_len | {
"file_name": "specs/tests/Spec.HKDF.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.int | {
"end_col": 18,
"end_line": 126,
"start_col": 16,
"start_line": 126
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Spec.Agile.HKDF",
"short_module": "HKDF"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HMAC",
"short_module": "HMAC"
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"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": "Spec.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.HKDF",
"short_module": null
},
{
"abbrev": 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 test2_hash = Spec.Hash.Definitions.SHA2_256 | let test2_hash = | false | null | false | Spec.Hash.Definitions.SHA2_256 | {
"checked_file": "Spec.HKDF.Test.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"Spec.Agile.HKDF.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.HKDF.Test.fst"
} | [
"total"
] | [
"Spec.Hash.Definitions.SHA2_256"
] | [] | module Spec.HKDF.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
module HMAC = Spec.Agile.HMAC
module HKDF = Spec.Agile.HKDF
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_hash = Spec.Hash.Definitions.SHA2_256
let test1_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test1_salt : lbytes 13 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy
] in
assert_norm (List.Tot.length l == 13);
of_list l
let test1_info : lbytes 10 =
let l = List.Tot.map u8_from_UInt8 [
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy
] in
assert_norm (List.Tot.length l == 10);
of_list l
let test1_len = 42
let test1_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x07uy; 0x77uy; 0x09uy; 0x36uy; 0x2cuy; 0x2euy; 0x32uy; 0xdfuy;
0x0duy; 0xdcuy; 0x3fuy; 0x0duy; 0xc4uy; 0x7buy; 0xbauy; 0x63uy;
0x90uy; 0xb6uy; 0xc7uy; 0x3buy; 0xb5uy; 0x0fuy; 0x9cuy; 0x31uy;
0x22uy; 0xecuy; 0x84uy; 0x4auy; 0xd7uy; 0xc2uy; 0xb3uy; 0xe5uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test1_expected_okm : lbytes 42 =
let l = List.Tot.map u8_from_UInt8 [
0x3cuy; 0xb2uy; 0x5fuy; 0x25uy; 0xfauy; 0xacuy; 0xd5uy; 0x7auy;
0x90uy; 0x43uy; 0x4fuy; 0x64uy; 0xd0uy; 0x36uy; 0x2fuy; 0x2auy;
0x2duy; 0x2duy; 0x0auy; 0x90uy; 0xcfuy; 0x1auy; 0x5auy; 0x4cuy;
0x5duy; 0xb0uy; 0x2duy; 0x56uy; 0xecuy; 0xc4uy; 0xc5uy; 0xbfuy;
0x34uy; 0x00uy; 0x72uy; 0x08uy; 0xd5uy; 0xb8uy; 0x87uy; 0x18uy;
0x58uy; 0x65uy
] in
assert_norm (List.Tot.length l == 42);
of_list l
/// Test 2 | false | true | Spec.HKDF.Test.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 test2_hash : Spec.Hash.Definitions.hash_alg | [] | Spec.HKDF.Test.test2_hash | {
"file_name": "specs/tests/Spec.HKDF.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Spec.Hash.Definitions.hash_alg | {
"end_col": 47,
"end_line": 74,
"start_col": 17,
"start_line": 74
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Spec.Agile.HKDF",
"short_module": "HKDF"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HMAC",
"short_module": "HMAC"
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"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": "Spec.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.HKDF",
"short_module": null
},
{
"abbrev": 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 test3_len = 42 | let test3_len = | false | null | false | 42 | {
"checked_file": "Spec.HKDF.Test.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"Spec.Agile.HKDF.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.HKDF.Test.fst"
} | [
"total"
] | [] | [] | module Spec.HKDF.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
module HMAC = Spec.Agile.HMAC
module HKDF = Spec.Agile.HKDF
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_hash = Spec.Hash.Definitions.SHA2_256
let test1_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test1_salt : lbytes 13 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy
] in
assert_norm (List.Tot.length l == 13);
of_list l
let test1_info : lbytes 10 =
let l = List.Tot.map u8_from_UInt8 [
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy
] in
assert_norm (List.Tot.length l == 10);
of_list l
let test1_len = 42
let test1_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x07uy; 0x77uy; 0x09uy; 0x36uy; 0x2cuy; 0x2euy; 0x32uy; 0xdfuy;
0x0duy; 0xdcuy; 0x3fuy; 0x0duy; 0xc4uy; 0x7buy; 0xbauy; 0x63uy;
0x90uy; 0xb6uy; 0xc7uy; 0x3buy; 0xb5uy; 0x0fuy; 0x9cuy; 0x31uy;
0x22uy; 0xecuy; 0x84uy; 0x4auy; 0xd7uy; 0xc2uy; 0xb3uy; 0xe5uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test1_expected_okm : lbytes 42 =
let l = List.Tot.map u8_from_UInt8 [
0x3cuy; 0xb2uy; 0x5fuy; 0x25uy; 0xfauy; 0xacuy; 0xd5uy; 0x7auy;
0x90uy; 0x43uy; 0x4fuy; 0x64uy; 0xd0uy; 0x36uy; 0x2fuy; 0x2auy;
0x2duy; 0x2duy; 0x0auy; 0x90uy; 0xcfuy; 0x1auy; 0x5auy; 0x4cuy;
0x5duy; 0xb0uy; 0x2duy; 0x56uy; 0xecuy; 0xc4uy; 0xc5uy; 0xbfuy;
0x34uy; 0x00uy; 0x72uy; 0x08uy; 0xd5uy; 0xb8uy; 0x87uy; 0x18uy;
0x58uy; 0x65uy
] in
assert_norm (List.Tot.length l == 42);
of_list l
/// Test 2
let test2_hash = Spec.Hash.Definitions.SHA2_256
let test2_ikm : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy; 0x0duy; 0x0euy; 0x0fuy;
0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy;
0x18uy; 0x19uy; 0x1auy; 0x1buy; 0x1cuy; 0x1duy; 0x1euy; 0x1fuy;
0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x24uy; 0x25uy; 0x26uy; 0x27uy;
0x28uy; 0x29uy; 0x2auy; 0x2buy; 0x2cuy; 0x2duy; 0x2euy; 0x2fuy;
0x30uy; 0x31uy; 0x32uy; 0x33uy; 0x34uy; 0x35uy; 0x36uy; 0x37uy;
0x38uy; 0x39uy; 0x3auy; 0x3buy; 0x3cuy; 0x3duy; 0x3euy; 0x3fuy;
0x40uy; 0x41uy; 0x42uy; 0x43uy; 0x44uy; 0x45uy; 0x46uy; 0x47uy;
0x48uy; 0x49uy; 0x4auy; 0x4buy; 0x4cuy; 0x4duy; 0x4euy; 0x4fuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_salt : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x60uy; 0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy;
0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy; 0x75uy; 0x76uy; 0x77uy;
0x78uy; 0x79uy; 0x7auy; 0x7buy; 0x7cuy; 0x7duy; 0x7euy; 0x7fuy;
0x80uy; 0x81uy; 0x82uy; 0x83uy; 0x84uy; 0x85uy; 0x86uy; 0x87uy;
0x88uy; 0x89uy; 0x8auy; 0x8buy; 0x8cuy; 0x8duy; 0x8euy; 0x8fuy;
0x90uy; 0x91uy; 0x92uy; 0x93uy; 0x94uy; 0x95uy; 0x96uy; 0x97uy;
0x98uy; 0x99uy; 0x9auy; 0x9buy; 0x9cuy; 0x9duy; 0x9euy; 0x9fuy;
0xa0uy; 0xa1uy; 0xa2uy; 0xa3uy; 0xa4uy; 0xa5uy; 0xa6uy; 0xa7uy;
0xa8uy; 0xa9uy; 0xaauy; 0xabuy; 0xacuy; 0xaduy; 0xaeuy; 0xafuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_info : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0xb0uy; 0xb1uy; 0xb2uy; 0xb3uy; 0xb4uy; 0xb5uy; 0xb6uy; 0xb7uy;
0xb8uy; 0xb9uy; 0xbauy; 0xbbuy; 0xbcuy; 0xbduy; 0xbeuy; 0xbfuy;
0xc0uy; 0xc1uy; 0xc2uy; 0xc3uy; 0xc4uy; 0xc5uy; 0xc6uy; 0xc7uy;
0xc8uy; 0xc9uy; 0xcauy; 0xcbuy; 0xccuy; 0xcduy; 0xceuy; 0xcfuy;
0xd0uy; 0xd1uy; 0xd2uy; 0xd3uy; 0xd4uy; 0xd5uy; 0xd6uy; 0xd7uy;
0xd8uy; 0xd9uy; 0xdauy; 0xdbuy; 0xdcuy; 0xdduy; 0xdeuy; 0xdfuy;
0xe0uy; 0xe1uy; 0xe2uy; 0xe3uy; 0xe4uy; 0xe5uy; 0xe6uy; 0xe7uy;
0xe8uy; 0xe9uy; 0xeauy; 0xebuy; 0xecuy; 0xeduy; 0xeeuy; 0xefuy;
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy; 0xfauy; 0xfbuy; 0xfcuy; 0xfduy; 0xfeuy; 0xffuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_len = 82
let test2_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x06uy; 0xa6uy; 0xb8uy; 0x8cuy; 0x58uy; 0x53uy; 0x36uy; 0x1auy;
0x06uy; 0x10uy; 0x4cuy; 0x9cuy; 0xebuy; 0x35uy; 0xb4uy; 0x5cuy;
0xefuy; 0x76uy; 0x00uy; 0x14uy; 0x90uy; 0x46uy; 0x71uy; 0x01uy;
0x4auy; 0x19uy; 0x3fuy; 0x40uy; 0xc1uy; 0x5fuy; 0xc2uy; 0x44uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test2_expected_okm : lbytes 82 =
let l = List.Tot.map u8_from_UInt8 [
0xb1uy; 0x1euy; 0x39uy; 0x8duy; 0xc8uy; 0x03uy; 0x27uy; 0xa1uy;
0xc8uy; 0xe7uy; 0xf7uy; 0x8cuy; 0x59uy; 0x6auy; 0x49uy; 0x34uy;
0x4fuy; 0x01uy; 0x2euy; 0xdauy; 0x2duy; 0x4euy; 0xfauy; 0xd8uy;
0xa0uy; 0x50uy; 0xccuy; 0x4cuy; 0x19uy; 0xafuy; 0xa9uy; 0x7cuy;
0x59uy; 0x04uy; 0x5auy; 0x99uy; 0xcauy; 0xc7uy; 0x82uy; 0x72uy;
0x71uy; 0xcbuy; 0x41uy; 0xc6uy; 0x5euy; 0x59uy; 0x0euy; 0x09uy;
0xdauy; 0x32uy; 0x75uy; 0x60uy; 0x0cuy; 0x2fuy; 0x09uy; 0xb8uy;
0x36uy; 0x77uy; 0x93uy; 0xa9uy; 0xacuy; 0xa3uy; 0xdbuy; 0x71uy;
0xccuy; 0x30uy; 0xc5uy; 0x81uy; 0x79uy; 0xecuy; 0x3euy; 0x87uy;
0xc1uy; 0x4cuy; 0x01uy; 0xd5uy; 0xc1uy; 0xf3uy; 0x43uy; 0x4fuy;
0x1duy; 0x87uy
] in
assert_norm (List.Tot.length l == 82);
of_list l
/// Test 3
let test3_hash = Spec.Hash.Definitions.SHA2_256
let test3_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test3_salt : lbytes 0 =
let l = List.Tot.map u8_from_UInt8 [] in
assert_norm (List.Tot.length l == 0);
of_list l
let test3_info : lbytes 0 =
let l = List.Tot.map u8_from_UInt8 [] in
assert_norm (List.Tot.length l == 0);
of_list l | false | true | Spec.HKDF.Test.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 test3_len : Prims.int | [] | Spec.HKDF.Test.test3_len | {
"file_name": "specs/tests/Spec.HKDF.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.int | {
"end_col": 18,
"end_line": 182,
"start_col": 16,
"start_line": 182
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Spec.Agile.HKDF",
"short_module": "HKDF"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HMAC",
"short_module": "HMAC"
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"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": "Spec.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.HKDF",
"short_module": null
},
{
"abbrev": 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 test1_hash = Spec.Hash.Definitions.SHA2_256 | let test1_hash = | false | null | false | Spec.Hash.Definitions.SHA2_256 | {
"checked_file": "Spec.HKDF.Test.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"Spec.Agile.HKDF.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.HKDF.Test.fst"
} | [
"total"
] | [
"Spec.Hash.Definitions.SHA2_256"
] | [] | module Spec.HKDF.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
module HMAC = Spec.Agile.HMAC
module HKDF = Spec.Agile.HKDF
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1 | false | true | Spec.HKDF.Test.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 test1_hash : Spec.Hash.Definitions.hash_alg | [] | Spec.HKDF.Test.test1_hash | {
"file_name": "specs/tests/Spec.HKDF.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Spec.Hash.Definitions.hash_alg | {
"end_col": 47,
"end_line": 17,
"start_col": 17,
"start_line": 17
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Spec.Agile.HKDF",
"short_module": "HKDF"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HMAC",
"short_module": "HMAC"
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"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": "Spec.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.HKDF",
"short_module": null
},
{
"abbrev": 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 test3_hash = Spec.Hash.Definitions.SHA2_256 | let test3_hash = | false | null | false | Spec.Hash.Definitions.SHA2_256 | {
"checked_file": "Spec.HKDF.Test.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"Spec.Agile.HKDF.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.HKDF.Test.fst"
} | [
"total"
] | [
"Spec.Hash.Definitions.SHA2_256"
] | [] | module Spec.HKDF.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
module HMAC = Spec.Agile.HMAC
module HKDF = Spec.Agile.HKDF
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_hash = Spec.Hash.Definitions.SHA2_256
let test1_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test1_salt : lbytes 13 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy
] in
assert_norm (List.Tot.length l == 13);
of_list l
let test1_info : lbytes 10 =
let l = List.Tot.map u8_from_UInt8 [
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy
] in
assert_norm (List.Tot.length l == 10);
of_list l
let test1_len = 42
let test1_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x07uy; 0x77uy; 0x09uy; 0x36uy; 0x2cuy; 0x2euy; 0x32uy; 0xdfuy;
0x0duy; 0xdcuy; 0x3fuy; 0x0duy; 0xc4uy; 0x7buy; 0xbauy; 0x63uy;
0x90uy; 0xb6uy; 0xc7uy; 0x3buy; 0xb5uy; 0x0fuy; 0x9cuy; 0x31uy;
0x22uy; 0xecuy; 0x84uy; 0x4auy; 0xd7uy; 0xc2uy; 0xb3uy; 0xe5uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test1_expected_okm : lbytes 42 =
let l = List.Tot.map u8_from_UInt8 [
0x3cuy; 0xb2uy; 0x5fuy; 0x25uy; 0xfauy; 0xacuy; 0xd5uy; 0x7auy;
0x90uy; 0x43uy; 0x4fuy; 0x64uy; 0xd0uy; 0x36uy; 0x2fuy; 0x2auy;
0x2duy; 0x2duy; 0x0auy; 0x90uy; 0xcfuy; 0x1auy; 0x5auy; 0x4cuy;
0x5duy; 0xb0uy; 0x2duy; 0x56uy; 0xecuy; 0xc4uy; 0xc5uy; 0xbfuy;
0x34uy; 0x00uy; 0x72uy; 0x08uy; 0xd5uy; 0xb8uy; 0x87uy; 0x18uy;
0x58uy; 0x65uy
] in
assert_norm (List.Tot.length l == 42);
of_list l
/// Test 2
let test2_hash = Spec.Hash.Definitions.SHA2_256
let test2_ikm : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy; 0x0duy; 0x0euy; 0x0fuy;
0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy;
0x18uy; 0x19uy; 0x1auy; 0x1buy; 0x1cuy; 0x1duy; 0x1euy; 0x1fuy;
0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x24uy; 0x25uy; 0x26uy; 0x27uy;
0x28uy; 0x29uy; 0x2auy; 0x2buy; 0x2cuy; 0x2duy; 0x2euy; 0x2fuy;
0x30uy; 0x31uy; 0x32uy; 0x33uy; 0x34uy; 0x35uy; 0x36uy; 0x37uy;
0x38uy; 0x39uy; 0x3auy; 0x3buy; 0x3cuy; 0x3duy; 0x3euy; 0x3fuy;
0x40uy; 0x41uy; 0x42uy; 0x43uy; 0x44uy; 0x45uy; 0x46uy; 0x47uy;
0x48uy; 0x49uy; 0x4auy; 0x4buy; 0x4cuy; 0x4duy; 0x4euy; 0x4fuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_salt : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x60uy; 0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy;
0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy; 0x75uy; 0x76uy; 0x77uy;
0x78uy; 0x79uy; 0x7auy; 0x7buy; 0x7cuy; 0x7duy; 0x7euy; 0x7fuy;
0x80uy; 0x81uy; 0x82uy; 0x83uy; 0x84uy; 0x85uy; 0x86uy; 0x87uy;
0x88uy; 0x89uy; 0x8auy; 0x8buy; 0x8cuy; 0x8duy; 0x8euy; 0x8fuy;
0x90uy; 0x91uy; 0x92uy; 0x93uy; 0x94uy; 0x95uy; 0x96uy; 0x97uy;
0x98uy; 0x99uy; 0x9auy; 0x9buy; 0x9cuy; 0x9duy; 0x9euy; 0x9fuy;
0xa0uy; 0xa1uy; 0xa2uy; 0xa3uy; 0xa4uy; 0xa5uy; 0xa6uy; 0xa7uy;
0xa8uy; 0xa9uy; 0xaauy; 0xabuy; 0xacuy; 0xaduy; 0xaeuy; 0xafuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_info : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0xb0uy; 0xb1uy; 0xb2uy; 0xb3uy; 0xb4uy; 0xb5uy; 0xb6uy; 0xb7uy;
0xb8uy; 0xb9uy; 0xbauy; 0xbbuy; 0xbcuy; 0xbduy; 0xbeuy; 0xbfuy;
0xc0uy; 0xc1uy; 0xc2uy; 0xc3uy; 0xc4uy; 0xc5uy; 0xc6uy; 0xc7uy;
0xc8uy; 0xc9uy; 0xcauy; 0xcbuy; 0xccuy; 0xcduy; 0xceuy; 0xcfuy;
0xd0uy; 0xd1uy; 0xd2uy; 0xd3uy; 0xd4uy; 0xd5uy; 0xd6uy; 0xd7uy;
0xd8uy; 0xd9uy; 0xdauy; 0xdbuy; 0xdcuy; 0xdduy; 0xdeuy; 0xdfuy;
0xe0uy; 0xe1uy; 0xe2uy; 0xe3uy; 0xe4uy; 0xe5uy; 0xe6uy; 0xe7uy;
0xe8uy; 0xe9uy; 0xeauy; 0xebuy; 0xecuy; 0xeduy; 0xeeuy; 0xefuy;
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy; 0xfauy; 0xfbuy; 0xfcuy; 0xfduy; 0xfeuy; 0xffuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_len = 82
let test2_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x06uy; 0xa6uy; 0xb8uy; 0x8cuy; 0x58uy; 0x53uy; 0x36uy; 0x1auy;
0x06uy; 0x10uy; 0x4cuy; 0x9cuy; 0xebuy; 0x35uy; 0xb4uy; 0x5cuy;
0xefuy; 0x76uy; 0x00uy; 0x14uy; 0x90uy; 0x46uy; 0x71uy; 0x01uy;
0x4auy; 0x19uy; 0x3fuy; 0x40uy; 0xc1uy; 0x5fuy; 0xc2uy; 0x44uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test2_expected_okm : lbytes 82 =
let l = List.Tot.map u8_from_UInt8 [
0xb1uy; 0x1euy; 0x39uy; 0x8duy; 0xc8uy; 0x03uy; 0x27uy; 0xa1uy;
0xc8uy; 0xe7uy; 0xf7uy; 0x8cuy; 0x59uy; 0x6auy; 0x49uy; 0x34uy;
0x4fuy; 0x01uy; 0x2euy; 0xdauy; 0x2duy; 0x4euy; 0xfauy; 0xd8uy;
0xa0uy; 0x50uy; 0xccuy; 0x4cuy; 0x19uy; 0xafuy; 0xa9uy; 0x7cuy;
0x59uy; 0x04uy; 0x5auy; 0x99uy; 0xcauy; 0xc7uy; 0x82uy; 0x72uy;
0x71uy; 0xcbuy; 0x41uy; 0xc6uy; 0x5euy; 0x59uy; 0x0euy; 0x09uy;
0xdauy; 0x32uy; 0x75uy; 0x60uy; 0x0cuy; 0x2fuy; 0x09uy; 0xb8uy;
0x36uy; 0x77uy; 0x93uy; 0xa9uy; 0xacuy; 0xa3uy; 0xdbuy; 0x71uy;
0xccuy; 0x30uy; 0xc5uy; 0x81uy; 0x79uy; 0xecuy; 0x3euy; 0x87uy;
0xc1uy; 0x4cuy; 0x01uy; 0xd5uy; 0xc1uy; 0xf3uy; 0x43uy; 0x4fuy;
0x1duy; 0x87uy
] in
assert_norm (List.Tot.length l == 82);
of_list l
/// Test 3 | false | true | Spec.HKDF.Test.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 test3_hash : Spec.Hash.Definitions.hash_alg | [] | Spec.HKDF.Test.test3_hash | {
"file_name": "specs/tests/Spec.HKDF.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Spec.Hash.Definitions.hash_alg | {
"end_col": 47,
"end_line": 159,
"start_col": 17,
"start_line": 159
} |
|
Prims.Tot | val test3_info:lbytes 0 | [
{
"abbrev": true,
"full_module": "Spec.Agile.HKDF",
"short_module": "HKDF"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HMAC",
"short_module": "HMAC"
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"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": "Spec.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.HKDF",
"short_module": null
},
{
"abbrev": 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 test3_info : lbytes 0 =
let l = List.Tot.map u8_from_UInt8 [] in
assert_norm (List.Tot.length l == 0);
of_list l | val test3_info:lbytes 0
let test3_info:lbytes 0 = | false | null | false | let l = List.Tot.map u8_from_UInt8 [] in
assert_norm (List.Tot.length l == 0);
of_list l | {
"checked_file": "Spec.HKDF.Test.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"Spec.Agile.HKDF.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.HKDF.Test.fst"
} | [
"total"
] | [
"Lib.Sequence.of_list",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Prims.list",
"FStar.List.Tot.Base.map",
"FStar.UInt8.t",
"Lib.RawIntTypes.u8_from_UInt8",
"Prims.Nil"
] | [] | module Spec.HKDF.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
module HMAC = Spec.Agile.HMAC
module HKDF = Spec.Agile.HKDF
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_hash = Spec.Hash.Definitions.SHA2_256
let test1_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test1_salt : lbytes 13 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy
] in
assert_norm (List.Tot.length l == 13);
of_list l
let test1_info : lbytes 10 =
let l = List.Tot.map u8_from_UInt8 [
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy
] in
assert_norm (List.Tot.length l == 10);
of_list l
let test1_len = 42
let test1_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x07uy; 0x77uy; 0x09uy; 0x36uy; 0x2cuy; 0x2euy; 0x32uy; 0xdfuy;
0x0duy; 0xdcuy; 0x3fuy; 0x0duy; 0xc4uy; 0x7buy; 0xbauy; 0x63uy;
0x90uy; 0xb6uy; 0xc7uy; 0x3buy; 0xb5uy; 0x0fuy; 0x9cuy; 0x31uy;
0x22uy; 0xecuy; 0x84uy; 0x4auy; 0xd7uy; 0xc2uy; 0xb3uy; 0xe5uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test1_expected_okm : lbytes 42 =
let l = List.Tot.map u8_from_UInt8 [
0x3cuy; 0xb2uy; 0x5fuy; 0x25uy; 0xfauy; 0xacuy; 0xd5uy; 0x7auy;
0x90uy; 0x43uy; 0x4fuy; 0x64uy; 0xd0uy; 0x36uy; 0x2fuy; 0x2auy;
0x2duy; 0x2duy; 0x0auy; 0x90uy; 0xcfuy; 0x1auy; 0x5auy; 0x4cuy;
0x5duy; 0xb0uy; 0x2duy; 0x56uy; 0xecuy; 0xc4uy; 0xc5uy; 0xbfuy;
0x34uy; 0x00uy; 0x72uy; 0x08uy; 0xd5uy; 0xb8uy; 0x87uy; 0x18uy;
0x58uy; 0x65uy
] in
assert_norm (List.Tot.length l == 42);
of_list l
/// Test 2
let test2_hash = Spec.Hash.Definitions.SHA2_256
let test2_ikm : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy; 0x0duy; 0x0euy; 0x0fuy;
0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy;
0x18uy; 0x19uy; 0x1auy; 0x1buy; 0x1cuy; 0x1duy; 0x1euy; 0x1fuy;
0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x24uy; 0x25uy; 0x26uy; 0x27uy;
0x28uy; 0x29uy; 0x2auy; 0x2buy; 0x2cuy; 0x2duy; 0x2euy; 0x2fuy;
0x30uy; 0x31uy; 0x32uy; 0x33uy; 0x34uy; 0x35uy; 0x36uy; 0x37uy;
0x38uy; 0x39uy; 0x3auy; 0x3buy; 0x3cuy; 0x3duy; 0x3euy; 0x3fuy;
0x40uy; 0x41uy; 0x42uy; 0x43uy; 0x44uy; 0x45uy; 0x46uy; 0x47uy;
0x48uy; 0x49uy; 0x4auy; 0x4buy; 0x4cuy; 0x4duy; 0x4euy; 0x4fuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_salt : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x60uy; 0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy;
0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy; 0x75uy; 0x76uy; 0x77uy;
0x78uy; 0x79uy; 0x7auy; 0x7buy; 0x7cuy; 0x7duy; 0x7euy; 0x7fuy;
0x80uy; 0x81uy; 0x82uy; 0x83uy; 0x84uy; 0x85uy; 0x86uy; 0x87uy;
0x88uy; 0x89uy; 0x8auy; 0x8buy; 0x8cuy; 0x8duy; 0x8euy; 0x8fuy;
0x90uy; 0x91uy; 0x92uy; 0x93uy; 0x94uy; 0x95uy; 0x96uy; 0x97uy;
0x98uy; 0x99uy; 0x9auy; 0x9buy; 0x9cuy; 0x9duy; 0x9euy; 0x9fuy;
0xa0uy; 0xa1uy; 0xa2uy; 0xa3uy; 0xa4uy; 0xa5uy; 0xa6uy; 0xa7uy;
0xa8uy; 0xa9uy; 0xaauy; 0xabuy; 0xacuy; 0xaduy; 0xaeuy; 0xafuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_info : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0xb0uy; 0xb1uy; 0xb2uy; 0xb3uy; 0xb4uy; 0xb5uy; 0xb6uy; 0xb7uy;
0xb8uy; 0xb9uy; 0xbauy; 0xbbuy; 0xbcuy; 0xbduy; 0xbeuy; 0xbfuy;
0xc0uy; 0xc1uy; 0xc2uy; 0xc3uy; 0xc4uy; 0xc5uy; 0xc6uy; 0xc7uy;
0xc8uy; 0xc9uy; 0xcauy; 0xcbuy; 0xccuy; 0xcduy; 0xceuy; 0xcfuy;
0xd0uy; 0xd1uy; 0xd2uy; 0xd3uy; 0xd4uy; 0xd5uy; 0xd6uy; 0xd7uy;
0xd8uy; 0xd9uy; 0xdauy; 0xdbuy; 0xdcuy; 0xdduy; 0xdeuy; 0xdfuy;
0xe0uy; 0xe1uy; 0xe2uy; 0xe3uy; 0xe4uy; 0xe5uy; 0xe6uy; 0xe7uy;
0xe8uy; 0xe9uy; 0xeauy; 0xebuy; 0xecuy; 0xeduy; 0xeeuy; 0xefuy;
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy; 0xfauy; 0xfbuy; 0xfcuy; 0xfduy; 0xfeuy; 0xffuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_len = 82
let test2_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x06uy; 0xa6uy; 0xb8uy; 0x8cuy; 0x58uy; 0x53uy; 0x36uy; 0x1auy;
0x06uy; 0x10uy; 0x4cuy; 0x9cuy; 0xebuy; 0x35uy; 0xb4uy; 0x5cuy;
0xefuy; 0x76uy; 0x00uy; 0x14uy; 0x90uy; 0x46uy; 0x71uy; 0x01uy;
0x4auy; 0x19uy; 0x3fuy; 0x40uy; 0xc1uy; 0x5fuy; 0xc2uy; 0x44uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test2_expected_okm : lbytes 82 =
let l = List.Tot.map u8_from_UInt8 [
0xb1uy; 0x1euy; 0x39uy; 0x8duy; 0xc8uy; 0x03uy; 0x27uy; 0xa1uy;
0xc8uy; 0xe7uy; 0xf7uy; 0x8cuy; 0x59uy; 0x6auy; 0x49uy; 0x34uy;
0x4fuy; 0x01uy; 0x2euy; 0xdauy; 0x2duy; 0x4euy; 0xfauy; 0xd8uy;
0xa0uy; 0x50uy; 0xccuy; 0x4cuy; 0x19uy; 0xafuy; 0xa9uy; 0x7cuy;
0x59uy; 0x04uy; 0x5auy; 0x99uy; 0xcauy; 0xc7uy; 0x82uy; 0x72uy;
0x71uy; 0xcbuy; 0x41uy; 0xc6uy; 0x5euy; 0x59uy; 0x0euy; 0x09uy;
0xdauy; 0x32uy; 0x75uy; 0x60uy; 0x0cuy; 0x2fuy; 0x09uy; 0xb8uy;
0x36uy; 0x77uy; 0x93uy; 0xa9uy; 0xacuy; 0xa3uy; 0xdbuy; 0x71uy;
0xccuy; 0x30uy; 0xc5uy; 0x81uy; 0x79uy; 0xecuy; 0x3euy; 0x87uy;
0xc1uy; 0x4cuy; 0x01uy; 0xd5uy; 0xc1uy; 0xf3uy; 0x43uy; 0x4fuy;
0x1duy; 0x87uy
] in
assert_norm (List.Tot.length l == 82);
of_list l
/// Test 3
let test3_hash = Spec.Hash.Definitions.SHA2_256
let test3_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test3_salt : lbytes 0 =
let l = List.Tot.map u8_from_UInt8 [] in
assert_norm (List.Tot.length l == 0);
of_list l | false | false | Spec.HKDF.Test.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 test3_info:lbytes 0 | [] | Spec.HKDF.Test.test3_info | {
"file_name": "specs/tests/Spec.HKDF.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 0 | {
"end_col": 11,
"end_line": 180,
"start_col": 27,
"start_line": 177
} |
Prims.Tot | val test3_salt:lbytes 0 | [
{
"abbrev": true,
"full_module": "Spec.Agile.HKDF",
"short_module": "HKDF"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HMAC",
"short_module": "HMAC"
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"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": "Spec.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.HKDF",
"short_module": null
},
{
"abbrev": 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 test3_salt : lbytes 0 =
let l = List.Tot.map u8_from_UInt8 [] in
assert_norm (List.Tot.length l == 0);
of_list l | val test3_salt:lbytes 0
let test3_salt:lbytes 0 = | false | null | false | let l = List.Tot.map u8_from_UInt8 [] in
assert_norm (List.Tot.length l == 0);
of_list l | {
"checked_file": "Spec.HKDF.Test.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"Spec.Agile.HKDF.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.HKDF.Test.fst"
} | [
"total"
] | [
"Lib.Sequence.of_list",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Prims.list",
"FStar.List.Tot.Base.map",
"FStar.UInt8.t",
"Lib.RawIntTypes.u8_from_UInt8",
"Prims.Nil"
] | [] | module Spec.HKDF.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
module HMAC = Spec.Agile.HMAC
module HKDF = Spec.Agile.HKDF
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_hash = Spec.Hash.Definitions.SHA2_256
let test1_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test1_salt : lbytes 13 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy
] in
assert_norm (List.Tot.length l == 13);
of_list l
let test1_info : lbytes 10 =
let l = List.Tot.map u8_from_UInt8 [
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy
] in
assert_norm (List.Tot.length l == 10);
of_list l
let test1_len = 42
let test1_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x07uy; 0x77uy; 0x09uy; 0x36uy; 0x2cuy; 0x2euy; 0x32uy; 0xdfuy;
0x0duy; 0xdcuy; 0x3fuy; 0x0duy; 0xc4uy; 0x7buy; 0xbauy; 0x63uy;
0x90uy; 0xb6uy; 0xc7uy; 0x3buy; 0xb5uy; 0x0fuy; 0x9cuy; 0x31uy;
0x22uy; 0xecuy; 0x84uy; 0x4auy; 0xd7uy; 0xc2uy; 0xb3uy; 0xe5uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test1_expected_okm : lbytes 42 =
let l = List.Tot.map u8_from_UInt8 [
0x3cuy; 0xb2uy; 0x5fuy; 0x25uy; 0xfauy; 0xacuy; 0xd5uy; 0x7auy;
0x90uy; 0x43uy; 0x4fuy; 0x64uy; 0xd0uy; 0x36uy; 0x2fuy; 0x2auy;
0x2duy; 0x2duy; 0x0auy; 0x90uy; 0xcfuy; 0x1auy; 0x5auy; 0x4cuy;
0x5duy; 0xb0uy; 0x2duy; 0x56uy; 0xecuy; 0xc4uy; 0xc5uy; 0xbfuy;
0x34uy; 0x00uy; 0x72uy; 0x08uy; 0xd5uy; 0xb8uy; 0x87uy; 0x18uy;
0x58uy; 0x65uy
] in
assert_norm (List.Tot.length l == 42);
of_list l
/// Test 2
let test2_hash = Spec.Hash.Definitions.SHA2_256
let test2_ikm : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy; 0x0duy; 0x0euy; 0x0fuy;
0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy;
0x18uy; 0x19uy; 0x1auy; 0x1buy; 0x1cuy; 0x1duy; 0x1euy; 0x1fuy;
0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x24uy; 0x25uy; 0x26uy; 0x27uy;
0x28uy; 0x29uy; 0x2auy; 0x2buy; 0x2cuy; 0x2duy; 0x2euy; 0x2fuy;
0x30uy; 0x31uy; 0x32uy; 0x33uy; 0x34uy; 0x35uy; 0x36uy; 0x37uy;
0x38uy; 0x39uy; 0x3auy; 0x3buy; 0x3cuy; 0x3duy; 0x3euy; 0x3fuy;
0x40uy; 0x41uy; 0x42uy; 0x43uy; 0x44uy; 0x45uy; 0x46uy; 0x47uy;
0x48uy; 0x49uy; 0x4auy; 0x4buy; 0x4cuy; 0x4duy; 0x4euy; 0x4fuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_salt : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x60uy; 0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy;
0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy; 0x75uy; 0x76uy; 0x77uy;
0x78uy; 0x79uy; 0x7auy; 0x7buy; 0x7cuy; 0x7duy; 0x7euy; 0x7fuy;
0x80uy; 0x81uy; 0x82uy; 0x83uy; 0x84uy; 0x85uy; 0x86uy; 0x87uy;
0x88uy; 0x89uy; 0x8auy; 0x8buy; 0x8cuy; 0x8duy; 0x8euy; 0x8fuy;
0x90uy; 0x91uy; 0x92uy; 0x93uy; 0x94uy; 0x95uy; 0x96uy; 0x97uy;
0x98uy; 0x99uy; 0x9auy; 0x9buy; 0x9cuy; 0x9duy; 0x9euy; 0x9fuy;
0xa0uy; 0xa1uy; 0xa2uy; 0xa3uy; 0xa4uy; 0xa5uy; 0xa6uy; 0xa7uy;
0xa8uy; 0xa9uy; 0xaauy; 0xabuy; 0xacuy; 0xaduy; 0xaeuy; 0xafuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_info : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0xb0uy; 0xb1uy; 0xb2uy; 0xb3uy; 0xb4uy; 0xb5uy; 0xb6uy; 0xb7uy;
0xb8uy; 0xb9uy; 0xbauy; 0xbbuy; 0xbcuy; 0xbduy; 0xbeuy; 0xbfuy;
0xc0uy; 0xc1uy; 0xc2uy; 0xc3uy; 0xc4uy; 0xc5uy; 0xc6uy; 0xc7uy;
0xc8uy; 0xc9uy; 0xcauy; 0xcbuy; 0xccuy; 0xcduy; 0xceuy; 0xcfuy;
0xd0uy; 0xd1uy; 0xd2uy; 0xd3uy; 0xd4uy; 0xd5uy; 0xd6uy; 0xd7uy;
0xd8uy; 0xd9uy; 0xdauy; 0xdbuy; 0xdcuy; 0xdduy; 0xdeuy; 0xdfuy;
0xe0uy; 0xe1uy; 0xe2uy; 0xe3uy; 0xe4uy; 0xe5uy; 0xe6uy; 0xe7uy;
0xe8uy; 0xe9uy; 0xeauy; 0xebuy; 0xecuy; 0xeduy; 0xeeuy; 0xefuy;
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy; 0xfauy; 0xfbuy; 0xfcuy; 0xfduy; 0xfeuy; 0xffuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_len = 82
let test2_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x06uy; 0xa6uy; 0xb8uy; 0x8cuy; 0x58uy; 0x53uy; 0x36uy; 0x1auy;
0x06uy; 0x10uy; 0x4cuy; 0x9cuy; 0xebuy; 0x35uy; 0xb4uy; 0x5cuy;
0xefuy; 0x76uy; 0x00uy; 0x14uy; 0x90uy; 0x46uy; 0x71uy; 0x01uy;
0x4auy; 0x19uy; 0x3fuy; 0x40uy; 0xc1uy; 0x5fuy; 0xc2uy; 0x44uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test2_expected_okm : lbytes 82 =
let l = List.Tot.map u8_from_UInt8 [
0xb1uy; 0x1euy; 0x39uy; 0x8duy; 0xc8uy; 0x03uy; 0x27uy; 0xa1uy;
0xc8uy; 0xe7uy; 0xf7uy; 0x8cuy; 0x59uy; 0x6auy; 0x49uy; 0x34uy;
0x4fuy; 0x01uy; 0x2euy; 0xdauy; 0x2duy; 0x4euy; 0xfauy; 0xd8uy;
0xa0uy; 0x50uy; 0xccuy; 0x4cuy; 0x19uy; 0xafuy; 0xa9uy; 0x7cuy;
0x59uy; 0x04uy; 0x5auy; 0x99uy; 0xcauy; 0xc7uy; 0x82uy; 0x72uy;
0x71uy; 0xcbuy; 0x41uy; 0xc6uy; 0x5euy; 0x59uy; 0x0euy; 0x09uy;
0xdauy; 0x32uy; 0x75uy; 0x60uy; 0x0cuy; 0x2fuy; 0x09uy; 0xb8uy;
0x36uy; 0x77uy; 0x93uy; 0xa9uy; 0xacuy; 0xa3uy; 0xdbuy; 0x71uy;
0xccuy; 0x30uy; 0xc5uy; 0x81uy; 0x79uy; 0xecuy; 0x3euy; 0x87uy;
0xc1uy; 0x4cuy; 0x01uy; 0xd5uy; 0xc1uy; 0xf3uy; 0x43uy; 0x4fuy;
0x1duy; 0x87uy
] in
assert_norm (List.Tot.length l == 82);
of_list l
/// Test 3
let test3_hash = Spec.Hash.Definitions.SHA2_256
let test3_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l | false | false | Spec.HKDF.Test.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 test3_salt:lbytes 0 | [] | Spec.HKDF.Test.test3_salt | {
"file_name": "specs/tests/Spec.HKDF.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 0 | {
"end_col": 11,
"end_line": 174,
"start_col": 27,
"start_line": 171
} |
Prims.Tot | val test1_ikm:lbytes 22 | [
{
"abbrev": true,
"full_module": "Spec.Agile.HKDF",
"short_module": "HKDF"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HMAC",
"short_module": "HMAC"
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"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": "Spec.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.HKDF",
"short_module": null
},
{
"abbrev": 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 test1_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l | val test1_ikm:lbytes 22
let test1_ikm:lbytes 22 = | false | null | false | let l =
List.Tot.map u8_from_UInt8
[
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
]
in
assert_norm (List.Tot.length l == 22);
of_list l | {
"checked_file": "Spec.HKDF.Test.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"Spec.Agile.HKDF.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.HKDF.Test.fst"
} | [
"total"
] | [
"Lib.Sequence.of_list",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Prims.list",
"FStar.List.Tot.Base.map",
"FStar.UInt8.t",
"Lib.RawIntTypes.u8_from_UInt8",
"Prims.Cons",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | module Spec.HKDF.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
module HMAC = Spec.Agile.HMAC
module HKDF = Spec.Agile.HKDF
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_hash = Spec.Hash.Definitions.SHA2_256 | false | false | Spec.HKDF.Test.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 test1_ikm:lbytes 22 | [] | Spec.HKDF.Test.test1_ikm | {
"file_name": "specs/tests/Spec.HKDF.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 22 | {
"end_col": 11,
"end_line": 26,
"start_col": 27,
"start_line": 19
} |
Prims.Tot | val test1_salt:lbytes 13 | [
{
"abbrev": true,
"full_module": "Spec.Agile.HKDF",
"short_module": "HKDF"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HMAC",
"short_module": "HMAC"
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"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": "Spec.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.HKDF",
"short_module": null
},
{
"abbrev": 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 test1_salt : lbytes 13 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy
] in
assert_norm (List.Tot.length l == 13);
of_list l | val test1_salt:lbytes 13
let test1_salt:lbytes 13 = | false | null | false | let l =
List.Tot.map u8_from_UInt8
[
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy; 0x08uy; 0x09uy; 0x0auy; 0x0buy;
0x0cuy
]
in
assert_norm (List.Tot.length l == 13);
of_list l | {
"checked_file": "Spec.HKDF.Test.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"Spec.Agile.HKDF.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.HKDF.Test.fst"
} | [
"total"
] | [
"Lib.Sequence.of_list",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Prims.list",
"FStar.List.Tot.Base.map",
"FStar.UInt8.t",
"Lib.RawIntTypes.u8_from_UInt8",
"Prims.Cons",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | module Spec.HKDF.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
module HMAC = Spec.Agile.HMAC
module HKDF = Spec.Agile.HKDF
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_hash = Spec.Hash.Definitions.SHA2_256
let test1_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l | false | false | Spec.HKDF.Test.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 test1_salt:lbytes 13 | [] | Spec.HKDF.Test.test1_salt | {
"file_name": "specs/tests/Spec.HKDF.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 13 | {
"end_col": 11,
"end_line": 35,
"start_col": 28,
"start_line": 29
} |
FStar.All.ALL | [
{
"abbrev": true,
"full_module": "Spec.Agile.HKDF",
"short_module": "HKDF"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HMAC",
"short_module": "HMAC"
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"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": "Spec.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.HKDF",
"short_module": null
},
{
"abbrev": 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 test_one (v:vec) =
let Vec a salt ikm expected_prk info out_len expected_okm = v in
let test_prk = HKDF.extract a salt ikm in
let test_okm = HKDF.expand a expected_prk info out_len in
IO.print_string "\nPRK:";
let r_a = PS.print_compare true (length expected_prk) expected_prk test_prk in
IO.print_string "\nOKM:";
let r_b = PS.print_compare true (length expected_okm) expected_okm test_okm in
let res = r_a && r_b in
if r_a then IO.print_string "\nHKDF Extract: Success!\n"
else IO.print_string "\nHKDF Extract: Failure :(\n";
if r_b then IO.print_string "HKDF Expand: Success!\n"
else IO.print_string "HKDF Expand: Failure :(\n";
res | let test_one (v: vec) = | true | null | false | let Vec a salt ikm expected_prk info out_len expected_okm = v in
let test_prk = HKDF.extract a salt ikm in
let test_okm = HKDF.expand a expected_prk info out_len in
IO.print_string "\nPRK:";
let r_a = PS.print_compare true (length expected_prk) expected_prk test_prk in
IO.print_string "\nOKM:";
let r_b = PS.print_compare true (length expected_okm) expected_okm test_okm in
let res = r_a && r_b in
if r_a
then IO.print_string "\nHKDF Extract: Success!\n"
else IO.print_string "\nHKDF Extract: Failure :(\n";
if r_b
then IO.print_string "HKDF Expand: Success!\n"
else IO.print_string "HKDF Expand: Failure :(\n";
res | {
"checked_file": "Spec.HKDF.Test.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"Spec.Agile.HKDF.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.HKDF.Test.fst"
} | [] | [
"Spec.HKDF.Test.vec",
"Spec.Hash.Definitions.fixed_len_alg",
"Lib.ByteSequence.bytes",
"Spec.Agile.HMAC.keysized",
"Lib.Sequence.length",
"Lib.IntTypes.uint_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.b2t",
"Spec.Agile.HKDF.extract_ikm_length_pred",
"Lib.ByteSequence.lbytes",
"Spec.Hash.Definitions.hash_length",
"Spec.Agile.HKDF.expand_info_length_pred",
"Prims.nat",
"Spec.Agile.HKDF.expand_output_length_pred",
"Prims.bool",
"Prims.unit",
"FStar.IO.print_string",
"Prims.op_AmpAmp",
"Lib.PrintSequence.print_compare",
"Spec.Agile.HKDF.lbytes",
"Spec.Agile.HKDF.expand",
"Spec.Agile.HKDF.extract"
] | [] | module Spec.HKDF.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
module HMAC = Spec.Agile.HMAC
module HKDF = Spec.Agile.HKDF
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_hash = Spec.Hash.Definitions.SHA2_256
let test1_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test1_salt : lbytes 13 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy
] in
assert_norm (List.Tot.length l == 13);
of_list l
let test1_info : lbytes 10 =
let l = List.Tot.map u8_from_UInt8 [
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy
] in
assert_norm (List.Tot.length l == 10);
of_list l
let test1_len = 42
let test1_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x07uy; 0x77uy; 0x09uy; 0x36uy; 0x2cuy; 0x2euy; 0x32uy; 0xdfuy;
0x0duy; 0xdcuy; 0x3fuy; 0x0duy; 0xc4uy; 0x7buy; 0xbauy; 0x63uy;
0x90uy; 0xb6uy; 0xc7uy; 0x3buy; 0xb5uy; 0x0fuy; 0x9cuy; 0x31uy;
0x22uy; 0xecuy; 0x84uy; 0x4auy; 0xd7uy; 0xc2uy; 0xb3uy; 0xe5uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test1_expected_okm : lbytes 42 =
let l = List.Tot.map u8_from_UInt8 [
0x3cuy; 0xb2uy; 0x5fuy; 0x25uy; 0xfauy; 0xacuy; 0xd5uy; 0x7auy;
0x90uy; 0x43uy; 0x4fuy; 0x64uy; 0xd0uy; 0x36uy; 0x2fuy; 0x2auy;
0x2duy; 0x2duy; 0x0auy; 0x90uy; 0xcfuy; 0x1auy; 0x5auy; 0x4cuy;
0x5duy; 0xb0uy; 0x2duy; 0x56uy; 0xecuy; 0xc4uy; 0xc5uy; 0xbfuy;
0x34uy; 0x00uy; 0x72uy; 0x08uy; 0xd5uy; 0xb8uy; 0x87uy; 0x18uy;
0x58uy; 0x65uy
] in
assert_norm (List.Tot.length l == 42);
of_list l
/// Test 2
let test2_hash = Spec.Hash.Definitions.SHA2_256
let test2_ikm : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy; 0x0duy; 0x0euy; 0x0fuy;
0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy;
0x18uy; 0x19uy; 0x1auy; 0x1buy; 0x1cuy; 0x1duy; 0x1euy; 0x1fuy;
0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x24uy; 0x25uy; 0x26uy; 0x27uy;
0x28uy; 0x29uy; 0x2auy; 0x2buy; 0x2cuy; 0x2duy; 0x2euy; 0x2fuy;
0x30uy; 0x31uy; 0x32uy; 0x33uy; 0x34uy; 0x35uy; 0x36uy; 0x37uy;
0x38uy; 0x39uy; 0x3auy; 0x3buy; 0x3cuy; 0x3duy; 0x3euy; 0x3fuy;
0x40uy; 0x41uy; 0x42uy; 0x43uy; 0x44uy; 0x45uy; 0x46uy; 0x47uy;
0x48uy; 0x49uy; 0x4auy; 0x4buy; 0x4cuy; 0x4duy; 0x4euy; 0x4fuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_salt : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x60uy; 0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy;
0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy; 0x75uy; 0x76uy; 0x77uy;
0x78uy; 0x79uy; 0x7auy; 0x7buy; 0x7cuy; 0x7duy; 0x7euy; 0x7fuy;
0x80uy; 0x81uy; 0x82uy; 0x83uy; 0x84uy; 0x85uy; 0x86uy; 0x87uy;
0x88uy; 0x89uy; 0x8auy; 0x8buy; 0x8cuy; 0x8duy; 0x8euy; 0x8fuy;
0x90uy; 0x91uy; 0x92uy; 0x93uy; 0x94uy; 0x95uy; 0x96uy; 0x97uy;
0x98uy; 0x99uy; 0x9auy; 0x9buy; 0x9cuy; 0x9duy; 0x9euy; 0x9fuy;
0xa0uy; 0xa1uy; 0xa2uy; 0xa3uy; 0xa4uy; 0xa5uy; 0xa6uy; 0xa7uy;
0xa8uy; 0xa9uy; 0xaauy; 0xabuy; 0xacuy; 0xaduy; 0xaeuy; 0xafuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_info : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0xb0uy; 0xb1uy; 0xb2uy; 0xb3uy; 0xb4uy; 0xb5uy; 0xb6uy; 0xb7uy;
0xb8uy; 0xb9uy; 0xbauy; 0xbbuy; 0xbcuy; 0xbduy; 0xbeuy; 0xbfuy;
0xc0uy; 0xc1uy; 0xc2uy; 0xc3uy; 0xc4uy; 0xc5uy; 0xc6uy; 0xc7uy;
0xc8uy; 0xc9uy; 0xcauy; 0xcbuy; 0xccuy; 0xcduy; 0xceuy; 0xcfuy;
0xd0uy; 0xd1uy; 0xd2uy; 0xd3uy; 0xd4uy; 0xd5uy; 0xd6uy; 0xd7uy;
0xd8uy; 0xd9uy; 0xdauy; 0xdbuy; 0xdcuy; 0xdduy; 0xdeuy; 0xdfuy;
0xe0uy; 0xe1uy; 0xe2uy; 0xe3uy; 0xe4uy; 0xe5uy; 0xe6uy; 0xe7uy;
0xe8uy; 0xe9uy; 0xeauy; 0xebuy; 0xecuy; 0xeduy; 0xeeuy; 0xefuy;
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy; 0xfauy; 0xfbuy; 0xfcuy; 0xfduy; 0xfeuy; 0xffuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_len = 82
let test2_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x06uy; 0xa6uy; 0xb8uy; 0x8cuy; 0x58uy; 0x53uy; 0x36uy; 0x1auy;
0x06uy; 0x10uy; 0x4cuy; 0x9cuy; 0xebuy; 0x35uy; 0xb4uy; 0x5cuy;
0xefuy; 0x76uy; 0x00uy; 0x14uy; 0x90uy; 0x46uy; 0x71uy; 0x01uy;
0x4auy; 0x19uy; 0x3fuy; 0x40uy; 0xc1uy; 0x5fuy; 0xc2uy; 0x44uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test2_expected_okm : lbytes 82 =
let l = List.Tot.map u8_from_UInt8 [
0xb1uy; 0x1euy; 0x39uy; 0x8duy; 0xc8uy; 0x03uy; 0x27uy; 0xa1uy;
0xc8uy; 0xe7uy; 0xf7uy; 0x8cuy; 0x59uy; 0x6auy; 0x49uy; 0x34uy;
0x4fuy; 0x01uy; 0x2euy; 0xdauy; 0x2duy; 0x4euy; 0xfauy; 0xd8uy;
0xa0uy; 0x50uy; 0xccuy; 0x4cuy; 0x19uy; 0xafuy; 0xa9uy; 0x7cuy;
0x59uy; 0x04uy; 0x5auy; 0x99uy; 0xcauy; 0xc7uy; 0x82uy; 0x72uy;
0x71uy; 0xcbuy; 0x41uy; 0xc6uy; 0x5euy; 0x59uy; 0x0euy; 0x09uy;
0xdauy; 0x32uy; 0x75uy; 0x60uy; 0x0cuy; 0x2fuy; 0x09uy; 0xb8uy;
0x36uy; 0x77uy; 0x93uy; 0xa9uy; 0xacuy; 0xa3uy; 0xdbuy; 0x71uy;
0xccuy; 0x30uy; 0xc5uy; 0x81uy; 0x79uy; 0xecuy; 0x3euy; 0x87uy;
0xc1uy; 0x4cuy; 0x01uy; 0xd5uy; 0xc1uy; 0xf3uy; 0x43uy; 0x4fuy;
0x1duy; 0x87uy
] in
assert_norm (List.Tot.length l == 82);
of_list l
/// Test 3
let test3_hash = Spec.Hash.Definitions.SHA2_256
let test3_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test3_salt : lbytes 0 =
let l = List.Tot.map u8_from_UInt8 [] in
assert_norm (List.Tot.length l == 0);
of_list l
let test3_info : lbytes 0 =
let l = List.Tot.map u8_from_UInt8 [] in
assert_norm (List.Tot.length l == 0);
of_list l
let test3_len = 42
let test3_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x19uy; 0xefuy; 0x24uy; 0xa3uy; 0x2cuy; 0x71uy; 0x7buy; 0x16uy;
0x7fuy; 0x33uy; 0xa9uy; 0x1duy; 0x6fuy; 0x64uy; 0x8buy; 0xdfuy;
0x96uy; 0x59uy; 0x67uy; 0x76uy; 0xafuy; 0xdbuy; 0x63uy; 0x77uy;
0xacuy; 0x43uy; 0x4cuy; 0x1cuy; 0x29uy; 0x3cuy; 0xcbuy; 0x04uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test3_expected_okm : lbytes 42 =
let l = List.Tot.map u8_from_UInt8 [
0x8duy; 0xa4uy; 0xe7uy; 0x75uy; 0xa5uy; 0x63uy; 0xc1uy; 0x8fuy;
0x71uy; 0x5fuy; 0x80uy; 0x2auy; 0x06uy; 0x3cuy; 0x5auy; 0x31uy;
0xb8uy; 0xa1uy; 0x1fuy; 0x5cuy; 0x5euy; 0xe1uy; 0x87uy; 0x9euy;
0xc3uy; 0x45uy; 0x4euy; 0x5fuy; 0x3cuy; 0x73uy; 0x8duy; 0x2duy;
0x9duy; 0x20uy; 0x13uy; 0x95uy; 0xfauy; 0xa4uy; 0xb6uy; 0x1auy;
0x96uy; 0xc8uy
] in
assert_norm (List.Tot.length l == 42);
of_list l
noeq type vec =
| Vec :
a:Spec.Hash.Definitions.fixed_len_alg
-> salt:bytes{HMAC.keysized a (length salt)}
-> ikm:bytes{HKDF.extract_ikm_length_pred a (length ikm)}
-> expected_prk:lbytes (Spec.Hash.Definitions.hash_length a)
-> info:bytes{HKDF.expand_info_length_pred a (length info)}
-> out_len:nat{HKDF.expand_output_length_pred a out_len}
-> expected_okm:lbytes out_len -> vec
let _: squash (pow2 32 < pow2 61 /\ pow2 32 < pow2 125) =
Math.Lemmas.pow2_lt_compat 61 32;
Math.Lemmas.pow2_lt_compat 125 32
let test_vectors: list vec = [
Vec test1_hash test1_salt test1_ikm
test1_expected_prk test1_info test1_len test1_expected_okm;
Vec test2_hash test2_salt test2_ikm
test2_expected_prk test2_info test2_len test2_expected_okm;
Vec test3_hash test3_salt test3_ikm
test3_expected_prk test3_info test3_len test3_expected_okm ]
#set-options "--ifuel 2" | false | false | Spec.HKDF.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 2,
"max_fuel": 0,
"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": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val test_one : v: Spec.HKDF.Test.vec -> FStar.All.ALL Prims.bool | [] | Spec.HKDF.Test.test_one | {
"file_name": "specs/tests/Spec.HKDF.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | v: Spec.HKDF.Test.vec -> FStar.All.ALL Prims.bool | {
"end_col": 5,
"end_line": 250,
"start_col": 22,
"start_line": 235
} |
|
Prims.Tot | val test3_ikm:lbytes 22 | [
{
"abbrev": true,
"full_module": "Spec.Agile.HKDF",
"short_module": "HKDF"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HMAC",
"short_module": "HMAC"
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"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": "Spec.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.HKDF",
"short_module": null
},
{
"abbrev": 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 test3_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l | val test3_ikm:lbytes 22
let test3_ikm:lbytes 22 = | false | null | false | let l =
List.Tot.map u8_from_UInt8
[
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
]
in
assert_norm (List.Tot.length l == 22);
of_list l | {
"checked_file": "Spec.HKDF.Test.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"Spec.Agile.HKDF.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.HKDF.Test.fst"
} | [
"total"
] | [
"Lib.Sequence.of_list",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Prims.list",
"FStar.List.Tot.Base.map",
"FStar.UInt8.t",
"Lib.RawIntTypes.u8_from_UInt8",
"Prims.Cons",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | module Spec.HKDF.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
module HMAC = Spec.Agile.HMAC
module HKDF = Spec.Agile.HKDF
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_hash = Spec.Hash.Definitions.SHA2_256
let test1_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test1_salt : lbytes 13 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy
] in
assert_norm (List.Tot.length l == 13);
of_list l
let test1_info : lbytes 10 =
let l = List.Tot.map u8_from_UInt8 [
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy
] in
assert_norm (List.Tot.length l == 10);
of_list l
let test1_len = 42
let test1_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x07uy; 0x77uy; 0x09uy; 0x36uy; 0x2cuy; 0x2euy; 0x32uy; 0xdfuy;
0x0duy; 0xdcuy; 0x3fuy; 0x0duy; 0xc4uy; 0x7buy; 0xbauy; 0x63uy;
0x90uy; 0xb6uy; 0xc7uy; 0x3buy; 0xb5uy; 0x0fuy; 0x9cuy; 0x31uy;
0x22uy; 0xecuy; 0x84uy; 0x4auy; 0xd7uy; 0xc2uy; 0xb3uy; 0xe5uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test1_expected_okm : lbytes 42 =
let l = List.Tot.map u8_from_UInt8 [
0x3cuy; 0xb2uy; 0x5fuy; 0x25uy; 0xfauy; 0xacuy; 0xd5uy; 0x7auy;
0x90uy; 0x43uy; 0x4fuy; 0x64uy; 0xd0uy; 0x36uy; 0x2fuy; 0x2auy;
0x2duy; 0x2duy; 0x0auy; 0x90uy; 0xcfuy; 0x1auy; 0x5auy; 0x4cuy;
0x5duy; 0xb0uy; 0x2duy; 0x56uy; 0xecuy; 0xc4uy; 0xc5uy; 0xbfuy;
0x34uy; 0x00uy; 0x72uy; 0x08uy; 0xd5uy; 0xb8uy; 0x87uy; 0x18uy;
0x58uy; 0x65uy
] in
assert_norm (List.Tot.length l == 42);
of_list l
/// Test 2
let test2_hash = Spec.Hash.Definitions.SHA2_256
let test2_ikm : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy; 0x0duy; 0x0euy; 0x0fuy;
0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy;
0x18uy; 0x19uy; 0x1auy; 0x1buy; 0x1cuy; 0x1duy; 0x1euy; 0x1fuy;
0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x24uy; 0x25uy; 0x26uy; 0x27uy;
0x28uy; 0x29uy; 0x2auy; 0x2buy; 0x2cuy; 0x2duy; 0x2euy; 0x2fuy;
0x30uy; 0x31uy; 0x32uy; 0x33uy; 0x34uy; 0x35uy; 0x36uy; 0x37uy;
0x38uy; 0x39uy; 0x3auy; 0x3buy; 0x3cuy; 0x3duy; 0x3euy; 0x3fuy;
0x40uy; 0x41uy; 0x42uy; 0x43uy; 0x44uy; 0x45uy; 0x46uy; 0x47uy;
0x48uy; 0x49uy; 0x4auy; 0x4buy; 0x4cuy; 0x4duy; 0x4euy; 0x4fuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_salt : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x60uy; 0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy;
0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy; 0x75uy; 0x76uy; 0x77uy;
0x78uy; 0x79uy; 0x7auy; 0x7buy; 0x7cuy; 0x7duy; 0x7euy; 0x7fuy;
0x80uy; 0x81uy; 0x82uy; 0x83uy; 0x84uy; 0x85uy; 0x86uy; 0x87uy;
0x88uy; 0x89uy; 0x8auy; 0x8buy; 0x8cuy; 0x8duy; 0x8euy; 0x8fuy;
0x90uy; 0x91uy; 0x92uy; 0x93uy; 0x94uy; 0x95uy; 0x96uy; 0x97uy;
0x98uy; 0x99uy; 0x9auy; 0x9buy; 0x9cuy; 0x9duy; 0x9euy; 0x9fuy;
0xa0uy; 0xa1uy; 0xa2uy; 0xa3uy; 0xa4uy; 0xa5uy; 0xa6uy; 0xa7uy;
0xa8uy; 0xa9uy; 0xaauy; 0xabuy; 0xacuy; 0xaduy; 0xaeuy; 0xafuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_info : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0xb0uy; 0xb1uy; 0xb2uy; 0xb3uy; 0xb4uy; 0xb5uy; 0xb6uy; 0xb7uy;
0xb8uy; 0xb9uy; 0xbauy; 0xbbuy; 0xbcuy; 0xbduy; 0xbeuy; 0xbfuy;
0xc0uy; 0xc1uy; 0xc2uy; 0xc3uy; 0xc4uy; 0xc5uy; 0xc6uy; 0xc7uy;
0xc8uy; 0xc9uy; 0xcauy; 0xcbuy; 0xccuy; 0xcduy; 0xceuy; 0xcfuy;
0xd0uy; 0xd1uy; 0xd2uy; 0xd3uy; 0xd4uy; 0xd5uy; 0xd6uy; 0xd7uy;
0xd8uy; 0xd9uy; 0xdauy; 0xdbuy; 0xdcuy; 0xdduy; 0xdeuy; 0xdfuy;
0xe0uy; 0xe1uy; 0xe2uy; 0xe3uy; 0xe4uy; 0xe5uy; 0xe6uy; 0xe7uy;
0xe8uy; 0xe9uy; 0xeauy; 0xebuy; 0xecuy; 0xeduy; 0xeeuy; 0xefuy;
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy; 0xfauy; 0xfbuy; 0xfcuy; 0xfduy; 0xfeuy; 0xffuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_len = 82
let test2_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x06uy; 0xa6uy; 0xb8uy; 0x8cuy; 0x58uy; 0x53uy; 0x36uy; 0x1auy;
0x06uy; 0x10uy; 0x4cuy; 0x9cuy; 0xebuy; 0x35uy; 0xb4uy; 0x5cuy;
0xefuy; 0x76uy; 0x00uy; 0x14uy; 0x90uy; 0x46uy; 0x71uy; 0x01uy;
0x4auy; 0x19uy; 0x3fuy; 0x40uy; 0xc1uy; 0x5fuy; 0xc2uy; 0x44uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test2_expected_okm : lbytes 82 =
let l = List.Tot.map u8_from_UInt8 [
0xb1uy; 0x1euy; 0x39uy; 0x8duy; 0xc8uy; 0x03uy; 0x27uy; 0xa1uy;
0xc8uy; 0xe7uy; 0xf7uy; 0x8cuy; 0x59uy; 0x6auy; 0x49uy; 0x34uy;
0x4fuy; 0x01uy; 0x2euy; 0xdauy; 0x2duy; 0x4euy; 0xfauy; 0xd8uy;
0xa0uy; 0x50uy; 0xccuy; 0x4cuy; 0x19uy; 0xafuy; 0xa9uy; 0x7cuy;
0x59uy; 0x04uy; 0x5auy; 0x99uy; 0xcauy; 0xc7uy; 0x82uy; 0x72uy;
0x71uy; 0xcbuy; 0x41uy; 0xc6uy; 0x5euy; 0x59uy; 0x0euy; 0x09uy;
0xdauy; 0x32uy; 0x75uy; 0x60uy; 0x0cuy; 0x2fuy; 0x09uy; 0xb8uy;
0x36uy; 0x77uy; 0x93uy; 0xa9uy; 0xacuy; 0xa3uy; 0xdbuy; 0x71uy;
0xccuy; 0x30uy; 0xc5uy; 0x81uy; 0x79uy; 0xecuy; 0x3euy; 0x87uy;
0xc1uy; 0x4cuy; 0x01uy; 0xd5uy; 0xc1uy; 0xf3uy; 0x43uy; 0x4fuy;
0x1duy; 0x87uy
] in
assert_norm (List.Tot.length l == 82);
of_list l
/// Test 3
let test3_hash = Spec.Hash.Definitions.SHA2_256 | false | false | Spec.HKDF.Test.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 test3_ikm:lbytes 22 | [] | Spec.HKDF.Test.test3_ikm | {
"file_name": "specs/tests/Spec.HKDF.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 22 | {
"end_col": 11,
"end_line": 168,
"start_col": 27,
"start_line": 161
} |
FStar.All.ALL | [
{
"abbrev": true,
"full_module": "Spec.Agile.HKDF",
"short_module": "HKDF"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HMAC",
"short_module": "HMAC"
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"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": "Spec.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.HKDF",
"short_module": null
},
{
"abbrev": 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 test () =
let res = List.for_all test_one test_vectors in
if res then begin IO.print_string "\n\nHKDF: Success!\n"; true end
else begin IO.print_string "\n\nHKDF: Failure :(\n"; false end | let test () = | true | null | false | let res = List.for_all test_one test_vectors in
if res
then
(IO.print_string "\n\nHKDF: Success!\n";
true)
else
(IO.print_string "\n\nHKDF: Failure :(\n";
false) | {
"checked_file": "Spec.HKDF.Test.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"Spec.Agile.HKDF.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.HKDF.Test.fst"
} | [] | [
"Prims.unit",
"Prims.bool",
"FStar.IO.print_string",
"FStar.List.for_all",
"Spec.HKDF.Test.vec",
"Spec.HKDF.Test.test_one",
"Spec.HKDF.Test.test_vectors"
] | [] | module Spec.HKDF.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
module HMAC = Spec.Agile.HMAC
module HKDF = Spec.Agile.HKDF
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_hash = Spec.Hash.Definitions.SHA2_256
let test1_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test1_salt : lbytes 13 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy
] in
assert_norm (List.Tot.length l == 13);
of_list l
let test1_info : lbytes 10 =
let l = List.Tot.map u8_from_UInt8 [
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy
] in
assert_norm (List.Tot.length l == 10);
of_list l
let test1_len = 42
let test1_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x07uy; 0x77uy; 0x09uy; 0x36uy; 0x2cuy; 0x2euy; 0x32uy; 0xdfuy;
0x0duy; 0xdcuy; 0x3fuy; 0x0duy; 0xc4uy; 0x7buy; 0xbauy; 0x63uy;
0x90uy; 0xb6uy; 0xc7uy; 0x3buy; 0xb5uy; 0x0fuy; 0x9cuy; 0x31uy;
0x22uy; 0xecuy; 0x84uy; 0x4auy; 0xd7uy; 0xc2uy; 0xb3uy; 0xe5uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test1_expected_okm : lbytes 42 =
let l = List.Tot.map u8_from_UInt8 [
0x3cuy; 0xb2uy; 0x5fuy; 0x25uy; 0xfauy; 0xacuy; 0xd5uy; 0x7auy;
0x90uy; 0x43uy; 0x4fuy; 0x64uy; 0xd0uy; 0x36uy; 0x2fuy; 0x2auy;
0x2duy; 0x2duy; 0x0auy; 0x90uy; 0xcfuy; 0x1auy; 0x5auy; 0x4cuy;
0x5duy; 0xb0uy; 0x2duy; 0x56uy; 0xecuy; 0xc4uy; 0xc5uy; 0xbfuy;
0x34uy; 0x00uy; 0x72uy; 0x08uy; 0xd5uy; 0xb8uy; 0x87uy; 0x18uy;
0x58uy; 0x65uy
] in
assert_norm (List.Tot.length l == 42);
of_list l
/// Test 2
let test2_hash = Spec.Hash.Definitions.SHA2_256
let test2_ikm : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy; 0x0duy; 0x0euy; 0x0fuy;
0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy;
0x18uy; 0x19uy; 0x1auy; 0x1buy; 0x1cuy; 0x1duy; 0x1euy; 0x1fuy;
0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x24uy; 0x25uy; 0x26uy; 0x27uy;
0x28uy; 0x29uy; 0x2auy; 0x2buy; 0x2cuy; 0x2duy; 0x2euy; 0x2fuy;
0x30uy; 0x31uy; 0x32uy; 0x33uy; 0x34uy; 0x35uy; 0x36uy; 0x37uy;
0x38uy; 0x39uy; 0x3auy; 0x3buy; 0x3cuy; 0x3duy; 0x3euy; 0x3fuy;
0x40uy; 0x41uy; 0x42uy; 0x43uy; 0x44uy; 0x45uy; 0x46uy; 0x47uy;
0x48uy; 0x49uy; 0x4auy; 0x4buy; 0x4cuy; 0x4duy; 0x4euy; 0x4fuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_salt : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x60uy; 0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy;
0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy; 0x75uy; 0x76uy; 0x77uy;
0x78uy; 0x79uy; 0x7auy; 0x7buy; 0x7cuy; 0x7duy; 0x7euy; 0x7fuy;
0x80uy; 0x81uy; 0x82uy; 0x83uy; 0x84uy; 0x85uy; 0x86uy; 0x87uy;
0x88uy; 0x89uy; 0x8auy; 0x8buy; 0x8cuy; 0x8duy; 0x8euy; 0x8fuy;
0x90uy; 0x91uy; 0x92uy; 0x93uy; 0x94uy; 0x95uy; 0x96uy; 0x97uy;
0x98uy; 0x99uy; 0x9auy; 0x9buy; 0x9cuy; 0x9duy; 0x9euy; 0x9fuy;
0xa0uy; 0xa1uy; 0xa2uy; 0xa3uy; 0xa4uy; 0xa5uy; 0xa6uy; 0xa7uy;
0xa8uy; 0xa9uy; 0xaauy; 0xabuy; 0xacuy; 0xaduy; 0xaeuy; 0xafuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_info : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0xb0uy; 0xb1uy; 0xb2uy; 0xb3uy; 0xb4uy; 0xb5uy; 0xb6uy; 0xb7uy;
0xb8uy; 0xb9uy; 0xbauy; 0xbbuy; 0xbcuy; 0xbduy; 0xbeuy; 0xbfuy;
0xc0uy; 0xc1uy; 0xc2uy; 0xc3uy; 0xc4uy; 0xc5uy; 0xc6uy; 0xc7uy;
0xc8uy; 0xc9uy; 0xcauy; 0xcbuy; 0xccuy; 0xcduy; 0xceuy; 0xcfuy;
0xd0uy; 0xd1uy; 0xd2uy; 0xd3uy; 0xd4uy; 0xd5uy; 0xd6uy; 0xd7uy;
0xd8uy; 0xd9uy; 0xdauy; 0xdbuy; 0xdcuy; 0xdduy; 0xdeuy; 0xdfuy;
0xe0uy; 0xe1uy; 0xe2uy; 0xe3uy; 0xe4uy; 0xe5uy; 0xe6uy; 0xe7uy;
0xe8uy; 0xe9uy; 0xeauy; 0xebuy; 0xecuy; 0xeduy; 0xeeuy; 0xefuy;
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy; 0xfauy; 0xfbuy; 0xfcuy; 0xfduy; 0xfeuy; 0xffuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_len = 82
let test2_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x06uy; 0xa6uy; 0xb8uy; 0x8cuy; 0x58uy; 0x53uy; 0x36uy; 0x1auy;
0x06uy; 0x10uy; 0x4cuy; 0x9cuy; 0xebuy; 0x35uy; 0xb4uy; 0x5cuy;
0xefuy; 0x76uy; 0x00uy; 0x14uy; 0x90uy; 0x46uy; 0x71uy; 0x01uy;
0x4auy; 0x19uy; 0x3fuy; 0x40uy; 0xc1uy; 0x5fuy; 0xc2uy; 0x44uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test2_expected_okm : lbytes 82 =
let l = List.Tot.map u8_from_UInt8 [
0xb1uy; 0x1euy; 0x39uy; 0x8duy; 0xc8uy; 0x03uy; 0x27uy; 0xa1uy;
0xc8uy; 0xe7uy; 0xf7uy; 0x8cuy; 0x59uy; 0x6auy; 0x49uy; 0x34uy;
0x4fuy; 0x01uy; 0x2euy; 0xdauy; 0x2duy; 0x4euy; 0xfauy; 0xd8uy;
0xa0uy; 0x50uy; 0xccuy; 0x4cuy; 0x19uy; 0xafuy; 0xa9uy; 0x7cuy;
0x59uy; 0x04uy; 0x5auy; 0x99uy; 0xcauy; 0xc7uy; 0x82uy; 0x72uy;
0x71uy; 0xcbuy; 0x41uy; 0xc6uy; 0x5euy; 0x59uy; 0x0euy; 0x09uy;
0xdauy; 0x32uy; 0x75uy; 0x60uy; 0x0cuy; 0x2fuy; 0x09uy; 0xb8uy;
0x36uy; 0x77uy; 0x93uy; 0xa9uy; 0xacuy; 0xa3uy; 0xdbuy; 0x71uy;
0xccuy; 0x30uy; 0xc5uy; 0x81uy; 0x79uy; 0xecuy; 0x3euy; 0x87uy;
0xc1uy; 0x4cuy; 0x01uy; 0xd5uy; 0xc1uy; 0xf3uy; 0x43uy; 0x4fuy;
0x1duy; 0x87uy
] in
assert_norm (List.Tot.length l == 82);
of_list l
/// Test 3
let test3_hash = Spec.Hash.Definitions.SHA2_256
let test3_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test3_salt : lbytes 0 =
let l = List.Tot.map u8_from_UInt8 [] in
assert_norm (List.Tot.length l == 0);
of_list l
let test3_info : lbytes 0 =
let l = List.Tot.map u8_from_UInt8 [] in
assert_norm (List.Tot.length l == 0);
of_list l
let test3_len = 42
let test3_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x19uy; 0xefuy; 0x24uy; 0xa3uy; 0x2cuy; 0x71uy; 0x7buy; 0x16uy;
0x7fuy; 0x33uy; 0xa9uy; 0x1duy; 0x6fuy; 0x64uy; 0x8buy; 0xdfuy;
0x96uy; 0x59uy; 0x67uy; 0x76uy; 0xafuy; 0xdbuy; 0x63uy; 0x77uy;
0xacuy; 0x43uy; 0x4cuy; 0x1cuy; 0x29uy; 0x3cuy; 0xcbuy; 0x04uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test3_expected_okm : lbytes 42 =
let l = List.Tot.map u8_from_UInt8 [
0x8duy; 0xa4uy; 0xe7uy; 0x75uy; 0xa5uy; 0x63uy; 0xc1uy; 0x8fuy;
0x71uy; 0x5fuy; 0x80uy; 0x2auy; 0x06uy; 0x3cuy; 0x5auy; 0x31uy;
0xb8uy; 0xa1uy; 0x1fuy; 0x5cuy; 0x5euy; 0xe1uy; 0x87uy; 0x9euy;
0xc3uy; 0x45uy; 0x4euy; 0x5fuy; 0x3cuy; 0x73uy; 0x8duy; 0x2duy;
0x9duy; 0x20uy; 0x13uy; 0x95uy; 0xfauy; 0xa4uy; 0xb6uy; 0x1auy;
0x96uy; 0xc8uy
] in
assert_norm (List.Tot.length l == 42);
of_list l
noeq type vec =
| Vec :
a:Spec.Hash.Definitions.fixed_len_alg
-> salt:bytes{HMAC.keysized a (length salt)}
-> ikm:bytes{HKDF.extract_ikm_length_pred a (length ikm)}
-> expected_prk:lbytes (Spec.Hash.Definitions.hash_length a)
-> info:bytes{HKDF.expand_info_length_pred a (length info)}
-> out_len:nat{HKDF.expand_output_length_pred a out_len}
-> expected_okm:lbytes out_len -> vec
let _: squash (pow2 32 < pow2 61 /\ pow2 32 < pow2 125) =
Math.Lemmas.pow2_lt_compat 61 32;
Math.Lemmas.pow2_lt_compat 125 32
let test_vectors: list vec = [
Vec test1_hash test1_salt test1_ikm
test1_expected_prk test1_info test1_len test1_expected_okm;
Vec test2_hash test2_salt test2_ikm
test2_expected_prk test2_info test2_len test2_expected_okm;
Vec test3_hash test3_salt test3_ikm
test3_expected_prk test3_info test3_len test3_expected_okm ]
#set-options "--ifuel 2"
let test_one (v:vec) =
let Vec a salt ikm expected_prk info out_len expected_okm = v in
let test_prk = HKDF.extract a salt ikm in
let test_okm = HKDF.expand a expected_prk info out_len in
IO.print_string "\nPRK:";
let r_a = PS.print_compare true (length expected_prk) expected_prk test_prk in
IO.print_string "\nOKM:";
let r_b = PS.print_compare true (length expected_okm) expected_okm test_okm in
let res = r_a && r_b in
if r_a then IO.print_string "\nHKDF Extract: Success!\n"
else IO.print_string "\nHKDF Extract: Failure :(\n";
if r_b then IO.print_string "HKDF Expand: Success!\n"
else IO.print_string "HKDF Expand: Failure :(\n";
res | false | false | Spec.HKDF.Test.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 2,
"max_fuel": 0,
"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": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val test : _: Prims.unit -> FStar.All.ALL Prims.bool | [] | Spec.HKDF.Test.test | {
"file_name": "specs/tests/Spec.HKDF.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: Prims.unit -> FStar.All.ALL Prims.bool | {
"end_col": 64,
"end_line": 256,
"start_col": 13,
"start_line": 253
} |
|
Prims.Tot | val test1_info:lbytes 10 | [
{
"abbrev": true,
"full_module": "Spec.Agile.HKDF",
"short_module": "HKDF"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HMAC",
"short_module": "HMAC"
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"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": "Spec.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.HKDF",
"short_module": null
},
{
"abbrev": 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 test1_info : lbytes 10 =
let l = List.Tot.map u8_from_UInt8 [
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy
] in
assert_norm (List.Tot.length l == 10);
of_list l | val test1_info:lbytes 10
let test1_info:lbytes 10 = | false | null | false | let l =
List.Tot.map u8_from_UInt8
[0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy; 0xf8uy; 0xf9uy]
in
assert_norm (List.Tot.length l == 10);
of_list l | {
"checked_file": "Spec.HKDF.Test.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"Spec.Agile.HKDF.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.HKDF.Test.fst"
} | [
"total"
] | [
"Lib.Sequence.of_list",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Prims.list",
"FStar.List.Tot.Base.map",
"FStar.UInt8.t",
"Lib.RawIntTypes.u8_from_UInt8",
"Prims.Cons",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | module Spec.HKDF.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
module HMAC = Spec.Agile.HMAC
module HKDF = Spec.Agile.HKDF
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_hash = Spec.Hash.Definitions.SHA2_256
let test1_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test1_salt : lbytes 13 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy
] in
assert_norm (List.Tot.length l == 13);
of_list l | false | false | Spec.HKDF.Test.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 test1_info:lbytes 10 | [] | Spec.HKDF.Test.test1_info | {
"file_name": "specs/tests/Spec.HKDF.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 10 | {
"end_col": 11,
"end_line": 44,
"start_col": 28,
"start_line": 38
} |
Prims.Tot | val test2_expected_prk:lbytes 32 | [
{
"abbrev": true,
"full_module": "Spec.Agile.HKDF",
"short_module": "HKDF"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HMAC",
"short_module": "HMAC"
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"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": "Spec.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.HKDF",
"short_module": null
},
{
"abbrev": 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 test2_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x06uy; 0xa6uy; 0xb8uy; 0x8cuy; 0x58uy; 0x53uy; 0x36uy; 0x1auy;
0x06uy; 0x10uy; 0x4cuy; 0x9cuy; 0xebuy; 0x35uy; 0xb4uy; 0x5cuy;
0xefuy; 0x76uy; 0x00uy; 0x14uy; 0x90uy; 0x46uy; 0x71uy; 0x01uy;
0x4auy; 0x19uy; 0x3fuy; 0x40uy; 0xc1uy; 0x5fuy; 0xc2uy; 0x44uy
] in
assert_norm (List.Tot.length l == 32);
of_list l | val test2_expected_prk:lbytes 32
let test2_expected_prk:lbytes 32 = | false | null | false | let l =
List.Tot.map u8_from_UInt8
[
0x06uy; 0xa6uy; 0xb8uy; 0x8cuy; 0x58uy; 0x53uy; 0x36uy; 0x1auy; 0x06uy; 0x10uy; 0x4cuy; 0x9cuy;
0xebuy; 0x35uy; 0xb4uy; 0x5cuy; 0xefuy; 0x76uy; 0x00uy; 0x14uy; 0x90uy; 0x46uy; 0x71uy; 0x01uy;
0x4auy; 0x19uy; 0x3fuy; 0x40uy; 0xc1uy; 0x5fuy; 0xc2uy; 0x44uy
]
in
assert_norm (List.Tot.length l == 32);
of_list l | {
"checked_file": "Spec.HKDF.Test.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"Spec.Agile.HKDF.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.HKDF.Test.fst"
} | [
"total"
] | [
"Lib.Sequence.of_list",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Prims.list",
"FStar.List.Tot.Base.map",
"FStar.UInt8.t",
"Lib.RawIntTypes.u8_from_UInt8",
"Prims.Cons",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | module Spec.HKDF.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
module HMAC = Spec.Agile.HMAC
module HKDF = Spec.Agile.HKDF
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_hash = Spec.Hash.Definitions.SHA2_256
let test1_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test1_salt : lbytes 13 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy
] in
assert_norm (List.Tot.length l == 13);
of_list l
let test1_info : lbytes 10 =
let l = List.Tot.map u8_from_UInt8 [
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy
] in
assert_norm (List.Tot.length l == 10);
of_list l
let test1_len = 42
let test1_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x07uy; 0x77uy; 0x09uy; 0x36uy; 0x2cuy; 0x2euy; 0x32uy; 0xdfuy;
0x0duy; 0xdcuy; 0x3fuy; 0x0duy; 0xc4uy; 0x7buy; 0xbauy; 0x63uy;
0x90uy; 0xb6uy; 0xc7uy; 0x3buy; 0xb5uy; 0x0fuy; 0x9cuy; 0x31uy;
0x22uy; 0xecuy; 0x84uy; 0x4auy; 0xd7uy; 0xc2uy; 0xb3uy; 0xe5uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test1_expected_okm : lbytes 42 =
let l = List.Tot.map u8_from_UInt8 [
0x3cuy; 0xb2uy; 0x5fuy; 0x25uy; 0xfauy; 0xacuy; 0xd5uy; 0x7auy;
0x90uy; 0x43uy; 0x4fuy; 0x64uy; 0xd0uy; 0x36uy; 0x2fuy; 0x2auy;
0x2duy; 0x2duy; 0x0auy; 0x90uy; 0xcfuy; 0x1auy; 0x5auy; 0x4cuy;
0x5duy; 0xb0uy; 0x2duy; 0x56uy; 0xecuy; 0xc4uy; 0xc5uy; 0xbfuy;
0x34uy; 0x00uy; 0x72uy; 0x08uy; 0xd5uy; 0xb8uy; 0x87uy; 0x18uy;
0x58uy; 0x65uy
] in
assert_norm (List.Tot.length l == 42);
of_list l
/// Test 2
let test2_hash = Spec.Hash.Definitions.SHA2_256
let test2_ikm : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy; 0x0duy; 0x0euy; 0x0fuy;
0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy;
0x18uy; 0x19uy; 0x1auy; 0x1buy; 0x1cuy; 0x1duy; 0x1euy; 0x1fuy;
0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x24uy; 0x25uy; 0x26uy; 0x27uy;
0x28uy; 0x29uy; 0x2auy; 0x2buy; 0x2cuy; 0x2duy; 0x2euy; 0x2fuy;
0x30uy; 0x31uy; 0x32uy; 0x33uy; 0x34uy; 0x35uy; 0x36uy; 0x37uy;
0x38uy; 0x39uy; 0x3auy; 0x3buy; 0x3cuy; 0x3duy; 0x3euy; 0x3fuy;
0x40uy; 0x41uy; 0x42uy; 0x43uy; 0x44uy; 0x45uy; 0x46uy; 0x47uy;
0x48uy; 0x49uy; 0x4auy; 0x4buy; 0x4cuy; 0x4duy; 0x4euy; 0x4fuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_salt : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x60uy; 0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy;
0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy; 0x75uy; 0x76uy; 0x77uy;
0x78uy; 0x79uy; 0x7auy; 0x7buy; 0x7cuy; 0x7duy; 0x7euy; 0x7fuy;
0x80uy; 0x81uy; 0x82uy; 0x83uy; 0x84uy; 0x85uy; 0x86uy; 0x87uy;
0x88uy; 0x89uy; 0x8auy; 0x8buy; 0x8cuy; 0x8duy; 0x8euy; 0x8fuy;
0x90uy; 0x91uy; 0x92uy; 0x93uy; 0x94uy; 0x95uy; 0x96uy; 0x97uy;
0x98uy; 0x99uy; 0x9auy; 0x9buy; 0x9cuy; 0x9duy; 0x9euy; 0x9fuy;
0xa0uy; 0xa1uy; 0xa2uy; 0xa3uy; 0xa4uy; 0xa5uy; 0xa6uy; 0xa7uy;
0xa8uy; 0xa9uy; 0xaauy; 0xabuy; 0xacuy; 0xaduy; 0xaeuy; 0xafuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_info : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0xb0uy; 0xb1uy; 0xb2uy; 0xb3uy; 0xb4uy; 0xb5uy; 0xb6uy; 0xb7uy;
0xb8uy; 0xb9uy; 0xbauy; 0xbbuy; 0xbcuy; 0xbduy; 0xbeuy; 0xbfuy;
0xc0uy; 0xc1uy; 0xc2uy; 0xc3uy; 0xc4uy; 0xc5uy; 0xc6uy; 0xc7uy;
0xc8uy; 0xc9uy; 0xcauy; 0xcbuy; 0xccuy; 0xcduy; 0xceuy; 0xcfuy;
0xd0uy; 0xd1uy; 0xd2uy; 0xd3uy; 0xd4uy; 0xd5uy; 0xd6uy; 0xd7uy;
0xd8uy; 0xd9uy; 0xdauy; 0xdbuy; 0xdcuy; 0xdduy; 0xdeuy; 0xdfuy;
0xe0uy; 0xe1uy; 0xe2uy; 0xe3uy; 0xe4uy; 0xe5uy; 0xe6uy; 0xe7uy;
0xe8uy; 0xe9uy; 0xeauy; 0xebuy; 0xecuy; 0xeduy; 0xeeuy; 0xefuy;
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy; 0xfauy; 0xfbuy; 0xfcuy; 0xfduy; 0xfeuy; 0xffuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_len = 82 | false | false | Spec.HKDF.Test.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 test2_expected_prk:lbytes 32 | [] | Spec.HKDF.Test.test2_expected_prk | {
"file_name": "specs/tests/Spec.HKDF.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 32 | {
"end_col": 11,
"end_line": 136,
"start_col": 36,
"start_line": 128
} |
Prims.Tot | val test1_expected_prk:lbytes 32 | [
{
"abbrev": true,
"full_module": "Spec.Agile.HKDF",
"short_module": "HKDF"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HMAC",
"short_module": "HMAC"
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"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": "Spec.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.HKDF",
"short_module": null
},
{
"abbrev": 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 test1_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x07uy; 0x77uy; 0x09uy; 0x36uy; 0x2cuy; 0x2euy; 0x32uy; 0xdfuy;
0x0duy; 0xdcuy; 0x3fuy; 0x0duy; 0xc4uy; 0x7buy; 0xbauy; 0x63uy;
0x90uy; 0xb6uy; 0xc7uy; 0x3buy; 0xb5uy; 0x0fuy; 0x9cuy; 0x31uy;
0x22uy; 0xecuy; 0x84uy; 0x4auy; 0xd7uy; 0xc2uy; 0xb3uy; 0xe5uy
] in
assert_norm (List.Tot.length l == 32);
of_list l | val test1_expected_prk:lbytes 32
let test1_expected_prk:lbytes 32 = | false | null | false | let l =
List.Tot.map u8_from_UInt8
[
0x07uy; 0x77uy; 0x09uy; 0x36uy; 0x2cuy; 0x2euy; 0x32uy; 0xdfuy; 0x0duy; 0xdcuy; 0x3fuy; 0x0duy;
0xc4uy; 0x7buy; 0xbauy; 0x63uy; 0x90uy; 0xb6uy; 0xc7uy; 0x3buy; 0xb5uy; 0x0fuy; 0x9cuy; 0x31uy;
0x22uy; 0xecuy; 0x84uy; 0x4auy; 0xd7uy; 0xc2uy; 0xb3uy; 0xe5uy
]
in
assert_norm (List.Tot.length l == 32);
of_list l | {
"checked_file": "Spec.HKDF.Test.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"Spec.Agile.HKDF.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.HKDF.Test.fst"
} | [
"total"
] | [
"Lib.Sequence.of_list",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Prims.list",
"FStar.List.Tot.Base.map",
"FStar.UInt8.t",
"Lib.RawIntTypes.u8_from_UInt8",
"Prims.Cons",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | module Spec.HKDF.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
module HMAC = Spec.Agile.HMAC
module HKDF = Spec.Agile.HKDF
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_hash = Spec.Hash.Definitions.SHA2_256
let test1_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test1_salt : lbytes 13 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy
] in
assert_norm (List.Tot.length l == 13);
of_list l
let test1_info : lbytes 10 =
let l = List.Tot.map u8_from_UInt8 [
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy
] in
assert_norm (List.Tot.length l == 10);
of_list l
let test1_len = 42 | false | false | Spec.HKDF.Test.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 test1_expected_prk:lbytes 32 | [] | Spec.HKDF.Test.test1_expected_prk | {
"file_name": "specs/tests/Spec.HKDF.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 32 | {
"end_col": 11,
"end_line": 56,
"start_col": 36,
"start_line": 48
} |
Prims.Tot | val test1_expected_okm:lbytes 42 | [
{
"abbrev": true,
"full_module": "Spec.Agile.HKDF",
"short_module": "HKDF"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HMAC",
"short_module": "HMAC"
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"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": "Spec.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.HKDF",
"short_module": null
},
{
"abbrev": 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 test1_expected_okm : lbytes 42 =
let l = List.Tot.map u8_from_UInt8 [
0x3cuy; 0xb2uy; 0x5fuy; 0x25uy; 0xfauy; 0xacuy; 0xd5uy; 0x7auy;
0x90uy; 0x43uy; 0x4fuy; 0x64uy; 0xd0uy; 0x36uy; 0x2fuy; 0x2auy;
0x2duy; 0x2duy; 0x0auy; 0x90uy; 0xcfuy; 0x1auy; 0x5auy; 0x4cuy;
0x5duy; 0xb0uy; 0x2duy; 0x56uy; 0xecuy; 0xc4uy; 0xc5uy; 0xbfuy;
0x34uy; 0x00uy; 0x72uy; 0x08uy; 0xd5uy; 0xb8uy; 0x87uy; 0x18uy;
0x58uy; 0x65uy
] in
assert_norm (List.Tot.length l == 42);
of_list l | val test1_expected_okm:lbytes 42
let test1_expected_okm:lbytes 42 = | false | null | false | let l =
List.Tot.map u8_from_UInt8
[
0x3cuy; 0xb2uy; 0x5fuy; 0x25uy; 0xfauy; 0xacuy; 0xd5uy; 0x7auy; 0x90uy; 0x43uy; 0x4fuy; 0x64uy;
0xd0uy; 0x36uy; 0x2fuy; 0x2auy; 0x2duy; 0x2duy; 0x0auy; 0x90uy; 0xcfuy; 0x1auy; 0x5auy; 0x4cuy;
0x5duy; 0xb0uy; 0x2duy; 0x56uy; 0xecuy; 0xc4uy; 0xc5uy; 0xbfuy; 0x34uy; 0x00uy; 0x72uy; 0x08uy;
0xd5uy; 0xb8uy; 0x87uy; 0x18uy; 0x58uy; 0x65uy
]
in
assert_norm (List.Tot.length l == 42);
of_list l | {
"checked_file": "Spec.HKDF.Test.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"Spec.Agile.HKDF.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.HKDF.Test.fst"
} | [
"total"
] | [
"Lib.Sequence.of_list",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Prims.list",
"FStar.List.Tot.Base.map",
"FStar.UInt8.t",
"Lib.RawIntTypes.u8_from_UInt8",
"Prims.Cons",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | module Spec.HKDF.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
module HMAC = Spec.Agile.HMAC
module HKDF = Spec.Agile.HKDF
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_hash = Spec.Hash.Definitions.SHA2_256
let test1_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test1_salt : lbytes 13 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy
] in
assert_norm (List.Tot.length l == 13);
of_list l
let test1_info : lbytes 10 =
let l = List.Tot.map u8_from_UInt8 [
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy
] in
assert_norm (List.Tot.length l == 10);
of_list l
let test1_len = 42
let test1_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x07uy; 0x77uy; 0x09uy; 0x36uy; 0x2cuy; 0x2euy; 0x32uy; 0xdfuy;
0x0duy; 0xdcuy; 0x3fuy; 0x0duy; 0xc4uy; 0x7buy; 0xbauy; 0x63uy;
0x90uy; 0xb6uy; 0xc7uy; 0x3buy; 0xb5uy; 0x0fuy; 0x9cuy; 0x31uy;
0x22uy; 0xecuy; 0x84uy; 0x4auy; 0xd7uy; 0xc2uy; 0xb3uy; 0xe5uy
] in
assert_norm (List.Tot.length l == 32);
of_list l | false | false | Spec.HKDF.Test.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 test1_expected_okm:lbytes 42 | [] | Spec.HKDF.Test.test1_expected_okm | {
"file_name": "specs/tests/Spec.HKDF.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 42 | {
"end_col": 11,
"end_line": 69,
"start_col": 36,
"start_line": 59
} |
Prims.Tot | val test3_expected_prk:lbytes 32 | [
{
"abbrev": true,
"full_module": "Spec.Agile.HKDF",
"short_module": "HKDF"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HMAC",
"short_module": "HMAC"
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"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": "Spec.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.HKDF",
"short_module": null
},
{
"abbrev": 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 test3_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x19uy; 0xefuy; 0x24uy; 0xa3uy; 0x2cuy; 0x71uy; 0x7buy; 0x16uy;
0x7fuy; 0x33uy; 0xa9uy; 0x1duy; 0x6fuy; 0x64uy; 0x8buy; 0xdfuy;
0x96uy; 0x59uy; 0x67uy; 0x76uy; 0xafuy; 0xdbuy; 0x63uy; 0x77uy;
0xacuy; 0x43uy; 0x4cuy; 0x1cuy; 0x29uy; 0x3cuy; 0xcbuy; 0x04uy
] in
assert_norm (List.Tot.length l == 32);
of_list l | val test3_expected_prk:lbytes 32
let test3_expected_prk:lbytes 32 = | false | null | false | let l =
List.Tot.map u8_from_UInt8
[
0x19uy; 0xefuy; 0x24uy; 0xa3uy; 0x2cuy; 0x71uy; 0x7buy; 0x16uy; 0x7fuy; 0x33uy; 0xa9uy; 0x1duy;
0x6fuy; 0x64uy; 0x8buy; 0xdfuy; 0x96uy; 0x59uy; 0x67uy; 0x76uy; 0xafuy; 0xdbuy; 0x63uy; 0x77uy;
0xacuy; 0x43uy; 0x4cuy; 0x1cuy; 0x29uy; 0x3cuy; 0xcbuy; 0x04uy
]
in
assert_norm (List.Tot.length l == 32);
of_list l | {
"checked_file": "Spec.HKDF.Test.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"Spec.Agile.HKDF.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.HKDF.Test.fst"
} | [
"total"
] | [
"Lib.Sequence.of_list",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Prims.list",
"FStar.List.Tot.Base.map",
"FStar.UInt8.t",
"Lib.RawIntTypes.u8_from_UInt8",
"Prims.Cons",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | module Spec.HKDF.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
module HMAC = Spec.Agile.HMAC
module HKDF = Spec.Agile.HKDF
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_hash = Spec.Hash.Definitions.SHA2_256
let test1_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test1_salt : lbytes 13 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy
] in
assert_norm (List.Tot.length l == 13);
of_list l
let test1_info : lbytes 10 =
let l = List.Tot.map u8_from_UInt8 [
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy
] in
assert_norm (List.Tot.length l == 10);
of_list l
let test1_len = 42
let test1_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x07uy; 0x77uy; 0x09uy; 0x36uy; 0x2cuy; 0x2euy; 0x32uy; 0xdfuy;
0x0duy; 0xdcuy; 0x3fuy; 0x0duy; 0xc4uy; 0x7buy; 0xbauy; 0x63uy;
0x90uy; 0xb6uy; 0xc7uy; 0x3buy; 0xb5uy; 0x0fuy; 0x9cuy; 0x31uy;
0x22uy; 0xecuy; 0x84uy; 0x4auy; 0xd7uy; 0xc2uy; 0xb3uy; 0xe5uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test1_expected_okm : lbytes 42 =
let l = List.Tot.map u8_from_UInt8 [
0x3cuy; 0xb2uy; 0x5fuy; 0x25uy; 0xfauy; 0xacuy; 0xd5uy; 0x7auy;
0x90uy; 0x43uy; 0x4fuy; 0x64uy; 0xd0uy; 0x36uy; 0x2fuy; 0x2auy;
0x2duy; 0x2duy; 0x0auy; 0x90uy; 0xcfuy; 0x1auy; 0x5auy; 0x4cuy;
0x5duy; 0xb0uy; 0x2duy; 0x56uy; 0xecuy; 0xc4uy; 0xc5uy; 0xbfuy;
0x34uy; 0x00uy; 0x72uy; 0x08uy; 0xd5uy; 0xb8uy; 0x87uy; 0x18uy;
0x58uy; 0x65uy
] in
assert_norm (List.Tot.length l == 42);
of_list l
/// Test 2
let test2_hash = Spec.Hash.Definitions.SHA2_256
let test2_ikm : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy; 0x0duy; 0x0euy; 0x0fuy;
0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy;
0x18uy; 0x19uy; 0x1auy; 0x1buy; 0x1cuy; 0x1duy; 0x1euy; 0x1fuy;
0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x24uy; 0x25uy; 0x26uy; 0x27uy;
0x28uy; 0x29uy; 0x2auy; 0x2buy; 0x2cuy; 0x2duy; 0x2euy; 0x2fuy;
0x30uy; 0x31uy; 0x32uy; 0x33uy; 0x34uy; 0x35uy; 0x36uy; 0x37uy;
0x38uy; 0x39uy; 0x3auy; 0x3buy; 0x3cuy; 0x3duy; 0x3euy; 0x3fuy;
0x40uy; 0x41uy; 0x42uy; 0x43uy; 0x44uy; 0x45uy; 0x46uy; 0x47uy;
0x48uy; 0x49uy; 0x4auy; 0x4buy; 0x4cuy; 0x4duy; 0x4euy; 0x4fuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_salt : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x60uy; 0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy;
0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy; 0x75uy; 0x76uy; 0x77uy;
0x78uy; 0x79uy; 0x7auy; 0x7buy; 0x7cuy; 0x7duy; 0x7euy; 0x7fuy;
0x80uy; 0x81uy; 0x82uy; 0x83uy; 0x84uy; 0x85uy; 0x86uy; 0x87uy;
0x88uy; 0x89uy; 0x8auy; 0x8buy; 0x8cuy; 0x8duy; 0x8euy; 0x8fuy;
0x90uy; 0x91uy; 0x92uy; 0x93uy; 0x94uy; 0x95uy; 0x96uy; 0x97uy;
0x98uy; 0x99uy; 0x9auy; 0x9buy; 0x9cuy; 0x9duy; 0x9euy; 0x9fuy;
0xa0uy; 0xa1uy; 0xa2uy; 0xa3uy; 0xa4uy; 0xa5uy; 0xa6uy; 0xa7uy;
0xa8uy; 0xa9uy; 0xaauy; 0xabuy; 0xacuy; 0xaduy; 0xaeuy; 0xafuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_info : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0xb0uy; 0xb1uy; 0xb2uy; 0xb3uy; 0xb4uy; 0xb5uy; 0xb6uy; 0xb7uy;
0xb8uy; 0xb9uy; 0xbauy; 0xbbuy; 0xbcuy; 0xbduy; 0xbeuy; 0xbfuy;
0xc0uy; 0xc1uy; 0xc2uy; 0xc3uy; 0xc4uy; 0xc5uy; 0xc6uy; 0xc7uy;
0xc8uy; 0xc9uy; 0xcauy; 0xcbuy; 0xccuy; 0xcduy; 0xceuy; 0xcfuy;
0xd0uy; 0xd1uy; 0xd2uy; 0xd3uy; 0xd4uy; 0xd5uy; 0xd6uy; 0xd7uy;
0xd8uy; 0xd9uy; 0xdauy; 0xdbuy; 0xdcuy; 0xdduy; 0xdeuy; 0xdfuy;
0xe0uy; 0xe1uy; 0xe2uy; 0xe3uy; 0xe4uy; 0xe5uy; 0xe6uy; 0xe7uy;
0xe8uy; 0xe9uy; 0xeauy; 0xebuy; 0xecuy; 0xeduy; 0xeeuy; 0xefuy;
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy; 0xfauy; 0xfbuy; 0xfcuy; 0xfduy; 0xfeuy; 0xffuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_len = 82
let test2_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x06uy; 0xa6uy; 0xb8uy; 0x8cuy; 0x58uy; 0x53uy; 0x36uy; 0x1auy;
0x06uy; 0x10uy; 0x4cuy; 0x9cuy; 0xebuy; 0x35uy; 0xb4uy; 0x5cuy;
0xefuy; 0x76uy; 0x00uy; 0x14uy; 0x90uy; 0x46uy; 0x71uy; 0x01uy;
0x4auy; 0x19uy; 0x3fuy; 0x40uy; 0xc1uy; 0x5fuy; 0xc2uy; 0x44uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test2_expected_okm : lbytes 82 =
let l = List.Tot.map u8_from_UInt8 [
0xb1uy; 0x1euy; 0x39uy; 0x8duy; 0xc8uy; 0x03uy; 0x27uy; 0xa1uy;
0xc8uy; 0xe7uy; 0xf7uy; 0x8cuy; 0x59uy; 0x6auy; 0x49uy; 0x34uy;
0x4fuy; 0x01uy; 0x2euy; 0xdauy; 0x2duy; 0x4euy; 0xfauy; 0xd8uy;
0xa0uy; 0x50uy; 0xccuy; 0x4cuy; 0x19uy; 0xafuy; 0xa9uy; 0x7cuy;
0x59uy; 0x04uy; 0x5auy; 0x99uy; 0xcauy; 0xc7uy; 0x82uy; 0x72uy;
0x71uy; 0xcbuy; 0x41uy; 0xc6uy; 0x5euy; 0x59uy; 0x0euy; 0x09uy;
0xdauy; 0x32uy; 0x75uy; 0x60uy; 0x0cuy; 0x2fuy; 0x09uy; 0xb8uy;
0x36uy; 0x77uy; 0x93uy; 0xa9uy; 0xacuy; 0xa3uy; 0xdbuy; 0x71uy;
0xccuy; 0x30uy; 0xc5uy; 0x81uy; 0x79uy; 0xecuy; 0x3euy; 0x87uy;
0xc1uy; 0x4cuy; 0x01uy; 0xd5uy; 0xc1uy; 0xf3uy; 0x43uy; 0x4fuy;
0x1duy; 0x87uy
] in
assert_norm (List.Tot.length l == 82);
of_list l
/// Test 3
let test3_hash = Spec.Hash.Definitions.SHA2_256
let test3_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test3_salt : lbytes 0 =
let l = List.Tot.map u8_from_UInt8 [] in
assert_norm (List.Tot.length l == 0);
of_list l
let test3_info : lbytes 0 =
let l = List.Tot.map u8_from_UInt8 [] in
assert_norm (List.Tot.length l == 0);
of_list l
let test3_len = 42 | false | false | Spec.HKDF.Test.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 test3_expected_prk:lbytes 32 | [] | Spec.HKDF.Test.test3_expected_prk | {
"file_name": "specs/tests/Spec.HKDF.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 32 | {
"end_col": 11,
"end_line": 192,
"start_col": 36,
"start_line": 184
} |
Prims.Tot | val test3_expected_okm:lbytes 42 | [
{
"abbrev": true,
"full_module": "Spec.Agile.HKDF",
"short_module": "HKDF"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HMAC",
"short_module": "HMAC"
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"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": "Spec.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.HKDF",
"short_module": null
},
{
"abbrev": 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 test3_expected_okm : lbytes 42 =
let l = List.Tot.map u8_from_UInt8 [
0x8duy; 0xa4uy; 0xe7uy; 0x75uy; 0xa5uy; 0x63uy; 0xc1uy; 0x8fuy;
0x71uy; 0x5fuy; 0x80uy; 0x2auy; 0x06uy; 0x3cuy; 0x5auy; 0x31uy;
0xb8uy; 0xa1uy; 0x1fuy; 0x5cuy; 0x5euy; 0xe1uy; 0x87uy; 0x9euy;
0xc3uy; 0x45uy; 0x4euy; 0x5fuy; 0x3cuy; 0x73uy; 0x8duy; 0x2duy;
0x9duy; 0x20uy; 0x13uy; 0x95uy; 0xfauy; 0xa4uy; 0xb6uy; 0x1auy;
0x96uy; 0xc8uy
] in
assert_norm (List.Tot.length l == 42);
of_list l | val test3_expected_okm:lbytes 42
let test3_expected_okm:lbytes 42 = | false | null | false | let l =
List.Tot.map u8_from_UInt8
[
0x8duy; 0xa4uy; 0xe7uy; 0x75uy; 0xa5uy; 0x63uy; 0xc1uy; 0x8fuy; 0x71uy; 0x5fuy; 0x80uy; 0x2auy;
0x06uy; 0x3cuy; 0x5auy; 0x31uy; 0xb8uy; 0xa1uy; 0x1fuy; 0x5cuy; 0x5euy; 0xe1uy; 0x87uy; 0x9euy;
0xc3uy; 0x45uy; 0x4euy; 0x5fuy; 0x3cuy; 0x73uy; 0x8duy; 0x2duy; 0x9duy; 0x20uy; 0x13uy; 0x95uy;
0xfauy; 0xa4uy; 0xb6uy; 0x1auy; 0x96uy; 0xc8uy
]
in
assert_norm (List.Tot.length l == 42);
of_list l | {
"checked_file": "Spec.HKDF.Test.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"Spec.Agile.HKDF.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.HKDF.Test.fst"
} | [
"total"
] | [
"Lib.Sequence.of_list",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Prims.list",
"FStar.List.Tot.Base.map",
"FStar.UInt8.t",
"Lib.RawIntTypes.u8_from_UInt8",
"Prims.Cons",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | module Spec.HKDF.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
module HMAC = Spec.Agile.HMAC
module HKDF = Spec.Agile.HKDF
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_hash = Spec.Hash.Definitions.SHA2_256
let test1_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test1_salt : lbytes 13 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy
] in
assert_norm (List.Tot.length l == 13);
of_list l
let test1_info : lbytes 10 =
let l = List.Tot.map u8_from_UInt8 [
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy
] in
assert_norm (List.Tot.length l == 10);
of_list l
let test1_len = 42
let test1_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x07uy; 0x77uy; 0x09uy; 0x36uy; 0x2cuy; 0x2euy; 0x32uy; 0xdfuy;
0x0duy; 0xdcuy; 0x3fuy; 0x0duy; 0xc4uy; 0x7buy; 0xbauy; 0x63uy;
0x90uy; 0xb6uy; 0xc7uy; 0x3buy; 0xb5uy; 0x0fuy; 0x9cuy; 0x31uy;
0x22uy; 0xecuy; 0x84uy; 0x4auy; 0xd7uy; 0xc2uy; 0xb3uy; 0xe5uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test1_expected_okm : lbytes 42 =
let l = List.Tot.map u8_from_UInt8 [
0x3cuy; 0xb2uy; 0x5fuy; 0x25uy; 0xfauy; 0xacuy; 0xd5uy; 0x7auy;
0x90uy; 0x43uy; 0x4fuy; 0x64uy; 0xd0uy; 0x36uy; 0x2fuy; 0x2auy;
0x2duy; 0x2duy; 0x0auy; 0x90uy; 0xcfuy; 0x1auy; 0x5auy; 0x4cuy;
0x5duy; 0xb0uy; 0x2duy; 0x56uy; 0xecuy; 0xc4uy; 0xc5uy; 0xbfuy;
0x34uy; 0x00uy; 0x72uy; 0x08uy; 0xd5uy; 0xb8uy; 0x87uy; 0x18uy;
0x58uy; 0x65uy
] in
assert_norm (List.Tot.length l == 42);
of_list l
/// Test 2
let test2_hash = Spec.Hash.Definitions.SHA2_256
let test2_ikm : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy; 0x0duy; 0x0euy; 0x0fuy;
0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy;
0x18uy; 0x19uy; 0x1auy; 0x1buy; 0x1cuy; 0x1duy; 0x1euy; 0x1fuy;
0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x24uy; 0x25uy; 0x26uy; 0x27uy;
0x28uy; 0x29uy; 0x2auy; 0x2buy; 0x2cuy; 0x2duy; 0x2euy; 0x2fuy;
0x30uy; 0x31uy; 0x32uy; 0x33uy; 0x34uy; 0x35uy; 0x36uy; 0x37uy;
0x38uy; 0x39uy; 0x3auy; 0x3buy; 0x3cuy; 0x3duy; 0x3euy; 0x3fuy;
0x40uy; 0x41uy; 0x42uy; 0x43uy; 0x44uy; 0x45uy; 0x46uy; 0x47uy;
0x48uy; 0x49uy; 0x4auy; 0x4buy; 0x4cuy; 0x4duy; 0x4euy; 0x4fuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_salt : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x60uy; 0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy;
0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy; 0x75uy; 0x76uy; 0x77uy;
0x78uy; 0x79uy; 0x7auy; 0x7buy; 0x7cuy; 0x7duy; 0x7euy; 0x7fuy;
0x80uy; 0x81uy; 0x82uy; 0x83uy; 0x84uy; 0x85uy; 0x86uy; 0x87uy;
0x88uy; 0x89uy; 0x8auy; 0x8buy; 0x8cuy; 0x8duy; 0x8euy; 0x8fuy;
0x90uy; 0x91uy; 0x92uy; 0x93uy; 0x94uy; 0x95uy; 0x96uy; 0x97uy;
0x98uy; 0x99uy; 0x9auy; 0x9buy; 0x9cuy; 0x9duy; 0x9euy; 0x9fuy;
0xa0uy; 0xa1uy; 0xa2uy; 0xa3uy; 0xa4uy; 0xa5uy; 0xa6uy; 0xa7uy;
0xa8uy; 0xa9uy; 0xaauy; 0xabuy; 0xacuy; 0xaduy; 0xaeuy; 0xafuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_info : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0xb0uy; 0xb1uy; 0xb2uy; 0xb3uy; 0xb4uy; 0xb5uy; 0xb6uy; 0xb7uy;
0xb8uy; 0xb9uy; 0xbauy; 0xbbuy; 0xbcuy; 0xbduy; 0xbeuy; 0xbfuy;
0xc0uy; 0xc1uy; 0xc2uy; 0xc3uy; 0xc4uy; 0xc5uy; 0xc6uy; 0xc7uy;
0xc8uy; 0xc9uy; 0xcauy; 0xcbuy; 0xccuy; 0xcduy; 0xceuy; 0xcfuy;
0xd0uy; 0xd1uy; 0xd2uy; 0xd3uy; 0xd4uy; 0xd5uy; 0xd6uy; 0xd7uy;
0xd8uy; 0xd9uy; 0xdauy; 0xdbuy; 0xdcuy; 0xdduy; 0xdeuy; 0xdfuy;
0xe0uy; 0xe1uy; 0xe2uy; 0xe3uy; 0xe4uy; 0xe5uy; 0xe6uy; 0xe7uy;
0xe8uy; 0xe9uy; 0xeauy; 0xebuy; 0xecuy; 0xeduy; 0xeeuy; 0xefuy;
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy; 0xfauy; 0xfbuy; 0xfcuy; 0xfduy; 0xfeuy; 0xffuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_len = 82
let test2_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x06uy; 0xa6uy; 0xb8uy; 0x8cuy; 0x58uy; 0x53uy; 0x36uy; 0x1auy;
0x06uy; 0x10uy; 0x4cuy; 0x9cuy; 0xebuy; 0x35uy; 0xb4uy; 0x5cuy;
0xefuy; 0x76uy; 0x00uy; 0x14uy; 0x90uy; 0x46uy; 0x71uy; 0x01uy;
0x4auy; 0x19uy; 0x3fuy; 0x40uy; 0xc1uy; 0x5fuy; 0xc2uy; 0x44uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test2_expected_okm : lbytes 82 =
let l = List.Tot.map u8_from_UInt8 [
0xb1uy; 0x1euy; 0x39uy; 0x8duy; 0xc8uy; 0x03uy; 0x27uy; 0xa1uy;
0xc8uy; 0xe7uy; 0xf7uy; 0x8cuy; 0x59uy; 0x6auy; 0x49uy; 0x34uy;
0x4fuy; 0x01uy; 0x2euy; 0xdauy; 0x2duy; 0x4euy; 0xfauy; 0xd8uy;
0xa0uy; 0x50uy; 0xccuy; 0x4cuy; 0x19uy; 0xafuy; 0xa9uy; 0x7cuy;
0x59uy; 0x04uy; 0x5auy; 0x99uy; 0xcauy; 0xc7uy; 0x82uy; 0x72uy;
0x71uy; 0xcbuy; 0x41uy; 0xc6uy; 0x5euy; 0x59uy; 0x0euy; 0x09uy;
0xdauy; 0x32uy; 0x75uy; 0x60uy; 0x0cuy; 0x2fuy; 0x09uy; 0xb8uy;
0x36uy; 0x77uy; 0x93uy; 0xa9uy; 0xacuy; 0xa3uy; 0xdbuy; 0x71uy;
0xccuy; 0x30uy; 0xc5uy; 0x81uy; 0x79uy; 0xecuy; 0x3euy; 0x87uy;
0xc1uy; 0x4cuy; 0x01uy; 0xd5uy; 0xc1uy; 0xf3uy; 0x43uy; 0x4fuy;
0x1duy; 0x87uy
] in
assert_norm (List.Tot.length l == 82);
of_list l
/// Test 3
let test3_hash = Spec.Hash.Definitions.SHA2_256
let test3_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test3_salt : lbytes 0 =
let l = List.Tot.map u8_from_UInt8 [] in
assert_norm (List.Tot.length l == 0);
of_list l
let test3_info : lbytes 0 =
let l = List.Tot.map u8_from_UInt8 [] in
assert_norm (List.Tot.length l == 0);
of_list l
let test3_len = 42
let test3_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x19uy; 0xefuy; 0x24uy; 0xa3uy; 0x2cuy; 0x71uy; 0x7buy; 0x16uy;
0x7fuy; 0x33uy; 0xa9uy; 0x1duy; 0x6fuy; 0x64uy; 0x8buy; 0xdfuy;
0x96uy; 0x59uy; 0x67uy; 0x76uy; 0xafuy; 0xdbuy; 0x63uy; 0x77uy;
0xacuy; 0x43uy; 0x4cuy; 0x1cuy; 0x29uy; 0x3cuy; 0xcbuy; 0x04uy
] in
assert_norm (List.Tot.length l == 32);
of_list l | false | false | Spec.HKDF.Test.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 test3_expected_okm:lbytes 42 | [] | Spec.HKDF.Test.test3_expected_okm | {
"file_name": "specs/tests/Spec.HKDF.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 42 | {
"end_col": 11,
"end_line": 205,
"start_col": 36,
"start_line": 195
} |
Prims.Tot | val test2_ikm:lbytes 80 | [
{
"abbrev": true,
"full_module": "Spec.Agile.HKDF",
"short_module": "HKDF"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HMAC",
"short_module": "HMAC"
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"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": "Spec.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.HKDF",
"short_module": null
},
{
"abbrev": 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 test2_ikm : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy; 0x0duy; 0x0euy; 0x0fuy;
0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy;
0x18uy; 0x19uy; 0x1auy; 0x1buy; 0x1cuy; 0x1duy; 0x1euy; 0x1fuy;
0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x24uy; 0x25uy; 0x26uy; 0x27uy;
0x28uy; 0x29uy; 0x2auy; 0x2buy; 0x2cuy; 0x2duy; 0x2euy; 0x2fuy;
0x30uy; 0x31uy; 0x32uy; 0x33uy; 0x34uy; 0x35uy; 0x36uy; 0x37uy;
0x38uy; 0x39uy; 0x3auy; 0x3buy; 0x3cuy; 0x3duy; 0x3euy; 0x3fuy;
0x40uy; 0x41uy; 0x42uy; 0x43uy; 0x44uy; 0x45uy; 0x46uy; 0x47uy;
0x48uy; 0x49uy; 0x4auy; 0x4buy; 0x4cuy; 0x4duy; 0x4euy; 0x4fuy
] in
assert_norm (List.Tot.length l == 80);
of_list l | val test2_ikm:lbytes 80
let test2_ikm:lbytes 80 = | false | null | false | let l =
List.Tot.map u8_from_UInt8
[
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy; 0x08uy; 0x09uy; 0x0auy; 0x0buy;
0x0cuy; 0x0duy; 0x0euy; 0x0fuy; 0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy;
0x18uy; 0x19uy; 0x1auy; 0x1buy; 0x1cuy; 0x1duy; 0x1euy; 0x1fuy; 0x20uy; 0x21uy; 0x22uy; 0x23uy;
0x24uy; 0x25uy; 0x26uy; 0x27uy; 0x28uy; 0x29uy; 0x2auy; 0x2buy; 0x2cuy; 0x2duy; 0x2euy; 0x2fuy;
0x30uy; 0x31uy; 0x32uy; 0x33uy; 0x34uy; 0x35uy; 0x36uy; 0x37uy; 0x38uy; 0x39uy; 0x3auy; 0x3buy;
0x3cuy; 0x3duy; 0x3euy; 0x3fuy; 0x40uy; 0x41uy; 0x42uy; 0x43uy; 0x44uy; 0x45uy; 0x46uy; 0x47uy;
0x48uy; 0x49uy; 0x4auy; 0x4buy; 0x4cuy; 0x4duy; 0x4euy; 0x4fuy
]
in
assert_norm (List.Tot.length l == 80);
of_list l | {
"checked_file": "Spec.HKDF.Test.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"Spec.Agile.HKDF.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.HKDF.Test.fst"
} | [
"total"
] | [
"Lib.Sequence.of_list",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Prims.list",
"FStar.List.Tot.Base.map",
"FStar.UInt8.t",
"Lib.RawIntTypes.u8_from_UInt8",
"Prims.Cons",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | module Spec.HKDF.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
module HMAC = Spec.Agile.HMAC
module HKDF = Spec.Agile.HKDF
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_hash = Spec.Hash.Definitions.SHA2_256
let test1_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test1_salt : lbytes 13 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy
] in
assert_norm (List.Tot.length l == 13);
of_list l
let test1_info : lbytes 10 =
let l = List.Tot.map u8_from_UInt8 [
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy
] in
assert_norm (List.Tot.length l == 10);
of_list l
let test1_len = 42
let test1_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x07uy; 0x77uy; 0x09uy; 0x36uy; 0x2cuy; 0x2euy; 0x32uy; 0xdfuy;
0x0duy; 0xdcuy; 0x3fuy; 0x0duy; 0xc4uy; 0x7buy; 0xbauy; 0x63uy;
0x90uy; 0xb6uy; 0xc7uy; 0x3buy; 0xb5uy; 0x0fuy; 0x9cuy; 0x31uy;
0x22uy; 0xecuy; 0x84uy; 0x4auy; 0xd7uy; 0xc2uy; 0xb3uy; 0xe5uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test1_expected_okm : lbytes 42 =
let l = List.Tot.map u8_from_UInt8 [
0x3cuy; 0xb2uy; 0x5fuy; 0x25uy; 0xfauy; 0xacuy; 0xd5uy; 0x7auy;
0x90uy; 0x43uy; 0x4fuy; 0x64uy; 0xd0uy; 0x36uy; 0x2fuy; 0x2auy;
0x2duy; 0x2duy; 0x0auy; 0x90uy; 0xcfuy; 0x1auy; 0x5auy; 0x4cuy;
0x5duy; 0xb0uy; 0x2duy; 0x56uy; 0xecuy; 0xc4uy; 0xc5uy; 0xbfuy;
0x34uy; 0x00uy; 0x72uy; 0x08uy; 0xd5uy; 0xb8uy; 0x87uy; 0x18uy;
0x58uy; 0x65uy
] in
assert_norm (List.Tot.length l == 42);
of_list l
/// Test 2
let test2_hash = Spec.Hash.Definitions.SHA2_256 | false | false | Spec.HKDF.Test.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 test2_ikm:lbytes 80 | [] | Spec.HKDF.Test.test2_ikm | {
"file_name": "specs/tests/Spec.HKDF.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 80 | {
"end_col": 11,
"end_line": 90,
"start_col": 27,
"start_line": 76
} |
Prims.Tot | val test2_expected_okm:lbytes 82 | [
{
"abbrev": true,
"full_module": "Spec.Agile.HKDF",
"short_module": "HKDF"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HMAC",
"short_module": "HMAC"
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"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": "Spec.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.HKDF",
"short_module": null
},
{
"abbrev": 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 test2_expected_okm : lbytes 82 =
let l = List.Tot.map u8_from_UInt8 [
0xb1uy; 0x1euy; 0x39uy; 0x8duy; 0xc8uy; 0x03uy; 0x27uy; 0xa1uy;
0xc8uy; 0xe7uy; 0xf7uy; 0x8cuy; 0x59uy; 0x6auy; 0x49uy; 0x34uy;
0x4fuy; 0x01uy; 0x2euy; 0xdauy; 0x2duy; 0x4euy; 0xfauy; 0xd8uy;
0xa0uy; 0x50uy; 0xccuy; 0x4cuy; 0x19uy; 0xafuy; 0xa9uy; 0x7cuy;
0x59uy; 0x04uy; 0x5auy; 0x99uy; 0xcauy; 0xc7uy; 0x82uy; 0x72uy;
0x71uy; 0xcbuy; 0x41uy; 0xc6uy; 0x5euy; 0x59uy; 0x0euy; 0x09uy;
0xdauy; 0x32uy; 0x75uy; 0x60uy; 0x0cuy; 0x2fuy; 0x09uy; 0xb8uy;
0x36uy; 0x77uy; 0x93uy; 0xa9uy; 0xacuy; 0xa3uy; 0xdbuy; 0x71uy;
0xccuy; 0x30uy; 0xc5uy; 0x81uy; 0x79uy; 0xecuy; 0x3euy; 0x87uy;
0xc1uy; 0x4cuy; 0x01uy; 0xd5uy; 0xc1uy; 0xf3uy; 0x43uy; 0x4fuy;
0x1duy; 0x87uy
] in
assert_norm (List.Tot.length l == 82);
of_list l | val test2_expected_okm:lbytes 82
let test2_expected_okm:lbytes 82 = | false | null | false | let l =
List.Tot.map u8_from_UInt8
[
0xb1uy; 0x1euy; 0x39uy; 0x8duy; 0xc8uy; 0x03uy; 0x27uy; 0xa1uy; 0xc8uy; 0xe7uy; 0xf7uy; 0x8cuy;
0x59uy; 0x6auy; 0x49uy; 0x34uy; 0x4fuy; 0x01uy; 0x2euy; 0xdauy; 0x2duy; 0x4euy; 0xfauy; 0xd8uy;
0xa0uy; 0x50uy; 0xccuy; 0x4cuy; 0x19uy; 0xafuy; 0xa9uy; 0x7cuy; 0x59uy; 0x04uy; 0x5auy; 0x99uy;
0xcauy; 0xc7uy; 0x82uy; 0x72uy; 0x71uy; 0xcbuy; 0x41uy; 0xc6uy; 0x5euy; 0x59uy; 0x0euy; 0x09uy;
0xdauy; 0x32uy; 0x75uy; 0x60uy; 0x0cuy; 0x2fuy; 0x09uy; 0xb8uy; 0x36uy; 0x77uy; 0x93uy; 0xa9uy;
0xacuy; 0xa3uy; 0xdbuy; 0x71uy; 0xccuy; 0x30uy; 0xc5uy; 0x81uy; 0x79uy; 0xecuy; 0x3euy; 0x87uy;
0xc1uy; 0x4cuy; 0x01uy; 0xd5uy; 0xc1uy; 0xf3uy; 0x43uy; 0x4fuy; 0x1duy; 0x87uy
]
in
assert_norm (List.Tot.length l == 82);
of_list l | {
"checked_file": "Spec.HKDF.Test.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"Spec.Agile.HKDF.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.HKDF.Test.fst"
} | [
"total"
] | [
"Lib.Sequence.of_list",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Prims.list",
"FStar.List.Tot.Base.map",
"FStar.UInt8.t",
"Lib.RawIntTypes.u8_from_UInt8",
"Prims.Cons",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | module Spec.HKDF.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
module HMAC = Spec.Agile.HMAC
module HKDF = Spec.Agile.HKDF
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_hash = Spec.Hash.Definitions.SHA2_256
let test1_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test1_salt : lbytes 13 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy
] in
assert_norm (List.Tot.length l == 13);
of_list l
let test1_info : lbytes 10 =
let l = List.Tot.map u8_from_UInt8 [
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy
] in
assert_norm (List.Tot.length l == 10);
of_list l
let test1_len = 42
let test1_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x07uy; 0x77uy; 0x09uy; 0x36uy; 0x2cuy; 0x2euy; 0x32uy; 0xdfuy;
0x0duy; 0xdcuy; 0x3fuy; 0x0duy; 0xc4uy; 0x7buy; 0xbauy; 0x63uy;
0x90uy; 0xb6uy; 0xc7uy; 0x3buy; 0xb5uy; 0x0fuy; 0x9cuy; 0x31uy;
0x22uy; 0xecuy; 0x84uy; 0x4auy; 0xd7uy; 0xc2uy; 0xb3uy; 0xe5uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test1_expected_okm : lbytes 42 =
let l = List.Tot.map u8_from_UInt8 [
0x3cuy; 0xb2uy; 0x5fuy; 0x25uy; 0xfauy; 0xacuy; 0xd5uy; 0x7auy;
0x90uy; 0x43uy; 0x4fuy; 0x64uy; 0xd0uy; 0x36uy; 0x2fuy; 0x2auy;
0x2duy; 0x2duy; 0x0auy; 0x90uy; 0xcfuy; 0x1auy; 0x5auy; 0x4cuy;
0x5duy; 0xb0uy; 0x2duy; 0x56uy; 0xecuy; 0xc4uy; 0xc5uy; 0xbfuy;
0x34uy; 0x00uy; 0x72uy; 0x08uy; 0xd5uy; 0xb8uy; 0x87uy; 0x18uy;
0x58uy; 0x65uy
] in
assert_norm (List.Tot.length l == 42);
of_list l
/// Test 2
let test2_hash = Spec.Hash.Definitions.SHA2_256
let test2_ikm : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy; 0x0duy; 0x0euy; 0x0fuy;
0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy;
0x18uy; 0x19uy; 0x1auy; 0x1buy; 0x1cuy; 0x1duy; 0x1euy; 0x1fuy;
0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x24uy; 0x25uy; 0x26uy; 0x27uy;
0x28uy; 0x29uy; 0x2auy; 0x2buy; 0x2cuy; 0x2duy; 0x2euy; 0x2fuy;
0x30uy; 0x31uy; 0x32uy; 0x33uy; 0x34uy; 0x35uy; 0x36uy; 0x37uy;
0x38uy; 0x39uy; 0x3auy; 0x3buy; 0x3cuy; 0x3duy; 0x3euy; 0x3fuy;
0x40uy; 0x41uy; 0x42uy; 0x43uy; 0x44uy; 0x45uy; 0x46uy; 0x47uy;
0x48uy; 0x49uy; 0x4auy; 0x4buy; 0x4cuy; 0x4duy; 0x4euy; 0x4fuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_salt : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x60uy; 0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy;
0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy; 0x75uy; 0x76uy; 0x77uy;
0x78uy; 0x79uy; 0x7auy; 0x7buy; 0x7cuy; 0x7duy; 0x7euy; 0x7fuy;
0x80uy; 0x81uy; 0x82uy; 0x83uy; 0x84uy; 0x85uy; 0x86uy; 0x87uy;
0x88uy; 0x89uy; 0x8auy; 0x8buy; 0x8cuy; 0x8duy; 0x8euy; 0x8fuy;
0x90uy; 0x91uy; 0x92uy; 0x93uy; 0x94uy; 0x95uy; 0x96uy; 0x97uy;
0x98uy; 0x99uy; 0x9auy; 0x9buy; 0x9cuy; 0x9duy; 0x9euy; 0x9fuy;
0xa0uy; 0xa1uy; 0xa2uy; 0xa3uy; 0xa4uy; 0xa5uy; 0xa6uy; 0xa7uy;
0xa8uy; 0xa9uy; 0xaauy; 0xabuy; 0xacuy; 0xaduy; 0xaeuy; 0xafuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_info : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0xb0uy; 0xb1uy; 0xb2uy; 0xb3uy; 0xb4uy; 0xb5uy; 0xb6uy; 0xb7uy;
0xb8uy; 0xb9uy; 0xbauy; 0xbbuy; 0xbcuy; 0xbduy; 0xbeuy; 0xbfuy;
0xc0uy; 0xc1uy; 0xc2uy; 0xc3uy; 0xc4uy; 0xc5uy; 0xc6uy; 0xc7uy;
0xc8uy; 0xc9uy; 0xcauy; 0xcbuy; 0xccuy; 0xcduy; 0xceuy; 0xcfuy;
0xd0uy; 0xd1uy; 0xd2uy; 0xd3uy; 0xd4uy; 0xd5uy; 0xd6uy; 0xd7uy;
0xd8uy; 0xd9uy; 0xdauy; 0xdbuy; 0xdcuy; 0xdduy; 0xdeuy; 0xdfuy;
0xe0uy; 0xe1uy; 0xe2uy; 0xe3uy; 0xe4uy; 0xe5uy; 0xe6uy; 0xe7uy;
0xe8uy; 0xe9uy; 0xeauy; 0xebuy; 0xecuy; 0xeduy; 0xeeuy; 0xefuy;
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy; 0xfauy; 0xfbuy; 0xfcuy; 0xfduy; 0xfeuy; 0xffuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_len = 82
let test2_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x06uy; 0xa6uy; 0xb8uy; 0x8cuy; 0x58uy; 0x53uy; 0x36uy; 0x1auy;
0x06uy; 0x10uy; 0x4cuy; 0x9cuy; 0xebuy; 0x35uy; 0xb4uy; 0x5cuy;
0xefuy; 0x76uy; 0x00uy; 0x14uy; 0x90uy; 0x46uy; 0x71uy; 0x01uy;
0x4auy; 0x19uy; 0x3fuy; 0x40uy; 0xc1uy; 0x5fuy; 0xc2uy; 0x44uy
] in
assert_norm (List.Tot.length l == 32);
of_list l | false | false | Spec.HKDF.Test.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 test2_expected_okm:lbytes 82 | [] | Spec.HKDF.Test.test2_expected_okm | {
"file_name": "specs/tests/Spec.HKDF.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 82 | {
"end_col": 11,
"end_line": 154,
"start_col": 36,
"start_line": 139
} |
Prims.Tot | val test2_salt:lbytes 80 | [
{
"abbrev": true,
"full_module": "Spec.Agile.HKDF",
"short_module": "HKDF"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HMAC",
"short_module": "HMAC"
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"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": "Spec.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.HKDF",
"short_module": null
},
{
"abbrev": 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 test2_salt : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x60uy; 0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy;
0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy; 0x75uy; 0x76uy; 0x77uy;
0x78uy; 0x79uy; 0x7auy; 0x7buy; 0x7cuy; 0x7duy; 0x7euy; 0x7fuy;
0x80uy; 0x81uy; 0x82uy; 0x83uy; 0x84uy; 0x85uy; 0x86uy; 0x87uy;
0x88uy; 0x89uy; 0x8auy; 0x8buy; 0x8cuy; 0x8duy; 0x8euy; 0x8fuy;
0x90uy; 0x91uy; 0x92uy; 0x93uy; 0x94uy; 0x95uy; 0x96uy; 0x97uy;
0x98uy; 0x99uy; 0x9auy; 0x9buy; 0x9cuy; 0x9duy; 0x9euy; 0x9fuy;
0xa0uy; 0xa1uy; 0xa2uy; 0xa3uy; 0xa4uy; 0xa5uy; 0xa6uy; 0xa7uy;
0xa8uy; 0xa9uy; 0xaauy; 0xabuy; 0xacuy; 0xaduy; 0xaeuy; 0xafuy
] in
assert_norm (List.Tot.length l == 80);
of_list l | val test2_salt:lbytes 80
let test2_salt:lbytes 80 = | false | null | false | let l =
List.Tot.map u8_from_UInt8
[
0x60uy; 0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy;
0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy; 0x75uy; 0x76uy; 0x77uy;
0x78uy; 0x79uy; 0x7auy; 0x7buy; 0x7cuy; 0x7duy; 0x7euy; 0x7fuy; 0x80uy; 0x81uy; 0x82uy; 0x83uy;
0x84uy; 0x85uy; 0x86uy; 0x87uy; 0x88uy; 0x89uy; 0x8auy; 0x8buy; 0x8cuy; 0x8duy; 0x8euy; 0x8fuy;
0x90uy; 0x91uy; 0x92uy; 0x93uy; 0x94uy; 0x95uy; 0x96uy; 0x97uy; 0x98uy; 0x99uy; 0x9auy; 0x9buy;
0x9cuy; 0x9duy; 0x9euy; 0x9fuy; 0xa0uy; 0xa1uy; 0xa2uy; 0xa3uy; 0xa4uy; 0xa5uy; 0xa6uy; 0xa7uy;
0xa8uy; 0xa9uy; 0xaauy; 0xabuy; 0xacuy; 0xaduy; 0xaeuy; 0xafuy
]
in
assert_norm (List.Tot.length l == 80);
of_list l | {
"checked_file": "Spec.HKDF.Test.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"Spec.Agile.HKDF.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.HKDF.Test.fst"
} | [
"total"
] | [
"Lib.Sequence.of_list",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Prims.list",
"FStar.List.Tot.Base.map",
"FStar.UInt8.t",
"Lib.RawIntTypes.u8_from_UInt8",
"Prims.Cons",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | module Spec.HKDF.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
module HMAC = Spec.Agile.HMAC
module HKDF = Spec.Agile.HKDF
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_hash = Spec.Hash.Definitions.SHA2_256
let test1_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test1_salt : lbytes 13 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy
] in
assert_norm (List.Tot.length l == 13);
of_list l
let test1_info : lbytes 10 =
let l = List.Tot.map u8_from_UInt8 [
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy
] in
assert_norm (List.Tot.length l == 10);
of_list l
let test1_len = 42
let test1_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x07uy; 0x77uy; 0x09uy; 0x36uy; 0x2cuy; 0x2euy; 0x32uy; 0xdfuy;
0x0duy; 0xdcuy; 0x3fuy; 0x0duy; 0xc4uy; 0x7buy; 0xbauy; 0x63uy;
0x90uy; 0xb6uy; 0xc7uy; 0x3buy; 0xb5uy; 0x0fuy; 0x9cuy; 0x31uy;
0x22uy; 0xecuy; 0x84uy; 0x4auy; 0xd7uy; 0xc2uy; 0xb3uy; 0xe5uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test1_expected_okm : lbytes 42 =
let l = List.Tot.map u8_from_UInt8 [
0x3cuy; 0xb2uy; 0x5fuy; 0x25uy; 0xfauy; 0xacuy; 0xd5uy; 0x7auy;
0x90uy; 0x43uy; 0x4fuy; 0x64uy; 0xd0uy; 0x36uy; 0x2fuy; 0x2auy;
0x2duy; 0x2duy; 0x0auy; 0x90uy; 0xcfuy; 0x1auy; 0x5auy; 0x4cuy;
0x5duy; 0xb0uy; 0x2duy; 0x56uy; 0xecuy; 0xc4uy; 0xc5uy; 0xbfuy;
0x34uy; 0x00uy; 0x72uy; 0x08uy; 0xd5uy; 0xb8uy; 0x87uy; 0x18uy;
0x58uy; 0x65uy
] in
assert_norm (List.Tot.length l == 42);
of_list l
/// Test 2
let test2_hash = Spec.Hash.Definitions.SHA2_256
let test2_ikm : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy; 0x0duy; 0x0euy; 0x0fuy;
0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy;
0x18uy; 0x19uy; 0x1auy; 0x1buy; 0x1cuy; 0x1duy; 0x1euy; 0x1fuy;
0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x24uy; 0x25uy; 0x26uy; 0x27uy;
0x28uy; 0x29uy; 0x2auy; 0x2buy; 0x2cuy; 0x2duy; 0x2euy; 0x2fuy;
0x30uy; 0x31uy; 0x32uy; 0x33uy; 0x34uy; 0x35uy; 0x36uy; 0x37uy;
0x38uy; 0x39uy; 0x3auy; 0x3buy; 0x3cuy; 0x3duy; 0x3euy; 0x3fuy;
0x40uy; 0x41uy; 0x42uy; 0x43uy; 0x44uy; 0x45uy; 0x46uy; 0x47uy;
0x48uy; 0x49uy; 0x4auy; 0x4buy; 0x4cuy; 0x4duy; 0x4euy; 0x4fuy
] in
assert_norm (List.Tot.length l == 80);
of_list l | false | false | Spec.HKDF.Test.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 test2_salt:lbytes 80 | [] | Spec.HKDF.Test.test2_salt | {
"file_name": "specs/tests/Spec.HKDF.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 80 | {
"end_col": 11,
"end_line": 107,
"start_col": 28,
"start_line": 93
} |
Prims.Tot | val test2_info:lbytes 80 | [
{
"abbrev": true,
"full_module": "Spec.Agile.HKDF",
"short_module": "HKDF"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HMAC",
"short_module": "HMAC"
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"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": "Spec.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.HKDF",
"short_module": null
},
{
"abbrev": 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 test2_info : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0xb0uy; 0xb1uy; 0xb2uy; 0xb3uy; 0xb4uy; 0xb5uy; 0xb6uy; 0xb7uy;
0xb8uy; 0xb9uy; 0xbauy; 0xbbuy; 0xbcuy; 0xbduy; 0xbeuy; 0xbfuy;
0xc0uy; 0xc1uy; 0xc2uy; 0xc3uy; 0xc4uy; 0xc5uy; 0xc6uy; 0xc7uy;
0xc8uy; 0xc9uy; 0xcauy; 0xcbuy; 0xccuy; 0xcduy; 0xceuy; 0xcfuy;
0xd0uy; 0xd1uy; 0xd2uy; 0xd3uy; 0xd4uy; 0xd5uy; 0xd6uy; 0xd7uy;
0xd8uy; 0xd9uy; 0xdauy; 0xdbuy; 0xdcuy; 0xdduy; 0xdeuy; 0xdfuy;
0xe0uy; 0xe1uy; 0xe2uy; 0xe3uy; 0xe4uy; 0xe5uy; 0xe6uy; 0xe7uy;
0xe8uy; 0xe9uy; 0xeauy; 0xebuy; 0xecuy; 0xeduy; 0xeeuy; 0xefuy;
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy; 0xfauy; 0xfbuy; 0xfcuy; 0xfduy; 0xfeuy; 0xffuy
] in
assert_norm (List.Tot.length l == 80);
of_list l | val test2_info:lbytes 80
let test2_info:lbytes 80 = | false | null | false | let l =
List.Tot.map u8_from_UInt8
[
0xb0uy; 0xb1uy; 0xb2uy; 0xb3uy; 0xb4uy; 0xb5uy; 0xb6uy; 0xb7uy; 0xb8uy; 0xb9uy; 0xbauy; 0xbbuy;
0xbcuy; 0xbduy; 0xbeuy; 0xbfuy; 0xc0uy; 0xc1uy; 0xc2uy; 0xc3uy; 0xc4uy; 0xc5uy; 0xc6uy; 0xc7uy;
0xc8uy; 0xc9uy; 0xcauy; 0xcbuy; 0xccuy; 0xcduy; 0xceuy; 0xcfuy; 0xd0uy; 0xd1uy; 0xd2uy; 0xd3uy;
0xd4uy; 0xd5uy; 0xd6uy; 0xd7uy; 0xd8uy; 0xd9uy; 0xdauy; 0xdbuy; 0xdcuy; 0xdduy; 0xdeuy; 0xdfuy;
0xe0uy; 0xe1uy; 0xe2uy; 0xe3uy; 0xe4uy; 0xe5uy; 0xe6uy; 0xe7uy; 0xe8uy; 0xe9uy; 0xeauy; 0xebuy;
0xecuy; 0xeduy; 0xeeuy; 0xefuy; 0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy; 0xfauy; 0xfbuy; 0xfcuy; 0xfduy; 0xfeuy; 0xffuy
]
in
assert_norm (List.Tot.length l == 80);
of_list l | {
"checked_file": "Spec.HKDF.Test.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"Spec.Agile.HKDF.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.HKDF.Test.fst"
} | [
"total"
] | [
"Lib.Sequence.of_list",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.List.Tot.Base.length",
"Prims.list",
"FStar.List.Tot.Base.map",
"FStar.UInt8.t",
"Lib.RawIntTypes.u8_from_UInt8",
"Prims.Cons",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | module Spec.HKDF.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
module HMAC = Spec.Agile.HMAC
module HKDF = Spec.Agile.HKDF
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_hash = Spec.Hash.Definitions.SHA2_256
let test1_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test1_salt : lbytes 13 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy
] in
assert_norm (List.Tot.length l == 13);
of_list l
let test1_info : lbytes 10 =
let l = List.Tot.map u8_from_UInt8 [
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy
] in
assert_norm (List.Tot.length l == 10);
of_list l
let test1_len = 42
let test1_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x07uy; 0x77uy; 0x09uy; 0x36uy; 0x2cuy; 0x2euy; 0x32uy; 0xdfuy;
0x0duy; 0xdcuy; 0x3fuy; 0x0duy; 0xc4uy; 0x7buy; 0xbauy; 0x63uy;
0x90uy; 0xb6uy; 0xc7uy; 0x3buy; 0xb5uy; 0x0fuy; 0x9cuy; 0x31uy;
0x22uy; 0xecuy; 0x84uy; 0x4auy; 0xd7uy; 0xc2uy; 0xb3uy; 0xe5uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test1_expected_okm : lbytes 42 =
let l = List.Tot.map u8_from_UInt8 [
0x3cuy; 0xb2uy; 0x5fuy; 0x25uy; 0xfauy; 0xacuy; 0xd5uy; 0x7auy;
0x90uy; 0x43uy; 0x4fuy; 0x64uy; 0xd0uy; 0x36uy; 0x2fuy; 0x2auy;
0x2duy; 0x2duy; 0x0auy; 0x90uy; 0xcfuy; 0x1auy; 0x5auy; 0x4cuy;
0x5duy; 0xb0uy; 0x2duy; 0x56uy; 0xecuy; 0xc4uy; 0xc5uy; 0xbfuy;
0x34uy; 0x00uy; 0x72uy; 0x08uy; 0xd5uy; 0xb8uy; 0x87uy; 0x18uy;
0x58uy; 0x65uy
] in
assert_norm (List.Tot.length l == 42);
of_list l
/// Test 2
let test2_hash = Spec.Hash.Definitions.SHA2_256
let test2_ikm : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy; 0x0duy; 0x0euy; 0x0fuy;
0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy;
0x18uy; 0x19uy; 0x1auy; 0x1buy; 0x1cuy; 0x1duy; 0x1euy; 0x1fuy;
0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x24uy; 0x25uy; 0x26uy; 0x27uy;
0x28uy; 0x29uy; 0x2auy; 0x2buy; 0x2cuy; 0x2duy; 0x2euy; 0x2fuy;
0x30uy; 0x31uy; 0x32uy; 0x33uy; 0x34uy; 0x35uy; 0x36uy; 0x37uy;
0x38uy; 0x39uy; 0x3auy; 0x3buy; 0x3cuy; 0x3duy; 0x3euy; 0x3fuy;
0x40uy; 0x41uy; 0x42uy; 0x43uy; 0x44uy; 0x45uy; 0x46uy; 0x47uy;
0x48uy; 0x49uy; 0x4auy; 0x4buy; 0x4cuy; 0x4duy; 0x4euy; 0x4fuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_salt : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x60uy; 0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy;
0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy; 0x75uy; 0x76uy; 0x77uy;
0x78uy; 0x79uy; 0x7auy; 0x7buy; 0x7cuy; 0x7duy; 0x7euy; 0x7fuy;
0x80uy; 0x81uy; 0x82uy; 0x83uy; 0x84uy; 0x85uy; 0x86uy; 0x87uy;
0x88uy; 0x89uy; 0x8auy; 0x8buy; 0x8cuy; 0x8duy; 0x8euy; 0x8fuy;
0x90uy; 0x91uy; 0x92uy; 0x93uy; 0x94uy; 0x95uy; 0x96uy; 0x97uy;
0x98uy; 0x99uy; 0x9auy; 0x9buy; 0x9cuy; 0x9duy; 0x9euy; 0x9fuy;
0xa0uy; 0xa1uy; 0xa2uy; 0xa3uy; 0xa4uy; 0xa5uy; 0xa6uy; 0xa7uy;
0xa8uy; 0xa9uy; 0xaauy; 0xabuy; 0xacuy; 0xaduy; 0xaeuy; 0xafuy
] in
assert_norm (List.Tot.length l == 80);
of_list l | false | false | Spec.HKDF.Test.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 test2_info:lbytes 80 | [] | Spec.HKDF.Test.test2_info | {
"file_name": "specs/tests/Spec.HKDF.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U8 Lib.IntTypes.SEC) 80 | {
"end_col": 11,
"end_line": 124,
"start_col": 28,
"start_line": 110
} |
Prims.Tot | val test_vectors:list vec | [
{
"abbrev": true,
"full_module": "Spec.Agile.HKDF",
"short_module": "HKDF"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HMAC",
"short_module": "HMAC"
},
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"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": "Spec.HKDF",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.HKDF",
"short_module": null
},
{
"abbrev": 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 test_vectors: list vec = [
Vec test1_hash test1_salt test1_ikm
test1_expected_prk test1_info test1_len test1_expected_okm;
Vec test2_hash test2_salt test2_ikm
test2_expected_prk test2_info test2_len test2_expected_okm;
Vec test3_hash test3_salt test3_ikm
test3_expected_prk test3_info test3_len test3_expected_okm ] | val test_vectors:list vec
let test_vectors:list vec = | false | null | false | [
Vec test1_hash test1_salt test1_ikm test1_expected_prk test1_info test1_len test1_expected_okm;
Vec test2_hash test2_salt test2_ikm test2_expected_prk test2_info test2_len test2_expected_okm;
Vec test3_hash test3_salt test3_ikm test3_expected_prk test3_info test3_len test3_expected_okm
] | {
"checked_file": "Spec.HKDF.Test.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"Spec.Agile.HKDF.fsti.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.HKDF.Test.fst"
} | [
"total"
] | [
"Prims.Cons",
"Spec.HKDF.Test.vec",
"Spec.HKDF.Test.Vec",
"Spec.HKDF.Test.test1_hash",
"Spec.HKDF.Test.test1_salt",
"Spec.HKDF.Test.test1_ikm",
"Spec.HKDF.Test.test1_expected_prk",
"Spec.HKDF.Test.test1_info",
"Spec.HKDF.Test.test1_len",
"Spec.HKDF.Test.test1_expected_okm",
"Spec.HKDF.Test.test2_hash",
"Spec.HKDF.Test.test2_salt",
"Spec.HKDF.Test.test2_ikm",
"Spec.HKDF.Test.test2_expected_prk",
"Spec.HKDF.Test.test2_info",
"Spec.HKDF.Test.test2_len",
"Spec.HKDF.Test.test2_expected_okm",
"Spec.HKDF.Test.test3_hash",
"Spec.HKDF.Test.test3_salt",
"Spec.HKDF.Test.test3_ikm",
"Spec.HKDF.Test.test3_expected_prk",
"Spec.HKDF.Test.test3_info",
"Spec.HKDF.Test.test3_len",
"Spec.HKDF.Test.test3_expected_okm",
"Prims.Nil"
] | [] | module Spec.HKDF.Test
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
module PS = Lib.PrintSequence
module HMAC = Spec.Agile.HMAC
module HKDF = Spec.Agile.HKDF
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_hash = Spec.Hash.Definitions.SHA2_256
let test1_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test1_salt : lbytes 13 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy
] in
assert_norm (List.Tot.length l == 13);
of_list l
let test1_info : lbytes 10 =
let l = List.Tot.map u8_from_UInt8 [
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy
] in
assert_norm (List.Tot.length l == 10);
of_list l
let test1_len = 42
let test1_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x07uy; 0x77uy; 0x09uy; 0x36uy; 0x2cuy; 0x2euy; 0x32uy; 0xdfuy;
0x0duy; 0xdcuy; 0x3fuy; 0x0duy; 0xc4uy; 0x7buy; 0xbauy; 0x63uy;
0x90uy; 0xb6uy; 0xc7uy; 0x3buy; 0xb5uy; 0x0fuy; 0x9cuy; 0x31uy;
0x22uy; 0xecuy; 0x84uy; 0x4auy; 0xd7uy; 0xc2uy; 0xb3uy; 0xe5uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test1_expected_okm : lbytes 42 =
let l = List.Tot.map u8_from_UInt8 [
0x3cuy; 0xb2uy; 0x5fuy; 0x25uy; 0xfauy; 0xacuy; 0xd5uy; 0x7auy;
0x90uy; 0x43uy; 0x4fuy; 0x64uy; 0xd0uy; 0x36uy; 0x2fuy; 0x2auy;
0x2duy; 0x2duy; 0x0auy; 0x90uy; 0xcfuy; 0x1auy; 0x5auy; 0x4cuy;
0x5duy; 0xb0uy; 0x2duy; 0x56uy; 0xecuy; 0xc4uy; 0xc5uy; 0xbfuy;
0x34uy; 0x00uy; 0x72uy; 0x08uy; 0xd5uy; 0xb8uy; 0x87uy; 0x18uy;
0x58uy; 0x65uy
] in
assert_norm (List.Tot.length l == 42);
of_list l
/// Test 2
let test2_hash = Spec.Hash.Definitions.SHA2_256
let test2_ikm : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy;
0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy; 0x0duy; 0x0euy; 0x0fuy;
0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy;
0x18uy; 0x19uy; 0x1auy; 0x1buy; 0x1cuy; 0x1duy; 0x1euy; 0x1fuy;
0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x24uy; 0x25uy; 0x26uy; 0x27uy;
0x28uy; 0x29uy; 0x2auy; 0x2buy; 0x2cuy; 0x2duy; 0x2euy; 0x2fuy;
0x30uy; 0x31uy; 0x32uy; 0x33uy; 0x34uy; 0x35uy; 0x36uy; 0x37uy;
0x38uy; 0x39uy; 0x3auy; 0x3buy; 0x3cuy; 0x3duy; 0x3euy; 0x3fuy;
0x40uy; 0x41uy; 0x42uy; 0x43uy; 0x44uy; 0x45uy; 0x46uy; 0x47uy;
0x48uy; 0x49uy; 0x4auy; 0x4buy; 0x4cuy; 0x4duy; 0x4euy; 0x4fuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_salt : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0x60uy; 0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy;
0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy; 0x75uy; 0x76uy; 0x77uy;
0x78uy; 0x79uy; 0x7auy; 0x7buy; 0x7cuy; 0x7duy; 0x7euy; 0x7fuy;
0x80uy; 0x81uy; 0x82uy; 0x83uy; 0x84uy; 0x85uy; 0x86uy; 0x87uy;
0x88uy; 0x89uy; 0x8auy; 0x8buy; 0x8cuy; 0x8duy; 0x8euy; 0x8fuy;
0x90uy; 0x91uy; 0x92uy; 0x93uy; 0x94uy; 0x95uy; 0x96uy; 0x97uy;
0x98uy; 0x99uy; 0x9auy; 0x9buy; 0x9cuy; 0x9duy; 0x9euy; 0x9fuy;
0xa0uy; 0xa1uy; 0xa2uy; 0xa3uy; 0xa4uy; 0xa5uy; 0xa6uy; 0xa7uy;
0xa8uy; 0xa9uy; 0xaauy; 0xabuy; 0xacuy; 0xaduy; 0xaeuy; 0xafuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_info : lbytes 80 =
let l = List.Tot.map u8_from_UInt8 [
0xb0uy; 0xb1uy; 0xb2uy; 0xb3uy; 0xb4uy; 0xb5uy; 0xb6uy; 0xb7uy;
0xb8uy; 0xb9uy; 0xbauy; 0xbbuy; 0xbcuy; 0xbduy; 0xbeuy; 0xbfuy;
0xc0uy; 0xc1uy; 0xc2uy; 0xc3uy; 0xc4uy; 0xc5uy; 0xc6uy; 0xc7uy;
0xc8uy; 0xc9uy; 0xcauy; 0xcbuy; 0xccuy; 0xcduy; 0xceuy; 0xcfuy;
0xd0uy; 0xd1uy; 0xd2uy; 0xd3uy; 0xd4uy; 0xd5uy; 0xd6uy; 0xd7uy;
0xd8uy; 0xd9uy; 0xdauy; 0xdbuy; 0xdcuy; 0xdduy; 0xdeuy; 0xdfuy;
0xe0uy; 0xe1uy; 0xe2uy; 0xe3uy; 0xe4uy; 0xe5uy; 0xe6uy; 0xe7uy;
0xe8uy; 0xe9uy; 0xeauy; 0xebuy; 0xecuy; 0xeduy; 0xeeuy; 0xefuy;
0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy;
0xf8uy; 0xf9uy; 0xfauy; 0xfbuy; 0xfcuy; 0xfduy; 0xfeuy; 0xffuy
] in
assert_norm (List.Tot.length l == 80);
of_list l
let test2_len = 82
let test2_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x06uy; 0xa6uy; 0xb8uy; 0x8cuy; 0x58uy; 0x53uy; 0x36uy; 0x1auy;
0x06uy; 0x10uy; 0x4cuy; 0x9cuy; 0xebuy; 0x35uy; 0xb4uy; 0x5cuy;
0xefuy; 0x76uy; 0x00uy; 0x14uy; 0x90uy; 0x46uy; 0x71uy; 0x01uy;
0x4auy; 0x19uy; 0x3fuy; 0x40uy; 0xc1uy; 0x5fuy; 0xc2uy; 0x44uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test2_expected_okm : lbytes 82 =
let l = List.Tot.map u8_from_UInt8 [
0xb1uy; 0x1euy; 0x39uy; 0x8duy; 0xc8uy; 0x03uy; 0x27uy; 0xa1uy;
0xc8uy; 0xe7uy; 0xf7uy; 0x8cuy; 0x59uy; 0x6auy; 0x49uy; 0x34uy;
0x4fuy; 0x01uy; 0x2euy; 0xdauy; 0x2duy; 0x4euy; 0xfauy; 0xd8uy;
0xa0uy; 0x50uy; 0xccuy; 0x4cuy; 0x19uy; 0xafuy; 0xa9uy; 0x7cuy;
0x59uy; 0x04uy; 0x5auy; 0x99uy; 0xcauy; 0xc7uy; 0x82uy; 0x72uy;
0x71uy; 0xcbuy; 0x41uy; 0xc6uy; 0x5euy; 0x59uy; 0x0euy; 0x09uy;
0xdauy; 0x32uy; 0x75uy; 0x60uy; 0x0cuy; 0x2fuy; 0x09uy; 0xb8uy;
0x36uy; 0x77uy; 0x93uy; 0xa9uy; 0xacuy; 0xa3uy; 0xdbuy; 0x71uy;
0xccuy; 0x30uy; 0xc5uy; 0x81uy; 0x79uy; 0xecuy; 0x3euy; 0x87uy;
0xc1uy; 0x4cuy; 0x01uy; 0xd5uy; 0xc1uy; 0xf3uy; 0x43uy; 0x4fuy;
0x1duy; 0x87uy
] in
assert_norm (List.Tot.length l == 82);
of_list l
/// Test 3
let test3_hash = Spec.Hash.Definitions.SHA2_256
let test3_ikm : lbytes 22 =
let l = List.Tot.map u8_from_UInt8 [
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy;
0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy; 0x0buy
] in
assert_norm (List.Tot.length l == 22);
of_list l
let test3_salt : lbytes 0 =
let l = List.Tot.map u8_from_UInt8 [] in
assert_norm (List.Tot.length l == 0);
of_list l
let test3_info : lbytes 0 =
let l = List.Tot.map u8_from_UInt8 [] in
assert_norm (List.Tot.length l == 0);
of_list l
let test3_len = 42
let test3_expected_prk : lbytes 32 =
let l = List.Tot.map u8_from_UInt8 [
0x19uy; 0xefuy; 0x24uy; 0xa3uy; 0x2cuy; 0x71uy; 0x7buy; 0x16uy;
0x7fuy; 0x33uy; 0xa9uy; 0x1duy; 0x6fuy; 0x64uy; 0x8buy; 0xdfuy;
0x96uy; 0x59uy; 0x67uy; 0x76uy; 0xafuy; 0xdbuy; 0x63uy; 0x77uy;
0xacuy; 0x43uy; 0x4cuy; 0x1cuy; 0x29uy; 0x3cuy; 0xcbuy; 0x04uy
] in
assert_norm (List.Tot.length l == 32);
of_list l
let test3_expected_okm : lbytes 42 =
let l = List.Tot.map u8_from_UInt8 [
0x8duy; 0xa4uy; 0xe7uy; 0x75uy; 0xa5uy; 0x63uy; 0xc1uy; 0x8fuy;
0x71uy; 0x5fuy; 0x80uy; 0x2auy; 0x06uy; 0x3cuy; 0x5auy; 0x31uy;
0xb8uy; 0xa1uy; 0x1fuy; 0x5cuy; 0x5euy; 0xe1uy; 0x87uy; 0x9euy;
0xc3uy; 0x45uy; 0x4euy; 0x5fuy; 0x3cuy; 0x73uy; 0x8duy; 0x2duy;
0x9duy; 0x20uy; 0x13uy; 0x95uy; 0xfauy; 0xa4uy; 0xb6uy; 0x1auy;
0x96uy; 0xc8uy
] in
assert_norm (List.Tot.length l == 42);
of_list l
noeq type vec =
| Vec :
a:Spec.Hash.Definitions.fixed_len_alg
-> salt:bytes{HMAC.keysized a (length salt)}
-> ikm:bytes{HKDF.extract_ikm_length_pred a (length ikm)}
-> expected_prk:lbytes (Spec.Hash.Definitions.hash_length a)
-> info:bytes{HKDF.expand_info_length_pred a (length info)}
-> out_len:nat{HKDF.expand_output_length_pred a out_len}
-> expected_okm:lbytes out_len -> vec
let _: squash (pow2 32 < pow2 61 /\ pow2 32 < pow2 125) =
Math.Lemmas.pow2_lt_compat 61 32;
Math.Lemmas.pow2_lt_compat 125 32 | false | true | Spec.HKDF.Test.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 test_vectors:list vec | [] | Spec.HKDF.Test.test_vectors | {
"file_name": "specs/tests/Spec.HKDF.Test.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.list Spec.HKDF.Test.vec | {
"end_col": 66,
"end_line": 230,
"start_col": 29,
"start_line": 224
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": 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 finish_ k (acc, r) =
Spec.Poly1305.poly1305_finish k acc | let finish_ k (acc, r) = | false | null | false | Spec.Poly1305.poly1305_finish k acc | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
"total"
] | [
"Spec.Poly1305.key",
"FStar.Pervasives.Native.tuple2",
"Spec.Poly1305.felem",
"Spec.Poly1305.poly1305_finish",
"Spec.Poly1305.tag"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// =======================================
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Hacl.Impl.Poly1305.Fields
/// An instance of the stateful type class for poly1305 state
/// =========================================================
///
/// We use a custom view that separates r and acc, to respect abstraction boundaries established by Poly1305.
#set-options "--fuel 0 --ifuel 1 --z3rlimit 100"
inline_for_extraction noextract
let t (fs : field_spec) = b:B.buffer (limb fs) { B.length b == 25 }
inline_for_extraction noextract
let as_raw (#fs : field_spec) (x: t fs): B.buffer (limb fs) = x
inline_for_extraction noextract
let as_lib (#fs : field_spec) (x: t fs): P.poly1305_ctx fs =
assert (Lib.IntTypes.(v (add #U32 (nlimb fs) (precomplen fs))) == 25);
x
inline_for_extraction noextract
let poly1305_key = I.stateful_buffer uint8 32ul (Lib.IntTypes.u8 0) unit
inline_for_extraction noextract
let as_lib_k (x: B.buffer uint8 { B.length x = 32 }): Lib.Buffer.lbuffer uint8 32ul =
x
inline_for_extraction noextract
let num_lanes (fs : field_spec) : F32xN.lanes =
match fs with
| M32 -> 1
| M128 -> 2
| M256 -> 4
inline_for_extraction noextract
let stateful_poly1305_ctx (fs : field_spec) : I.stateful unit =
I.Stateful
(fun () -> t fs)
(fun #_ _ s -> B.loc_addr_of_buffer (as_raw s))
(fun #_ _ s -> B.freeable (as_raw s))
(fun #_ h s -> B.live h (as_raw s) /\ P.state_inv_t h (as_lib s))
(fun () -> Spec.Poly1305.felem & Spec.Poly1305.felem)
(fun () h s -> P.as_get_acc h (as_lib s), P.as_get_r h (as_lib s))
(fun #_ _ _ -> ())
(fun #_ l s h0 h1 ->
P.reveal_ctx_inv (as_lib s) h0 h1;
B.modifies_buffer_elim (as_raw s) l h0 h1)
(fun #_ _ _ _ _ -> ())
(fun () ->
[@inline_let]
let n = num_lanes fs in
let r = B.alloca (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun () r ->
[@inline_let]
let n = num_lanes fs in
let r = B.malloc r (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun _ s -> B.free s)
(fun _ src dst ->
let h0 = ST.get () in
B.blit src 0ul dst 0ul 25ul;
let h1 = ST.get () in
P.reveal_ctx_inv' (as_lib src) (as_lib dst) h0 h1)
/// Interlude for spec equivalence proofs
/// =====================================
///
/// A quick explanation about this proof of equivalence. At the spec level,
/// ``poly1305_update`` needs both ``r`` and the accumulator ``acc``. This thus
/// makes poly1305 update a function of two arguments. However, the streaming
/// facility is constructed over specifications that take one single argument.
/// Not a problem! We carry the pair ``(r, acc)`` as our "streaming functor
/// accumulator", and we now have to show that a specification in terms of
/// ``update (update (r, acc) init)`` is the same as poly1305. For that, we need
/// to do a little proof of equivalence to show first that this is the same as
/// ``(update r) ((update r) acc)`` (note that the update function now becomes a
/// partial application), then use the update-multi-repeat conversion lemma to
/// get the original specification of poly1305.
inline_for_extraction noextract
let block = (block: S.seq uint8 { S.length block = Spec.Poly1305.size_block })
inline_for_extraction noextract
let update_ (acc, r) (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc, r
/// Same as [update_], but with the input not necessarily a full block (can be smaller)
inline_for_extraction noextract
let update__ (acc, r) (input: S.seq uint8{S.length input <= Spec.Poly1305.size_block}) =
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r
inline_for_extraction noextract
let update' r acc (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc
inline_for_extraction noextract
let update_multi =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block update_
inline_for_extraction noextract
let update_multi' r =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block (update' r)
#push-options "--fuel 1"
inline_for_extraction noextract
let rec with_or_without_r (acc r: Spec.Poly1305.felem) (blocks: S.seq uint8):
Lemma
(requires
S.length blocks % Spec.Poly1305.size_block = 0)
(ensures
update_multi (acc, r) blocks == (update_multi' r acc blocks, r))
(decreases (S.length blocks))
=
if S.length blocks = 0 then
()
else
let block, rem = Lib.UpdateMulti.split_block Spec.Poly1305.size_block blocks 1 in
let acc = update' r acc block in
with_or_without_r acc r rem
#pop-options
inline_for_extraction noextract
let update_last (acc, r) (input: S.seq uint8 { S.length input <= Spec.Poly1305.size_block }) =
if S.length input = 0 then
acc, r
else
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r
inline_for_extraction noextract
let update_last' r acc (input: S.seq uint8 { S.length input <= Spec.Poly1305.size_block }) =
if S.length input = 0 then
acc
else
Spec.Poly1305.poly1305_update1 r (S.length input) input acc
inline_for_extraction noextract | false | false | Hacl.Streaming.Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val finish_ : k: Spec.Poly1305.key -> _: (Spec.Poly1305.felem * _) -> Spec.Poly1305.tag | [] | Hacl.Streaming.Poly1305.finish_ | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | k: Spec.Poly1305.key -> _: (Spec.Poly1305.felem * _) -> Spec.Poly1305.tag | {
"end_col": 37,
"end_line": 170,
"start_col": 2,
"start_line": 170
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": 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 spec k input =
Spec.Poly1305.poly1305_mac input k | let spec k input = | false | null | false | Spec.Poly1305.poly1305_mac input k | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
"total"
] | [
"Spec.Poly1305.key",
"Lib.ByteSequence.bytes",
"Spec.Poly1305.poly1305_mac",
"Spec.Poly1305.tag"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// =======================================
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Hacl.Impl.Poly1305.Fields
/// An instance of the stateful type class for poly1305 state
/// =========================================================
///
/// We use a custom view that separates r and acc, to respect abstraction boundaries established by Poly1305.
#set-options "--fuel 0 --ifuel 1 --z3rlimit 100"
inline_for_extraction noextract
let t (fs : field_spec) = b:B.buffer (limb fs) { B.length b == 25 }
inline_for_extraction noextract
let as_raw (#fs : field_spec) (x: t fs): B.buffer (limb fs) = x
inline_for_extraction noextract
let as_lib (#fs : field_spec) (x: t fs): P.poly1305_ctx fs =
assert (Lib.IntTypes.(v (add #U32 (nlimb fs) (precomplen fs))) == 25);
x
inline_for_extraction noextract
let poly1305_key = I.stateful_buffer uint8 32ul (Lib.IntTypes.u8 0) unit
inline_for_extraction noextract
let as_lib_k (x: B.buffer uint8 { B.length x = 32 }): Lib.Buffer.lbuffer uint8 32ul =
x
inline_for_extraction noextract
let num_lanes (fs : field_spec) : F32xN.lanes =
match fs with
| M32 -> 1
| M128 -> 2
| M256 -> 4
inline_for_extraction noextract
let stateful_poly1305_ctx (fs : field_spec) : I.stateful unit =
I.Stateful
(fun () -> t fs)
(fun #_ _ s -> B.loc_addr_of_buffer (as_raw s))
(fun #_ _ s -> B.freeable (as_raw s))
(fun #_ h s -> B.live h (as_raw s) /\ P.state_inv_t h (as_lib s))
(fun () -> Spec.Poly1305.felem & Spec.Poly1305.felem)
(fun () h s -> P.as_get_acc h (as_lib s), P.as_get_r h (as_lib s))
(fun #_ _ _ -> ())
(fun #_ l s h0 h1 ->
P.reveal_ctx_inv (as_lib s) h0 h1;
B.modifies_buffer_elim (as_raw s) l h0 h1)
(fun #_ _ _ _ _ -> ())
(fun () ->
[@inline_let]
let n = num_lanes fs in
let r = B.alloca (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun () r ->
[@inline_let]
let n = num_lanes fs in
let r = B.malloc r (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun _ s -> B.free s)
(fun _ src dst ->
let h0 = ST.get () in
B.blit src 0ul dst 0ul 25ul;
let h1 = ST.get () in
P.reveal_ctx_inv' (as_lib src) (as_lib dst) h0 h1)
/// Interlude for spec equivalence proofs
/// =====================================
///
/// A quick explanation about this proof of equivalence. At the spec level,
/// ``poly1305_update`` needs both ``r`` and the accumulator ``acc``. This thus
/// makes poly1305 update a function of two arguments. However, the streaming
/// facility is constructed over specifications that take one single argument.
/// Not a problem! We carry the pair ``(r, acc)`` as our "streaming functor
/// accumulator", and we now have to show that a specification in terms of
/// ``update (update (r, acc) init)`` is the same as poly1305. For that, we need
/// to do a little proof of equivalence to show first that this is the same as
/// ``(update r) ((update r) acc)`` (note that the update function now becomes a
/// partial application), then use the update-multi-repeat conversion lemma to
/// get the original specification of poly1305.
inline_for_extraction noextract
let block = (block: S.seq uint8 { S.length block = Spec.Poly1305.size_block })
inline_for_extraction noextract
let update_ (acc, r) (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc, r
/// Same as [update_], but with the input not necessarily a full block (can be smaller)
inline_for_extraction noextract
let update__ (acc, r) (input: S.seq uint8{S.length input <= Spec.Poly1305.size_block}) =
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r
inline_for_extraction noextract
let update' r acc (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc
inline_for_extraction noextract
let update_multi =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block update_
inline_for_extraction noextract
let update_multi' r =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block (update' r)
#push-options "--fuel 1"
inline_for_extraction noextract
let rec with_or_without_r (acc r: Spec.Poly1305.felem) (blocks: S.seq uint8):
Lemma
(requires
S.length blocks % Spec.Poly1305.size_block = 0)
(ensures
update_multi (acc, r) blocks == (update_multi' r acc blocks, r))
(decreases (S.length blocks))
=
if S.length blocks = 0 then
()
else
let block, rem = Lib.UpdateMulti.split_block Spec.Poly1305.size_block blocks 1 in
let acc = update' r acc block in
with_or_without_r acc r rem
#pop-options
inline_for_extraction noextract
let update_last (acc, r) (input: S.seq uint8 { S.length input <= Spec.Poly1305.size_block }) =
if S.length input = 0 then
acc, r
else
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r
inline_for_extraction noextract
let update_last' r acc (input: S.seq uint8 { S.length input <= Spec.Poly1305.size_block }) =
if S.length input = 0 then
acc
else
Spec.Poly1305.poly1305_update1 r (S.length input) input acc
inline_for_extraction noextract
let finish_ k (acc, r) =
Spec.Poly1305.poly1305_finish k acc
inline_for_extraction noextract | false | true | Hacl.Streaming.Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val spec : k: Spec.Poly1305.key -> input: Lib.ByteSequence.bytes -> Spec.Poly1305.tag | [] | Hacl.Streaming.Poly1305.spec | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | k: Spec.Poly1305.key -> input: Lib.ByteSequence.bytes -> Spec.Poly1305.tag | {
"end_col": 36,
"end_line": 174,
"start_col": 2,
"start_line": 174
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": 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 uint32 = Lib.IntTypes.uint32 | let uint32 = | false | null | false | Lib.IntTypes.uint32 | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
"total"
] | [
"Lib.IntTypes.uint32"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// =======================================
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8 | false | true | Hacl.Streaming.Poly1305.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": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val uint32 : Type0 | [] | Hacl.Streaming.Poly1305.uint32 | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 32,
"end_line": 25,
"start_col": 13,
"start_line": 25
} |
|
Prims.Tot | val as_raw (#fs: field_spec) (x: t fs) : B.buffer (limb fs) | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": 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 as_raw (#fs : field_spec) (x: t fs): B.buffer (limb fs) = x | val as_raw (#fs: field_spec) (x: t fs) : B.buffer (limb fs)
let as_raw (#fs: field_spec) (x: t fs) : B.buffer (limb fs) = | false | null | false | x | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
"total"
] | [
"Hacl.Impl.Poly1305.Fields.field_spec",
"Hacl.Streaming.Poly1305.t",
"LowStar.Buffer.buffer",
"Hacl.Impl.Poly1305.Fields.limb"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// =======================================
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Hacl.Impl.Poly1305.Fields
/// An instance of the stateful type class for poly1305 state
/// =========================================================
///
/// We use a custom view that separates r and acc, to respect abstraction boundaries established by Poly1305.
#set-options "--fuel 0 --ifuel 1 --z3rlimit 100"
inline_for_extraction noextract
let t (fs : field_spec) = b:B.buffer (limb fs) { B.length b == 25 } | false | false | Hacl.Streaming.Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val as_raw (#fs: field_spec) (x: t fs) : B.buffer (limb fs) | [] | Hacl.Streaming.Poly1305.as_raw | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Hacl.Streaming.Poly1305.t fs -> LowStar.Buffer.buffer (Hacl.Impl.Poly1305.Fields.limb fs) | {
"end_col": 63,
"end_line": 40,
"start_col": 62,
"start_line": 40
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": 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 t (fs : field_spec) = b:B.buffer (limb fs) { B.length b == 25 } | let t (fs: field_spec) = | false | null | false | b: B.buffer (limb fs) {B.length b == 25} | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
"total"
] | [
"Hacl.Impl.Poly1305.Fields.field_spec",
"LowStar.Buffer.buffer",
"Hacl.Impl.Poly1305.Fields.limb",
"Prims.eq2",
"Prims.int",
"LowStar.Monotonic.Buffer.length",
"LowStar.Buffer.trivial_preorder"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// =======================================
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Hacl.Impl.Poly1305.Fields
/// An instance of the stateful type class for poly1305 state
/// =========================================================
///
/// We use a custom view that separates r and acc, to respect abstraction boundaries established by Poly1305.
#set-options "--fuel 0 --ifuel 1 --z3rlimit 100" | false | true | Hacl.Streaming.Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val t : fs: Hacl.Impl.Poly1305.Fields.field_spec -> Type0 | [] | Hacl.Streaming.Poly1305.t | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | fs: Hacl.Impl.Poly1305.Fields.field_spec -> Type0 | {
"end_col": 67,
"end_line": 37,
"start_col": 26,
"start_line": 37
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": 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 uint8 = Lib.IntTypes.uint8 | let uint8 = | false | null | false | Lib.IntTypes.uint8 | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
"total"
] | [
"Lib.IntTypes.uint8"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// ======================================= | false | true | Hacl.Streaming.Poly1305.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": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val uint8 : Type0 | [] | Hacl.Streaming.Poly1305.uint8 | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 30,
"end_line": 22,
"start_col": 12,
"start_line": 22
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let update' r acc (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc | let update' r acc (block: block) = | false | null | false | Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
"total"
] | [
"Spec.Poly1305.felem",
"Hacl.Streaming.Poly1305.block",
"Spec.Poly1305.poly1305_update1",
"Spec.Poly1305.size_block"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// =======================================
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Hacl.Impl.Poly1305.Fields
/// An instance of the stateful type class for poly1305 state
/// =========================================================
///
/// We use a custom view that separates r and acc, to respect abstraction boundaries established by Poly1305.
#set-options "--fuel 0 --ifuel 1 --z3rlimit 100"
inline_for_extraction noextract
let t (fs : field_spec) = b:B.buffer (limb fs) { B.length b == 25 }
inline_for_extraction noextract
let as_raw (#fs : field_spec) (x: t fs): B.buffer (limb fs) = x
inline_for_extraction noextract
let as_lib (#fs : field_spec) (x: t fs): P.poly1305_ctx fs =
assert (Lib.IntTypes.(v (add #U32 (nlimb fs) (precomplen fs))) == 25);
x
inline_for_extraction noextract
let poly1305_key = I.stateful_buffer uint8 32ul (Lib.IntTypes.u8 0) unit
inline_for_extraction noextract
let as_lib_k (x: B.buffer uint8 { B.length x = 32 }): Lib.Buffer.lbuffer uint8 32ul =
x
inline_for_extraction noextract
let num_lanes (fs : field_spec) : F32xN.lanes =
match fs with
| M32 -> 1
| M128 -> 2
| M256 -> 4
inline_for_extraction noextract
let stateful_poly1305_ctx (fs : field_spec) : I.stateful unit =
I.Stateful
(fun () -> t fs)
(fun #_ _ s -> B.loc_addr_of_buffer (as_raw s))
(fun #_ _ s -> B.freeable (as_raw s))
(fun #_ h s -> B.live h (as_raw s) /\ P.state_inv_t h (as_lib s))
(fun () -> Spec.Poly1305.felem & Spec.Poly1305.felem)
(fun () h s -> P.as_get_acc h (as_lib s), P.as_get_r h (as_lib s))
(fun #_ _ _ -> ())
(fun #_ l s h0 h1 ->
P.reveal_ctx_inv (as_lib s) h0 h1;
B.modifies_buffer_elim (as_raw s) l h0 h1)
(fun #_ _ _ _ _ -> ())
(fun () ->
[@inline_let]
let n = num_lanes fs in
let r = B.alloca (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun () r ->
[@inline_let]
let n = num_lanes fs in
let r = B.malloc r (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun _ s -> B.free s)
(fun _ src dst ->
let h0 = ST.get () in
B.blit src 0ul dst 0ul 25ul;
let h1 = ST.get () in
P.reveal_ctx_inv' (as_lib src) (as_lib dst) h0 h1)
/// Interlude for spec equivalence proofs
/// =====================================
///
/// A quick explanation about this proof of equivalence. At the spec level,
/// ``poly1305_update`` needs both ``r`` and the accumulator ``acc``. This thus
/// makes poly1305 update a function of two arguments. However, the streaming
/// facility is constructed over specifications that take one single argument.
/// Not a problem! We carry the pair ``(r, acc)`` as our "streaming functor
/// accumulator", and we now have to show that a specification in terms of
/// ``update (update (r, acc) init)`` is the same as poly1305. For that, we need
/// to do a little proof of equivalence to show first that this is the same as
/// ``(update r) ((update r) acc)`` (note that the update function now becomes a
/// partial application), then use the update-multi-repeat conversion lemma to
/// get the original specification of poly1305.
inline_for_extraction noextract
let block = (block: S.seq uint8 { S.length block = Spec.Poly1305.size_block })
inline_for_extraction noextract
let update_ (acc, r) (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc, r
/// Same as [update_], but with the input not necessarily a full block (can be smaller)
inline_for_extraction noextract
let update__ (acc, r) (input: S.seq uint8{S.length input <= Spec.Poly1305.size_block}) =
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r
inline_for_extraction noextract | false | true | Hacl.Streaming.Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val update' : r: Spec.Poly1305.felem -> acc: Spec.Poly1305.felem -> block: Hacl.Streaming.Poly1305.block
-> Spec.Poly1305.felem | [] | Hacl.Streaming.Poly1305.update' | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | r: Spec.Poly1305.felem -> acc: Spec.Poly1305.felem -> block: Hacl.Streaming.Poly1305.block
-> Spec.Poly1305.felem | {
"end_col": 69,
"end_line": 126,
"start_col": 2,
"start_line": 126
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let poly1305_key = I.stateful_buffer uint8 32ul (Lib.IntTypes.u8 0) unit | let poly1305_key = | false | null | false | I.stateful_buffer uint8 32ul (Lib.IntTypes.u8 0) unit | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
"total"
] | [
"Hacl.Streaming.Interface.stateful_buffer",
"Hacl.Streaming.Poly1305.uint8",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.u8",
"Prims.unit"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// =======================================
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Hacl.Impl.Poly1305.Fields
/// An instance of the stateful type class for poly1305 state
/// =========================================================
///
/// We use a custom view that separates r and acc, to respect abstraction boundaries established by Poly1305.
#set-options "--fuel 0 --ifuel 1 --z3rlimit 100"
inline_for_extraction noextract
let t (fs : field_spec) = b:B.buffer (limb fs) { B.length b == 25 }
inline_for_extraction noextract
let as_raw (#fs : field_spec) (x: t fs): B.buffer (limb fs) = x
inline_for_extraction noextract
let as_lib (#fs : field_spec) (x: t fs): P.poly1305_ctx fs =
assert (Lib.IntTypes.(v (add #U32 (nlimb fs) (precomplen fs))) == 25);
x | false | true | Hacl.Streaming.Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val poly1305_key : Hacl.Streaming.Interface.stateful Prims.unit | [] | Hacl.Streaming.Poly1305.poly1305_key | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Streaming.Interface.stateful Prims.unit | {
"end_col": 72,
"end_line": 48,
"start_col": 19,
"start_line": 48
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let update_ (acc, r) (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc, r | let update_ (acc, r) (block: block) = | false | null | false | Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc, r | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
"total"
] | [
"FStar.Pervasives.Native.tuple2",
"Spec.Poly1305.felem",
"Hacl.Streaming.Poly1305.block",
"FStar.Pervasives.Native.Mktuple2",
"Spec.Poly1305.poly1305_update1",
"Spec.Poly1305.size_block"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// =======================================
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Hacl.Impl.Poly1305.Fields
/// An instance of the stateful type class for poly1305 state
/// =========================================================
///
/// We use a custom view that separates r and acc, to respect abstraction boundaries established by Poly1305.
#set-options "--fuel 0 --ifuel 1 --z3rlimit 100"
inline_for_extraction noextract
let t (fs : field_spec) = b:B.buffer (limb fs) { B.length b == 25 }
inline_for_extraction noextract
let as_raw (#fs : field_spec) (x: t fs): B.buffer (limb fs) = x
inline_for_extraction noextract
let as_lib (#fs : field_spec) (x: t fs): P.poly1305_ctx fs =
assert (Lib.IntTypes.(v (add #U32 (nlimb fs) (precomplen fs))) == 25);
x
inline_for_extraction noextract
let poly1305_key = I.stateful_buffer uint8 32ul (Lib.IntTypes.u8 0) unit
inline_for_extraction noextract
let as_lib_k (x: B.buffer uint8 { B.length x = 32 }): Lib.Buffer.lbuffer uint8 32ul =
x
inline_for_extraction noextract
let num_lanes (fs : field_spec) : F32xN.lanes =
match fs with
| M32 -> 1
| M128 -> 2
| M256 -> 4
inline_for_extraction noextract
let stateful_poly1305_ctx (fs : field_spec) : I.stateful unit =
I.Stateful
(fun () -> t fs)
(fun #_ _ s -> B.loc_addr_of_buffer (as_raw s))
(fun #_ _ s -> B.freeable (as_raw s))
(fun #_ h s -> B.live h (as_raw s) /\ P.state_inv_t h (as_lib s))
(fun () -> Spec.Poly1305.felem & Spec.Poly1305.felem)
(fun () h s -> P.as_get_acc h (as_lib s), P.as_get_r h (as_lib s))
(fun #_ _ _ -> ())
(fun #_ l s h0 h1 ->
P.reveal_ctx_inv (as_lib s) h0 h1;
B.modifies_buffer_elim (as_raw s) l h0 h1)
(fun #_ _ _ _ _ -> ())
(fun () ->
[@inline_let]
let n = num_lanes fs in
let r = B.alloca (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun () r ->
[@inline_let]
let n = num_lanes fs in
let r = B.malloc r (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun _ s -> B.free s)
(fun _ src dst ->
let h0 = ST.get () in
B.blit src 0ul dst 0ul 25ul;
let h1 = ST.get () in
P.reveal_ctx_inv' (as_lib src) (as_lib dst) h0 h1)
/// Interlude for spec equivalence proofs
/// =====================================
///
/// A quick explanation about this proof of equivalence. At the spec level,
/// ``poly1305_update`` needs both ``r`` and the accumulator ``acc``. This thus
/// makes poly1305 update a function of two arguments. However, the streaming
/// facility is constructed over specifications that take one single argument.
/// Not a problem! We carry the pair ``(r, acc)`` as our "streaming functor
/// accumulator", and we now have to show that a specification in terms of
/// ``update (update (r, acc) init)`` is the same as poly1305. For that, we need
/// to do a little proof of equivalence to show first that this is the same as
/// ``(update r) ((update r) acc)`` (note that the update function now becomes a
/// partial application), then use the update-multi-repeat conversion lemma to
/// get the original specification of poly1305.
inline_for_extraction noextract
let block = (block: S.seq uint8 { S.length block = Spec.Poly1305.size_block })
inline_for_extraction noextract | false | true | Hacl.Streaming.Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val update_ : _: (Spec.Poly1305.felem * Spec.Poly1305.felem) -> block: Hacl.Streaming.Poly1305.block
-> Spec.Poly1305.felem * Spec.Poly1305.felem | [] | Hacl.Streaming.Poly1305.update_ | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | _: (Spec.Poly1305.felem * Spec.Poly1305.felem) -> block: Hacl.Streaming.Poly1305.block
-> Spec.Poly1305.felem * Spec.Poly1305.felem | {
"end_col": 72,
"end_line": 117,
"start_col": 2,
"start_line": 117
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let block = (block: S.seq uint8 { S.length block = Spec.Poly1305.size_block }) | let block = | false | null | false | (block: S.seq uint8 {S.length block = Spec.Poly1305.size_block}) | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
"total"
] | [
"FStar.Seq.Base.seq",
"Hacl.Streaming.Poly1305.uint8",
"Prims.b2t",
"Prims.op_Equality",
"Prims.nat",
"FStar.Seq.Base.length",
"Spec.Poly1305.size_block"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// =======================================
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Hacl.Impl.Poly1305.Fields
/// An instance of the stateful type class for poly1305 state
/// =========================================================
///
/// We use a custom view that separates r and acc, to respect abstraction boundaries established by Poly1305.
#set-options "--fuel 0 --ifuel 1 --z3rlimit 100"
inline_for_extraction noextract
let t (fs : field_spec) = b:B.buffer (limb fs) { B.length b == 25 }
inline_for_extraction noextract
let as_raw (#fs : field_spec) (x: t fs): B.buffer (limb fs) = x
inline_for_extraction noextract
let as_lib (#fs : field_spec) (x: t fs): P.poly1305_ctx fs =
assert (Lib.IntTypes.(v (add #U32 (nlimb fs) (precomplen fs))) == 25);
x
inline_for_extraction noextract
let poly1305_key = I.stateful_buffer uint8 32ul (Lib.IntTypes.u8 0) unit
inline_for_extraction noextract
let as_lib_k (x: B.buffer uint8 { B.length x = 32 }): Lib.Buffer.lbuffer uint8 32ul =
x
inline_for_extraction noextract
let num_lanes (fs : field_spec) : F32xN.lanes =
match fs with
| M32 -> 1
| M128 -> 2
| M256 -> 4
inline_for_extraction noextract
let stateful_poly1305_ctx (fs : field_spec) : I.stateful unit =
I.Stateful
(fun () -> t fs)
(fun #_ _ s -> B.loc_addr_of_buffer (as_raw s))
(fun #_ _ s -> B.freeable (as_raw s))
(fun #_ h s -> B.live h (as_raw s) /\ P.state_inv_t h (as_lib s))
(fun () -> Spec.Poly1305.felem & Spec.Poly1305.felem)
(fun () h s -> P.as_get_acc h (as_lib s), P.as_get_r h (as_lib s))
(fun #_ _ _ -> ())
(fun #_ l s h0 h1 ->
P.reveal_ctx_inv (as_lib s) h0 h1;
B.modifies_buffer_elim (as_raw s) l h0 h1)
(fun #_ _ _ _ _ -> ())
(fun () ->
[@inline_let]
let n = num_lanes fs in
let r = B.alloca (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun () r ->
[@inline_let]
let n = num_lanes fs in
let r = B.malloc r (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun _ s -> B.free s)
(fun _ src dst ->
let h0 = ST.get () in
B.blit src 0ul dst 0ul 25ul;
let h1 = ST.get () in
P.reveal_ctx_inv' (as_lib src) (as_lib dst) h0 h1)
/// Interlude for spec equivalence proofs
/// =====================================
///
/// A quick explanation about this proof of equivalence. At the spec level,
/// ``poly1305_update`` needs both ``r`` and the accumulator ``acc``. This thus
/// makes poly1305 update a function of two arguments. However, the streaming
/// facility is constructed over specifications that take one single argument.
/// Not a problem! We carry the pair ``(r, acc)`` as our "streaming functor
/// accumulator", and we now have to show that a specification in terms of
/// ``update (update (r, acc) init)`` is the same as poly1305. For that, we need
/// to do a little proof of equivalence to show first that this is the same as
/// ``(update r) ((update r) acc)`` (note that the update function now becomes a
/// partial application), then use the update-multi-repeat conversion lemma to
/// get the original specification of poly1305. | false | true | Hacl.Streaming.Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val block : Type0 | [] | Hacl.Streaming.Poly1305.block | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 78,
"end_line": 113,
"start_col": 12,
"start_line": 113
} |
|
Prims.Pure | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let update_multi =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block update_ | let update_multi = | false | null | false | Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block update_ | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
""
] | [
"Lib.UpdateMulti.mk_update_multi",
"FStar.Pervasives.Native.tuple2",
"Spec.Poly1305.felem",
"Spec.Poly1305.size_block",
"Hacl.Streaming.Poly1305.update_"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// =======================================
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Hacl.Impl.Poly1305.Fields
/// An instance of the stateful type class for poly1305 state
/// =========================================================
///
/// We use a custom view that separates r and acc, to respect abstraction boundaries established by Poly1305.
#set-options "--fuel 0 --ifuel 1 --z3rlimit 100"
inline_for_extraction noextract
let t (fs : field_spec) = b:B.buffer (limb fs) { B.length b == 25 }
inline_for_extraction noextract
let as_raw (#fs : field_spec) (x: t fs): B.buffer (limb fs) = x
inline_for_extraction noextract
let as_lib (#fs : field_spec) (x: t fs): P.poly1305_ctx fs =
assert (Lib.IntTypes.(v (add #U32 (nlimb fs) (precomplen fs))) == 25);
x
inline_for_extraction noextract
let poly1305_key = I.stateful_buffer uint8 32ul (Lib.IntTypes.u8 0) unit
inline_for_extraction noextract
let as_lib_k (x: B.buffer uint8 { B.length x = 32 }): Lib.Buffer.lbuffer uint8 32ul =
x
inline_for_extraction noextract
let num_lanes (fs : field_spec) : F32xN.lanes =
match fs with
| M32 -> 1
| M128 -> 2
| M256 -> 4
inline_for_extraction noextract
let stateful_poly1305_ctx (fs : field_spec) : I.stateful unit =
I.Stateful
(fun () -> t fs)
(fun #_ _ s -> B.loc_addr_of_buffer (as_raw s))
(fun #_ _ s -> B.freeable (as_raw s))
(fun #_ h s -> B.live h (as_raw s) /\ P.state_inv_t h (as_lib s))
(fun () -> Spec.Poly1305.felem & Spec.Poly1305.felem)
(fun () h s -> P.as_get_acc h (as_lib s), P.as_get_r h (as_lib s))
(fun #_ _ _ -> ())
(fun #_ l s h0 h1 ->
P.reveal_ctx_inv (as_lib s) h0 h1;
B.modifies_buffer_elim (as_raw s) l h0 h1)
(fun #_ _ _ _ _ -> ())
(fun () ->
[@inline_let]
let n = num_lanes fs in
let r = B.alloca (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun () r ->
[@inline_let]
let n = num_lanes fs in
let r = B.malloc r (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun _ s -> B.free s)
(fun _ src dst ->
let h0 = ST.get () in
B.blit src 0ul dst 0ul 25ul;
let h1 = ST.get () in
P.reveal_ctx_inv' (as_lib src) (as_lib dst) h0 h1)
/// Interlude for spec equivalence proofs
/// =====================================
///
/// A quick explanation about this proof of equivalence. At the spec level,
/// ``poly1305_update`` needs both ``r`` and the accumulator ``acc``. This thus
/// makes poly1305 update a function of two arguments. However, the streaming
/// facility is constructed over specifications that take one single argument.
/// Not a problem! We carry the pair ``(r, acc)`` as our "streaming functor
/// accumulator", and we now have to show that a specification in terms of
/// ``update (update (r, acc) init)`` is the same as poly1305. For that, we need
/// to do a little proof of equivalence to show first that this is the same as
/// ``(update r) ((update r) acc)`` (note that the update function now becomes a
/// partial application), then use the update-multi-repeat conversion lemma to
/// get the original specification of poly1305.
inline_for_extraction noextract
let block = (block: S.seq uint8 { S.length block = Spec.Poly1305.size_block })
inline_for_extraction noextract
let update_ (acc, r) (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc, r
/// Same as [update_], but with the input not necessarily a full block (can be smaller)
inline_for_extraction noextract
let update__ (acc, r) (input: S.seq uint8{S.length input <= Spec.Poly1305.size_block}) =
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r
inline_for_extraction noextract
let update' r acc (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc
inline_for_extraction noextract | false | false | Hacl.Streaming.Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val update_multi : acc: (Spec.Poly1305.felem * Spec.Poly1305.felem) -> blocks: FStar.Seq.Base.seq Lib.UpdateMulti.uint8
-> Prims.Pure (Spec.Poly1305.felem * Spec.Poly1305.felem) | [] | Hacl.Streaming.Poly1305.update_multi | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | acc: (Spec.Poly1305.felem * Spec.Poly1305.felem) -> blocks: FStar.Seq.Base.seq Lib.UpdateMulti.uint8
-> Prims.Pure (Spec.Poly1305.felem * Spec.Poly1305.felem) | {
"end_col": 66,
"end_line": 130,
"start_col": 2,
"start_line": 130
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let update__ (acc, r) (input: S.seq uint8{S.length input <= Spec.Poly1305.size_block}) =
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r | let update__ (acc, r) (input: S.seq uint8 {S.length input <= Spec.Poly1305.size_block}) = | false | null | false | Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
"total"
] | [
"FStar.Pervasives.Native.tuple2",
"Spec.Poly1305.felem",
"FStar.Seq.Base.seq",
"Hacl.Streaming.Poly1305.uint8",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.Seq.Base.length",
"Spec.Poly1305.size_block",
"FStar.Pervasives.Native.Mktuple2",
"Spec.Poly1305.poly1305_update1"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// =======================================
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Hacl.Impl.Poly1305.Fields
/// An instance of the stateful type class for poly1305 state
/// =========================================================
///
/// We use a custom view that separates r and acc, to respect abstraction boundaries established by Poly1305.
#set-options "--fuel 0 --ifuel 1 --z3rlimit 100"
inline_for_extraction noextract
let t (fs : field_spec) = b:B.buffer (limb fs) { B.length b == 25 }
inline_for_extraction noextract
let as_raw (#fs : field_spec) (x: t fs): B.buffer (limb fs) = x
inline_for_extraction noextract
let as_lib (#fs : field_spec) (x: t fs): P.poly1305_ctx fs =
assert (Lib.IntTypes.(v (add #U32 (nlimb fs) (precomplen fs))) == 25);
x
inline_for_extraction noextract
let poly1305_key = I.stateful_buffer uint8 32ul (Lib.IntTypes.u8 0) unit
inline_for_extraction noextract
let as_lib_k (x: B.buffer uint8 { B.length x = 32 }): Lib.Buffer.lbuffer uint8 32ul =
x
inline_for_extraction noextract
let num_lanes (fs : field_spec) : F32xN.lanes =
match fs with
| M32 -> 1
| M128 -> 2
| M256 -> 4
inline_for_extraction noextract
let stateful_poly1305_ctx (fs : field_spec) : I.stateful unit =
I.Stateful
(fun () -> t fs)
(fun #_ _ s -> B.loc_addr_of_buffer (as_raw s))
(fun #_ _ s -> B.freeable (as_raw s))
(fun #_ h s -> B.live h (as_raw s) /\ P.state_inv_t h (as_lib s))
(fun () -> Spec.Poly1305.felem & Spec.Poly1305.felem)
(fun () h s -> P.as_get_acc h (as_lib s), P.as_get_r h (as_lib s))
(fun #_ _ _ -> ())
(fun #_ l s h0 h1 ->
P.reveal_ctx_inv (as_lib s) h0 h1;
B.modifies_buffer_elim (as_raw s) l h0 h1)
(fun #_ _ _ _ _ -> ())
(fun () ->
[@inline_let]
let n = num_lanes fs in
let r = B.alloca (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun () r ->
[@inline_let]
let n = num_lanes fs in
let r = B.malloc r (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun _ s -> B.free s)
(fun _ src dst ->
let h0 = ST.get () in
B.blit src 0ul dst 0ul 25ul;
let h1 = ST.get () in
P.reveal_ctx_inv' (as_lib src) (as_lib dst) h0 h1)
/// Interlude for spec equivalence proofs
/// =====================================
///
/// A quick explanation about this proof of equivalence. At the spec level,
/// ``poly1305_update`` needs both ``r`` and the accumulator ``acc``. This thus
/// makes poly1305 update a function of two arguments. However, the streaming
/// facility is constructed over specifications that take one single argument.
/// Not a problem! We carry the pair ``(r, acc)`` as our "streaming functor
/// accumulator", and we now have to show that a specification in terms of
/// ``update (update (r, acc) init)`` is the same as poly1305. For that, we need
/// to do a little proof of equivalence to show first that this is the same as
/// ``(update r) ((update r) acc)`` (note that the update function now becomes a
/// partial application), then use the update-multi-repeat conversion lemma to
/// get the original specification of poly1305.
inline_for_extraction noextract
let block = (block: S.seq uint8 { S.length block = Spec.Poly1305.size_block })
inline_for_extraction noextract
let update_ (acc, r) (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc, r
/// Same as [update_], but with the input not necessarily a full block (can be smaller)
inline_for_extraction noextract | false | false | Hacl.Streaming.Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val update__ : _: (Spec.Poly1305.felem * Spec.Poly1305.felem) ->
input:
FStar.Seq.Base.seq Hacl.Streaming.Poly1305.uint8
{FStar.Seq.Base.length input <= Spec.Poly1305.size_block}
-> Spec.Poly1305.felem * Spec.Poly1305.felem | [] | Hacl.Streaming.Poly1305.update__ | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
_: (Spec.Poly1305.felem * Spec.Poly1305.felem) ->
input:
FStar.Seq.Base.seq Hacl.Streaming.Poly1305.uint8
{FStar.Seq.Base.length input <= Spec.Poly1305.size_block}
-> Spec.Poly1305.felem * Spec.Poly1305.felem | {
"end_col": 64,
"end_line": 122,
"start_col": 2,
"start_line": 122
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let update_last' r acc (input: S.seq uint8 { S.length input <= Spec.Poly1305.size_block }) =
if S.length input = 0 then
acc
else
Spec.Poly1305.poly1305_update1 r (S.length input) input acc | let update_last' r acc (input: S.seq uint8 {S.length input <= Spec.Poly1305.size_block}) = | false | null | false | if S.length input = 0 then acc else Spec.Poly1305.poly1305_update1 r (S.length input) input acc | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
"total"
] | [
"Spec.Poly1305.felem",
"FStar.Seq.Base.seq",
"Hacl.Streaming.Poly1305.uint8",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.Seq.Base.length",
"Spec.Poly1305.size_block",
"Prims.op_Equality",
"Prims.int",
"Prims.bool",
"Spec.Poly1305.poly1305_update1"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// =======================================
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Hacl.Impl.Poly1305.Fields
/// An instance of the stateful type class for poly1305 state
/// =========================================================
///
/// We use a custom view that separates r and acc, to respect abstraction boundaries established by Poly1305.
#set-options "--fuel 0 --ifuel 1 --z3rlimit 100"
inline_for_extraction noextract
let t (fs : field_spec) = b:B.buffer (limb fs) { B.length b == 25 }
inline_for_extraction noextract
let as_raw (#fs : field_spec) (x: t fs): B.buffer (limb fs) = x
inline_for_extraction noextract
let as_lib (#fs : field_spec) (x: t fs): P.poly1305_ctx fs =
assert (Lib.IntTypes.(v (add #U32 (nlimb fs) (precomplen fs))) == 25);
x
inline_for_extraction noextract
let poly1305_key = I.stateful_buffer uint8 32ul (Lib.IntTypes.u8 0) unit
inline_for_extraction noextract
let as_lib_k (x: B.buffer uint8 { B.length x = 32 }): Lib.Buffer.lbuffer uint8 32ul =
x
inline_for_extraction noextract
let num_lanes (fs : field_spec) : F32xN.lanes =
match fs with
| M32 -> 1
| M128 -> 2
| M256 -> 4
inline_for_extraction noextract
let stateful_poly1305_ctx (fs : field_spec) : I.stateful unit =
I.Stateful
(fun () -> t fs)
(fun #_ _ s -> B.loc_addr_of_buffer (as_raw s))
(fun #_ _ s -> B.freeable (as_raw s))
(fun #_ h s -> B.live h (as_raw s) /\ P.state_inv_t h (as_lib s))
(fun () -> Spec.Poly1305.felem & Spec.Poly1305.felem)
(fun () h s -> P.as_get_acc h (as_lib s), P.as_get_r h (as_lib s))
(fun #_ _ _ -> ())
(fun #_ l s h0 h1 ->
P.reveal_ctx_inv (as_lib s) h0 h1;
B.modifies_buffer_elim (as_raw s) l h0 h1)
(fun #_ _ _ _ _ -> ())
(fun () ->
[@inline_let]
let n = num_lanes fs in
let r = B.alloca (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun () r ->
[@inline_let]
let n = num_lanes fs in
let r = B.malloc r (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun _ s -> B.free s)
(fun _ src dst ->
let h0 = ST.get () in
B.blit src 0ul dst 0ul 25ul;
let h1 = ST.get () in
P.reveal_ctx_inv' (as_lib src) (as_lib dst) h0 h1)
/// Interlude for spec equivalence proofs
/// =====================================
///
/// A quick explanation about this proof of equivalence. At the spec level,
/// ``poly1305_update`` needs both ``r`` and the accumulator ``acc``. This thus
/// makes poly1305 update a function of two arguments. However, the streaming
/// facility is constructed over specifications that take one single argument.
/// Not a problem! We carry the pair ``(r, acc)`` as our "streaming functor
/// accumulator", and we now have to show that a specification in terms of
/// ``update (update (r, acc) init)`` is the same as poly1305. For that, we need
/// to do a little proof of equivalence to show first that this is the same as
/// ``(update r) ((update r) acc)`` (note that the update function now becomes a
/// partial application), then use the update-multi-repeat conversion lemma to
/// get the original specification of poly1305.
inline_for_extraction noextract
let block = (block: S.seq uint8 { S.length block = Spec.Poly1305.size_block })
inline_for_extraction noextract
let update_ (acc, r) (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc, r
/// Same as [update_], but with the input not necessarily a full block (can be smaller)
inline_for_extraction noextract
let update__ (acc, r) (input: S.seq uint8{S.length input <= Spec.Poly1305.size_block}) =
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r
inline_for_extraction noextract
let update' r acc (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc
inline_for_extraction noextract
let update_multi =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block update_
inline_for_extraction noextract
let update_multi' r =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block (update' r)
#push-options "--fuel 1"
inline_for_extraction noextract
let rec with_or_without_r (acc r: Spec.Poly1305.felem) (blocks: S.seq uint8):
Lemma
(requires
S.length blocks % Spec.Poly1305.size_block = 0)
(ensures
update_multi (acc, r) blocks == (update_multi' r acc blocks, r))
(decreases (S.length blocks))
=
if S.length blocks = 0 then
()
else
let block, rem = Lib.UpdateMulti.split_block Spec.Poly1305.size_block blocks 1 in
let acc = update' r acc block in
with_or_without_r acc r rem
#pop-options
inline_for_extraction noextract
let update_last (acc, r) (input: S.seq uint8 { S.length input <= Spec.Poly1305.size_block }) =
if S.length input = 0 then
acc, r
else
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r
inline_for_extraction noextract | false | false | Hacl.Streaming.Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val update_last' : r: Spec.Poly1305.felem ->
acc: Spec.Poly1305.felem ->
input:
FStar.Seq.Base.seq Hacl.Streaming.Poly1305.uint8
{FStar.Seq.Base.length input <= Spec.Poly1305.size_block}
-> Spec.Poly1305.felem | [] | Hacl.Streaming.Poly1305.update_last' | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
r: Spec.Poly1305.felem ->
acc: Spec.Poly1305.felem ->
input:
FStar.Seq.Base.seq Hacl.Streaming.Poly1305.uint8
{FStar.Seq.Base.length input <= Spec.Poly1305.size_block}
-> Spec.Poly1305.felem | {
"end_col": 63,
"end_line": 166,
"start_col": 2,
"start_line": 163
} |
|
Prims.Tot | val num_lanes (fs: field_spec) : F32xN.lanes | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": 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 num_lanes (fs : field_spec) : F32xN.lanes =
match fs with
| M32 -> 1
| M128 -> 2
| M256 -> 4 | val num_lanes (fs: field_spec) : F32xN.lanes
let num_lanes (fs: field_spec) : F32xN.lanes = | false | null | false | match fs with
| M32 -> 1
| M128 -> 2
| M256 -> 4 | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
"total"
] | [
"Hacl.Impl.Poly1305.Fields.field_spec",
"Hacl.Spec.Poly1305.Field32xN.lanes"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// =======================================
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Hacl.Impl.Poly1305.Fields
/// An instance of the stateful type class for poly1305 state
/// =========================================================
///
/// We use a custom view that separates r and acc, to respect abstraction boundaries established by Poly1305.
#set-options "--fuel 0 --ifuel 1 --z3rlimit 100"
inline_for_extraction noextract
let t (fs : field_spec) = b:B.buffer (limb fs) { B.length b == 25 }
inline_for_extraction noextract
let as_raw (#fs : field_spec) (x: t fs): B.buffer (limb fs) = x
inline_for_extraction noextract
let as_lib (#fs : field_spec) (x: t fs): P.poly1305_ctx fs =
assert (Lib.IntTypes.(v (add #U32 (nlimb fs) (precomplen fs))) == 25);
x
inline_for_extraction noextract
let poly1305_key = I.stateful_buffer uint8 32ul (Lib.IntTypes.u8 0) unit
inline_for_extraction noextract
let as_lib_k (x: B.buffer uint8 { B.length x = 32 }): Lib.Buffer.lbuffer uint8 32ul =
x
inline_for_extraction noextract | false | true | Hacl.Streaming.Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val num_lanes (fs: field_spec) : F32xN.lanes | [] | Hacl.Streaming.Poly1305.num_lanes | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | fs: Hacl.Impl.Poly1305.Fields.field_spec -> Hacl.Spec.Poly1305.Field32xN.lanes | {
"end_col": 13,
"end_line": 59,
"start_col": 2,
"start_line": 56
} |
Prims.Pure | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let update_multi' r =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block (update' r) | let update_multi' r = | false | null | false | Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block (update' r) | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
""
] | [
"Spec.Poly1305.felem",
"Lib.UpdateMulti.mk_update_multi",
"Spec.Poly1305.size_block",
"Hacl.Streaming.Poly1305.update'",
"FStar.Seq.Base.seq",
"Lib.UpdateMulti.uint8",
"FStar.Seq.Base.length",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.op_Modulus",
"Prims.l_True"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// =======================================
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Hacl.Impl.Poly1305.Fields
/// An instance of the stateful type class for poly1305 state
/// =========================================================
///
/// We use a custom view that separates r and acc, to respect abstraction boundaries established by Poly1305.
#set-options "--fuel 0 --ifuel 1 --z3rlimit 100"
inline_for_extraction noextract
let t (fs : field_spec) = b:B.buffer (limb fs) { B.length b == 25 }
inline_for_extraction noextract
let as_raw (#fs : field_spec) (x: t fs): B.buffer (limb fs) = x
inline_for_extraction noextract
let as_lib (#fs : field_spec) (x: t fs): P.poly1305_ctx fs =
assert (Lib.IntTypes.(v (add #U32 (nlimb fs) (precomplen fs))) == 25);
x
inline_for_extraction noextract
let poly1305_key = I.stateful_buffer uint8 32ul (Lib.IntTypes.u8 0) unit
inline_for_extraction noextract
let as_lib_k (x: B.buffer uint8 { B.length x = 32 }): Lib.Buffer.lbuffer uint8 32ul =
x
inline_for_extraction noextract
let num_lanes (fs : field_spec) : F32xN.lanes =
match fs with
| M32 -> 1
| M128 -> 2
| M256 -> 4
inline_for_extraction noextract
let stateful_poly1305_ctx (fs : field_spec) : I.stateful unit =
I.Stateful
(fun () -> t fs)
(fun #_ _ s -> B.loc_addr_of_buffer (as_raw s))
(fun #_ _ s -> B.freeable (as_raw s))
(fun #_ h s -> B.live h (as_raw s) /\ P.state_inv_t h (as_lib s))
(fun () -> Spec.Poly1305.felem & Spec.Poly1305.felem)
(fun () h s -> P.as_get_acc h (as_lib s), P.as_get_r h (as_lib s))
(fun #_ _ _ -> ())
(fun #_ l s h0 h1 ->
P.reveal_ctx_inv (as_lib s) h0 h1;
B.modifies_buffer_elim (as_raw s) l h0 h1)
(fun #_ _ _ _ _ -> ())
(fun () ->
[@inline_let]
let n = num_lanes fs in
let r = B.alloca (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun () r ->
[@inline_let]
let n = num_lanes fs in
let r = B.malloc r (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun _ s -> B.free s)
(fun _ src dst ->
let h0 = ST.get () in
B.blit src 0ul dst 0ul 25ul;
let h1 = ST.get () in
P.reveal_ctx_inv' (as_lib src) (as_lib dst) h0 h1)
/// Interlude for spec equivalence proofs
/// =====================================
///
/// A quick explanation about this proof of equivalence. At the spec level,
/// ``poly1305_update`` needs both ``r`` and the accumulator ``acc``. This thus
/// makes poly1305 update a function of two arguments. However, the streaming
/// facility is constructed over specifications that take one single argument.
/// Not a problem! We carry the pair ``(r, acc)`` as our "streaming functor
/// accumulator", and we now have to show that a specification in terms of
/// ``update (update (r, acc) init)`` is the same as poly1305. For that, we need
/// to do a little proof of equivalence to show first that this is the same as
/// ``(update r) ((update r) acc)`` (note that the update function now becomes a
/// partial application), then use the update-multi-repeat conversion lemma to
/// get the original specification of poly1305.
inline_for_extraction noextract
let block = (block: S.seq uint8 { S.length block = Spec.Poly1305.size_block })
inline_for_extraction noextract
let update_ (acc, r) (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc, r
/// Same as [update_], but with the input not necessarily a full block (can be smaller)
inline_for_extraction noextract
let update__ (acc, r) (input: S.seq uint8{S.length input <= Spec.Poly1305.size_block}) =
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r
inline_for_extraction noextract
let update' r acc (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc
inline_for_extraction noextract
let update_multi =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block update_
inline_for_extraction noextract | false | false | Hacl.Streaming.Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val update_multi' : r: Spec.Poly1305.felem ->
acc: Spec.Poly1305.felem ->
blocks: FStar.Seq.Base.seq Lib.UpdateMulti.uint8
-> Prims.Pure Spec.Poly1305.felem | [] | Hacl.Streaming.Poly1305.update_multi' | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
r: Spec.Poly1305.felem ->
acc: Spec.Poly1305.felem ->
blocks: FStar.Seq.Base.seq Lib.UpdateMulti.uint8
-> Prims.Pure Spec.Poly1305.felem | {
"end_col": 70,
"end_line": 134,
"start_col": 2,
"start_line": 134
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let update_last (acc, r) (input: S.seq uint8 { S.length input <= Spec.Poly1305.size_block }) =
if S.length input = 0 then
acc, r
else
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r | let update_last (acc, r) (input: S.seq uint8 {S.length input <= Spec.Poly1305.size_block}) = | false | null | false | if S.length input = 0
then acc, r
else Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
"total"
] | [
"FStar.Pervasives.Native.tuple2",
"Spec.Poly1305.felem",
"FStar.Seq.Base.seq",
"Hacl.Streaming.Poly1305.uint8",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.Seq.Base.length",
"Spec.Poly1305.size_block",
"Prims.op_Equality",
"Prims.int",
"FStar.Pervasives.Native.Mktuple2",
"Prims.bool",
"Spec.Poly1305.poly1305_update1"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// =======================================
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Hacl.Impl.Poly1305.Fields
/// An instance of the stateful type class for poly1305 state
/// =========================================================
///
/// We use a custom view that separates r and acc, to respect abstraction boundaries established by Poly1305.
#set-options "--fuel 0 --ifuel 1 --z3rlimit 100"
inline_for_extraction noextract
let t (fs : field_spec) = b:B.buffer (limb fs) { B.length b == 25 }
inline_for_extraction noextract
let as_raw (#fs : field_spec) (x: t fs): B.buffer (limb fs) = x
inline_for_extraction noextract
let as_lib (#fs : field_spec) (x: t fs): P.poly1305_ctx fs =
assert (Lib.IntTypes.(v (add #U32 (nlimb fs) (precomplen fs))) == 25);
x
inline_for_extraction noextract
let poly1305_key = I.stateful_buffer uint8 32ul (Lib.IntTypes.u8 0) unit
inline_for_extraction noextract
let as_lib_k (x: B.buffer uint8 { B.length x = 32 }): Lib.Buffer.lbuffer uint8 32ul =
x
inline_for_extraction noextract
let num_lanes (fs : field_spec) : F32xN.lanes =
match fs with
| M32 -> 1
| M128 -> 2
| M256 -> 4
inline_for_extraction noextract
let stateful_poly1305_ctx (fs : field_spec) : I.stateful unit =
I.Stateful
(fun () -> t fs)
(fun #_ _ s -> B.loc_addr_of_buffer (as_raw s))
(fun #_ _ s -> B.freeable (as_raw s))
(fun #_ h s -> B.live h (as_raw s) /\ P.state_inv_t h (as_lib s))
(fun () -> Spec.Poly1305.felem & Spec.Poly1305.felem)
(fun () h s -> P.as_get_acc h (as_lib s), P.as_get_r h (as_lib s))
(fun #_ _ _ -> ())
(fun #_ l s h0 h1 ->
P.reveal_ctx_inv (as_lib s) h0 h1;
B.modifies_buffer_elim (as_raw s) l h0 h1)
(fun #_ _ _ _ _ -> ())
(fun () ->
[@inline_let]
let n = num_lanes fs in
let r = B.alloca (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun () r ->
[@inline_let]
let n = num_lanes fs in
let r = B.malloc r (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun _ s -> B.free s)
(fun _ src dst ->
let h0 = ST.get () in
B.blit src 0ul dst 0ul 25ul;
let h1 = ST.get () in
P.reveal_ctx_inv' (as_lib src) (as_lib dst) h0 h1)
/// Interlude for spec equivalence proofs
/// =====================================
///
/// A quick explanation about this proof of equivalence. At the spec level,
/// ``poly1305_update`` needs both ``r`` and the accumulator ``acc``. This thus
/// makes poly1305 update a function of two arguments. However, the streaming
/// facility is constructed over specifications that take one single argument.
/// Not a problem! We carry the pair ``(r, acc)`` as our "streaming functor
/// accumulator", and we now have to show that a specification in terms of
/// ``update (update (r, acc) init)`` is the same as poly1305. For that, we need
/// to do a little proof of equivalence to show first that this is the same as
/// ``(update r) ((update r) acc)`` (note that the update function now becomes a
/// partial application), then use the update-multi-repeat conversion lemma to
/// get the original specification of poly1305.
inline_for_extraction noextract
let block = (block: S.seq uint8 { S.length block = Spec.Poly1305.size_block })
inline_for_extraction noextract
let update_ (acc, r) (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc, r
/// Same as [update_], but with the input not necessarily a full block (can be smaller)
inline_for_extraction noextract
let update__ (acc, r) (input: S.seq uint8{S.length input <= Spec.Poly1305.size_block}) =
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r
inline_for_extraction noextract
let update' r acc (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc
inline_for_extraction noextract
let update_multi =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block update_
inline_for_extraction noextract
let update_multi' r =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block (update' r)
#push-options "--fuel 1"
inline_for_extraction noextract
let rec with_or_without_r (acc r: Spec.Poly1305.felem) (blocks: S.seq uint8):
Lemma
(requires
S.length blocks % Spec.Poly1305.size_block = 0)
(ensures
update_multi (acc, r) blocks == (update_multi' r acc blocks, r))
(decreases (S.length blocks))
=
if S.length blocks = 0 then
()
else
let block, rem = Lib.UpdateMulti.split_block Spec.Poly1305.size_block blocks 1 in
let acc = update' r acc block in
with_or_without_r acc r rem
#pop-options
inline_for_extraction noextract | false | false | Hacl.Streaming.Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val update_last : _: (Spec.Poly1305.felem * Spec.Poly1305.felem) ->
input:
FStar.Seq.Base.seq Hacl.Streaming.Poly1305.uint8
{FStar.Seq.Base.length input <= Spec.Poly1305.size_block}
-> Spec.Poly1305.felem * Spec.Poly1305.felem | [] | Hacl.Streaming.Poly1305.update_last | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
_: (Spec.Poly1305.felem * Spec.Poly1305.felem) ->
input:
FStar.Seq.Base.seq Hacl.Streaming.Poly1305.uint8
{FStar.Seq.Base.length input <= Spec.Poly1305.size_block}
-> Spec.Poly1305.felem * Spec.Poly1305.felem | {
"end_col": 66,
"end_line": 159,
"start_col": 2,
"start_line": 156
} |
|
Prims.Tot | val as_lib_k (x: B.buffer uint8 {B.length x = 32}) : Lib.Buffer.lbuffer uint8 32ul | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": 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 as_lib_k (x: B.buffer uint8 { B.length x = 32 }): Lib.Buffer.lbuffer uint8 32ul =
x | val as_lib_k (x: B.buffer uint8 {B.length x = 32}) : Lib.Buffer.lbuffer uint8 32ul
let as_lib_k (x: B.buffer uint8 {B.length x = 32}) : Lib.Buffer.lbuffer uint8 32ul = | false | null | false | x | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
"total"
] | [
"LowStar.Buffer.buffer",
"Hacl.Streaming.Poly1305.uint8",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"LowStar.Monotonic.Buffer.length",
"LowStar.Buffer.trivial_preorder",
"Lib.Buffer.lbuffer",
"FStar.UInt32.__uint_to_t"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// =======================================
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Hacl.Impl.Poly1305.Fields
/// An instance of the stateful type class for poly1305 state
/// =========================================================
///
/// We use a custom view that separates r and acc, to respect abstraction boundaries established by Poly1305.
#set-options "--fuel 0 --ifuel 1 --z3rlimit 100"
inline_for_extraction noextract
let t (fs : field_spec) = b:B.buffer (limb fs) { B.length b == 25 }
inline_for_extraction noextract
let as_raw (#fs : field_spec) (x: t fs): B.buffer (limb fs) = x
inline_for_extraction noextract
let as_lib (#fs : field_spec) (x: t fs): P.poly1305_ctx fs =
assert (Lib.IntTypes.(v (add #U32 (nlimb fs) (precomplen fs))) == 25);
x
inline_for_extraction noextract
let poly1305_key = I.stateful_buffer uint8 32ul (Lib.IntTypes.u8 0) unit
inline_for_extraction noextract | false | false | Hacl.Streaming.Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val as_lib_k (x: B.buffer uint8 {B.length x = 32}) : Lib.Buffer.lbuffer uint8 32ul | [] | Hacl.Streaming.Poly1305.as_lib_k | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: LowStar.Buffer.buffer Hacl.Streaming.Poly1305.uint8 {LowStar.Monotonic.Buffer.length x = 32}
-> Lib.Buffer.lbuffer Hacl.Streaming.Poly1305.uint8 32ul | {
"end_col": 3,
"end_line": 52,
"start_col": 2,
"start_line": 52
} |
FStar.Pervasives.Lemma | val update_last_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input <= Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r))) | [
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let update_last_is_update input acc r =
if S.length input = Spec.Poly1305.size_block
then update_last_block_is_update input acc r
else update_last_not_block_is_update input acc r | val update_last_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input <= Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r)))
let update_last_is_update input acc r = | false | null | true | if S.length input = Spec.Poly1305.size_block
then update_last_block_is_update input acc r
else update_last_not_block_is_update input acc r | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
"lemma"
] | [
"FStar.Seq.Base.seq",
"Hacl.Streaming.Poly1305.uint8",
"Spec.Poly1305.felem",
"Prims.op_Equality",
"Prims.nat",
"FStar.Seq.Base.length",
"Spec.Poly1305.size_block",
"Hacl.Streaming.Poly1305.update_last_block_is_update",
"Prims.bool",
"Hacl.Streaming.Poly1305.update_last_not_block_is_update",
"Prims.unit"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// =======================================
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Hacl.Impl.Poly1305.Fields
/// An instance of the stateful type class for poly1305 state
/// =========================================================
///
/// We use a custom view that separates r and acc, to respect abstraction boundaries established by Poly1305.
#set-options "--fuel 0 --ifuel 1 --z3rlimit 100"
inline_for_extraction noextract
let t (fs : field_spec) = b:B.buffer (limb fs) { B.length b == 25 }
inline_for_extraction noextract
let as_raw (#fs : field_spec) (x: t fs): B.buffer (limb fs) = x
inline_for_extraction noextract
let as_lib (#fs : field_spec) (x: t fs): P.poly1305_ctx fs =
assert (Lib.IntTypes.(v (add #U32 (nlimb fs) (precomplen fs))) == 25);
x
inline_for_extraction noextract
let poly1305_key = I.stateful_buffer uint8 32ul (Lib.IntTypes.u8 0) unit
inline_for_extraction noextract
let as_lib_k (x: B.buffer uint8 { B.length x = 32 }): Lib.Buffer.lbuffer uint8 32ul =
x
inline_for_extraction noextract
let num_lanes (fs : field_spec) : F32xN.lanes =
match fs with
| M32 -> 1
| M128 -> 2
| M256 -> 4
inline_for_extraction noextract
let stateful_poly1305_ctx (fs : field_spec) : I.stateful unit =
I.Stateful
(fun () -> t fs)
(fun #_ _ s -> B.loc_addr_of_buffer (as_raw s))
(fun #_ _ s -> B.freeable (as_raw s))
(fun #_ h s -> B.live h (as_raw s) /\ P.state_inv_t h (as_lib s))
(fun () -> Spec.Poly1305.felem & Spec.Poly1305.felem)
(fun () h s -> P.as_get_acc h (as_lib s), P.as_get_r h (as_lib s))
(fun #_ _ _ -> ())
(fun #_ l s h0 h1 ->
P.reveal_ctx_inv (as_lib s) h0 h1;
B.modifies_buffer_elim (as_raw s) l h0 h1)
(fun #_ _ _ _ _ -> ())
(fun () ->
[@inline_let]
let n = num_lanes fs in
let r = B.alloca (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun () r ->
[@inline_let]
let n = num_lanes fs in
let r = B.malloc r (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun _ s -> B.free s)
(fun _ src dst ->
let h0 = ST.get () in
B.blit src 0ul dst 0ul 25ul;
let h1 = ST.get () in
P.reveal_ctx_inv' (as_lib src) (as_lib dst) h0 h1)
/// Interlude for spec equivalence proofs
/// =====================================
///
/// A quick explanation about this proof of equivalence. At the spec level,
/// ``poly1305_update`` needs both ``r`` and the accumulator ``acc``. This thus
/// makes poly1305 update a function of two arguments. However, the streaming
/// facility is constructed over specifications that take one single argument.
/// Not a problem! We carry the pair ``(r, acc)`` as our "streaming functor
/// accumulator", and we now have to show that a specification in terms of
/// ``update (update (r, acc) init)`` is the same as poly1305. For that, we need
/// to do a little proof of equivalence to show first that this is the same as
/// ``(update r) ((update r) acc)`` (note that the update function now becomes a
/// partial application), then use the update-multi-repeat conversion lemma to
/// get the original specification of poly1305.
inline_for_extraction noextract
let block = (block: S.seq uint8 { S.length block = Spec.Poly1305.size_block })
inline_for_extraction noextract
let update_ (acc, r) (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc, r
/// Same as [update_], but with the input not necessarily a full block (can be smaller)
inline_for_extraction noextract
let update__ (acc, r) (input: S.seq uint8{S.length input <= Spec.Poly1305.size_block}) =
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r
inline_for_extraction noextract
let update' r acc (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc
inline_for_extraction noextract
let update_multi =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block update_
inline_for_extraction noextract
let update_multi' r =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block (update' r)
#push-options "--fuel 1"
inline_for_extraction noextract
let rec with_or_without_r (acc r: Spec.Poly1305.felem) (blocks: S.seq uint8):
Lemma
(requires
S.length blocks % Spec.Poly1305.size_block = 0)
(ensures
update_multi (acc, r) blocks == (update_multi' r acc blocks, r))
(decreases (S.length blocks))
=
if S.length blocks = 0 then
()
else
let block, rem = Lib.UpdateMulti.split_block Spec.Poly1305.size_block blocks 1 in
let acc = update' r acc block in
with_or_without_r acc r rem
#pop-options
inline_for_extraction noextract
let update_last (acc, r) (input: S.seq uint8 { S.length input <= Spec.Poly1305.size_block }) =
if S.length input = 0 then
acc, r
else
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r
inline_for_extraction noextract
let update_last' r acc (input: S.seq uint8 { S.length input <= Spec.Poly1305.size_block }) =
if S.length input = 0 then
acc
else
Spec.Poly1305.poly1305_update1 r (S.length input) input acc
inline_for_extraction noextract
let finish_ k (acc, r) =
Spec.Poly1305.poly1305_finish k acc
inline_for_extraction noextract
let spec k input =
Spec.Poly1305.poly1305_mac input k
val update_last_not_block_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input < Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r)))
let update_last_not_block_is_update input acc r =
let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
calc (==) {
update_last (acc, r) input;
(==) { }
update_last' r acc input, r;
(==) { Lib.UpdateMulti.update_multi_zero Spec.Poly1305.size_block (update' r) acc }
update_last' r (update_multi' r acc S.empty) input, r;
(==) { update_full_is_repeat_blocks block_length (update' r) (update_last' r) acc input input }
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc, r;
(==) { Lib.Sequence.Lemmas.repeat_blocks_extensionality block_length input
(repeat_f block_length (update' r))
Spec.Poly1305.(poly1305_update1 r size_block)
(repeat_l block_length (update_last' r) input)
Spec.Poly1305.(poly1305_update_last r)
acc
}
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
Spec.Poly1305.(poly1305_update1 r size_block)
Spec.Poly1305.(poly1305_update_last r)
acc, r;
}
val update_last_block_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input = Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r)))
open FStar.Tactics
#push-options "--fuel 1 --print_implicits"
let update_last_block_is_update input acc r =
let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
assert(input `S.equal` S.append input S.empty);
let acc1 = update' r acc input in
let acc1' = update_multi' r acc input in
// SH: fun fact: this lemma call and the following assert should be the
// last part of the below calc. However, if put below/inside the calc,
// the proof loops.
Lib.Sequence.Lemmas.repeat_blocks_extensionality block_length input
(repeat_f block_length (update' r))
Spec.Poly1305.(poly1305_update1 r size_block)
(repeat_l block_length (update_last' r) input)
Spec.Poly1305.(poly1305_update_last r)
acc;
assert(
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc ==
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
Spec.Poly1305.(poly1305_update1 r size_block)
Spec.Poly1305.(poly1305_update_last r)
acc);
assert(
let block, rem = Lib.UpdateMulti.split_block block_length input 1 in
block `S.equal` input /\ rem `S.equal` S.empty);
assert(
Lib.UpdateMulti.mk_update_multi block_length (update' r) acc1 S.empty ==
acc1');
assert(acc1 == acc1');
calc (==) {
update_last (acc, r) input;
(==) { }
update_last' r acc input, r;
(==) { }
update_last' r (update' r acc input) S.empty, r;
(==) { }
update_last' r (update_multi' r acc input) S.empty, r;
(==) { update_full_is_repeat_blocks block_length (update' r) (update_last' r) acc input input }
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc, r;
}
#pop-options
val update_last_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input <= Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r))) | false | false | Hacl.Streaming.Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val update_last_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input <= Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r))) | [] | Hacl.Streaming.Poly1305.update_last_is_update | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
input: FStar.Seq.Base.seq Hacl.Streaming.Poly1305.uint8 ->
acc: Spec.Poly1305.felem ->
r: Spec.Poly1305.felem
-> FStar.Pervasives.Lemma (requires FStar.Seq.Base.length input <= Spec.Poly1305.size_block)
(ensures
Hacl.Streaming.Poly1305.update_last (acc, r) input ==
FStar.Pervasives.Native.Mktuple2 (Spec.Poly1305.poly1305_update input acc r) r) | {
"end_col": 50,
"end_line": 282,
"start_col": 2,
"start_line": 280
} |
Prims.Tot | val as_lib (#fs: field_spec) (x: t fs) : P.poly1305_ctx fs | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": 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 as_lib (#fs : field_spec) (x: t fs): P.poly1305_ctx fs =
assert (Lib.IntTypes.(v (add #U32 (nlimb fs) (precomplen fs))) == 25);
x | val as_lib (#fs: field_spec) (x: t fs) : P.poly1305_ctx fs
let as_lib (#fs: field_spec) (x: t fs) : P.poly1305_ctx fs = | false | null | false | assert (Lib.IntTypes.(v (add #U32 (nlimb fs) (precomplen fs))) == 25);
x | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
"total"
] | [
"Hacl.Impl.Poly1305.Fields.field_spec",
"Hacl.Streaming.Poly1305.t",
"Prims.unit",
"Prims._assert",
"Prims.eq2",
"Prims.int",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.IntTypes.add",
"Hacl.Impl.Poly1305.Fields.nlimb",
"Hacl.Impl.Poly1305.Fields.precomplen",
"Hacl.Impl.Poly1305.poly1305_ctx"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// =======================================
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Hacl.Impl.Poly1305.Fields
/// An instance of the stateful type class for poly1305 state
/// =========================================================
///
/// We use a custom view that separates r and acc, to respect abstraction boundaries established by Poly1305.
#set-options "--fuel 0 --ifuel 1 --z3rlimit 100"
inline_for_extraction noextract
let t (fs : field_spec) = b:B.buffer (limb fs) { B.length b == 25 }
inline_for_extraction noextract
let as_raw (#fs : field_spec) (x: t fs): B.buffer (limb fs) = x
inline_for_extraction noextract | false | false | Hacl.Streaming.Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val as_lib (#fs: field_spec) (x: t fs) : P.poly1305_ctx fs | [] | Hacl.Streaming.Poly1305.as_lib | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Hacl.Streaming.Poly1305.t fs -> Hacl.Impl.Poly1305.poly1305_ctx fs | {
"end_col": 3,
"end_line": 45,
"start_col": 2,
"start_line": 44
} |
FStar.Pervasives.Lemma | val with_or_without_r (acc r: Spec.Poly1305.felem) (blocks: S.seq uint8)
: Lemma (requires S.length blocks % Spec.Poly1305.size_block = 0)
(ensures update_multi (acc, r) blocks == (update_multi' r acc blocks, r))
(decreases (S.length blocks)) | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": 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 with_or_without_r (acc r: Spec.Poly1305.felem) (blocks: S.seq uint8):
Lemma
(requires
S.length blocks % Spec.Poly1305.size_block = 0)
(ensures
update_multi (acc, r) blocks == (update_multi' r acc blocks, r))
(decreases (S.length blocks))
=
if S.length blocks = 0 then
()
else
let block, rem = Lib.UpdateMulti.split_block Spec.Poly1305.size_block blocks 1 in
let acc = update' r acc block in
with_or_without_r acc r rem | val with_or_without_r (acc r: Spec.Poly1305.felem) (blocks: S.seq uint8)
: Lemma (requires S.length blocks % Spec.Poly1305.size_block = 0)
(ensures update_multi (acc, r) blocks == (update_multi' r acc blocks, r))
(decreases (S.length blocks))
let rec with_or_without_r (acc r: Spec.Poly1305.felem) (blocks: S.seq uint8)
: Lemma (requires S.length blocks % Spec.Poly1305.size_block = 0)
(ensures update_multi (acc, r) blocks == (update_multi' r acc blocks, r))
(decreases (S.length blocks)) = | false | null | true | if S.length blocks = 0
then ()
else
let block, rem = Lib.UpdateMulti.split_block Spec.Poly1305.size_block blocks 1 in
let acc = update' r acc block in
with_or_without_r acc r rem | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
"lemma",
""
] | [
"Spec.Poly1305.felem",
"FStar.Seq.Base.seq",
"Hacl.Streaming.Poly1305.uint8",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.bool",
"Lib.UpdateMulti.uint8",
"Hacl.Streaming.Poly1305.with_or_without_r",
"Hacl.Streaming.Poly1305.update'",
"Prims.unit",
"FStar.Pervasives.Native.tuple2",
"Lib.UpdateMulti.split_block",
"Spec.Poly1305.size_block",
"Prims.b2t",
"Prims.op_Modulus",
"Prims.squash",
"Prims.eq2",
"Hacl.Streaming.Poly1305.update_multi",
"FStar.Pervasives.Native.Mktuple2",
"Hacl.Streaming.Poly1305.update_multi'",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// =======================================
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Hacl.Impl.Poly1305.Fields
/// An instance of the stateful type class for poly1305 state
/// =========================================================
///
/// We use a custom view that separates r and acc, to respect abstraction boundaries established by Poly1305.
#set-options "--fuel 0 --ifuel 1 --z3rlimit 100"
inline_for_extraction noextract
let t (fs : field_spec) = b:B.buffer (limb fs) { B.length b == 25 }
inline_for_extraction noextract
let as_raw (#fs : field_spec) (x: t fs): B.buffer (limb fs) = x
inline_for_extraction noextract
let as_lib (#fs : field_spec) (x: t fs): P.poly1305_ctx fs =
assert (Lib.IntTypes.(v (add #U32 (nlimb fs) (precomplen fs))) == 25);
x
inline_for_extraction noextract
let poly1305_key = I.stateful_buffer uint8 32ul (Lib.IntTypes.u8 0) unit
inline_for_extraction noextract
let as_lib_k (x: B.buffer uint8 { B.length x = 32 }): Lib.Buffer.lbuffer uint8 32ul =
x
inline_for_extraction noextract
let num_lanes (fs : field_spec) : F32xN.lanes =
match fs with
| M32 -> 1
| M128 -> 2
| M256 -> 4
inline_for_extraction noextract
let stateful_poly1305_ctx (fs : field_spec) : I.stateful unit =
I.Stateful
(fun () -> t fs)
(fun #_ _ s -> B.loc_addr_of_buffer (as_raw s))
(fun #_ _ s -> B.freeable (as_raw s))
(fun #_ h s -> B.live h (as_raw s) /\ P.state_inv_t h (as_lib s))
(fun () -> Spec.Poly1305.felem & Spec.Poly1305.felem)
(fun () h s -> P.as_get_acc h (as_lib s), P.as_get_r h (as_lib s))
(fun #_ _ _ -> ())
(fun #_ l s h0 h1 ->
P.reveal_ctx_inv (as_lib s) h0 h1;
B.modifies_buffer_elim (as_raw s) l h0 h1)
(fun #_ _ _ _ _ -> ())
(fun () ->
[@inline_let]
let n = num_lanes fs in
let r = B.alloca (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun () r ->
[@inline_let]
let n = num_lanes fs in
let r = B.malloc r (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun _ s -> B.free s)
(fun _ src dst ->
let h0 = ST.get () in
B.blit src 0ul dst 0ul 25ul;
let h1 = ST.get () in
P.reveal_ctx_inv' (as_lib src) (as_lib dst) h0 h1)
/// Interlude for spec equivalence proofs
/// =====================================
///
/// A quick explanation about this proof of equivalence. At the spec level,
/// ``poly1305_update`` needs both ``r`` and the accumulator ``acc``. This thus
/// makes poly1305 update a function of two arguments. However, the streaming
/// facility is constructed over specifications that take one single argument.
/// Not a problem! We carry the pair ``(r, acc)`` as our "streaming functor
/// accumulator", and we now have to show that a specification in terms of
/// ``update (update (r, acc) init)`` is the same as poly1305. For that, we need
/// to do a little proof of equivalence to show first that this is the same as
/// ``(update r) ((update r) acc)`` (note that the update function now becomes a
/// partial application), then use the update-multi-repeat conversion lemma to
/// get the original specification of poly1305.
inline_for_extraction noextract
let block = (block: S.seq uint8 { S.length block = Spec.Poly1305.size_block })
inline_for_extraction noextract
let update_ (acc, r) (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc, r
/// Same as [update_], but with the input not necessarily a full block (can be smaller)
inline_for_extraction noextract
let update__ (acc, r) (input: S.seq uint8{S.length input <= Spec.Poly1305.size_block}) =
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r
inline_for_extraction noextract
let update' r acc (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc
inline_for_extraction noextract
let update_multi =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block update_
inline_for_extraction noextract
let update_multi' r =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block (update' r)
#push-options "--fuel 1"
inline_for_extraction noextract
let rec with_or_without_r (acc r: Spec.Poly1305.felem) (blocks: S.seq uint8):
Lemma
(requires
S.length blocks % Spec.Poly1305.size_block = 0)
(ensures
update_multi (acc, r) blocks == (update_multi' r acc blocks, r))
(decreases (S.length blocks)) | false | false | Hacl.Streaming.Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"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": false,
"smtencoding_l_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 with_or_without_r (acc r: Spec.Poly1305.felem) (blocks: S.seq uint8)
: Lemma (requires S.length blocks % Spec.Poly1305.size_block = 0)
(ensures update_multi (acc, r) blocks == (update_multi' r acc blocks, r))
(decreases (S.length blocks)) | [
"recursion"
] | Hacl.Streaming.Poly1305.with_or_without_r | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
acc: Spec.Poly1305.felem ->
r: Spec.Poly1305.felem ->
blocks: FStar.Seq.Base.seq Hacl.Streaming.Poly1305.uint8
-> FStar.Pervasives.Lemma (requires FStar.Seq.Base.length blocks % Spec.Poly1305.size_block = 0)
(ensures
Hacl.Streaming.Poly1305.update_multi (acc, r) blocks ==
FStar.Pervasives.Native.Mktuple2 (Hacl.Streaming.Poly1305.update_multi' r acc blocks) r)
(decreases FStar.Seq.Base.length blocks) | {
"end_col": 31,
"end_line": 151,
"start_col": 2,
"start_line": 146
} |
FStar.Pervasives.Lemma | val update_last_block_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input = Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r))) | [
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let update_last_block_is_update input acc r =
let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
assert(input `S.equal` S.append input S.empty);
let acc1 = update' r acc input in
let acc1' = update_multi' r acc input in
// SH: fun fact: this lemma call and the following assert should be the
// last part of the below calc. However, if put below/inside the calc,
// the proof loops.
Lib.Sequence.Lemmas.repeat_blocks_extensionality block_length input
(repeat_f block_length (update' r))
Spec.Poly1305.(poly1305_update1 r size_block)
(repeat_l block_length (update_last' r) input)
Spec.Poly1305.(poly1305_update_last r)
acc;
assert(
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc ==
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
Spec.Poly1305.(poly1305_update1 r size_block)
Spec.Poly1305.(poly1305_update_last r)
acc);
assert(
let block, rem = Lib.UpdateMulti.split_block block_length input 1 in
block `S.equal` input /\ rem `S.equal` S.empty);
assert(
Lib.UpdateMulti.mk_update_multi block_length (update' r) acc1 S.empty ==
acc1');
assert(acc1 == acc1');
calc (==) {
update_last (acc, r) input;
(==) { }
update_last' r acc input, r;
(==) { }
update_last' r (update' r acc input) S.empty, r;
(==) { }
update_last' r (update_multi' r acc input) S.empty, r;
(==) { update_full_is_repeat_blocks block_length (update' r) (update_last' r) acc input input }
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc, r;
} | val update_last_block_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input = Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r)))
let update_last_block_is_update input acc r = | false | null | true | let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
assert (input `S.equal` (S.append input S.empty));
let acc1 = update' r acc input in
let acc1' = update_multi' r acc input in
Lib.Sequence.Lemmas.repeat_blocks_extensionality block_length
input
(repeat_f block_length (update' r))
Spec.Poly1305.(poly1305_update1 r size_block)
(repeat_l block_length (update_last' r) input)
Spec.Poly1305.(poly1305_update_last r)
acc;
assert (Lib.Sequence.repeat_blocks #uint8
#Spec.Poly1305.felem
block_length
input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc ==
Lib.Sequence.repeat_blocks #uint8
#Spec.Poly1305.felem
block_length
input
Spec.Poly1305.(poly1305_update1 r size_block)
Spec.Poly1305.(poly1305_update_last r)
acc);
assert (let block, rem = Lib.UpdateMulti.split_block block_length input 1 in
block `S.equal` input /\ rem `S.equal` S.empty);
assert (Lib.UpdateMulti.mk_update_multi block_length (update' r) acc1 S.empty == acc1');
assert (acc1 == acc1');
calc ( == ) {
update_last (acc, r) input;
( == ) { () }
update_last' r acc input, r;
( == ) { () }
update_last' r (update' r acc input) S.empty, r;
( == ) { () }
update_last' r (update_multi' r acc input) S.empty, r;
( == ) { update_full_is_repeat_blocks block_length (update' r) (update_last' r) acc input input }
Lib.Sequence.repeat_blocks #uint8
#Spec.Poly1305.felem
block_length
input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc,
r;
} | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
"lemma"
] | [
"FStar.Seq.Base.seq",
"Hacl.Streaming.Poly1305.uint8",
"Spec.Poly1305.felem",
"FStar.Calc.calc_finish",
"FStar.Pervasives.Native.tuple2",
"Prims.eq2",
"Hacl.Streaming.Poly1305.update_last",
"FStar.Pervasives.Native.Mktuple2",
"Lib.Sequence.repeat_blocks",
"Lib.UpdateMulti.Lemmas.uint8",
"Lib.UpdateMulti.Lemmas.repeat_f",
"Hacl.Streaming.Poly1305.update'",
"Lib.UpdateMulti.Lemmas.repeat_l",
"Hacl.Streaming.Poly1305.update_last'",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.Nil",
"Prims.unit",
"FStar.Calc.calc_step",
"Hacl.Streaming.Poly1305.update_multi'",
"FStar.Seq.Base.empty",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"Prims.squash",
"Lib.UpdateMulti.Lemmas.update_full_is_repeat_blocks",
"Prims._assert",
"Lib.UpdateMulti.mk_update_multi",
"Lib.UpdateMulti.uint8",
"Prims.l_and",
"FStar.Seq.Base.equal",
"Lib.UpdateMulti.split_block",
"Spec.Poly1305.poly1305_update1",
"Spec.Poly1305.size_block",
"Spec.Poly1305.poly1305_update_last",
"Lib.Sequence.Lemmas.repeat_blocks_extensionality",
"FStar.Seq.Base.append",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.pow2",
"Prims.nat",
"Prims.op_LessThanOrEqual",
"Prims.op_Subtraction"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// =======================================
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Hacl.Impl.Poly1305.Fields
/// An instance of the stateful type class for poly1305 state
/// =========================================================
///
/// We use a custom view that separates r and acc, to respect abstraction boundaries established by Poly1305.
#set-options "--fuel 0 --ifuel 1 --z3rlimit 100"
inline_for_extraction noextract
let t (fs : field_spec) = b:B.buffer (limb fs) { B.length b == 25 }
inline_for_extraction noextract
let as_raw (#fs : field_spec) (x: t fs): B.buffer (limb fs) = x
inline_for_extraction noextract
let as_lib (#fs : field_spec) (x: t fs): P.poly1305_ctx fs =
assert (Lib.IntTypes.(v (add #U32 (nlimb fs) (precomplen fs))) == 25);
x
inline_for_extraction noextract
let poly1305_key = I.stateful_buffer uint8 32ul (Lib.IntTypes.u8 0) unit
inline_for_extraction noextract
let as_lib_k (x: B.buffer uint8 { B.length x = 32 }): Lib.Buffer.lbuffer uint8 32ul =
x
inline_for_extraction noextract
let num_lanes (fs : field_spec) : F32xN.lanes =
match fs with
| M32 -> 1
| M128 -> 2
| M256 -> 4
inline_for_extraction noextract
let stateful_poly1305_ctx (fs : field_spec) : I.stateful unit =
I.Stateful
(fun () -> t fs)
(fun #_ _ s -> B.loc_addr_of_buffer (as_raw s))
(fun #_ _ s -> B.freeable (as_raw s))
(fun #_ h s -> B.live h (as_raw s) /\ P.state_inv_t h (as_lib s))
(fun () -> Spec.Poly1305.felem & Spec.Poly1305.felem)
(fun () h s -> P.as_get_acc h (as_lib s), P.as_get_r h (as_lib s))
(fun #_ _ _ -> ())
(fun #_ l s h0 h1 ->
P.reveal_ctx_inv (as_lib s) h0 h1;
B.modifies_buffer_elim (as_raw s) l h0 h1)
(fun #_ _ _ _ _ -> ())
(fun () ->
[@inline_let]
let n = num_lanes fs in
let r = B.alloca (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun () r ->
[@inline_let]
let n = num_lanes fs in
let r = B.malloc r (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun _ s -> B.free s)
(fun _ src dst ->
let h0 = ST.get () in
B.blit src 0ul dst 0ul 25ul;
let h1 = ST.get () in
P.reveal_ctx_inv' (as_lib src) (as_lib dst) h0 h1)
/// Interlude for spec equivalence proofs
/// =====================================
///
/// A quick explanation about this proof of equivalence. At the spec level,
/// ``poly1305_update`` needs both ``r`` and the accumulator ``acc``. This thus
/// makes poly1305 update a function of two arguments. However, the streaming
/// facility is constructed over specifications that take one single argument.
/// Not a problem! We carry the pair ``(r, acc)`` as our "streaming functor
/// accumulator", and we now have to show that a specification in terms of
/// ``update (update (r, acc) init)`` is the same as poly1305. For that, we need
/// to do a little proof of equivalence to show first that this is the same as
/// ``(update r) ((update r) acc)`` (note that the update function now becomes a
/// partial application), then use the update-multi-repeat conversion lemma to
/// get the original specification of poly1305.
inline_for_extraction noextract
let block = (block: S.seq uint8 { S.length block = Spec.Poly1305.size_block })
inline_for_extraction noextract
let update_ (acc, r) (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc, r
/// Same as [update_], but with the input not necessarily a full block (can be smaller)
inline_for_extraction noextract
let update__ (acc, r) (input: S.seq uint8{S.length input <= Spec.Poly1305.size_block}) =
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r
inline_for_extraction noextract
let update' r acc (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc
inline_for_extraction noextract
let update_multi =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block update_
inline_for_extraction noextract
let update_multi' r =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block (update' r)
#push-options "--fuel 1"
inline_for_extraction noextract
let rec with_or_without_r (acc r: Spec.Poly1305.felem) (blocks: S.seq uint8):
Lemma
(requires
S.length blocks % Spec.Poly1305.size_block = 0)
(ensures
update_multi (acc, r) blocks == (update_multi' r acc blocks, r))
(decreases (S.length blocks))
=
if S.length blocks = 0 then
()
else
let block, rem = Lib.UpdateMulti.split_block Spec.Poly1305.size_block blocks 1 in
let acc = update' r acc block in
with_or_without_r acc r rem
#pop-options
inline_for_extraction noextract
let update_last (acc, r) (input: S.seq uint8 { S.length input <= Spec.Poly1305.size_block }) =
if S.length input = 0 then
acc, r
else
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r
inline_for_extraction noextract
let update_last' r acc (input: S.seq uint8 { S.length input <= Spec.Poly1305.size_block }) =
if S.length input = 0 then
acc
else
Spec.Poly1305.poly1305_update1 r (S.length input) input acc
inline_for_extraction noextract
let finish_ k (acc, r) =
Spec.Poly1305.poly1305_finish k acc
inline_for_extraction noextract
let spec k input =
Spec.Poly1305.poly1305_mac input k
val update_last_not_block_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input < Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r)))
let update_last_not_block_is_update input acc r =
let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
calc (==) {
update_last (acc, r) input;
(==) { }
update_last' r acc input, r;
(==) { Lib.UpdateMulti.update_multi_zero Spec.Poly1305.size_block (update' r) acc }
update_last' r (update_multi' r acc S.empty) input, r;
(==) { update_full_is_repeat_blocks block_length (update' r) (update_last' r) acc input input }
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc, r;
(==) { Lib.Sequence.Lemmas.repeat_blocks_extensionality block_length input
(repeat_f block_length (update' r))
Spec.Poly1305.(poly1305_update1 r size_block)
(repeat_l block_length (update_last' r) input)
Spec.Poly1305.(poly1305_update_last r)
acc
}
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
Spec.Poly1305.(poly1305_update1 r size_block)
Spec.Poly1305.(poly1305_update_last r)
acc, r;
}
val update_last_block_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input = Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r)))
open FStar.Tactics
#push-options "--fuel 1 --print_implicits" | false | false | Hacl.Streaming.Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"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": false,
"smtencoding_l_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 update_last_block_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input = Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r))) | [] | Hacl.Streaming.Poly1305.update_last_block_is_update | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
input: FStar.Seq.Base.seq Hacl.Streaming.Poly1305.uint8 ->
acc: Spec.Poly1305.felem ->
r: Spec.Poly1305.felem
-> FStar.Pervasives.Lemma (requires FStar.Seq.Base.length input = Spec.Poly1305.size_block)
(ensures
Hacl.Streaming.Poly1305.update_last (acc, r) input ==
FStar.Pervasives.Native.Mktuple2 (Spec.Poly1305.poly1305_update input acc r) r) | {
"end_col": 3,
"end_line": 268,
"start_col": 2,
"start_line": 224
} |
Prims.Tot | val stateful_poly1305_ctx (fs: field_spec) : I.stateful unit | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": 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 stateful_poly1305_ctx (fs : field_spec) : I.stateful unit =
I.Stateful
(fun () -> t fs)
(fun #_ _ s -> B.loc_addr_of_buffer (as_raw s))
(fun #_ _ s -> B.freeable (as_raw s))
(fun #_ h s -> B.live h (as_raw s) /\ P.state_inv_t h (as_lib s))
(fun () -> Spec.Poly1305.felem & Spec.Poly1305.felem)
(fun () h s -> P.as_get_acc h (as_lib s), P.as_get_r h (as_lib s))
(fun #_ _ _ -> ())
(fun #_ l s h0 h1 ->
P.reveal_ctx_inv (as_lib s) h0 h1;
B.modifies_buffer_elim (as_raw s) l h0 h1)
(fun #_ _ _ _ _ -> ())
(fun () ->
[@inline_let]
let n = num_lanes fs in
let r = B.alloca (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun () r ->
[@inline_let]
let n = num_lanes fs in
let r = B.malloc r (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun _ s -> B.free s)
(fun _ src dst ->
let h0 = ST.get () in
B.blit src 0ul dst 0ul 25ul;
let h1 = ST.get () in
P.reveal_ctx_inv' (as_lib src) (as_lib dst) h0 h1) | val stateful_poly1305_ctx (fs: field_spec) : I.stateful unit
let stateful_poly1305_ctx (fs: field_spec) : I.stateful unit = | false | null | false | I.Stateful (fun () -> t fs)
(fun #_ _ s -> B.loc_addr_of_buffer (as_raw s))
(fun #_ _ s -> B.freeable (as_raw s))
(fun #_ h s -> B.live h (as_raw s) /\ P.state_inv_t h (as_lib s))
(fun () -> Spec.Poly1305.felem & Spec.Poly1305.felem)
(fun () h s -> P.as_get_acc h (as_lib s), P.as_get_r h (as_lib s))
(fun #_ _ _ -> ())
(fun #_ l s h0 h1 ->
P.reveal_ctx_inv (as_lib s) h0 h1;
B.modifies_buffer_elim (as_raw s) l h0 h1)
(fun #_ _ _ _ _ -> ())
(fun () ->
[@@ inline_let ]let n = num_lanes fs in
let r = B.alloca (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun () r ->
[@@ inline_let ]let n = num_lanes fs in
let r = B.malloc r (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun _ s -> B.free s)
(fun _ src dst ->
let h0 = ST.get () in
B.blit src 0ul dst 0ul 25ul;
let h1 = ST.get () in
P.reveal_ctx_inv' (as_lib src) (as_lib dst) h0 h1) | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
"total"
] | [
"Hacl.Impl.Poly1305.Fields.field_spec",
"Hacl.Streaming.Interface.Stateful",
"Prims.unit",
"Hacl.Streaming.Poly1305.t",
"FStar.Monotonic.HyperStack.mem",
"LowStar.Monotonic.Buffer.loc_addr_of_buffer",
"Hacl.Impl.Poly1305.Fields.limb",
"LowStar.Buffer.trivial_preorder",
"Hacl.Streaming.Poly1305.as_raw",
"LowStar.Monotonic.Buffer.loc",
"LowStar.Monotonic.Buffer.freeable",
"Prims.l_and",
"LowStar.Monotonic.Buffer.live",
"Hacl.Impl.Poly1305.state_inv_t",
"Hacl.Streaming.Poly1305.as_lib",
"FStar.Pervasives.Native.tuple2",
"Spec.Poly1305.felem",
"FStar.Pervasives.Native.Mktuple2",
"Hacl.Impl.Poly1305.as_get_acc",
"Hacl.Impl.Poly1305.as_get_r",
"LowStar.Monotonic.Buffer.modifies_buffer_elim",
"Hacl.Impl.Poly1305.reveal_ctx_inv",
"Hacl.Impl.Poly1305.ctx_inv_zeros",
"FStar.HyperStack.ST.get",
"LowStar.Monotonic.Buffer.mbuffer",
"Hacl.Spec.Poly1305.Field32xN.uint64xN",
"Prims.eq2",
"Prims.nat",
"LowStar.Monotonic.Buffer.length",
"FStar.UInt32.v",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Prims.b2t",
"Prims.op_Negation",
"LowStar.Monotonic.Buffer.g_is_null",
"LowStar.Buffer.alloca",
"Hacl.Spec.Poly1305.Field32xN.zero",
"FStar.UInt32.__uint_to_t",
"Hacl.Spec.Poly1305.Field32xN.lanes",
"Hacl.Streaming.Poly1305.num_lanes",
"FStar.Monotonic.HyperHeap.rid",
"LowStar.Monotonic.Buffer.frameOf",
"LowStar.Buffer.malloc",
"FStar.Ghost.erased",
"LowStar.Monotonic.Buffer.free",
"Hacl.Impl.Poly1305.reveal_ctx_inv'",
"LowStar.Monotonic.Buffer.blit",
"Hacl.Streaming.Interface.stateful"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// =======================================
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Hacl.Impl.Poly1305.Fields
/// An instance of the stateful type class for poly1305 state
/// =========================================================
///
/// We use a custom view that separates r and acc, to respect abstraction boundaries established by Poly1305.
#set-options "--fuel 0 --ifuel 1 --z3rlimit 100"
inline_for_extraction noextract
let t (fs : field_spec) = b:B.buffer (limb fs) { B.length b == 25 }
inline_for_extraction noextract
let as_raw (#fs : field_spec) (x: t fs): B.buffer (limb fs) = x
inline_for_extraction noextract
let as_lib (#fs : field_spec) (x: t fs): P.poly1305_ctx fs =
assert (Lib.IntTypes.(v (add #U32 (nlimb fs) (precomplen fs))) == 25);
x
inline_for_extraction noextract
let poly1305_key = I.stateful_buffer uint8 32ul (Lib.IntTypes.u8 0) unit
inline_for_extraction noextract
let as_lib_k (x: B.buffer uint8 { B.length x = 32 }): Lib.Buffer.lbuffer uint8 32ul =
x
inline_for_extraction noextract
let num_lanes (fs : field_spec) : F32xN.lanes =
match fs with
| M32 -> 1
| M128 -> 2
| M256 -> 4
inline_for_extraction noextract | false | true | Hacl.Streaming.Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val stateful_poly1305_ctx (fs: field_spec) : I.stateful unit | [] | Hacl.Streaming.Poly1305.stateful_poly1305_ctx | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | fs: Hacl.Impl.Poly1305.Fields.field_spec -> Hacl.Streaming.Interface.stateful Prims.unit | {
"end_col": 56,
"end_line": 95,
"start_col": 2,
"start_line": 63
} |
FStar.Pervasives.Lemma | val update_multi_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input % Spec.Poly1305.size_block = 0))
(ensures (update_multi (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r))) | [
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let update_multi_is_update input acc r =
let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
calc (==) {
update_multi (acc, r) input;
(==) { with_or_without_r acc r input }
update_multi' r acc input, r;
(==) { }
update_last' r (update_multi' r acc input) S.empty, r;
(==) { update_full_is_repeat_blocks block_length (update' r) (update_last' r) acc input input }
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc, r;
(==) { Lib.Sequence.Lemmas.repeat_blocks_extensionality block_length input
(repeat_f block_length (update' r))
Spec.Poly1305.(poly1305_update1 r size_block)
(repeat_l block_length (update_last' r) input)
Spec.Poly1305.(poly1305_update_last r)
acc
}
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
Spec.Poly1305.(poly1305_update1 r size_block)
Spec.Poly1305.(poly1305_update_last r)
acc, r;
} | val update_multi_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input % Spec.Poly1305.size_block = 0))
(ensures (update_multi (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r)))
let update_multi_is_update input acc r = | false | null | true | let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
calc ( == ) {
update_multi (acc, r) input;
( == ) { with_or_without_r acc r input }
update_multi' r acc input, r;
( == ) { () }
update_last' r (update_multi' r acc input) S.empty, r;
( == ) { update_full_is_repeat_blocks block_length (update' r) (update_last' r) acc input input }
Lib.Sequence.repeat_blocks #uint8
#Spec.Poly1305.felem
block_length
input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc,
r;
( == ) { Lib.Sequence.Lemmas.repeat_blocks_extensionality block_length
input
(repeat_f block_length (update' r))
Spec.Poly1305.(poly1305_update1 r size_block)
(repeat_l block_length (update_last' r) input)
Spec.Poly1305.(poly1305_update_last r)
acc }
Lib.Sequence.repeat_blocks #uint8
#Spec.Poly1305.felem
block_length
input
Spec.Poly1305.(poly1305_update1 r size_block)
Spec.Poly1305.(poly1305_update_last r)
acc,
r;
} | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
"lemma"
] | [
"FStar.Seq.Base.seq",
"Hacl.Streaming.Poly1305.uint8",
"Spec.Poly1305.felem",
"FStar.Calc.calc_finish",
"FStar.Pervasives.Native.tuple2",
"Prims.eq2",
"Hacl.Streaming.Poly1305.update_multi",
"FStar.Pervasives.Native.Mktuple2",
"Lib.Sequence.repeat_blocks",
"Lib.UpdateMulti.Lemmas.uint8",
"Spec.Poly1305.poly1305_update1",
"Spec.Poly1305.size_block",
"Spec.Poly1305.poly1305_update_last",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.Nil",
"Prims.unit",
"FStar.Calc.calc_step",
"Lib.UpdateMulti.Lemmas.repeat_f",
"Hacl.Streaming.Poly1305.update'",
"Lib.UpdateMulti.Lemmas.repeat_l",
"Hacl.Streaming.Poly1305.update_last'",
"Hacl.Streaming.Poly1305.update_multi'",
"FStar.Seq.Base.empty",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"Hacl.Streaming.Poly1305.with_or_without_r",
"Prims.squash",
"Lib.UpdateMulti.Lemmas.update_full_is_repeat_blocks",
"Lib.Sequence.Lemmas.repeat_blocks_extensionality",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.pow2",
"Prims.nat",
"Prims.op_LessThanOrEqual",
"Prims.op_Subtraction"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// =======================================
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Hacl.Impl.Poly1305.Fields
/// An instance of the stateful type class for poly1305 state
/// =========================================================
///
/// We use a custom view that separates r and acc, to respect abstraction boundaries established by Poly1305.
#set-options "--fuel 0 --ifuel 1 --z3rlimit 100"
inline_for_extraction noextract
let t (fs : field_spec) = b:B.buffer (limb fs) { B.length b == 25 }
inline_for_extraction noextract
let as_raw (#fs : field_spec) (x: t fs): B.buffer (limb fs) = x
inline_for_extraction noextract
let as_lib (#fs : field_spec) (x: t fs): P.poly1305_ctx fs =
assert (Lib.IntTypes.(v (add #U32 (nlimb fs) (precomplen fs))) == 25);
x
inline_for_extraction noextract
let poly1305_key = I.stateful_buffer uint8 32ul (Lib.IntTypes.u8 0) unit
inline_for_extraction noextract
let as_lib_k (x: B.buffer uint8 { B.length x = 32 }): Lib.Buffer.lbuffer uint8 32ul =
x
inline_for_extraction noextract
let num_lanes (fs : field_spec) : F32xN.lanes =
match fs with
| M32 -> 1
| M128 -> 2
| M256 -> 4
inline_for_extraction noextract
let stateful_poly1305_ctx (fs : field_spec) : I.stateful unit =
I.Stateful
(fun () -> t fs)
(fun #_ _ s -> B.loc_addr_of_buffer (as_raw s))
(fun #_ _ s -> B.freeable (as_raw s))
(fun #_ h s -> B.live h (as_raw s) /\ P.state_inv_t h (as_lib s))
(fun () -> Spec.Poly1305.felem & Spec.Poly1305.felem)
(fun () h s -> P.as_get_acc h (as_lib s), P.as_get_r h (as_lib s))
(fun #_ _ _ -> ())
(fun #_ l s h0 h1 ->
P.reveal_ctx_inv (as_lib s) h0 h1;
B.modifies_buffer_elim (as_raw s) l h0 h1)
(fun #_ _ _ _ _ -> ())
(fun () ->
[@inline_let]
let n = num_lanes fs in
let r = B.alloca (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun () r ->
[@inline_let]
let n = num_lanes fs in
let r = B.malloc r (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun _ s -> B.free s)
(fun _ src dst ->
let h0 = ST.get () in
B.blit src 0ul dst 0ul 25ul;
let h1 = ST.get () in
P.reveal_ctx_inv' (as_lib src) (as_lib dst) h0 h1)
/// Interlude for spec equivalence proofs
/// =====================================
///
/// A quick explanation about this proof of equivalence. At the spec level,
/// ``poly1305_update`` needs both ``r`` and the accumulator ``acc``. This thus
/// makes poly1305 update a function of two arguments. However, the streaming
/// facility is constructed over specifications that take one single argument.
/// Not a problem! We carry the pair ``(r, acc)`` as our "streaming functor
/// accumulator", and we now have to show that a specification in terms of
/// ``update (update (r, acc) init)`` is the same as poly1305. For that, we need
/// to do a little proof of equivalence to show first that this is the same as
/// ``(update r) ((update r) acc)`` (note that the update function now becomes a
/// partial application), then use the update-multi-repeat conversion lemma to
/// get the original specification of poly1305.
inline_for_extraction noextract
let block = (block: S.seq uint8 { S.length block = Spec.Poly1305.size_block })
inline_for_extraction noextract
let update_ (acc, r) (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc, r
/// Same as [update_], but with the input not necessarily a full block (can be smaller)
inline_for_extraction noextract
let update__ (acc, r) (input: S.seq uint8{S.length input <= Spec.Poly1305.size_block}) =
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r
inline_for_extraction noextract
let update' r acc (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc
inline_for_extraction noextract
let update_multi =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block update_
inline_for_extraction noextract
let update_multi' r =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block (update' r)
#push-options "--fuel 1"
inline_for_extraction noextract
let rec with_or_without_r (acc r: Spec.Poly1305.felem) (blocks: S.seq uint8):
Lemma
(requires
S.length blocks % Spec.Poly1305.size_block = 0)
(ensures
update_multi (acc, r) blocks == (update_multi' r acc blocks, r))
(decreases (S.length blocks))
=
if S.length blocks = 0 then
()
else
let block, rem = Lib.UpdateMulti.split_block Spec.Poly1305.size_block blocks 1 in
let acc = update' r acc block in
with_or_without_r acc r rem
#pop-options
inline_for_extraction noextract
let update_last (acc, r) (input: S.seq uint8 { S.length input <= Spec.Poly1305.size_block }) =
if S.length input = 0 then
acc, r
else
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r
inline_for_extraction noextract
let update_last' r acc (input: S.seq uint8 { S.length input <= Spec.Poly1305.size_block }) =
if S.length input = 0 then
acc
else
Spec.Poly1305.poly1305_update1 r (S.length input) input acc
inline_for_extraction noextract
let finish_ k (acc, r) =
Spec.Poly1305.poly1305_finish k acc
inline_for_extraction noextract
let spec k input =
Spec.Poly1305.poly1305_mac input k
val update_last_not_block_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input < Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r)))
let update_last_not_block_is_update input acc r =
let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
calc (==) {
update_last (acc, r) input;
(==) { }
update_last' r acc input, r;
(==) { Lib.UpdateMulti.update_multi_zero Spec.Poly1305.size_block (update' r) acc }
update_last' r (update_multi' r acc S.empty) input, r;
(==) { update_full_is_repeat_blocks block_length (update' r) (update_last' r) acc input input }
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc, r;
(==) { Lib.Sequence.Lemmas.repeat_blocks_extensionality block_length input
(repeat_f block_length (update' r))
Spec.Poly1305.(poly1305_update1 r size_block)
(repeat_l block_length (update_last' r) input)
Spec.Poly1305.(poly1305_update_last r)
acc
}
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
Spec.Poly1305.(poly1305_update1 r size_block)
Spec.Poly1305.(poly1305_update_last r)
acc, r;
}
val update_last_block_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input = Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r)))
open FStar.Tactics
#push-options "--fuel 1 --print_implicits"
let update_last_block_is_update input acc r =
let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
assert(input `S.equal` S.append input S.empty);
let acc1 = update' r acc input in
let acc1' = update_multi' r acc input in
// SH: fun fact: this lemma call and the following assert should be the
// last part of the below calc. However, if put below/inside the calc,
// the proof loops.
Lib.Sequence.Lemmas.repeat_blocks_extensionality block_length input
(repeat_f block_length (update' r))
Spec.Poly1305.(poly1305_update1 r size_block)
(repeat_l block_length (update_last' r) input)
Spec.Poly1305.(poly1305_update_last r)
acc;
assert(
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc ==
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
Spec.Poly1305.(poly1305_update1 r size_block)
Spec.Poly1305.(poly1305_update_last r)
acc);
assert(
let block, rem = Lib.UpdateMulti.split_block block_length input 1 in
block `S.equal` input /\ rem `S.equal` S.empty);
assert(
Lib.UpdateMulti.mk_update_multi block_length (update' r) acc1 S.empty ==
acc1');
assert(acc1 == acc1');
calc (==) {
update_last (acc, r) input;
(==) { }
update_last' r acc input, r;
(==) { }
update_last' r (update' r acc input) S.empty, r;
(==) { }
update_last' r (update_multi' r acc input) S.empty, r;
(==) { update_full_is_repeat_blocks block_length (update' r) (update_last' r) acc input input }
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc, r;
}
#pop-options
val update_last_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input <= Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r)))
let update_last_is_update input acc r =
if S.length input = Spec.Poly1305.size_block
then update_last_block_is_update input acc r
else update_last_not_block_is_update input acc r
val update_multi_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input % Spec.Poly1305.size_block = 0))
(ensures (update_multi (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r))) | false | false | Hacl.Streaming.Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val update_multi_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input % Spec.Poly1305.size_block = 0))
(ensures (update_multi (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r))) | [] | Hacl.Streaming.Poly1305.update_multi_is_update | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
input: FStar.Seq.Base.seq Hacl.Streaming.Poly1305.uint8 ->
acc: Spec.Poly1305.felem ->
r: Spec.Poly1305.felem
-> FStar.Pervasives.Lemma (requires FStar.Seq.Base.length input % Spec.Poly1305.size_block = 0)
(ensures
Hacl.Streaming.Poly1305.update_multi (acc, r) input ==
FStar.Pervasives.Native.Mktuple2 (Spec.Poly1305.poly1305_update input acc r) r) | {
"end_col": 3,
"end_line": 318,
"start_col": 2,
"start_line": 293
} |
FStar.Pervasives.Lemma | val poly_is_incremental:
key: S.seq uint8 { S.length key = 32 } ->
input:S.seq uint8 { S.length input <= pow2 32 - 1 } ->
Lemma (ensures (
let hash = Lib.UpdateMulti.update_full Spec.Poly1305.size_block update_ update_last (Spec.Poly1305.poly1305_init key) input in
finish_ key hash `S.equal` spec key input)) | [
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let poly_is_incremental key input =
let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
let n = S.length input / block_length in
let bs, l = S.split input (n * block_length) in
FStar.Math.Lemmas.multiple_modulo_lemma n block_length;
let acc, r = Spec.Poly1305.poly1305_init key in
calc (S.equal) {
finish_ key (update_last (update_multi (acc, r) bs) l);
(S.equal) { with_or_without_r acc r bs }
Spec.Poly1305.poly1305_finish key (update_last' r (update_multi' r acc bs) l);
(S.equal) { update_full_is_repeat_blocks block_length (update' r) (update_last' r)
acc input input }
Spec.Poly1305.poly1305_finish key (Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc);
(S.equal) { Lib.Sequence.Lemmas.repeat_blocks_extensionality block_length input
(repeat_f block_length (update' r))
Spec.Poly1305.(poly1305_update1 r size_block)
(repeat_l block_length (update_last' r) input)
Spec.Poly1305.(poly1305_update_last r)
acc
}
Spec.Poly1305.poly1305_finish key (Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
Spec.Poly1305.(poly1305_update1 r size_block)
Spec.Poly1305.(poly1305_update_last r)
acc);
} | val poly_is_incremental:
key: S.seq uint8 { S.length key = 32 } ->
input:S.seq uint8 { S.length input <= pow2 32 - 1 } ->
Lemma (ensures (
let hash = Lib.UpdateMulti.update_full Spec.Poly1305.size_block update_ update_last (Spec.Poly1305.poly1305_init key) input in
finish_ key hash `S.equal` spec key input))
let poly_is_incremental key input = | false | null | true | let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
let n = S.length input / block_length in
let bs, l = S.split input (n * block_length) in
FStar.Math.Lemmas.multiple_modulo_lemma n block_length;
let acc, r = Spec.Poly1305.poly1305_init key in
calc (S.equal) {
finish_ key (update_last (update_multi (acc, r) bs) l);
(S.equal) { with_or_without_r acc r bs }
Spec.Poly1305.poly1305_finish key (update_last' r (update_multi' r acc bs) l);
(S.equal) { update_full_is_repeat_blocks block_length (update' r) (update_last' r) acc input input }
Spec.Poly1305.poly1305_finish key
(Lib.Sequence.repeat_blocks #uint8
#Spec.Poly1305.felem
block_length
input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc);
(S.equal) { Lib.Sequence.Lemmas.repeat_blocks_extensionality block_length
input
(repeat_f block_length (update' r))
Spec.Poly1305.(poly1305_update1 r size_block)
(repeat_l block_length (update_last' r) input)
Spec.Poly1305.(poly1305_update_last r)
acc }
Spec.Poly1305.poly1305_finish key
(Lib.Sequence.repeat_blocks #uint8
#Spec.Poly1305.felem
block_length
input
Spec.Poly1305.(poly1305_update1 r size_block)
Spec.Poly1305.(poly1305_update_last r)
acc);
} | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
"lemma"
] | [
"FStar.Seq.Base.seq",
"Hacl.Streaming.Poly1305.uint8",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.op_LessThanOrEqual",
"Prims.op_Subtraction",
"Prims.pow2",
"Spec.Poly1305.felem",
"FStar.Calc.calc_finish",
"Lib.IntTypes.uint_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"FStar.Seq.Base.equal",
"Hacl.Streaming.Poly1305.finish_",
"Hacl.Streaming.Poly1305.update_last",
"Hacl.Streaming.Poly1305.update_multi",
"FStar.Pervasives.Native.Mktuple2",
"Spec.Poly1305.poly1305_finish",
"Lib.Sequence.repeat_blocks",
"Lib.UpdateMulti.Lemmas.uint8",
"Spec.Poly1305.poly1305_update1",
"Spec.Poly1305.size_block",
"Spec.Poly1305.poly1305_update_last",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.Nil",
"Prims.unit",
"FStar.Calc.calc_step",
"Lib.UpdateMulti.Lemmas.repeat_f",
"Hacl.Streaming.Poly1305.update'",
"Lib.UpdateMulti.Lemmas.repeat_l",
"Hacl.Streaming.Poly1305.update_last'",
"Hacl.Streaming.Poly1305.update_multi'",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"Hacl.Streaming.Poly1305.with_or_without_r",
"Prims.squash",
"Lib.UpdateMulti.Lemmas.update_full_is_repeat_blocks",
"Lib.Sequence.Lemmas.repeat_blocks_extensionality",
"FStar.Pervasives.Native.tuple2",
"Spec.Poly1305.poly1305_init",
"FStar.Math.Lemmas.multiple_modulo_lemma",
"FStar.Seq.Properties.split",
"FStar.Mul.op_Star",
"Prims.op_Division",
"FStar.Pervasives.assert_norm",
"Prims.op_LessThan",
"Prims.nat"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// =======================================
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Hacl.Impl.Poly1305.Fields
/// An instance of the stateful type class for poly1305 state
/// =========================================================
///
/// We use a custom view that separates r and acc, to respect abstraction boundaries established by Poly1305.
#set-options "--fuel 0 --ifuel 1 --z3rlimit 100"
inline_for_extraction noextract
let t (fs : field_spec) = b:B.buffer (limb fs) { B.length b == 25 }
inline_for_extraction noextract
let as_raw (#fs : field_spec) (x: t fs): B.buffer (limb fs) = x
inline_for_extraction noextract
let as_lib (#fs : field_spec) (x: t fs): P.poly1305_ctx fs =
assert (Lib.IntTypes.(v (add #U32 (nlimb fs) (precomplen fs))) == 25);
x
inline_for_extraction noextract
let poly1305_key = I.stateful_buffer uint8 32ul (Lib.IntTypes.u8 0) unit
inline_for_extraction noextract
let as_lib_k (x: B.buffer uint8 { B.length x = 32 }): Lib.Buffer.lbuffer uint8 32ul =
x
inline_for_extraction noextract
let num_lanes (fs : field_spec) : F32xN.lanes =
match fs with
| M32 -> 1
| M128 -> 2
| M256 -> 4
inline_for_extraction noextract
let stateful_poly1305_ctx (fs : field_spec) : I.stateful unit =
I.Stateful
(fun () -> t fs)
(fun #_ _ s -> B.loc_addr_of_buffer (as_raw s))
(fun #_ _ s -> B.freeable (as_raw s))
(fun #_ h s -> B.live h (as_raw s) /\ P.state_inv_t h (as_lib s))
(fun () -> Spec.Poly1305.felem & Spec.Poly1305.felem)
(fun () h s -> P.as_get_acc h (as_lib s), P.as_get_r h (as_lib s))
(fun #_ _ _ -> ())
(fun #_ l s h0 h1 ->
P.reveal_ctx_inv (as_lib s) h0 h1;
B.modifies_buffer_elim (as_raw s) l h0 h1)
(fun #_ _ _ _ _ -> ())
(fun () ->
[@inline_let]
let n = num_lanes fs in
let r = B.alloca (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun () r ->
[@inline_let]
let n = num_lanes fs in
let r = B.malloc r (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun _ s -> B.free s)
(fun _ src dst ->
let h0 = ST.get () in
B.blit src 0ul dst 0ul 25ul;
let h1 = ST.get () in
P.reveal_ctx_inv' (as_lib src) (as_lib dst) h0 h1)
/// Interlude for spec equivalence proofs
/// =====================================
///
/// A quick explanation about this proof of equivalence. At the spec level,
/// ``poly1305_update`` needs both ``r`` and the accumulator ``acc``. This thus
/// makes poly1305 update a function of two arguments. However, the streaming
/// facility is constructed over specifications that take one single argument.
/// Not a problem! We carry the pair ``(r, acc)`` as our "streaming functor
/// accumulator", and we now have to show that a specification in terms of
/// ``update (update (r, acc) init)`` is the same as poly1305. For that, we need
/// to do a little proof of equivalence to show first that this is the same as
/// ``(update r) ((update r) acc)`` (note that the update function now becomes a
/// partial application), then use the update-multi-repeat conversion lemma to
/// get the original specification of poly1305.
inline_for_extraction noextract
let block = (block: S.seq uint8 { S.length block = Spec.Poly1305.size_block })
inline_for_extraction noextract
let update_ (acc, r) (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc, r
/// Same as [update_], but with the input not necessarily a full block (can be smaller)
inline_for_extraction noextract
let update__ (acc, r) (input: S.seq uint8{S.length input <= Spec.Poly1305.size_block}) =
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r
inline_for_extraction noextract
let update' r acc (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc
inline_for_extraction noextract
let update_multi =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block update_
inline_for_extraction noextract
let update_multi' r =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block (update' r)
#push-options "--fuel 1"
inline_for_extraction noextract
let rec with_or_without_r (acc r: Spec.Poly1305.felem) (blocks: S.seq uint8):
Lemma
(requires
S.length blocks % Spec.Poly1305.size_block = 0)
(ensures
update_multi (acc, r) blocks == (update_multi' r acc blocks, r))
(decreases (S.length blocks))
=
if S.length blocks = 0 then
()
else
let block, rem = Lib.UpdateMulti.split_block Spec.Poly1305.size_block blocks 1 in
let acc = update' r acc block in
with_or_without_r acc r rem
#pop-options
inline_for_extraction noextract
let update_last (acc, r) (input: S.seq uint8 { S.length input <= Spec.Poly1305.size_block }) =
if S.length input = 0 then
acc, r
else
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r
inline_for_extraction noextract
let update_last' r acc (input: S.seq uint8 { S.length input <= Spec.Poly1305.size_block }) =
if S.length input = 0 then
acc
else
Spec.Poly1305.poly1305_update1 r (S.length input) input acc
inline_for_extraction noextract
let finish_ k (acc, r) =
Spec.Poly1305.poly1305_finish k acc
inline_for_extraction noextract
let spec k input =
Spec.Poly1305.poly1305_mac input k
val update_last_not_block_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input < Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r)))
let update_last_not_block_is_update input acc r =
let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
calc (==) {
update_last (acc, r) input;
(==) { }
update_last' r acc input, r;
(==) { Lib.UpdateMulti.update_multi_zero Spec.Poly1305.size_block (update' r) acc }
update_last' r (update_multi' r acc S.empty) input, r;
(==) { update_full_is_repeat_blocks block_length (update' r) (update_last' r) acc input input }
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc, r;
(==) { Lib.Sequence.Lemmas.repeat_blocks_extensionality block_length input
(repeat_f block_length (update' r))
Spec.Poly1305.(poly1305_update1 r size_block)
(repeat_l block_length (update_last' r) input)
Spec.Poly1305.(poly1305_update_last r)
acc
}
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
Spec.Poly1305.(poly1305_update1 r size_block)
Spec.Poly1305.(poly1305_update_last r)
acc, r;
}
val update_last_block_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input = Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r)))
open FStar.Tactics
#push-options "--fuel 1 --print_implicits"
let update_last_block_is_update input acc r =
let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
assert(input `S.equal` S.append input S.empty);
let acc1 = update' r acc input in
let acc1' = update_multi' r acc input in
// SH: fun fact: this lemma call and the following assert should be the
// last part of the below calc. However, if put below/inside the calc,
// the proof loops.
Lib.Sequence.Lemmas.repeat_blocks_extensionality block_length input
(repeat_f block_length (update' r))
Spec.Poly1305.(poly1305_update1 r size_block)
(repeat_l block_length (update_last' r) input)
Spec.Poly1305.(poly1305_update_last r)
acc;
assert(
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc ==
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
Spec.Poly1305.(poly1305_update1 r size_block)
Spec.Poly1305.(poly1305_update_last r)
acc);
assert(
let block, rem = Lib.UpdateMulti.split_block block_length input 1 in
block `S.equal` input /\ rem `S.equal` S.empty);
assert(
Lib.UpdateMulti.mk_update_multi block_length (update' r) acc1 S.empty ==
acc1');
assert(acc1 == acc1');
calc (==) {
update_last (acc, r) input;
(==) { }
update_last' r acc input, r;
(==) { }
update_last' r (update' r acc input) S.empty, r;
(==) { }
update_last' r (update_multi' r acc input) S.empty, r;
(==) { update_full_is_repeat_blocks block_length (update' r) (update_last' r) acc input input }
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc, r;
}
#pop-options
val update_last_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input <= Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r)))
let update_last_is_update input acc r =
if S.length input = Spec.Poly1305.size_block
then update_last_block_is_update input acc r
else update_last_not_block_is_update input acc r
val update_multi_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input % Spec.Poly1305.size_block = 0))
(ensures (update_multi (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r)))
let update_multi_is_update input acc r =
let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
calc (==) {
update_multi (acc, r) input;
(==) { with_or_without_r acc r input }
update_multi' r acc input, r;
(==) { }
update_last' r (update_multi' r acc input) S.empty, r;
(==) { update_full_is_repeat_blocks block_length (update' r) (update_last' r) acc input input }
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc, r;
(==) { Lib.Sequence.Lemmas.repeat_blocks_extensionality block_length input
(repeat_f block_length (update' r))
Spec.Poly1305.(poly1305_update1 r size_block)
(repeat_l block_length (update_last' r) input)
Spec.Poly1305.(poly1305_update_last r)
acc
}
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
Spec.Poly1305.(poly1305_update1 r size_block)
Spec.Poly1305.(poly1305_update_last r)
acc, r;
}
val poly_is_incremental:
key: S.seq uint8 { S.length key = 32 } ->
input:S.seq uint8 { S.length input <= pow2 32 - 1 } ->
Lemma (ensures (
let hash = Lib.UpdateMulti.update_full Spec.Poly1305.size_block update_ update_last (Spec.Poly1305.poly1305_init key) input in
finish_ key hash `S.equal` spec key input)) | false | false | Hacl.Streaming.Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val poly_is_incremental:
key: S.seq uint8 { S.length key = 32 } ->
input:S.seq uint8 { S.length input <= pow2 32 - 1 } ->
Lemma (ensures (
let hash = Lib.UpdateMulti.update_full Spec.Poly1305.size_block update_ update_last (Spec.Poly1305.poly1305_init key) input in
finish_ key hash `S.equal` spec key input)) | [] | Hacl.Streaming.Poly1305.poly_is_incremental | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
key: FStar.Seq.Base.seq Hacl.Streaming.Poly1305.uint8 {FStar.Seq.Base.length key = 32} ->
input:
FStar.Seq.Base.seq Hacl.Streaming.Poly1305.uint8
{FStar.Seq.Base.length input <= Prims.pow2 32 - 1}
-> FStar.Pervasives.Lemma
(ensures
(let hash =
Lib.UpdateMulti.update_full Spec.Poly1305.size_block
Hacl.Streaming.Poly1305.update_
Hacl.Streaming.Poly1305.update_last
(Spec.Poly1305.poly1305_init key)
input
in
FStar.Seq.Base.equal (Hacl.Streaming.Poly1305.finish_ key hash)
(Hacl.Streaming.Poly1305.spec key input))) | {
"end_col": 3,
"end_line": 356,
"start_col": 2,
"start_line": 328
} |
FStar.Pervasives.Lemma | val update_last_not_block_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input < Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r))) | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let update_last_not_block_is_update input acc r =
let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
calc (==) {
update_last (acc, r) input;
(==) { }
update_last' r acc input, r;
(==) { Lib.UpdateMulti.update_multi_zero Spec.Poly1305.size_block (update' r) acc }
update_last' r (update_multi' r acc S.empty) input, r;
(==) { update_full_is_repeat_blocks block_length (update' r) (update_last' r) acc input input }
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc, r;
(==) { Lib.Sequence.Lemmas.repeat_blocks_extensionality block_length input
(repeat_f block_length (update' r))
Spec.Poly1305.(poly1305_update1 r size_block)
(repeat_l block_length (update_last' r) input)
Spec.Poly1305.(poly1305_update_last r)
acc
}
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
Spec.Poly1305.(poly1305_update1 r size_block)
Spec.Poly1305.(poly1305_update_last r)
acc, r;
} | val update_last_not_block_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input < Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r)))
let update_last_not_block_is_update input acc r = | false | null | true | let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
calc ( == ) {
update_last (acc, r) input;
( == ) { () }
update_last' r acc input, r;
( == ) { Lib.UpdateMulti.update_multi_zero Spec.Poly1305.size_block (update' r) acc }
update_last' r (update_multi' r acc S.empty) input, r;
( == ) { update_full_is_repeat_blocks block_length (update' r) (update_last' r) acc input input }
Lib.Sequence.repeat_blocks #uint8
#Spec.Poly1305.felem
block_length
input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc,
r;
( == ) { Lib.Sequence.Lemmas.repeat_blocks_extensionality block_length
input
(repeat_f block_length (update' r))
Spec.Poly1305.(poly1305_update1 r size_block)
(repeat_l block_length (update_last' r) input)
Spec.Poly1305.(poly1305_update_last r)
acc }
Lib.Sequence.repeat_blocks #uint8
#Spec.Poly1305.felem
block_length
input
Spec.Poly1305.(poly1305_update1 r size_block)
Spec.Poly1305.(poly1305_update_last r)
acc,
r;
} | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
"lemma"
] | [
"FStar.Seq.Base.seq",
"Hacl.Streaming.Poly1305.uint8",
"Spec.Poly1305.felem",
"FStar.Calc.calc_finish",
"FStar.Pervasives.Native.tuple2",
"Prims.eq2",
"Hacl.Streaming.Poly1305.update_last",
"FStar.Pervasives.Native.Mktuple2",
"Lib.Sequence.repeat_blocks",
"Lib.UpdateMulti.Lemmas.uint8",
"Spec.Poly1305.poly1305_update1",
"Spec.Poly1305.size_block",
"Spec.Poly1305.poly1305_update_last",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.Nil",
"Prims.unit",
"FStar.Calc.calc_step",
"Lib.UpdateMulti.Lemmas.repeat_f",
"Hacl.Streaming.Poly1305.update'",
"Lib.UpdateMulti.Lemmas.repeat_l",
"Hacl.Streaming.Poly1305.update_last'",
"Hacl.Streaming.Poly1305.update_multi'",
"FStar.Seq.Base.empty",
"Lib.UpdateMulti.uint8",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"Prims.squash",
"Lib.UpdateMulti.update_multi_zero",
"Lib.UpdateMulti.Lemmas.update_full_is_repeat_blocks",
"Lib.Sequence.Lemmas.repeat_blocks_extensionality",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.pow2",
"Prims.nat",
"Prims.op_LessThanOrEqual",
"Prims.op_Subtraction"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// =======================================
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Hacl.Impl.Poly1305.Fields
/// An instance of the stateful type class for poly1305 state
/// =========================================================
///
/// We use a custom view that separates r and acc, to respect abstraction boundaries established by Poly1305.
#set-options "--fuel 0 --ifuel 1 --z3rlimit 100"
inline_for_extraction noextract
let t (fs : field_spec) = b:B.buffer (limb fs) { B.length b == 25 }
inline_for_extraction noextract
let as_raw (#fs : field_spec) (x: t fs): B.buffer (limb fs) = x
inline_for_extraction noextract
let as_lib (#fs : field_spec) (x: t fs): P.poly1305_ctx fs =
assert (Lib.IntTypes.(v (add #U32 (nlimb fs) (precomplen fs))) == 25);
x
inline_for_extraction noextract
let poly1305_key = I.stateful_buffer uint8 32ul (Lib.IntTypes.u8 0) unit
inline_for_extraction noextract
let as_lib_k (x: B.buffer uint8 { B.length x = 32 }): Lib.Buffer.lbuffer uint8 32ul =
x
inline_for_extraction noextract
let num_lanes (fs : field_spec) : F32xN.lanes =
match fs with
| M32 -> 1
| M128 -> 2
| M256 -> 4
inline_for_extraction noextract
let stateful_poly1305_ctx (fs : field_spec) : I.stateful unit =
I.Stateful
(fun () -> t fs)
(fun #_ _ s -> B.loc_addr_of_buffer (as_raw s))
(fun #_ _ s -> B.freeable (as_raw s))
(fun #_ h s -> B.live h (as_raw s) /\ P.state_inv_t h (as_lib s))
(fun () -> Spec.Poly1305.felem & Spec.Poly1305.felem)
(fun () h s -> P.as_get_acc h (as_lib s), P.as_get_r h (as_lib s))
(fun #_ _ _ -> ())
(fun #_ l s h0 h1 ->
P.reveal_ctx_inv (as_lib s) h0 h1;
B.modifies_buffer_elim (as_raw s) l h0 h1)
(fun #_ _ _ _ _ -> ())
(fun () ->
[@inline_let]
let n = num_lanes fs in
let r = B.alloca (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun () r ->
[@inline_let]
let n = num_lanes fs in
let r = B.malloc r (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun _ s -> B.free s)
(fun _ src dst ->
let h0 = ST.get () in
B.blit src 0ul dst 0ul 25ul;
let h1 = ST.get () in
P.reveal_ctx_inv' (as_lib src) (as_lib dst) h0 h1)
/// Interlude for spec equivalence proofs
/// =====================================
///
/// A quick explanation about this proof of equivalence. At the spec level,
/// ``poly1305_update`` needs both ``r`` and the accumulator ``acc``. This thus
/// makes poly1305 update a function of two arguments. However, the streaming
/// facility is constructed over specifications that take one single argument.
/// Not a problem! We carry the pair ``(r, acc)`` as our "streaming functor
/// accumulator", and we now have to show that a specification in terms of
/// ``update (update (r, acc) init)`` is the same as poly1305. For that, we need
/// to do a little proof of equivalence to show first that this is the same as
/// ``(update r) ((update r) acc)`` (note that the update function now becomes a
/// partial application), then use the update-multi-repeat conversion lemma to
/// get the original specification of poly1305.
inline_for_extraction noextract
let block = (block: S.seq uint8 { S.length block = Spec.Poly1305.size_block })
inline_for_extraction noextract
let update_ (acc, r) (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc, r
/// Same as [update_], but with the input not necessarily a full block (can be smaller)
inline_for_extraction noextract
let update__ (acc, r) (input: S.seq uint8{S.length input <= Spec.Poly1305.size_block}) =
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r
inline_for_extraction noextract
let update' r acc (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc
inline_for_extraction noextract
let update_multi =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block update_
inline_for_extraction noextract
let update_multi' r =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block (update' r)
#push-options "--fuel 1"
inline_for_extraction noextract
let rec with_or_without_r (acc r: Spec.Poly1305.felem) (blocks: S.seq uint8):
Lemma
(requires
S.length blocks % Spec.Poly1305.size_block = 0)
(ensures
update_multi (acc, r) blocks == (update_multi' r acc blocks, r))
(decreases (S.length blocks))
=
if S.length blocks = 0 then
()
else
let block, rem = Lib.UpdateMulti.split_block Spec.Poly1305.size_block blocks 1 in
let acc = update' r acc block in
with_or_without_r acc r rem
#pop-options
inline_for_extraction noextract
let update_last (acc, r) (input: S.seq uint8 { S.length input <= Spec.Poly1305.size_block }) =
if S.length input = 0 then
acc, r
else
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r
inline_for_extraction noextract
let update_last' r acc (input: S.seq uint8 { S.length input <= Spec.Poly1305.size_block }) =
if S.length input = 0 then
acc
else
Spec.Poly1305.poly1305_update1 r (S.length input) input acc
inline_for_extraction noextract
let finish_ k (acc, r) =
Spec.Poly1305.poly1305_finish k acc
inline_for_extraction noextract
let spec k input =
Spec.Poly1305.poly1305_mac input k
val update_last_not_block_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input < Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r))) | false | false | Hacl.Streaming.Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val update_last_not_block_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input < Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r))) | [] | Hacl.Streaming.Poly1305.update_last_not_block_is_update | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
input: FStar.Seq.Base.seq Hacl.Streaming.Poly1305.uint8 ->
acc: Spec.Poly1305.felem ->
r: Spec.Poly1305.felem
-> FStar.Pervasives.Lemma (requires FStar.Seq.Base.length input < Spec.Poly1305.size_block)
(ensures
Hacl.Streaming.Poly1305.update_last (acc, r) input ==
FStar.Pervasives.Native.Mktuple2 (Spec.Poly1305.poly1305_update input acc r) r) | {
"end_col": 3,
"end_line": 210,
"start_col": 2,
"start_line": 185
} |
FStar.Pervasives.Lemma | val poly_is_incremental_lazy:
key: S.seq uint8 { S.length key = 32 } ->
input:S.seq uint8 { S.length input <= pow2 32 - 1 } ->
Lemma (ensures (
let hash = Lib.UpdateMulti.update_full_lazy Spec.Poly1305.size_block update_ update_last (Spec.Poly1305.poly1305_init key) input in
finish_ key hash `S.equal` spec key input)) | [
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let poly_is_incremental_lazy key input =
let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
let n = S.length input / block_length in
let rem = S.length input % block_length in
let n', rem' = if rem = 0 && n > 0 then n - 1, block_length else n, rem in (**)
let bs, l = S.split input (n' * block_length) in
let acc, r = Spec.Poly1305.poly1305_init key in
let acc1 = update_multi (acc, r) bs in
let acc_f = update_last acc1 l in
if rem = 0 && n > 0 then
begin
assert(acc_f == update__ acc1 l);
assert(
let block, rem = Lib.UpdateMulti.split_block Spec.Poly1305.size_block l 1 in
block `S.equal` l /\ rem `S.equal` S.empty);
let acc2 = update__ acc1 l in
assert_norm(Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block update_ acc2 S.empty
== acc2);
assert(acc_f == update_multi acc1 l);
Lib.UpdateMulti.update_multi_associative Spec.Poly1305.size_block update_ (acc, r) bs l;
assert(input `S.equal` S.append bs l);
assert(acc_f = update_multi (acc, r) input);
assert(update_last acc_f S.empty == acc_f);
assert(input `S.equal` S.append input S.empty);
poly_is_incremental key input
end
else poly_is_incremental key input | val poly_is_incremental_lazy:
key: S.seq uint8 { S.length key = 32 } ->
input:S.seq uint8 { S.length input <= pow2 32 - 1 } ->
Lemma (ensures (
let hash = Lib.UpdateMulti.update_full_lazy Spec.Poly1305.size_block update_ update_last (Spec.Poly1305.poly1305_init key) input in
finish_ key hash `S.equal` spec key input))
let poly_is_incremental_lazy key input = | false | null | true | let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
let n = S.length input / block_length in
let rem = S.length input % block_length in
let n', rem' = if rem = 0 && n > 0 then n - 1, block_length else n, rem in
let bs, l = S.split input (n' * block_length) in
let acc, r = Spec.Poly1305.poly1305_init key in
let acc1 = update_multi (acc, r) bs in
let acc_f = update_last acc1 l in
if rem = 0 && n > 0
then
(assert (acc_f == update__ acc1 l);
assert (let block, rem = Lib.UpdateMulti.split_block Spec.Poly1305.size_block l 1 in
block `S.equal` l /\ rem `S.equal` S.empty);
let acc2 = update__ acc1 l in
assert_norm (Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block update_ acc2 S.empty ==
acc2);
assert (acc_f == update_multi acc1 l);
Lib.UpdateMulti.update_multi_associative Spec.Poly1305.size_block update_ (acc, r) bs l;
assert (input `S.equal` (S.append bs l));
assert (acc_f = update_multi (acc, r) input);
assert (update_last acc_f S.empty == acc_f);
assert (input `S.equal` (S.append input S.empty));
poly_is_incremental key input)
else poly_is_incremental key input | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
"lemma"
] | [
"FStar.Seq.Base.seq",
"Hacl.Streaming.Poly1305.uint8",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.op_LessThanOrEqual",
"Prims.op_Subtraction",
"Prims.pow2",
"Spec.Poly1305.felem",
"Prims.op_AmpAmp",
"Prims.op_GreaterThan",
"Hacl.Streaming.Poly1305.poly_is_incremental",
"Prims.unit",
"Prims._assert",
"FStar.Seq.Base.equal",
"FStar.Seq.Base.append",
"FStar.Seq.Base.empty",
"Prims.eq2",
"FStar.Pervasives.Native.tuple2",
"Hacl.Streaming.Poly1305.update_last",
"Hacl.Streaming.Poly1305.update_multi",
"FStar.Pervasives.Native.Mktuple2",
"Lib.UpdateMulti.update_multi_associative",
"Spec.Poly1305.size_block",
"Hacl.Streaming.Poly1305.update_",
"FStar.Pervasives.assert_norm",
"Lib.UpdateMulti.mk_update_multi",
"Lib.UpdateMulti.uint8",
"Hacl.Streaming.Poly1305.update__",
"Prims.l_and",
"Lib.UpdateMulti.split_block",
"Prims.bool",
"Spec.Poly1305.poly1305_init",
"FStar.Seq.Properties.split",
"FStar.Mul.op_Star",
"Prims.op_Modulus",
"Prims.op_Division",
"Prims.op_LessThan",
"Prims.nat"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// =======================================
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Hacl.Impl.Poly1305.Fields
/// An instance of the stateful type class for poly1305 state
/// =========================================================
///
/// We use a custom view that separates r and acc, to respect abstraction boundaries established by Poly1305.
#set-options "--fuel 0 --ifuel 1 --z3rlimit 100"
inline_for_extraction noextract
let t (fs : field_spec) = b:B.buffer (limb fs) { B.length b == 25 }
inline_for_extraction noextract
let as_raw (#fs : field_spec) (x: t fs): B.buffer (limb fs) = x
inline_for_extraction noextract
let as_lib (#fs : field_spec) (x: t fs): P.poly1305_ctx fs =
assert (Lib.IntTypes.(v (add #U32 (nlimb fs) (precomplen fs))) == 25);
x
inline_for_extraction noextract
let poly1305_key = I.stateful_buffer uint8 32ul (Lib.IntTypes.u8 0) unit
inline_for_extraction noextract
let as_lib_k (x: B.buffer uint8 { B.length x = 32 }): Lib.Buffer.lbuffer uint8 32ul =
x
inline_for_extraction noextract
let num_lanes (fs : field_spec) : F32xN.lanes =
match fs with
| M32 -> 1
| M128 -> 2
| M256 -> 4
inline_for_extraction noextract
let stateful_poly1305_ctx (fs : field_spec) : I.stateful unit =
I.Stateful
(fun () -> t fs)
(fun #_ _ s -> B.loc_addr_of_buffer (as_raw s))
(fun #_ _ s -> B.freeable (as_raw s))
(fun #_ h s -> B.live h (as_raw s) /\ P.state_inv_t h (as_lib s))
(fun () -> Spec.Poly1305.felem & Spec.Poly1305.felem)
(fun () h s -> P.as_get_acc h (as_lib s), P.as_get_r h (as_lib s))
(fun #_ _ _ -> ())
(fun #_ l s h0 h1 ->
P.reveal_ctx_inv (as_lib s) h0 h1;
B.modifies_buffer_elim (as_raw s) l h0 h1)
(fun #_ _ _ _ _ -> ())
(fun () ->
[@inline_let]
let n = num_lanes fs in
let r = B.alloca (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun () r ->
[@inline_let]
let n = num_lanes fs in
let r = B.malloc r (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun _ s -> B.free s)
(fun _ src dst ->
let h0 = ST.get () in
B.blit src 0ul dst 0ul 25ul;
let h1 = ST.get () in
P.reveal_ctx_inv' (as_lib src) (as_lib dst) h0 h1)
/// Interlude for spec equivalence proofs
/// =====================================
///
/// A quick explanation about this proof of equivalence. At the spec level,
/// ``poly1305_update`` needs both ``r`` and the accumulator ``acc``. This thus
/// makes poly1305 update a function of two arguments. However, the streaming
/// facility is constructed over specifications that take one single argument.
/// Not a problem! We carry the pair ``(r, acc)`` as our "streaming functor
/// accumulator", and we now have to show that a specification in terms of
/// ``update (update (r, acc) init)`` is the same as poly1305. For that, we need
/// to do a little proof of equivalence to show first that this is the same as
/// ``(update r) ((update r) acc)`` (note that the update function now becomes a
/// partial application), then use the update-multi-repeat conversion lemma to
/// get the original specification of poly1305.
inline_for_extraction noextract
let block = (block: S.seq uint8 { S.length block = Spec.Poly1305.size_block })
inline_for_extraction noextract
let update_ (acc, r) (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc, r
/// Same as [update_], but with the input not necessarily a full block (can be smaller)
inline_for_extraction noextract
let update__ (acc, r) (input: S.seq uint8{S.length input <= Spec.Poly1305.size_block}) =
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r
inline_for_extraction noextract
let update' r acc (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc
inline_for_extraction noextract
let update_multi =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block update_
inline_for_extraction noextract
let update_multi' r =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block (update' r)
#push-options "--fuel 1"
inline_for_extraction noextract
let rec with_or_without_r (acc r: Spec.Poly1305.felem) (blocks: S.seq uint8):
Lemma
(requires
S.length blocks % Spec.Poly1305.size_block = 0)
(ensures
update_multi (acc, r) blocks == (update_multi' r acc blocks, r))
(decreases (S.length blocks))
=
if S.length blocks = 0 then
()
else
let block, rem = Lib.UpdateMulti.split_block Spec.Poly1305.size_block blocks 1 in
let acc = update' r acc block in
with_or_without_r acc r rem
#pop-options
inline_for_extraction noextract
let update_last (acc, r) (input: S.seq uint8 { S.length input <= Spec.Poly1305.size_block }) =
if S.length input = 0 then
acc, r
else
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r
inline_for_extraction noextract
let update_last' r acc (input: S.seq uint8 { S.length input <= Spec.Poly1305.size_block }) =
if S.length input = 0 then
acc
else
Spec.Poly1305.poly1305_update1 r (S.length input) input acc
inline_for_extraction noextract
let finish_ k (acc, r) =
Spec.Poly1305.poly1305_finish k acc
inline_for_extraction noextract
let spec k input =
Spec.Poly1305.poly1305_mac input k
val update_last_not_block_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input < Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r)))
let update_last_not_block_is_update input acc r =
let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
calc (==) {
update_last (acc, r) input;
(==) { }
update_last' r acc input, r;
(==) { Lib.UpdateMulti.update_multi_zero Spec.Poly1305.size_block (update' r) acc }
update_last' r (update_multi' r acc S.empty) input, r;
(==) { update_full_is_repeat_blocks block_length (update' r) (update_last' r) acc input input }
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc, r;
(==) { Lib.Sequence.Lemmas.repeat_blocks_extensionality block_length input
(repeat_f block_length (update' r))
Spec.Poly1305.(poly1305_update1 r size_block)
(repeat_l block_length (update_last' r) input)
Spec.Poly1305.(poly1305_update_last r)
acc
}
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
Spec.Poly1305.(poly1305_update1 r size_block)
Spec.Poly1305.(poly1305_update_last r)
acc, r;
}
val update_last_block_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input = Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r)))
open FStar.Tactics
#push-options "--fuel 1 --print_implicits"
let update_last_block_is_update input acc r =
let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
assert(input `S.equal` S.append input S.empty);
let acc1 = update' r acc input in
let acc1' = update_multi' r acc input in
// SH: fun fact: this lemma call and the following assert should be the
// last part of the below calc. However, if put below/inside the calc,
// the proof loops.
Lib.Sequence.Lemmas.repeat_blocks_extensionality block_length input
(repeat_f block_length (update' r))
Spec.Poly1305.(poly1305_update1 r size_block)
(repeat_l block_length (update_last' r) input)
Spec.Poly1305.(poly1305_update_last r)
acc;
assert(
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc ==
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
Spec.Poly1305.(poly1305_update1 r size_block)
Spec.Poly1305.(poly1305_update_last r)
acc);
assert(
let block, rem = Lib.UpdateMulti.split_block block_length input 1 in
block `S.equal` input /\ rem `S.equal` S.empty);
assert(
Lib.UpdateMulti.mk_update_multi block_length (update' r) acc1 S.empty ==
acc1');
assert(acc1 == acc1');
calc (==) {
update_last (acc, r) input;
(==) { }
update_last' r acc input, r;
(==) { }
update_last' r (update' r acc input) S.empty, r;
(==) { }
update_last' r (update_multi' r acc input) S.empty, r;
(==) { update_full_is_repeat_blocks block_length (update' r) (update_last' r) acc input input }
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc, r;
}
#pop-options
val update_last_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input <= Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r)))
let update_last_is_update input acc r =
if S.length input = Spec.Poly1305.size_block
then update_last_block_is_update input acc r
else update_last_not_block_is_update input acc r
val update_multi_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input % Spec.Poly1305.size_block = 0))
(ensures (update_multi (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r)))
let update_multi_is_update input acc r =
let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
calc (==) {
update_multi (acc, r) input;
(==) { with_or_without_r acc r input }
update_multi' r acc input, r;
(==) { }
update_last' r (update_multi' r acc input) S.empty, r;
(==) { update_full_is_repeat_blocks block_length (update' r) (update_last' r) acc input input }
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc, r;
(==) { Lib.Sequence.Lemmas.repeat_blocks_extensionality block_length input
(repeat_f block_length (update' r))
Spec.Poly1305.(poly1305_update1 r size_block)
(repeat_l block_length (update_last' r) input)
Spec.Poly1305.(poly1305_update_last r)
acc
}
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
Spec.Poly1305.(poly1305_update1 r size_block)
Spec.Poly1305.(poly1305_update_last r)
acc, r;
}
val poly_is_incremental:
key: S.seq uint8 { S.length key = 32 } ->
input:S.seq uint8 { S.length input <= pow2 32 - 1 } ->
Lemma (ensures (
let hash = Lib.UpdateMulti.update_full Spec.Poly1305.size_block update_ update_last (Spec.Poly1305.poly1305_init key) input in
finish_ key hash `S.equal` spec key input))
let poly_is_incremental key input =
let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
let n = S.length input / block_length in
let bs, l = S.split input (n * block_length) in
FStar.Math.Lemmas.multiple_modulo_lemma n block_length;
let acc, r = Spec.Poly1305.poly1305_init key in
calc (S.equal) {
finish_ key (update_last (update_multi (acc, r) bs) l);
(S.equal) { with_or_without_r acc r bs }
Spec.Poly1305.poly1305_finish key (update_last' r (update_multi' r acc bs) l);
(S.equal) { update_full_is_repeat_blocks block_length (update' r) (update_last' r)
acc input input }
Spec.Poly1305.poly1305_finish key (Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc);
(S.equal) { Lib.Sequence.Lemmas.repeat_blocks_extensionality block_length input
(repeat_f block_length (update' r))
Spec.Poly1305.(poly1305_update1 r size_block)
(repeat_l block_length (update_last' r) input)
Spec.Poly1305.(poly1305_update_last r)
acc
}
Spec.Poly1305.poly1305_finish key (Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
Spec.Poly1305.(poly1305_update1 r size_block)
Spec.Poly1305.(poly1305_update_last r)
acc);
}
/// Same lemma as above, but we take into account the fact that the hash stream
/// processes the buffer lazily.
val poly_is_incremental_lazy:
key: S.seq uint8 { S.length key = 32 } ->
input:S.seq uint8 { S.length input <= pow2 32 - 1 } ->
Lemma (ensures (
let hash = Lib.UpdateMulti.update_full_lazy Spec.Poly1305.size_block update_ update_last (Spec.Poly1305.poly1305_init key) input in
finish_ key hash `S.equal` spec key input))
#push-options "--fuel 1" | false | false | Hacl.Streaming.Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"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": false,
"smtencoding_l_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 poly_is_incremental_lazy:
key: S.seq uint8 { S.length key = 32 } ->
input:S.seq uint8 { S.length input <= pow2 32 - 1 } ->
Lemma (ensures (
let hash = Lib.UpdateMulti.update_full_lazy Spec.Poly1305.size_block update_ update_last (Spec.Poly1305.poly1305_init key) input in
finish_ key hash `S.equal` spec key input)) | [] | Hacl.Streaming.Poly1305.poly_is_incremental_lazy | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
key: FStar.Seq.Base.seq Hacl.Streaming.Poly1305.uint8 {FStar.Seq.Base.length key = 32} ->
input:
FStar.Seq.Base.seq Hacl.Streaming.Poly1305.uint8
{FStar.Seq.Base.length input <= Prims.pow2 32 - 1}
-> FStar.Pervasives.Lemma
(ensures
(let hash =
Lib.UpdateMulti.update_full_lazy Spec.Poly1305.size_block
Hacl.Streaming.Poly1305.update_
Hacl.Streaming.Poly1305.update_last
(Spec.Poly1305.poly1305_init key)
input
in
FStar.Seq.Base.equal (Hacl.Streaming.Poly1305.finish_ key hash)
(Hacl.Streaming.Poly1305.spec key input))) | {
"end_col": 36,
"end_line": 396,
"start_col": 2,
"start_line": 369
} |
Prims.Tot | val poly1305 (fs: field_spec) : I.block unit | [
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Poly1305.Fields",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Poly1305.Field32xN",
"short_module": "F32xN"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Poly1305",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Interface",
"short_module": "I"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let poly1305 (fs : field_spec) : I.block unit =
I.Block
I.Runtime
(stateful_poly1305_ctx fs) (* state *)
poly1305_key (* key *)
unit
(fun () -> 0xffffffffUL) (* max_input_len *)
(fun () () -> 16) (* output_len *)
(fun () -> 16ul) (* block_len *)
(* blocks_state_len *)
(fun () ->
match fs with
| M32 -> 16ul // block_length
| M128 -> 32ul // 2 * block_length
| M256 -> 64ul) // 4 * block_length
(fun () -> 0ul) (* init_input_len *)
(fun () _k -> S.empty) (* init_input_s *)
(fun () -> Spec.Poly1305.poly1305_init) (* init_s *)
(fun () acc prevlen data -> update_multi acc data) (* update_multi_s *)
(fun () x _ y -> update_last x y) (* update_last_s *)
(fun () k s () -> finish_ k s) (* finish_s *)
(fun () k s () -> spec k s) (* spec_s *)
(* update_multi_zero *)
(fun () acc prevlen -> Lib.UpdateMulti.update_multi_zero Spec.Poly1305.size_block update_ acc)
(* update_multi_associative *)
(fun () acc prevlen1 prevlen2 input1 input2 ->
Lib.UpdateMulti.update_multi_associative Spec.Poly1305.size_block update_
acc input1 input2)
(* spec_is_incremental *)
(fun () key input () ->
let input1 = S.append S.empty input in
assert (S.equal input1 input);
poly_is_incremental_lazy key input)
(* index_of_state *)
(fun _ _ -> ())
(* init *)
(fun _ k _ s ->
match fs with
| M32 -> Hacl.Poly1305_32.poly1305_init s k
| M128 -> Hacl.Poly1305_128.poly1305_init s k
| M256 -> Hacl.Poly1305_256.poly1305_init s k)
(* update_multi *)
(fun _ s prevlen blocks len ->
let h0 = ST.get () in
begin
let acc, r = P.as_get_acc h0 (as_lib s), P.as_get_r h0 (as_lib s) in
update_multi_is_update (B.as_seq h0 blocks) acc r
end;
match fs with
| M32 -> Hacl.Poly1305_32.poly1305_update s len blocks
| M128 -> Hacl.Poly1305_128.poly1305_update s len blocks
| M256 -> Hacl.Poly1305_256.poly1305_update s len blocks)
(* update_last *)
(fun _ s prev_len last last_len ->
let h0 = ST.get () in
begin
let acc, r = P.as_get_acc h0 (as_lib s), P.as_get_r h0 (as_lib s) in
update_last_is_update (B.as_seq h0 last) acc r
end;
match fs with
| M32 -> Hacl.Poly1305_32.poly1305_update s last_len last
| M128 -> Hacl.Poly1305_128.poly1305_update s last_len last
| M256 -> Hacl.Poly1305_256.poly1305_update s last_len last)
(* finish *)
(fun _ k s dst _ ->
let h0 = ST.get () in
ST.push_frame ();
let h1 = ST.get () in
[@inline_let] let nl = num_lanes fs in
let tmp = B.alloca (F32xN.zero nl) 25ul in
let h2 = ST.get () in
B.modifies_only_not_unused_in B.loc_none h1 h2;
B.blit s 0ul tmp 0ul 25ul;
let h3 = ST.get () in
B.modifies_only_not_unused_in B.loc_none h1 h3;
P.reveal_ctx_inv' (as_lib s) (as_lib tmp) h0 h3;
begin match fs with
| M32 -> Hacl.Poly1305_32.poly1305_finish dst k tmp
| M128 -> Hacl.Poly1305_128.poly1305_finish dst k tmp
| M256 -> Hacl.Poly1305_256.poly1305_finish dst k tmp
end;
let h4 = ST.get () in
ST.pop_frame ();
let h5 = ST.get () in
B.modifies_only_not_unused_in B.(loc_buffer dst) h1 h4;
B.modifies_fresh_frame_popped h0 h1 B.(loc_buffer dst) h4 h5;
assert B.(loc_disjoint (loc_buffer s) (loc_buffer dst));
P.reveal_ctx_inv (as_lib s) h0 h5
) | val poly1305 (fs: field_spec) : I.block unit
let poly1305 (fs: field_spec) : I.block unit = | false | null | false | I.Block I.Runtime
(stateful_poly1305_ctx fs)
poly1305_key
unit
(fun () -> 0xffffffffuL)
(fun () () -> 16)
(fun () -> 16ul)
(fun () ->
match fs with
| M32 -> 16ul
| M128 -> 32ul
| M256 -> 64ul)
(fun () -> 0ul)
(fun () _k -> S.empty)
(fun () -> Spec.Poly1305.poly1305_init)
(fun () acc prevlen data -> update_multi acc data)
(fun () x _ y -> update_last x y)
(fun () k s () -> finish_ k s)
(fun () k s () -> spec k s)
(fun () acc prevlen -> Lib.UpdateMulti.update_multi_zero Spec.Poly1305.size_block update_ acc)
(fun () acc prevlen1 prevlen2 input1 input2 ->
Lib.UpdateMulti.update_multi_associative Spec.Poly1305.size_block update_ acc input1 input2)
(fun () key input () ->
let input1 = S.append S.empty input in
assert (S.equal input1 input);
poly_is_incremental_lazy key input)
(fun _ _ -> ())
(fun _ k _ s ->
match fs with
| M32 -> Hacl.Poly1305_32.poly1305_init s k
| M128 -> Hacl.Poly1305_128.poly1305_init s k
| M256 -> Hacl.Poly1305_256.poly1305_init s k)
(fun _ s prevlen blocks len ->
let h0 = ST.get () in
(let acc, r = P.as_get_acc h0 (as_lib s), P.as_get_r h0 (as_lib s) in
update_multi_is_update (B.as_seq h0 blocks) acc r);
match fs with
| M32 -> Hacl.Poly1305_32.poly1305_update s len blocks
| M128 -> Hacl.Poly1305_128.poly1305_update s len blocks
| M256 -> Hacl.Poly1305_256.poly1305_update s len blocks)
(fun _ s prev_len last last_len ->
let h0 = ST.get () in
(let acc, r = P.as_get_acc h0 (as_lib s), P.as_get_r h0 (as_lib s) in
update_last_is_update (B.as_seq h0 last) acc r);
match fs with
| M32 -> Hacl.Poly1305_32.poly1305_update s last_len last
| M128 -> Hacl.Poly1305_128.poly1305_update s last_len last
| M256 -> Hacl.Poly1305_256.poly1305_update s last_len last)
(fun _ k s dst _ ->
let h0 = ST.get () in
ST.push_frame ();
let h1 = ST.get () in
[@@ inline_let ]let nl = num_lanes fs in
let tmp = B.alloca (F32xN.zero nl) 25ul in
let h2 = ST.get () in
B.modifies_only_not_unused_in B.loc_none h1 h2;
B.blit s 0ul tmp 0ul 25ul;
let h3 = ST.get () in
B.modifies_only_not_unused_in B.loc_none h1 h3;
P.reveal_ctx_inv' (as_lib s) (as_lib tmp) h0 h3;
(match fs with
| M32 -> Hacl.Poly1305_32.poly1305_finish dst k tmp
| M128 -> Hacl.Poly1305_128.poly1305_finish dst k tmp
| M256 -> Hacl.Poly1305_256.poly1305_finish dst k tmp);
let h4 = ST.get () in
ST.pop_frame ();
let h5 = ST.get () in
B.modifies_only_not_unused_in B.(loc_buffer dst) h1 h4;
B.modifies_fresh_frame_popped h0 h1 B.(loc_buffer dst) h4 h5;
assert B.(loc_disjoint (loc_buffer s) (loc_buffer dst));
P.reveal_ctx_inv (as_lib s) h0 h5) | {
"checked_file": "Hacl.Streaming.Poly1305.fst.checked",
"dependencies": [
"Spec.Poly1305.fst.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Spec.Poly1305.Field32xN.fst.checked",
"Hacl.Poly1305_32.fsti.checked",
"Hacl.Poly1305_256.fsti.checked",
"Hacl.Poly1305_128.fsti.checked",
"Hacl.Impl.Poly1305.Fields.fst.checked",
"Hacl.Impl.Poly1305.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Tactics.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Poly1305.fst"
} | [
"total"
] | [
"Hacl.Impl.Poly1305.Fields.field_spec",
"Hacl.Streaming.Interface.Block",
"Prims.unit",
"Hacl.Streaming.Interface.Runtime",
"Hacl.Streaming.Poly1305.stateful_poly1305_ctx",
"Hacl.Streaming.Poly1305.poly1305_key",
"FStar.UInt64.__uint_to_t",
"FStar.UInt64.t",
"Prims.b2t",
"FStar.Integers.op_Greater",
"FStar.Integers.Signed",
"FStar.Integers.Winfinite",
"FStar.UInt64.v",
"Lib.IntTypes.size_nat",
"FStar.UInt32.__uint_to_t",
"FStar.UInt32.t",
"FStar.UInt32.v",
"Prims.l_and",
"FStar.Integers.op_Greater_Equals",
"Prims.op_Equality",
"Prims.int",
"FStar.Integers.op_Percent",
"FStar.Integers.op_Less_Equals",
"Hacl.Streaming.Interface.__proj__Stateful__item__t",
"FStar.Seq.Base.empty",
"Hacl.Streaming.Interface.uint8",
"FStar.Seq.Base.seq",
"Prims.l_or",
"Prims.op_GreaterThanOrEqual",
"FStar.UInt.size",
"FStar.UInt32.n",
"FStar.Seq.Base.length",
"Spec.Poly1305.poly1305_init",
"FStar.Integers.nat",
"FStar.Integers.op_Plus",
"Hacl.Streaming.Poly1305.update_multi",
"Hacl.Streaming.Poly1305.update_last",
"Hacl.Streaming.Poly1305.finish_",
"Spec.Poly1305.felem",
"Prims.nat",
"Hacl.Streaming.Poly1305.spec",
"Prims.eq2",
"Lib.UpdateMulti.update_multi_zero",
"FStar.Pervasives.Native.tuple2",
"Spec.Poly1305.size_block",
"Hacl.Streaming.Poly1305.update_",
"Lib.UpdateMulti.update_multi_associative",
"Hacl.Streaming.Poly1305.poly_is_incremental_lazy",
"Prims._assert",
"FStar.Seq.Base.equal",
"FStar.Seq.Base.append",
"FStar.Ghost.erased",
"Hacl.Streaming.Interface.__proj__Stateful__item__s",
"FStar.Ghost.reveal",
"LowStar.Buffer.buffer",
"LowStar.Monotonic.Buffer.length",
"LowStar.Buffer.trivial_preorder",
"Hacl.Poly1305_32.poly1305_init",
"Hacl.Poly1305_128.poly1305_init",
"Hacl.Poly1305_256.poly1305_init",
"Hacl.Poly1305_32.poly1305_update",
"Hacl.Poly1305_128.poly1305_update",
"Hacl.Poly1305_256.poly1305_update",
"Hacl.Streaming.Poly1305.update_multi_is_update",
"LowStar.Monotonic.Buffer.as_seq",
"FStar.Pervasives.Native.Mktuple2",
"Hacl.Impl.Poly1305.as_get_acc",
"Hacl.Streaming.Poly1305.as_lib",
"Hacl.Impl.Poly1305.as_get_r",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"LowStar.Monotonic.Buffer.len",
"Hacl.Streaming.Poly1305.update_last_is_update",
"Hacl.Streaming.Interface.optional_key",
"Hacl.Impl.Poly1305.reveal_ctx_inv",
"LowStar.Monotonic.Buffer.loc_disjoint",
"LowStar.Monotonic.Buffer.loc_buffer",
"Hacl.Impl.Poly1305.Fields.limb",
"LowStar.Monotonic.Buffer.modifies_fresh_frame_popped",
"LowStar.Monotonic.Buffer.modifies_only_not_unused_in",
"FStar.HyperStack.ST.pop_frame",
"Hacl.Poly1305_32.poly1305_finish",
"Hacl.Poly1305_128.poly1305_finish",
"Hacl.Poly1305_256.poly1305_finish",
"Hacl.Impl.Poly1305.reveal_ctx_inv'",
"LowStar.Monotonic.Buffer.loc_none",
"LowStar.Monotonic.Buffer.blit",
"LowStar.Monotonic.Buffer.mbuffer",
"Hacl.Spec.Poly1305.Field32xN.uint64xN",
"FStar.UInt32.uint_to_t",
"Prims.op_Negation",
"LowStar.Monotonic.Buffer.g_is_null",
"LowStar.Buffer.alloca",
"Hacl.Spec.Poly1305.Field32xN.zero",
"Hacl.Spec.Poly1305.Field32xN.lanes",
"Hacl.Streaming.Poly1305.num_lanes",
"FStar.HyperStack.ST.push_frame",
"Hacl.Streaming.Interface.block"
] | [] | module Hacl.Streaming.Poly1305
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module I = Hacl.Streaming.Interface
module P = Hacl.Impl.Poly1305
module F32xN = Hacl.Spec.Poly1305.Field32xN
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
/// Opening a bunch of modules for Poly1305
/// =======================================
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Hacl.Impl.Poly1305.Fields
/// An instance of the stateful type class for poly1305 state
/// =========================================================
///
/// We use a custom view that separates r and acc, to respect abstraction boundaries established by Poly1305.
#set-options "--fuel 0 --ifuel 1 --z3rlimit 100"
inline_for_extraction noextract
let t (fs : field_spec) = b:B.buffer (limb fs) { B.length b == 25 }
inline_for_extraction noextract
let as_raw (#fs : field_spec) (x: t fs): B.buffer (limb fs) = x
inline_for_extraction noextract
let as_lib (#fs : field_spec) (x: t fs): P.poly1305_ctx fs =
assert (Lib.IntTypes.(v (add #U32 (nlimb fs) (precomplen fs))) == 25);
x
inline_for_extraction noextract
let poly1305_key = I.stateful_buffer uint8 32ul (Lib.IntTypes.u8 0) unit
inline_for_extraction noextract
let as_lib_k (x: B.buffer uint8 { B.length x = 32 }): Lib.Buffer.lbuffer uint8 32ul =
x
inline_for_extraction noextract
let num_lanes (fs : field_spec) : F32xN.lanes =
match fs with
| M32 -> 1
| M128 -> 2
| M256 -> 4
inline_for_extraction noextract
let stateful_poly1305_ctx (fs : field_spec) : I.stateful unit =
I.Stateful
(fun () -> t fs)
(fun #_ _ s -> B.loc_addr_of_buffer (as_raw s))
(fun #_ _ s -> B.freeable (as_raw s))
(fun #_ h s -> B.live h (as_raw s) /\ P.state_inv_t h (as_lib s))
(fun () -> Spec.Poly1305.felem & Spec.Poly1305.felem)
(fun () h s -> P.as_get_acc h (as_lib s), P.as_get_r h (as_lib s))
(fun #_ _ _ -> ())
(fun #_ l s h0 h1 ->
P.reveal_ctx_inv (as_lib s) h0 h1;
B.modifies_buffer_elim (as_raw s) l h0 h1)
(fun #_ _ _ _ _ -> ())
(fun () ->
[@inline_let]
let n = num_lanes fs in
let r = B.alloca (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun () r ->
[@inline_let]
let n = num_lanes fs in
let r = B.malloc r (F32xN.zero n) 25ul in
let h1 = ST.get () in
P.ctx_inv_zeros #fs r h1;
r)
(fun _ s -> B.free s)
(fun _ src dst ->
let h0 = ST.get () in
B.blit src 0ul dst 0ul 25ul;
let h1 = ST.get () in
P.reveal_ctx_inv' (as_lib src) (as_lib dst) h0 h1)
/// Interlude for spec equivalence proofs
/// =====================================
///
/// A quick explanation about this proof of equivalence. At the spec level,
/// ``poly1305_update`` needs both ``r`` and the accumulator ``acc``. This thus
/// makes poly1305 update a function of two arguments. However, the streaming
/// facility is constructed over specifications that take one single argument.
/// Not a problem! We carry the pair ``(r, acc)`` as our "streaming functor
/// accumulator", and we now have to show that a specification in terms of
/// ``update (update (r, acc) init)`` is the same as poly1305. For that, we need
/// to do a little proof of equivalence to show first that this is the same as
/// ``(update r) ((update r) acc)`` (note that the update function now becomes a
/// partial application), then use the update-multi-repeat conversion lemma to
/// get the original specification of poly1305.
inline_for_extraction noextract
let block = (block: S.seq uint8 { S.length block = Spec.Poly1305.size_block })
inline_for_extraction noextract
let update_ (acc, r) (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc, r
/// Same as [update_], but with the input not necessarily a full block (can be smaller)
inline_for_extraction noextract
let update__ (acc, r) (input: S.seq uint8{S.length input <= Spec.Poly1305.size_block}) =
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r
inline_for_extraction noextract
let update' r acc (block: block) =
Spec.Poly1305.poly1305_update1 r Spec.Poly1305.size_block block acc
inline_for_extraction noextract
let update_multi =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block update_
inline_for_extraction noextract
let update_multi' r =
Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block (update' r)
#push-options "--fuel 1"
inline_for_extraction noextract
let rec with_or_without_r (acc r: Spec.Poly1305.felem) (blocks: S.seq uint8):
Lemma
(requires
S.length blocks % Spec.Poly1305.size_block = 0)
(ensures
update_multi (acc, r) blocks == (update_multi' r acc blocks, r))
(decreases (S.length blocks))
=
if S.length blocks = 0 then
()
else
let block, rem = Lib.UpdateMulti.split_block Spec.Poly1305.size_block blocks 1 in
let acc = update' r acc block in
with_or_without_r acc r rem
#pop-options
inline_for_extraction noextract
let update_last (acc, r) (input: S.seq uint8 { S.length input <= Spec.Poly1305.size_block }) =
if S.length input = 0 then
acc, r
else
Spec.Poly1305.poly1305_update1 r (S.length input) input acc, r
inline_for_extraction noextract
let update_last' r acc (input: S.seq uint8 { S.length input <= Spec.Poly1305.size_block }) =
if S.length input = 0 then
acc
else
Spec.Poly1305.poly1305_update1 r (S.length input) input acc
inline_for_extraction noextract
let finish_ k (acc, r) =
Spec.Poly1305.poly1305_finish k acc
inline_for_extraction noextract
let spec k input =
Spec.Poly1305.poly1305_mac input k
val update_last_not_block_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input < Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r)))
let update_last_not_block_is_update input acc r =
let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
calc (==) {
update_last (acc, r) input;
(==) { }
update_last' r acc input, r;
(==) { Lib.UpdateMulti.update_multi_zero Spec.Poly1305.size_block (update' r) acc }
update_last' r (update_multi' r acc S.empty) input, r;
(==) { update_full_is_repeat_blocks block_length (update' r) (update_last' r) acc input input }
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc, r;
(==) { Lib.Sequence.Lemmas.repeat_blocks_extensionality block_length input
(repeat_f block_length (update' r))
Spec.Poly1305.(poly1305_update1 r size_block)
(repeat_l block_length (update_last' r) input)
Spec.Poly1305.(poly1305_update_last r)
acc
}
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
Spec.Poly1305.(poly1305_update1 r size_block)
Spec.Poly1305.(poly1305_update_last r)
acc, r;
}
val update_last_block_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input = Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r)))
open FStar.Tactics
#push-options "--fuel 1 --print_implicits"
let update_last_block_is_update input acc r =
let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
assert(input `S.equal` S.append input S.empty);
let acc1 = update' r acc input in
let acc1' = update_multi' r acc input in
// SH: fun fact: this lemma call and the following assert should be the
// last part of the below calc. However, if put below/inside the calc,
// the proof loops.
Lib.Sequence.Lemmas.repeat_blocks_extensionality block_length input
(repeat_f block_length (update' r))
Spec.Poly1305.(poly1305_update1 r size_block)
(repeat_l block_length (update_last' r) input)
Spec.Poly1305.(poly1305_update_last r)
acc;
assert(
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc ==
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
Spec.Poly1305.(poly1305_update1 r size_block)
Spec.Poly1305.(poly1305_update_last r)
acc);
assert(
let block, rem = Lib.UpdateMulti.split_block block_length input 1 in
block `S.equal` input /\ rem `S.equal` S.empty);
assert(
Lib.UpdateMulti.mk_update_multi block_length (update' r) acc1 S.empty ==
acc1');
assert(acc1 == acc1');
calc (==) {
update_last (acc, r) input;
(==) { }
update_last' r acc input, r;
(==) { }
update_last' r (update' r acc input) S.empty, r;
(==) { }
update_last' r (update_multi' r acc input) S.empty, r;
(==) { update_full_is_repeat_blocks block_length (update' r) (update_last' r) acc input input }
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc, r;
}
#pop-options
val update_last_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input <= Spec.Poly1305.size_block))
(ensures (update_last (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r)))
let update_last_is_update input acc r =
if S.length input = Spec.Poly1305.size_block
then update_last_block_is_update input acc r
else update_last_not_block_is_update input acc r
val update_multi_is_update
(input: S.seq uint8)
(acc: Spec.Poly1305.felem)
(r: Spec.Poly1305.felem):
Lemma
(requires (S.length input % Spec.Poly1305.size_block = 0))
(ensures (update_multi (acc, r) input == (Spec.Poly1305.poly1305_update input acc r, r)))
let update_multi_is_update input acc r =
let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
calc (==) {
update_multi (acc, r) input;
(==) { with_or_without_r acc r input }
update_multi' r acc input, r;
(==) { }
update_last' r (update_multi' r acc input) S.empty, r;
(==) { update_full_is_repeat_blocks block_length (update' r) (update_last' r) acc input input }
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc, r;
(==) { Lib.Sequence.Lemmas.repeat_blocks_extensionality block_length input
(repeat_f block_length (update' r))
Spec.Poly1305.(poly1305_update1 r size_block)
(repeat_l block_length (update_last' r) input)
Spec.Poly1305.(poly1305_update_last r)
acc
}
Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
Spec.Poly1305.(poly1305_update1 r size_block)
Spec.Poly1305.(poly1305_update_last r)
acc, r;
}
val poly_is_incremental:
key: S.seq uint8 { S.length key = 32 } ->
input:S.seq uint8 { S.length input <= pow2 32 - 1 } ->
Lemma (ensures (
let hash = Lib.UpdateMulti.update_full Spec.Poly1305.size_block update_ update_last (Spec.Poly1305.poly1305_init key) input in
finish_ key hash `S.equal` spec key input))
let poly_is_incremental key input =
let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
let n = S.length input / block_length in
let bs, l = S.split input (n * block_length) in
FStar.Math.Lemmas.multiple_modulo_lemma n block_length;
let acc, r = Spec.Poly1305.poly1305_init key in
calc (S.equal) {
finish_ key (update_last (update_multi (acc, r) bs) l);
(S.equal) { with_or_without_r acc r bs }
Spec.Poly1305.poly1305_finish key (update_last' r (update_multi' r acc bs) l);
(S.equal) { update_full_is_repeat_blocks block_length (update' r) (update_last' r)
acc input input }
Spec.Poly1305.poly1305_finish key (Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
(repeat_f block_length (update' r))
(repeat_l block_length (update_last' r) input)
acc);
(S.equal) { Lib.Sequence.Lemmas.repeat_blocks_extensionality block_length input
(repeat_f block_length (update' r))
Spec.Poly1305.(poly1305_update1 r size_block)
(repeat_l block_length (update_last' r) input)
Spec.Poly1305.(poly1305_update_last r)
acc
}
Spec.Poly1305.poly1305_finish key (Lib.Sequence.repeat_blocks #uint8 #Spec.Poly1305.felem block_length input
Spec.Poly1305.(poly1305_update1 r size_block)
Spec.Poly1305.(poly1305_update_last r)
acc);
}
/// Same lemma as above, but we take into account the fact that the hash stream
/// processes the buffer lazily.
val poly_is_incremental_lazy:
key: S.seq uint8 { S.length key = 32 } ->
input:S.seq uint8 { S.length input <= pow2 32 - 1 } ->
Lemma (ensures (
let hash = Lib.UpdateMulti.update_full_lazy Spec.Poly1305.size_block update_ update_last (Spec.Poly1305.poly1305_init key) input in
finish_ key hash `S.equal` spec key input))
#push-options "--fuel 1"
let poly_is_incremental_lazy key input =
let open Lib.UpdateMulti.Lemmas in
let block_length = Spec.Poly1305.size_block in
assert_norm (block_length < pow2 32);
let n = S.length input / block_length in
let rem = S.length input % block_length in
let n', rem' = if rem = 0 && n > 0 then n - 1, block_length else n, rem in (**)
let bs, l = S.split input (n' * block_length) in
let acc, r = Spec.Poly1305.poly1305_init key in
let acc1 = update_multi (acc, r) bs in
let acc_f = update_last acc1 l in
if rem = 0 && n > 0 then
begin
assert(acc_f == update__ acc1 l);
assert(
let block, rem = Lib.UpdateMulti.split_block Spec.Poly1305.size_block l 1 in
block `S.equal` l /\ rem `S.equal` S.empty);
let acc2 = update__ acc1 l in
assert_norm(Lib.UpdateMulti.mk_update_multi Spec.Poly1305.size_block update_ acc2 S.empty
== acc2);
assert(acc_f == update_multi acc1 l);
Lib.UpdateMulti.update_multi_associative Spec.Poly1305.size_block update_ (acc, r) bs l;
assert(input `S.equal` S.append bs l);
assert(acc_f = update_multi (acc, r) input);
assert(update_last acc_f S.empty == acc_f);
assert(input `S.equal` S.append input S.empty);
poly_is_incremental key input
end
else poly_is_incremental key input
#pop-options
/// The block instance for poly1305!
/// ================================
#push-options "--z3rlimit 300"
inline_for_extraction noextract | false | true | Hacl.Streaming.Poly1305.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 300,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val poly1305 (fs: field_spec) : I.block unit | [] | Hacl.Streaming.Poly1305.poly1305 | {
"file_name": "code/streaming/Hacl.Streaming.Poly1305.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | fs: Hacl.Impl.Poly1305.Fields.field_spec -> Hacl.Streaming.Interface.block Prims.unit | {
"end_col": 5,
"end_line": 505,
"start_col": 2,
"start_line": 405
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": 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 pos_width = normalize_term (64 - error_width) | let pos_width = | false | null | false | normalize_term (64 - error_width) | {
"checked_file": "EverParse3d.ErrorCode.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "EverParse3d.ErrorCode.fst"
} | [
"total"
] | [
"FStar.Pervasives.normalize_term",
"Prims.int",
"Prims.op_Subtraction",
"EverParse3d.ErrorCode.error_width"
] | [] | module EverParse3d.ErrorCode
module U64 = FStar.UInt64
module BF = LowParse.BitFields
inline_for_extraction
noextract
let error_width = 4
inline_for_extraction | false | true | EverParse3d.ErrorCode.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"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": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val pos_width : Prims.int | [] | EverParse3d.ErrorCode.pos_width | {
"file_name": "src/3d/prelude/EverParse3d.ErrorCode.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | Prims.int | {
"end_col": 49,
"end_line": 12,
"start_col": 16,
"start_line": 12
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": 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 error_width = 4 | let error_width = | false | null | false | 4 | {
"checked_file": "EverParse3d.ErrorCode.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "EverParse3d.ErrorCode.fst"
} | [
"total"
] | [] | [] | module EverParse3d.ErrorCode
module U64 = FStar.UInt64
module BF = LowParse.BitFields
inline_for_extraction | false | true | EverParse3d.ErrorCode.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"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": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val error_width : Prims.int | [] | EverParse3d.ErrorCode.error_width | {
"file_name": "src/3d/prelude/EverParse3d.ErrorCode.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | Prims.int | {
"end_col": 19,
"end_line": 8,
"start_col": 18,
"start_line": 8
} |
|
Prims.Tot | val is_success (positionOrError: U64.t) : Tot bool | [
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": 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 is_success (positionOrError: U64.t) : Tot bool = positionOrError `U64.lte` validator_max_length | val is_success (positionOrError: U64.t) : Tot bool
let is_success (positionOrError: U64.t) : Tot bool = | false | null | false | positionOrError `U64.lte` validator_max_length | {
"checked_file": "EverParse3d.ErrorCode.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "EverParse3d.ErrorCode.fst"
} | [
"total"
] | [
"FStar.UInt64.t",
"FStar.UInt64.lte",
"EverParse3d.ErrorCode.validator_max_length",
"Prims.bool"
] | [] | module EverParse3d.ErrorCode
module U64 = FStar.UInt64
module BF = LowParse.BitFields
inline_for_extraction
noextract
let error_width = 4
inline_for_extraction
noextract
let pos_width = normalize_term (64 - error_width)
[@ CMacro ]
let validator_max_length : (u: U64.t { 4 <= U64.v u /\ U64.v u == pow2 pos_width - 1 } ) =
FStar.Math.Lemmas.pow2_le_compat 64 pos_width;
[@inline_let]
let x = U64.uint_to_t (pow2 pos_width - 1) in
normalize_term_spec x;
normalize_term x
let is_error (positionOrError: U64.t) : Tot bool = positionOrError `U64.gt` validator_max_length | false | true | EverParse3d.ErrorCode.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"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": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val is_success (positionOrError: U64.t) : Tot bool | [] | EverParse3d.ErrorCode.is_success | {
"file_name": "src/3d/prelude/EverParse3d.ErrorCode.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | positionOrError: FStar.UInt64.t -> Prims.bool | {
"end_col": 99,
"end_line": 24,
"start_col": 53,
"start_line": 24
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": 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 pos_t = (pos: U64.t {is_success pos}) | let pos_t = | false | null | false | (pos: U64.t{is_success pos}) | {
"checked_file": "EverParse3d.ErrorCode.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "EverParse3d.ErrorCode.fst"
} | [
"total"
] | [
"FStar.UInt64.t",
"Prims.b2t",
"EverParse3d.ErrorCode.is_success"
] | [] | module EverParse3d.ErrorCode
module U64 = FStar.UInt64
module BF = LowParse.BitFields
inline_for_extraction
noextract
let error_width = 4
inline_for_extraction
noextract
let pos_width = normalize_term (64 - error_width)
[@ CMacro ]
let validator_max_length : (u: U64.t { 4 <= U64.v u /\ U64.v u == pow2 pos_width - 1 } ) =
FStar.Math.Lemmas.pow2_le_compat 64 pos_width;
[@inline_let]
let x = U64.uint_to_t (pow2 pos_width - 1) in
normalize_term_spec x;
normalize_term x
let is_error (positionOrError: U64.t) : Tot bool = positionOrError `U64.gt` validator_max_length
let is_success (positionOrError: U64.t) : Tot bool = positionOrError `U64.lte` validator_max_length
inline_for_extraction
noextract
type validator_error = (u: U64.t { is_error u } )
inline_for_extraction | false | true | EverParse3d.ErrorCode.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"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": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val pos_t : Type0 | [] | EverParse3d.ErrorCode.pos_t | {
"file_name": "src/3d/prelude/EverParse3d.ErrorCode.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | Type0 | {
"end_col": 41,
"end_line": 32,
"start_col": 12,
"start_line": 32
} |
|
Prims.Tot | val is_error (positionOrError: U64.t) : Tot bool | [
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": 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 is_error (positionOrError: U64.t) : Tot bool = positionOrError `U64.gt` validator_max_length | val is_error (positionOrError: U64.t) : Tot bool
let is_error (positionOrError: U64.t) : Tot bool = | false | null | false | positionOrError `U64.gt` validator_max_length | {
"checked_file": "EverParse3d.ErrorCode.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "EverParse3d.ErrorCode.fst"
} | [
"total"
] | [
"FStar.UInt64.t",
"FStar.UInt64.gt",
"EverParse3d.ErrorCode.validator_max_length",
"Prims.bool"
] | [] | module EverParse3d.ErrorCode
module U64 = FStar.UInt64
module BF = LowParse.BitFields
inline_for_extraction
noextract
let error_width = 4
inline_for_extraction
noextract
let pos_width = normalize_term (64 - error_width)
[@ CMacro ]
let validator_max_length : (u: U64.t { 4 <= U64.v u /\ U64.v u == pow2 pos_width - 1 } ) =
FStar.Math.Lemmas.pow2_le_compat 64 pos_width;
[@inline_let]
let x = U64.uint_to_t (pow2 pos_width - 1) in
normalize_term_spec x;
normalize_term x | false | true | EverParse3d.ErrorCode.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"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": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val is_error (positionOrError: U64.t) : Tot bool | [] | EverParse3d.ErrorCode.is_error | {
"file_name": "src/3d/prelude/EverParse3d.ErrorCode.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | positionOrError: FStar.UInt64.t -> Prims.bool | {
"end_col": 96,
"end_line": 22,
"start_col": 51,
"start_line": 22
} |
Prims.Tot | val validator_error_generic:validator_error | [
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": 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 validator_error_generic : validator_error = normalize_term (set_validator_error_kind 0uL 1uL) | val validator_error_generic:validator_error
let validator_error_generic:validator_error = | false | null | false | normalize_term (set_validator_error_kind 0uL 1uL) | {
"checked_file": "EverParse3d.ErrorCode.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "EverParse3d.ErrorCode.fst"
} | [
"total"
] | [
"FStar.Pervasives.normalize_term",
"EverParse3d.ErrorCode.validator_error",
"EverParse3d.ErrorCode.set_validator_error_kind",
"FStar.UInt64.__uint_to_t"
] | [] | module EverParse3d.ErrorCode
module U64 = FStar.UInt64
module BF = LowParse.BitFields
inline_for_extraction
noextract
let error_width = 4
inline_for_extraction
noextract
let pos_width = normalize_term (64 - error_width)
[@ CMacro ]
let validator_max_length : (u: U64.t { 4 <= U64.v u /\ U64.v u == pow2 pos_width - 1 } ) =
FStar.Math.Lemmas.pow2_le_compat 64 pos_width;
[@inline_let]
let x = U64.uint_to_t (pow2 pos_width - 1) in
normalize_term_spec x;
normalize_term x
let is_error (positionOrError: U64.t) : Tot bool = positionOrError `U64.gt` validator_max_length
let is_success (positionOrError: U64.t) : Tot bool = positionOrError `U64.lte` validator_max_length
inline_for_extraction
noextract
type validator_error = (u: U64.t { is_error u } )
inline_for_extraction
noextract
let pos_t = (pos: U64.t {is_success pos})
module BF = LowParse.BitFields
#push-options "--z3rlimit 16"
inline_for_extraction
noextract
let get_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < pow2 (hi - lo) }) =
[@inline_let]
let res =
BF.uint64.BF.get_bitfield x (pos_width + lo) (pos_width + hi)
in
res
inline_for_extraction
noextract
let set_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) (code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) }) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield x (pos_width + lo) (pos_width + hi) code
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_same #64 (U64.v x) (pos_width + lo) (pos_width + hi) (U64.v code);
BF.get_bitfield_zero_inner (U64.v res) pos_width 64 (pos_width + lo) (pos_width + hi);
assert (BF.get_bitfield (U64.v res) pos_width 64 > 0);
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
let get_validator_error_field_set_validator_error_field
(x: U64.t)
(lo: nat)
(hi: nat { lo < hi /\ hi <= error_width })
(code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) })
: Lemma
(get_validator_error_field (set_validator_error_field x lo hi code) lo hi == code)
= ()
let set_validator_error_pos (error: validator_error) (position: pos_t) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield error 0 pos_width position
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_other (U64.v error) 0 pos_width (U64.v position) pos_width 64;
assert (BF.get_bitfield (U64.v res) pos_width 64 == BF.get_bitfield (U64.v error) pos_width 64);
Classical.move_requires (BF.get_bitfield_hi_lt_pow2 (U64.v error)) pos_width;
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
#pop-options
let get_validator_error_pos (x: U64.t) : Tot pos_t =
(BF.uint64.BF.get_bitfield x 0 pos_width)
let set_validator_error_kind (error: U64.t) (code: U64.t { 0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) : Tot validator_error =
normalize_term_spec (pow2 error_width);
set_validator_error_field error 0 error_width code
let get_validator_error_kind (error: U64.t) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) =
normalize_term_spec (pow2 error_width);
get_validator_error_field error 0 error_width
let get_validator_error_kind_set_validator_error_kind (error: U64.t) (code: U64.t {0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width)}) : Lemma
(get_validator_error_kind (set_validator_error_kind error code) == code)
[SMTPat (get_validator_error_kind (set_validator_error_kind error code))]
= assert_norm (normalize_term (pow2 error_width) == pow2 error_width);
get_validator_error_field_set_validator_error_field error 0 error_width code
let get_validator_error_pos_eq_pos (x: pos_t) : Lemma
(get_validator_error_pos x == x)
[SMTPat (get_validator_error_pos x)]
= BF.get_bitfield_size pos_width 64 (U64.v x) 0 pos_width;
BF.get_bitfield_full #pos_width (U64.v x);
BF.lt_pow2_get_bitfield_hi #64 (U64.v x) (64 - error_width);
assert (BF.get_bitfield #64 (U64.v x) pos_width 64 == 0);
BF.get_bitfield_set_bitfield_other #64 (U64.v x) pos_width 64 0 0 pos_width;
BF.get_bitfield_set_bitfield_same #64 (U64.v x) pos_width 64 0;
BF.get_bitfield_partition_2 #64 (64 - error_width) (U64.v x)
(U64.v (BF.uint64.BF.set_bitfield x pos_width 64 0uL)) | false | true | EverParse3d.ErrorCode.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"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": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val validator_error_generic:validator_error | [] | EverParse3d.ErrorCode.validator_error_generic | {
"file_name": "src/3d/prelude/EverParse3d.ErrorCode.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | EverParse3d.ErrorCode.validator_error | {
"end_col": 97,
"end_line": 120,
"start_col": 48,
"start_line": 120
} |
Prims.Tot | val validator_error_not_enough_data:validator_error | [
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": 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 validator_error_not_enough_data : validator_error = normalize_term (set_validator_error_kind 0uL 2uL) | val validator_error_not_enough_data:validator_error
let validator_error_not_enough_data:validator_error = | false | null | false | normalize_term (set_validator_error_kind 0uL 2uL) | {
"checked_file": "EverParse3d.ErrorCode.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "EverParse3d.ErrorCode.fst"
} | [
"total"
] | [
"FStar.Pervasives.normalize_term",
"EverParse3d.ErrorCode.validator_error",
"EverParse3d.ErrorCode.set_validator_error_kind",
"FStar.UInt64.__uint_to_t"
] | [] | module EverParse3d.ErrorCode
module U64 = FStar.UInt64
module BF = LowParse.BitFields
inline_for_extraction
noextract
let error_width = 4
inline_for_extraction
noextract
let pos_width = normalize_term (64 - error_width)
[@ CMacro ]
let validator_max_length : (u: U64.t { 4 <= U64.v u /\ U64.v u == pow2 pos_width - 1 } ) =
FStar.Math.Lemmas.pow2_le_compat 64 pos_width;
[@inline_let]
let x = U64.uint_to_t (pow2 pos_width - 1) in
normalize_term_spec x;
normalize_term x
let is_error (positionOrError: U64.t) : Tot bool = positionOrError `U64.gt` validator_max_length
let is_success (positionOrError: U64.t) : Tot bool = positionOrError `U64.lte` validator_max_length
inline_for_extraction
noextract
type validator_error = (u: U64.t { is_error u } )
inline_for_extraction
noextract
let pos_t = (pos: U64.t {is_success pos})
module BF = LowParse.BitFields
#push-options "--z3rlimit 16"
inline_for_extraction
noextract
let get_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < pow2 (hi - lo) }) =
[@inline_let]
let res =
BF.uint64.BF.get_bitfield x (pos_width + lo) (pos_width + hi)
in
res
inline_for_extraction
noextract
let set_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) (code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) }) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield x (pos_width + lo) (pos_width + hi) code
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_same #64 (U64.v x) (pos_width + lo) (pos_width + hi) (U64.v code);
BF.get_bitfield_zero_inner (U64.v res) pos_width 64 (pos_width + lo) (pos_width + hi);
assert (BF.get_bitfield (U64.v res) pos_width 64 > 0);
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
let get_validator_error_field_set_validator_error_field
(x: U64.t)
(lo: nat)
(hi: nat { lo < hi /\ hi <= error_width })
(code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) })
: Lemma
(get_validator_error_field (set_validator_error_field x lo hi code) lo hi == code)
= ()
let set_validator_error_pos (error: validator_error) (position: pos_t) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield error 0 pos_width position
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_other (U64.v error) 0 pos_width (U64.v position) pos_width 64;
assert (BF.get_bitfield (U64.v res) pos_width 64 == BF.get_bitfield (U64.v error) pos_width 64);
Classical.move_requires (BF.get_bitfield_hi_lt_pow2 (U64.v error)) pos_width;
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
#pop-options
let get_validator_error_pos (x: U64.t) : Tot pos_t =
(BF.uint64.BF.get_bitfield x 0 pos_width)
let set_validator_error_kind (error: U64.t) (code: U64.t { 0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) : Tot validator_error =
normalize_term_spec (pow2 error_width);
set_validator_error_field error 0 error_width code
let get_validator_error_kind (error: U64.t) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) =
normalize_term_spec (pow2 error_width);
get_validator_error_field error 0 error_width
let get_validator_error_kind_set_validator_error_kind (error: U64.t) (code: U64.t {0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width)}) : Lemma
(get_validator_error_kind (set_validator_error_kind error code) == code)
[SMTPat (get_validator_error_kind (set_validator_error_kind error code))]
= assert_norm (normalize_term (pow2 error_width) == pow2 error_width);
get_validator_error_field_set_validator_error_field error 0 error_width code
let get_validator_error_pos_eq_pos (x: pos_t) : Lemma
(get_validator_error_pos x == x)
[SMTPat (get_validator_error_pos x)]
= BF.get_bitfield_size pos_width 64 (U64.v x) 0 pos_width;
BF.get_bitfield_full #pos_width (U64.v x);
BF.lt_pow2_get_bitfield_hi #64 (U64.v x) (64 - error_width);
assert (BF.get_bitfield #64 (U64.v x) pos_width 64 == 0);
BF.get_bitfield_set_bitfield_other #64 (U64.v x) pos_width 64 0 0 pos_width;
BF.get_bitfield_set_bitfield_same #64 (U64.v x) pos_width 64 0;
BF.get_bitfield_partition_2 #64 (64 - error_width) (U64.v x)
(U64.v (BF.uint64.BF.set_bitfield x pos_width 64 0uL))
[@ CMacro ]
let validator_error_generic : validator_error = normalize_term (set_validator_error_kind 0uL 1uL) | false | true | EverParse3d.ErrorCode.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"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": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val validator_error_not_enough_data:validator_error | [] | EverParse3d.ErrorCode.validator_error_not_enough_data | {
"file_name": "src/3d/prelude/EverParse3d.ErrorCode.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | EverParse3d.ErrorCode.validator_error | {
"end_col": 105,
"end_line": 123,
"start_col": 56,
"start_line": 123
} |
Prims.Tot | val validator_error_impossible:validator_error | [
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": 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 validator_error_impossible : validator_error = normalize_term (set_validator_error_kind 0uL 3uL) | val validator_error_impossible:validator_error
let validator_error_impossible:validator_error = | false | null | false | normalize_term (set_validator_error_kind 0uL 3uL) | {
"checked_file": "EverParse3d.ErrorCode.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "EverParse3d.ErrorCode.fst"
} | [
"total"
] | [
"FStar.Pervasives.normalize_term",
"EverParse3d.ErrorCode.validator_error",
"EverParse3d.ErrorCode.set_validator_error_kind",
"FStar.UInt64.__uint_to_t"
] | [] | module EverParse3d.ErrorCode
module U64 = FStar.UInt64
module BF = LowParse.BitFields
inline_for_extraction
noextract
let error_width = 4
inline_for_extraction
noextract
let pos_width = normalize_term (64 - error_width)
[@ CMacro ]
let validator_max_length : (u: U64.t { 4 <= U64.v u /\ U64.v u == pow2 pos_width - 1 } ) =
FStar.Math.Lemmas.pow2_le_compat 64 pos_width;
[@inline_let]
let x = U64.uint_to_t (pow2 pos_width - 1) in
normalize_term_spec x;
normalize_term x
let is_error (positionOrError: U64.t) : Tot bool = positionOrError `U64.gt` validator_max_length
let is_success (positionOrError: U64.t) : Tot bool = positionOrError `U64.lte` validator_max_length
inline_for_extraction
noextract
type validator_error = (u: U64.t { is_error u } )
inline_for_extraction
noextract
let pos_t = (pos: U64.t {is_success pos})
module BF = LowParse.BitFields
#push-options "--z3rlimit 16"
inline_for_extraction
noextract
let get_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < pow2 (hi - lo) }) =
[@inline_let]
let res =
BF.uint64.BF.get_bitfield x (pos_width + lo) (pos_width + hi)
in
res
inline_for_extraction
noextract
let set_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) (code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) }) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield x (pos_width + lo) (pos_width + hi) code
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_same #64 (U64.v x) (pos_width + lo) (pos_width + hi) (U64.v code);
BF.get_bitfield_zero_inner (U64.v res) pos_width 64 (pos_width + lo) (pos_width + hi);
assert (BF.get_bitfield (U64.v res) pos_width 64 > 0);
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
let get_validator_error_field_set_validator_error_field
(x: U64.t)
(lo: nat)
(hi: nat { lo < hi /\ hi <= error_width })
(code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) })
: Lemma
(get_validator_error_field (set_validator_error_field x lo hi code) lo hi == code)
= ()
let set_validator_error_pos (error: validator_error) (position: pos_t) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield error 0 pos_width position
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_other (U64.v error) 0 pos_width (U64.v position) pos_width 64;
assert (BF.get_bitfield (U64.v res) pos_width 64 == BF.get_bitfield (U64.v error) pos_width 64);
Classical.move_requires (BF.get_bitfield_hi_lt_pow2 (U64.v error)) pos_width;
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
#pop-options
let get_validator_error_pos (x: U64.t) : Tot pos_t =
(BF.uint64.BF.get_bitfield x 0 pos_width)
let set_validator_error_kind (error: U64.t) (code: U64.t { 0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) : Tot validator_error =
normalize_term_spec (pow2 error_width);
set_validator_error_field error 0 error_width code
let get_validator_error_kind (error: U64.t) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) =
normalize_term_spec (pow2 error_width);
get_validator_error_field error 0 error_width
let get_validator_error_kind_set_validator_error_kind (error: U64.t) (code: U64.t {0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width)}) : Lemma
(get_validator_error_kind (set_validator_error_kind error code) == code)
[SMTPat (get_validator_error_kind (set_validator_error_kind error code))]
= assert_norm (normalize_term (pow2 error_width) == pow2 error_width);
get_validator_error_field_set_validator_error_field error 0 error_width code
let get_validator_error_pos_eq_pos (x: pos_t) : Lemma
(get_validator_error_pos x == x)
[SMTPat (get_validator_error_pos x)]
= BF.get_bitfield_size pos_width 64 (U64.v x) 0 pos_width;
BF.get_bitfield_full #pos_width (U64.v x);
BF.lt_pow2_get_bitfield_hi #64 (U64.v x) (64 - error_width);
assert (BF.get_bitfield #64 (U64.v x) pos_width 64 == 0);
BF.get_bitfield_set_bitfield_other #64 (U64.v x) pos_width 64 0 0 pos_width;
BF.get_bitfield_set_bitfield_same #64 (U64.v x) pos_width 64 0;
BF.get_bitfield_partition_2 #64 (64 - error_width) (U64.v x)
(U64.v (BF.uint64.BF.set_bitfield x pos_width 64 0uL))
[@ CMacro ]
let validator_error_generic : validator_error = normalize_term (set_validator_error_kind 0uL 1uL)
[@ CMacro ]
let validator_error_not_enough_data : validator_error = normalize_term (set_validator_error_kind 0uL 2uL) | false | true | EverParse3d.ErrorCode.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"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": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val validator_error_impossible:validator_error | [] | EverParse3d.ErrorCode.validator_error_impossible | {
"file_name": "src/3d/prelude/EverParse3d.ErrorCode.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | EverParse3d.ErrorCode.validator_error | {
"end_col": 100,
"end_line": 126,
"start_col": 51,
"start_line": 126
} |
Prims.Tot | val validator_error_list_size_not_multiple:validator_error | [
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": 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 validator_error_list_size_not_multiple : validator_error = normalize_term (set_validator_error_kind 0uL 4uL) | val validator_error_list_size_not_multiple:validator_error
let validator_error_list_size_not_multiple:validator_error = | false | null | false | normalize_term (set_validator_error_kind 0uL 4uL) | {
"checked_file": "EverParse3d.ErrorCode.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "EverParse3d.ErrorCode.fst"
} | [
"total"
] | [
"FStar.Pervasives.normalize_term",
"EverParse3d.ErrorCode.validator_error",
"EverParse3d.ErrorCode.set_validator_error_kind",
"FStar.UInt64.__uint_to_t"
] | [] | module EverParse3d.ErrorCode
module U64 = FStar.UInt64
module BF = LowParse.BitFields
inline_for_extraction
noextract
let error_width = 4
inline_for_extraction
noextract
let pos_width = normalize_term (64 - error_width)
[@ CMacro ]
let validator_max_length : (u: U64.t { 4 <= U64.v u /\ U64.v u == pow2 pos_width - 1 } ) =
FStar.Math.Lemmas.pow2_le_compat 64 pos_width;
[@inline_let]
let x = U64.uint_to_t (pow2 pos_width - 1) in
normalize_term_spec x;
normalize_term x
let is_error (positionOrError: U64.t) : Tot bool = positionOrError `U64.gt` validator_max_length
let is_success (positionOrError: U64.t) : Tot bool = positionOrError `U64.lte` validator_max_length
inline_for_extraction
noextract
type validator_error = (u: U64.t { is_error u } )
inline_for_extraction
noextract
let pos_t = (pos: U64.t {is_success pos})
module BF = LowParse.BitFields
#push-options "--z3rlimit 16"
inline_for_extraction
noextract
let get_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < pow2 (hi - lo) }) =
[@inline_let]
let res =
BF.uint64.BF.get_bitfield x (pos_width + lo) (pos_width + hi)
in
res
inline_for_extraction
noextract
let set_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) (code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) }) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield x (pos_width + lo) (pos_width + hi) code
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_same #64 (U64.v x) (pos_width + lo) (pos_width + hi) (U64.v code);
BF.get_bitfield_zero_inner (U64.v res) pos_width 64 (pos_width + lo) (pos_width + hi);
assert (BF.get_bitfield (U64.v res) pos_width 64 > 0);
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
let get_validator_error_field_set_validator_error_field
(x: U64.t)
(lo: nat)
(hi: nat { lo < hi /\ hi <= error_width })
(code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) })
: Lemma
(get_validator_error_field (set_validator_error_field x lo hi code) lo hi == code)
= ()
let set_validator_error_pos (error: validator_error) (position: pos_t) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield error 0 pos_width position
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_other (U64.v error) 0 pos_width (U64.v position) pos_width 64;
assert (BF.get_bitfield (U64.v res) pos_width 64 == BF.get_bitfield (U64.v error) pos_width 64);
Classical.move_requires (BF.get_bitfield_hi_lt_pow2 (U64.v error)) pos_width;
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
#pop-options
let get_validator_error_pos (x: U64.t) : Tot pos_t =
(BF.uint64.BF.get_bitfield x 0 pos_width)
let set_validator_error_kind (error: U64.t) (code: U64.t { 0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) : Tot validator_error =
normalize_term_spec (pow2 error_width);
set_validator_error_field error 0 error_width code
let get_validator_error_kind (error: U64.t) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) =
normalize_term_spec (pow2 error_width);
get_validator_error_field error 0 error_width
let get_validator_error_kind_set_validator_error_kind (error: U64.t) (code: U64.t {0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width)}) : Lemma
(get_validator_error_kind (set_validator_error_kind error code) == code)
[SMTPat (get_validator_error_kind (set_validator_error_kind error code))]
= assert_norm (normalize_term (pow2 error_width) == pow2 error_width);
get_validator_error_field_set_validator_error_field error 0 error_width code
let get_validator_error_pos_eq_pos (x: pos_t) : Lemma
(get_validator_error_pos x == x)
[SMTPat (get_validator_error_pos x)]
= BF.get_bitfield_size pos_width 64 (U64.v x) 0 pos_width;
BF.get_bitfield_full #pos_width (U64.v x);
BF.lt_pow2_get_bitfield_hi #64 (U64.v x) (64 - error_width);
assert (BF.get_bitfield #64 (U64.v x) pos_width 64 == 0);
BF.get_bitfield_set_bitfield_other #64 (U64.v x) pos_width 64 0 0 pos_width;
BF.get_bitfield_set_bitfield_same #64 (U64.v x) pos_width 64 0;
BF.get_bitfield_partition_2 #64 (64 - error_width) (U64.v x)
(U64.v (BF.uint64.BF.set_bitfield x pos_width 64 0uL))
[@ CMacro ]
let validator_error_generic : validator_error = normalize_term (set_validator_error_kind 0uL 1uL)
[@ CMacro ]
let validator_error_not_enough_data : validator_error = normalize_term (set_validator_error_kind 0uL 2uL)
[@ CMacro ]
let validator_error_impossible : validator_error = normalize_term (set_validator_error_kind 0uL 3uL) | false | true | EverParse3d.ErrorCode.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"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": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val validator_error_list_size_not_multiple:validator_error | [] | EverParse3d.ErrorCode.validator_error_list_size_not_multiple | {
"file_name": "src/3d/prelude/EverParse3d.ErrorCode.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | EverParse3d.ErrorCode.validator_error | {
"end_col": 112,
"end_line": 129,
"start_col": 63,
"start_line": 129
} |
Prims.Tot | val validator_error_action_failed:validator_error | [
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": 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 validator_error_action_failed : validator_error = normalize_term (set_validator_error_kind 0uL 5uL) | val validator_error_action_failed:validator_error
let validator_error_action_failed:validator_error = | false | null | false | normalize_term (set_validator_error_kind 0uL 5uL) | {
"checked_file": "EverParse3d.ErrorCode.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "EverParse3d.ErrorCode.fst"
} | [
"total"
] | [
"FStar.Pervasives.normalize_term",
"EverParse3d.ErrorCode.validator_error",
"EverParse3d.ErrorCode.set_validator_error_kind",
"FStar.UInt64.__uint_to_t"
] | [] | module EverParse3d.ErrorCode
module U64 = FStar.UInt64
module BF = LowParse.BitFields
inline_for_extraction
noextract
let error_width = 4
inline_for_extraction
noextract
let pos_width = normalize_term (64 - error_width)
[@ CMacro ]
let validator_max_length : (u: U64.t { 4 <= U64.v u /\ U64.v u == pow2 pos_width - 1 } ) =
FStar.Math.Lemmas.pow2_le_compat 64 pos_width;
[@inline_let]
let x = U64.uint_to_t (pow2 pos_width - 1) in
normalize_term_spec x;
normalize_term x
let is_error (positionOrError: U64.t) : Tot bool = positionOrError `U64.gt` validator_max_length
let is_success (positionOrError: U64.t) : Tot bool = positionOrError `U64.lte` validator_max_length
inline_for_extraction
noextract
type validator_error = (u: U64.t { is_error u } )
inline_for_extraction
noextract
let pos_t = (pos: U64.t {is_success pos})
module BF = LowParse.BitFields
#push-options "--z3rlimit 16"
inline_for_extraction
noextract
let get_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < pow2 (hi - lo) }) =
[@inline_let]
let res =
BF.uint64.BF.get_bitfield x (pos_width + lo) (pos_width + hi)
in
res
inline_for_extraction
noextract
let set_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) (code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) }) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield x (pos_width + lo) (pos_width + hi) code
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_same #64 (U64.v x) (pos_width + lo) (pos_width + hi) (U64.v code);
BF.get_bitfield_zero_inner (U64.v res) pos_width 64 (pos_width + lo) (pos_width + hi);
assert (BF.get_bitfield (U64.v res) pos_width 64 > 0);
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
let get_validator_error_field_set_validator_error_field
(x: U64.t)
(lo: nat)
(hi: nat { lo < hi /\ hi <= error_width })
(code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) })
: Lemma
(get_validator_error_field (set_validator_error_field x lo hi code) lo hi == code)
= ()
let set_validator_error_pos (error: validator_error) (position: pos_t) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield error 0 pos_width position
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_other (U64.v error) 0 pos_width (U64.v position) pos_width 64;
assert (BF.get_bitfield (U64.v res) pos_width 64 == BF.get_bitfield (U64.v error) pos_width 64);
Classical.move_requires (BF.get_bitfield_hi_lt_pow2 (U64.v error)) pos_width;
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
#pop-options
let get_validator_error_pos (x: U64.t) : Tot pos_t =
(BF.uint64.BF.get_bitfield x 0 pos_width)
let set_validator_error_kind (error: U64.t) (code: U64.t { 0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) : Tot validator_error =
normalize_term_spec (pow2 error_width);
set_validator_error_field error 0 error_width code
let get_validator_error_kind (error: U64.t) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) =
normalize_term_spec (pow2 error_width);
get_validator_error_field error 0 error_width
let get_validator_error_kind_set_validator_error_kind (error: U64.t) (code: U64.t {0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width)}) : Lemma
(get_validator_error_kind (set_validator_error_kind error code) == code)
[SMTPat (get_validator_error_kind (set_validator_error_kind error code))]
= assert_norm (normalize_term (pow2 error_width) == pow2 error_width);
get_validator_error_field_set_validator_error_field error 0 error_width code
let get_validator_error_pos_eq_pos (x: pos_t) : Lemma
(get_validator_error_pos x == x)
[SMTPat (get_validator_error_pos x)]
= BF.get_bitfield_size pos_width 64 (U64.v x) 0 pos_width;
BF.get_bitfield_full #pos_width (U64.v x);
BF.lt_pow2_get_bitfield_hi #64 (U64.v x) (64 - error_width);
assert (BF.get_bitfield #64 (U64.v x) pos_width 64 == 0);
BF.get_bitfield_set_bitfield_other #64 (U64.v x) pos_width 64 0 0 pos_width;
BF.get_bitfield_set_bitfield_same #64 (U64.v x) pos_width 64 0;
BF.get_bitfield_partition_2 #64 (64 - error_width) (U64.v x)
(U64.v (BF.uint64.BF.set_bitfield x pos_width 64 0uL))
[@ CMacro ]
let validator_error_generic : validator_error = normalize_term (set_validator_error_kind 0uL 1uL)
[@ CMacro ]
let validator_error_not_enough_data : validator_error = normalize_term (set_validator_error_kind 0uL 2uL)
[@ CMacro ]
let validator_error_impossible : validator_error = normalize_term (set_validator_error_kind 0uL 3uL)
[@ CMacro ]
let validator_error_list_size_not_multiple : validator_error = normalize_term (set_validator_error_kind 0uL 4uL) | false | true | EverParse3d.ErrorCode.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"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": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val validator_error_action_failed:validator_error | [] | EverParse3d.ErrorCode.validator_error_action_failed | {
"file_name": "src/3d/prelude/EverParse3d.ErrorCode.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | EverParse3d.ErrorCode.validator_error | {
"end_col": 103,
"end_line": 132,
"start_col": 54,
"start_line": 132
} |
Prims.Tot | val validator_error_constraint_failed:validator_error | [
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": 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 validator_error_constraint_failed : validator_error = normalize_term (set_validator_error_kind 0uL 6uL) | val validator_error_constraint_failed:validator_error
let validator_error_constraint_failed:validator_error = | false | null | false | normalize_term (set_validator_error_kind 0uL 6uL) | {
"checked_file": "EverParse3d.ErrorCode.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "EverParse3d.ErrorCode.fst"
} | [
"total"
] | [
"FStar.Pervasives.normalize_term",
"EverParse3d.ErrorCode.validator_error",
"EverParse3d.ErrorCode.set_validator_error_kind",
"FStar.UInt64.__uint_to_t"
] | [] | module EverParse3d.ErrorCode
module U64 = FStar.UInt64
module BF = LowParse.BitFields
inline_for_extraction
noextract
let error_width = 4
inline_for_extraction
noextract
let pos_width = normalize_term (64 - error_width)
[@ CMacro ]
let validator_max_length : (u: U64.t { 4 <= U64.v u /\ U64.v u == pow2 pos_width - 1 } ) =
FStar.Math.Lemmas.pow2_le_compat 64 pos_width;
[@inline_let]
let x = U64.uint_to_t (pow2 pos_width - 1) in
normalize_term_spec x;
normalize_term x
let is_error (positionOrError: U64.t) : Tot bool = positionOrError `U64.gt` validator_max_length
let is_success (positionOrError: U64.t) : Tot bool = positionOrError `U64.lte` validator_max_length
inline_for_extraction
noextract
type validator_error = (u: U64.t { is_error u } )
inline_for_extraction
noextract
let pos_t = (pos: U64.t {is_success pos})
module BF = LowParse.BitFields
#push-options "--z3rlimit 16"
inline_for_extraction
noextract
let get_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < pow2 (hi - lo) }) =
[@inline_let]
let res =
BF.uint64.BF.get_bitfield x (pos_width + lo) (pos_width + hi)
in
res
inline_for_extraction
noextract
let set_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) (code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) }) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield x (pos_width + lo) (pos_width + hi) code
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_same #64 (U64.v x) (pos_width + lo) (pos_width + hi) (U64.v code);
BF.get_bitfield_zero_inner (U64.v res) pos_width 64 (pos_width + lo) (pos_width + hi);
assert (BF.get_bitfield (U64.v res) pos_width 64 > 0);
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
let get_validator_error_field_set_validator_error_field
(x: U64.t)
(lo: nat)
(hi: nat { lo < hi /\ hi <= error_width })
(code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) })
: Lemma
(get_validator_error_field (set_validator_error_field x lo hi code) lo hi == code)
= ()
let set_validator_error_pos (error: validator_error) (position: pos_t) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield error 0 pos_width position
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_other (U64.v error) 0 pos_width (U64.v position) pos_width 64;
assert (BF.get_bitfield (U64.v res) pos_width 64 == BF.get_bitfield (U64.v error) pos_width 64);
Classical.move_requires (BF.get_bitfield_hi_lt_pow2 (U64.v error)) pos_width;
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
#pop-options
let get_validator_error_pos (x: U64.t) : Tot pos_t =
(BF.uint64.BF.get_bitfield x 0 pos_width)
let set_validator_error_kind (error: U64.t) (code: U64.t { 0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) : Tot validator_error =
normalize_term_spec (pow2 error_width);
set_validator_error_field error 0 error_width code
let get_validator_error_kind (error: U64.t) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) =
normalize_term_spec (pow2 error_width);
get_validator_error_field error 0 error_width
let get_validator_error_kind_set_validator_error_kind (error: U64.t) (code: U64.t {0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width)}) : Lemma
(get_validator_error_kind (set_validator_error_kind error code) == code)
[SMTPat (get_validator_error_kind (set_validator_error_kind error code))]
= assert_norm (normalize_term (pow2 error_width) == pow2 error_width);
get_validator_error_field_set_validator_error_field error 0 error_width code
let get_validator_error_pos_eq_pos (x: pos_t) : Lemma
(get_validator_error_pos x == x)
[SMTPat (get_validator_error_pos x)]
= BF.get_bitfield_size pos_width 64 (U64.v x) 0 pos_width;
BF.get_bitfield_full #pos_width (U64.v x);
BF.lt_pow2_get_bitfield_hi #64 (U64.v x) (64 - error_width);
assert (BF.get_bitfield #64 (U64.v x) pos_width 64 == 0);
BF.get_bitfield_set_bitfield_other #64 (U64.v x) pos_width 64 0 0 pos_width;
BF.get_bitfield_set_bitfield_same #64 (U64.v x) pos_width 64 0;
BF.get_bitfield_partition_2 #64 (64 - error_width) (U64.v x)
(U64.v (BF.uint64.BF.set_bitfield x pos_width 64 0uL))
[@ CMacro ]
let validator_error_generic : validator_error = normalize_term (set_validator_error_kind 0uL 1uL)
[@ CMacro ]
let validator_error_not_enough_data : validator_error = normalize_term (set_validator_error_kind 0uL 2uL)
[@ CMacro ]
let validator_error_impossible : validator_error = normalize_term (set_validator_error_kind 0uL 3uL)
[@ CMacro ]
let validator_error_list_size_not_multiple : validator_error = normalize_term (set_validator_error_kind 0uL 4uL)
[@ CMacro ]
let validator_error_action_failed : validator_error = normalize_term (set_validator_error_kind 0uL 5uL) | false | true | EverParse3d.ErrorCode.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"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": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val validator_error_constraint_failed:validator_error | [] | EverParse3d.ErrorCode.validator_error_constraint_failed | {
"file_name": "src/3d/prelude/EverParse3d.ErrorCode.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | EverParse3d.ErrorCode.validator_error | {
"end_col": 107,
"end_line": 135,
"start_col": 58,
"start_line": 135
} |
Prims.Tot | val validator_error_unexpected_padding:validator_error | [
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": 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 validator_error_unexpected_padding : validator_error = normalize_term (set_validator_error_kind 0uL 7uL) | val validator_error_unexpected_padding:validator_error
let validator_error_unexpected_padding:validator_error = | false | null | false | normalize_term (set_validator_error_kind 0uL 7uL) | {
"checked_file": "EverParse3d.ErrorCode.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "EverParse3d.ErrorCode.fst"
} | [
"total"
] | [
"FStar.Pervasives.normalize_term",
"EverParse3d.ErrorCode.validator_error",
"EverParse3d.ErrorCode.set_validator_error_kind",
"FStar.UInt64.__uint_to_t"
] | [] | module EverParse3d.ErrorCode
module U64 = FStar.UInt64
module BF = LowParse.BitFields
inline_for_extraction
noextract
let error_width = 4
inline_for_extraction
noextract
let pos_width = normalize_term (64 - error_width)
[@ CMacro ]
let validator_max_length : (u: U64.t { 4 <= U64.v u /\ U64.v u == pow2 pos_width - 1 } ) =
FStar.Math.Lemmas.pow2_le_compat 64 pos_width;
[@inline_let]
let x = U64.uint_to_t (pow2 pos_width - 1) in
normalize_term_spec x;
normalize_term x
let is_error (positionOrError: U64.t) : Tot bool = positionOrError `U64.gt` validator_max_length
let is_success (positionOrError: U64.t) : Tot bool = positionOrError `U64.lte` validator_max_length
inline_for_extraction
noextract
type validator_error = (u: U64.t { is_error u } )
inline_for_extraction
noextract
let pos_t = (pos: U64.t {is_success pos})
module BF = LowParse.BitFields
#push-options "--z3rlimit 16"
inline_for_extraction
noextract
let get_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < pow2 (hi - lo) }) =
[@inline_let]
let res =
BF.uint64.BF.get_bitfield x (pos_width + lo) (pos_width + hi)
in
res
inline_for_extraction
noextract
let set_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) (code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) }) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield x (pos_width + lo) (pos_width + hi) code
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_same #64 (U64.v x) (pos_width + lo) (pos_width + hi) (U64.v code);
BF.get_bitfield_zero_inner (U64.v res) pos_width 64 (pos_width + lo) (pos_width + hi);
assert (BF.get_bitfield (U64.v res) pos_width 64 > 0);
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
let get_validator_error_field_set_validator_error_field
(x: U64.t)
(lo: nat)
(hi: nat { lo < hi /\ hi <= error_width })
(code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) })
: Lemma
(get_validator_error_field (set_validator_error_field x lo hi code) lo hi == code)
= ()
let set_validator_error_pos (error: validator_error) (position: pos_t) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield error 0 pos_width position
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_other (U64.v error) 0 pos_width (U64.v position) pos_width 64;
assert (BF.get_bitfield (U64.v res) pos_width 64 == BF.get_bitfield (U64.v error) pos_width 64);
Classical.move_requires (BF.get_bitfield_hi_lt_pow2 (U64.v error)) pos_width;
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
#pop-options
let get_validator_error_pos (x: U64.t) : Tot pos_t =
(BF.uint64.BF.get_bitfield x 0 pos_width)
let set_validator_error_kind (error: U64.t) (code: U64.t { 0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) : Tot validator_error =
normalize_term_spec (pow2 error_width);
set_validator_error_field error 0 error_width code
let get_validator_error_kind (error: U64.t) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) =
normalize_term_spec (pow2 error_width);
get_validator_error_field error 0 error_width
let get_validator_error_kind_set_validator_error_kind (error: U64.t) (code: U64.t {0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width)}) : Lemma
(get_validator_error_kind (set_validator_error_kind error code) == code)
[SMTPat (get_validator_error_kind (set_validator_error_kind error code))]
= assert_norm (normalize_term (pow2 error_width) == pow2 error_width);
get_validator_error_field_set_validator_error_field error 0 error_width code
let get_validator_error_pos_eq_pos (x: pos_t) : Lemma
(get_validator_error_pos x == x)
[SMTPat (get_validator_error_pos x)]
= BF.get_bitfield_size pos_width 64 (U64.v x) 0 pos_width;
BF.get_bitfield_full #pos_width (U64.v x);
BF.lt_pow2_get_bitfield_hi #64 (U64.v x) (64 - error_width);
assert (BF.get_bitfield #64 (U64.v x) pos_width 64 == 0);
BF.get_bitfield_set_bitfield_other #64 (U64.v x) pos_width 64 0 0 pos_width;
BF.get_bitfield_set_bitfield_same #64 (U64.v x) pos_width 64 0;
BF.get_bitfield_partition_2 #64 (64 - error_width) (U64.v x)
(U64.v (BF.uint64.BF.set_bitfield x pos_width 64 0uL))
[@ CMacro ]
let validator_error_generic : validator_error = normalize_term (set_validator_error_kind 0uL 1uL)
[@ CMacro ]
let validator_error_not_enough_data : validator_error = normalize_term (set_validator_error_kind 0uL 2uL)
[@ CMacro ]
let validator_error_impossible : validator_error = normalize_term (set_validator_error_kind 0uL 3uL)
[@ CMacro ]
let validator_error_list_size_not_multiple : validator_error = normalize_term (set_validator_error_kind 0uL 4uL)
[@ CMacro ]
let validator_error_action_failed : validator_error = normalize_term (set_validator_error_kind 0uL 5uL)
[@ CMacro ]
let validator_error_constraint_failed : validator_error = normalize_term (set_validator_error_kind 0uL 6uL) | false | true | EverParse3d.ErrorCode.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"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": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val validator_error_unexpected_padding:validator_error | [] | EverParse3d.ErrorCode.validator_error_unexpected_padding | {
"file_name": "src/3d/prelude/EverParse3d.ErrorCode.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | EverParse3d.ErrorCode.validator_error | {
"end_col": 108,
"end_line": 138,
"start_col": 59,
"start_line": 138
} |
Prims.Tot | val check_constraint_ok (ok: bool) (position: pos_t) : Tot U64.t | [
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": 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 check_constraint_ok (ok:bool) (position: pos_t): Tot U64.t =
if ok
then position
else set_validator_error_pos validator_error_constraint_failed position | val check_constraint_ok (ok: bool) (position: pos_t) : Tot U64.t
let check_constraint_ok (ok: bool) (position: pos_t) : Tot U64.t = | false | null | false | if ok then position else set_validator_error_pos validator_error_constraint_failed position | {
"checked_file": "EverParse3d.ErrorCode.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "EverParse3d.ErrorCode.fst"
} | [
"total"
] | [
"Prims.bool",
"EverParse3d.ErrorCode.pos_t",
"EverParse3d.ErrorCode.set_validator_error_pos",
"EverParse3d.ErrorCode.validator_error_constraint_failed",
"FStar.UInt64.t"
] | [] | module EverParse3d.ErrorCode
module U64 = FStar.UInt64
module BF = LowParse.BitFields
inline_for_extraction
noextract
let error_width = 4
inline_for_extraction
noextract
let pos_width = normalize_term (64 - error_width)
[@ CMacro ]
let validator_max_length : (u: U64.t { 4 <= U64.v u /\ U64.v u == pow2 pos_width - 1 } ) =
FStar.Math.Lemmas.pow2_le_compat 64 pos_width;
[@inline_let]
let x = U64.uint_to_t (pow2 pos_width - 1) in
normalize_term_spec x;
normalize_term x
let is_error (positionOrError: U64.t) : Tot bool = positionOrError `U64.gt` validator_max_length
let is_success (positionOrError: U64.t) : Tot bool = positionOrError `U64.lte` validator_max_length
inline_for_extraction
noextract
type validator_error = (u: U64.t { is_error u } )
inline_for_extraction
noextract
let pos_t = (pos: U64.t {is_success pos})
module BF = LowParse.BitFields
#push-options "--z3rlimit 16"
inline_for_extraction
noextract
let get_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < pow2 (hi - lo) }) =
[@inline_let]
let res =
BF.uint64.BF.get_bitfield x (pos_width + lo) (pos_width + hi)
in
res
inline_for_extraction
noextract
let set_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) (code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) }) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield x (pos_width + lo) (pos_width + hi) code
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_same #64 (U64.v x) (pos_width + lo) (pos_width + hi) (U64.v code);
BF.get_bitfield_zero_inner (U64.v res) pos_width 64 (pos_width + lo) (pos_width + hi);
assert (BF.get_bitfield (U64.v res) pos_width 64 > 0);
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
let get_validator_error_field_set_validator_error_field
(x: U64.t)
(lo: nat)
(hi: nat { lo < hi /\ hi <= error_width })
(code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) })
: Lemma
(get_validator_error_field (set_validator_error_field x lo hi code) lo hi == code)
= ()
let set_validator_error_pos (error: validator_error) (position: pos_t) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield error 0 pos_width position
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_other (U64.v error) 0 pos_width (U64.v position) pos_width 64;
assert (BF.get_bitfield (U64.v res) pos_width 64 == BF.get_bitfield (U64.v error) pos_width 64);
Classical.move_requires (BF.get_bitfield_hi_lt_pow2 (U64.v error)) pos_width;
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
#pop-options
let get_validator_error_pos (x: U64.t) : Tot pos_t =
(BF.uint64.BF.get_bitfield x 0 pos_width)
let set_validator_error_kind (error: U64.t) (code: U64.t { 0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) : Tot validator_error =
normalize_term_spec (pow2 error_width);
set_validator_error_field error 0 error_width code
let get_validator_error_kind (error: U64.t) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) =
normalize_term_spec (pow2 error_width);
get_validator_error_field error 0 error_width
let get_validator_error_kind_set_validator_error_kind (error: U64.t) (code: U64.t {0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width)}) : Lemma
(get_validator_error_kind (set_validator_error_kind error code) == code)
[SMTPat (get_validator_error_kind (set_validator_error_kind error code))]
= assert_norm (normalize_term (pow2 error_width) == pow2 error_width);
get_validator_error_field_set_validator_error_field error 0 error_width code
let get_validator_error_pos_eq_pos (x: pos_t) : Lemma
(get_validator_error_pos x == x)
[SMTPat (get_validator_error_pos x)]
= BF.get_bitfield_size pos_width 64 (U64.v x) 0 pos_width;
BF.get_bitfield_full #pos_width (U64.v x);
BF.lt_pow2_get_bitfield_hi #64 (U64.v x) (64 - error_width);
assert (BF.get_bitfield #64 (U64.v x) pos_width 64 == 0);
BF.get_bitfield_set_bitfield_other #64 (U64.v x) pos_width 64 0 0 pos_width;
BF.get_bitfield_set_bitfield_same #64 (U64.v x) pos_width 64 0;
BF.get_bitfield_partition_2 #64 (64 - error_width) (U64.v x)
(U64.v (BF.uint64.BF.set_bitfield x pos_width 64 0uL))
[@ CMacro ]
let validator_error_generic : validator_error = normalize_term (set_validator_error_kind 0uL 1uL)
[@ CMacro ]
let validator_error_not_enough_data : validator_error = normalize_term (set_validator_error_kind 0uL 2uL)
[@ CMacro ]
let validator_error_impossible : validator_error = normalize_term (set_validator_error_kind 0uL 3uL)
[@ CMacro ]
let validator_error_list_size_not_multiple : validator_error = normalize_term (set_validator_error_kind 0uL 4uL)
[@ CMacro ]
let validator_error_action_failed : validator_error = normalize_term (set_validator_error_kind 0uL 5uL)
[@ CMacro ]
let validator_error_constraint_failed : validator_error = normalize_term (set_validator_error_kind 0uL 6uL)
[@ CMacro ]
let validator_error_unexpected_padding : validator_error = normalize_term (set_validator_error_kind 0uL 7uL)
let error_reason_of_result (code:U64.t) : string =
match (get_validator_error_kind code) with
| 1uL -> "generic error"
| 2uL -> "not enough data"
| 3uL -> "impossible"
| 4uL -> "list size not multiple of element size"
| 5uL -> "action failed"
| 6uL -> "constraint failed"
| 7uL -> "unexpected padding"
| _ -> "unspecified" | false | true | EverParse3d.ErrorCode.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"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": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val check_constraint_ok (ok: bool) (position: pos_t) : Tot U64.t | [] | EverParse3d.ErrorCode.check_constraint_ok | {
"file_name": "src/3d/prelude/EverParse3d.ErrorCode.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | ok: Prims.bool -> position: EverParse3d.ErrorCode.pos_t -> FStar.UInt64.t | {
"end_col": 77,
"end_line": 154,
"start_col": 6,
"start_line": 152
} |
Prims.Tot | val error_reason_of_result (code: U64.t) : string | [
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": 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 error_reason_of_result (code:U64.t) : string =
match (get_validator_error_kind code) with
| 1uL -> "generic error"
| 2uL -> "not enough data"
| 3uL -> "impossible"
| 4uL -> "list size not multiple of element size"
| 5uL -> "action failed"
| 6uL -> "constraint failed"
| 7uL -> "unexpected padding"
| _ -> "unspecified" | val error_reason_of_result (code: U64.t) : string
let error_reason_of_result (code: U64.t) : string = | false | null | false | match (get_validator_error_kind code) with
| 1uL -> "generic error"
| 2uL -> "not enough data"
| 3uL -> "impossible"
| 4uL -> "list size not multiple of element size"
| 5uL -> "action failed"
| 6uL -> "constraint failed"
| 7uL -> "unexpected padding"
| _ -> "unspecified" | {
"checked_file": "EverParse3d.ErrorCode.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "EverParse3d.ErrorCode.fst"
} | [
"total"
] | [
"FStar.UInt64.t",
"EverParse3d.ErrorCode.get_validator_error_kind",
"Prims.string"
] | [] | module EverParse3d.ErrorCode
module U64 = FStar.UInt64
module BF = LowParse.BitFields
inline_for_extraction
noextract
let error_width = 4
inline_for_extraction
noextract
let pos_width = normalize_term (64 - error_width)
[@ CMacro ]
let validator_max_length : (u: U64.t { 4 <= U64.v u /\ U64.v u == pow2 pos_width - 1 } ) =
FStar.Math.Lemmas.pow2_le_compat 64 pos_width;
[@inline_let]
let x = U64.uint_to_t (pow2 pos_width - 1) in
normalize_term_spec x;
normalize_term x
let is_error (positionOrError: U64.t) : Tot bool = positionOrError `U64.gt` validator_max_length
let is_success (positionOrError: U64.t) : Tot bool = positionOrError `U64.lte` validator_max_length
inline_for_extraction
noextract
type validator_error = (u: U64.t { is_error u } )
inline_for_extraction
noextract
let pos_t = (pos: U64.t {is_success pos})
module BF = LowParse.BitFields
#push-options "--z3rlimit 16"
inline_for_extraction
noextract
let get_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < pow2 (hi - lo) }) =
[@inline_let]
let res =
BF.uint64.BF.get_bitfield x (pos_width + lo) (pos_width + hi)
in
res
inline_for_extraction
noextract
let set_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) (code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) }) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield x (pos_width + lo) (pos_width + hi) code
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_same #64 (U64.v x) (pos_width + lo) (pos_width + hi) (U64.v code);
BF.get_bitfield_zero_inner (U64.v res) pos_width 64 (pos_width + lo) (pos_width + hi);
assert (BF.get_bitfield (U64.v res) pos_width 64 > 0);
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
let get_validator_error_field_set_validator_error_field
(x: U64.t)
(lo: nat)
(hi: nat { lo < hi /\ hi <= error_width })
(code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) })
: Lemma
(get_validator_error_field (set_validator_error_field x lo hi code) lo hi == code)
= ()
let set_validator_error_pos (error: validator_error) (position: pos_t) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield error 0 pos_width position
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_other (U64.v error) 0 pos_width (U64.v position) pos_width 64;
assert (BF.get_bitfield (U64.v res) pos_width 64 == BF.get_bitfield (U64.v error) pos_width 64);
Classical.move_requires (BF.get_bitfield_hi_lt_pow2 (U64.v error)) pos_width;
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
#pop-options
let get_validator_error_pos (x: U64.t) : Tot pos_t =
(BF.uint64.BF.get_bitfield x 0 pos_width)
let set_validator_error_kind (error: U64.t) (code: U64.t { 0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) : Tot validator_error =
normalize_term_spec (pow2 error_width);
set_validator_error_field error 0 error_width code
let get_validator_error_kind (error: U64.t) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) =
normalize_term_spec (pow2 error_width);
get_validator_error_field error 0 error_width
let get_validator_error_kind_set_validator_error_kind (error: U64.t) (code: U64.t {0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width)}) : Lemma
(get_validator_error_kind (set_validator_error_kind error code) == code)
[SMTPat (get_validator_error_kind (set_validator_error_kind error code))]
= assert_norm (normalize_term (pow2 error_width) == pow2 error_width);
get_validator_error_field_set_validator_error_field error 0 error_width code
let get_validator_error_pos_eq_pos (x: pos_t) : Lemma
(get_validator_error_pos x == x)
[SMTPat (get_validator_error_pos x)]
= BF.get_bitfield_size pos_width 64 (U64.v x) 0 pos_width;
BF.get_bitfield_full #pos_width (U64.v x);
BF.lt_pow2_get_bitfield_hi #64 (U64.v x) (64 - error_width);
assert (BF.get_bitfield #64 (U64.v x) pos_width 64 == 0);
BF.get_bitfield_set_bitfield_other #64 (U64.v x) pos_width 64 0 0 pos_width;
BF.get_bitfield_set_bitfield_same #64 (U64.v x) pos_width 64 0;
BF.get_bitfield_partition_2 #64 (64 - error_width) (U64.v x)
(U64.v (BF.uint64.BF.set_bitfield x pos_width 64 0uL))
[@ CMacro ]
let validator_error_generic : validator_error = normalize_term (set_validator_error_kind 0uL 1uL)
[@ CMacro ]
let validator_error_not_enough_data : validator_error = normalize_term (set_validator_error_kind 0uL 2uL)
[@ CMacro ]
let validator_error_impossible : validator_error = normalize_term (set_validator_error_kind 0uL 3uL)
[@ CMacro ]
let validator_error_list_size_not_multiple : validator_error = normalize_term (set_validator_error_kind 0uL 4uL)
[@ CMacro ]
let validator_error_action_failed : validator_error = normalize_term (set_validator_error_kind 0uL 5uL)
[@ CMacro ]
let validator_error_constraint_failed : validator_error = normalize_term (set_validator_error_kind 0uL 6uL)
[@ CMacro ]
let validator_error_unexpected_padding : validator_error = normalize_term (set_validator_error_kind 0uL 7uL) | false | true | EverParse3d.ErrorCode.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"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": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val error_reason_of_result (code: U64.t) : string | [] | EverParse3d.ErrorCode.error_reason_of_result | {
"file_name": "src/3d/prelude/EverParse3d.ErrorCode.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | code: FStar.UInt64.t -> Prims.string | {
"end_col": 22,
"end_line": 149,
"start_col": 2,
"start_line": 141
} |
Prims.Tot | val get_validator_error_pos (x: U64.t) : Tot pos_t | [
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": 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_validator_error_pos (x: U64.t) : Tot pos_t =
(BF.uint64.BF.get_bitfield x 0 pos_width) | val get_validator_error_pos (x: U64.t) : Tot pos_t
let get_validator_error_pos (x: U64.t) : Tot pos_t = | false | null | false | (BF.uint64.BF.get_bitfield x 0 pos_width) | {
"checked_file": "EverParse3d.ErrorCode.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "EverParse3d.ErrorCode.fst"
} | [
"total"
] | [
"FStar.UInt64.t",
"LowParse.BitFields.__proj__Mkuint_t__item__get_bitfield",
"LowParse.BitFields.uint64",
"EverParse3d.ErrorCode.pos_width",
"EverParse3d.ErrorCode.pos_t"
] | [] | module EverParse3d.ErrorCode
module U64 = FStar.UInt64
module BF = LowParse.BitFields
inline_for_extraction
noextract
let error_width = 4
inline_for_extraction
noextract
let pos_width = normalize_term (64 - error_width)
[@ CMacro ]
let validator_max_length : (u: U64.t { 4 <= U64.v u /\ U64.v u == pow2 pos_width - 1 } ) =
FStar.Math.Lemmas.pow2_le_compat 64 pos_width;
[@inline_let]
let x = U64.uint_to_t (pow2 pos_width - 1) in
normalize_term_spec x;
normalize_term x
let is_error (positionOrError: U64.t) : Tot bool = positionOrError `U64.gt` validator_max_length
let is_success (positionOrError: U64.t) : Tot bool = positionOrError `U64.lte` validator_max_length
inline_for_extraction
noextract
type validator_error = (u: U64.t { is_error u } )
inline_for_extraction
noextract
let pos_t = (pos: U64.t {is_success pos})
module BF = LowParse.BitFields
#push-options "--z3rlimit 16"
inline_for_extraction
noextract
let get_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < pow2 (hi - lo) }) =
[@inline_let]
let res =
BF.uint64.BF.get_bitfield x (pos_width + lo) (pos_width + hi)
in
res
inline_for_extraction
noextract
let set_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) (code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) }) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield x (pos_width + lo) (pos_width + hi) code
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_same #64 (U64.v x) (pos_width + lo) (pos_width + hi) (U64.v code);
BF.get_bitfield_zero_inner (U64.v res) pos_width 64 (pos_width + lo) (pos_width + hi);
assert (BF.get_bitfield (U64.v res) pos_width 64 > 0);
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
let get_validator_error_field_set_validator_error_field
(x: U64.t)
(lo: nat)
(hi: nat { lo < hi /\ hi <= error_width })
(code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) })
: Lemma
(get_validator_error_field (set_validator_error_field x lo hi code) lo hi == code)
= ()
let set_validator_error_pos (error: validator_error) (position: pos_t) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield error 0 pos_width position
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_other (U64.v error) 0 pos_width (U64.v position) pos_width 64;
assert (BF.get_bitfield (U64.v res) pos_width 64 == BF.get_bitfield (U64.v error) pos_width 64);
Classical.move_requires (BF.get_bitfield_hi_lt_pow2 (U64.v error)) pos_width;
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
#pop-options | false | true | EverParse3d.ErrorCode.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"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": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val get_validator_error_pos (x: U64.t) : Tot pos_t | [] | EverParse3d.ErrorCode.get_validator_error_pos | {
"file_name": "src/3d/prelude/EverParse3d.ErrorCode.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | x: FStar.UInt64.t -> EverParse3d.ErrorCode.pos_t | {
"end_col": 43,
"end_line": 91,
"start_col": 2,
"start_line": 91
} |
FStar.Pervasives.Lemma | val get_validator_error_pos_eq_pos (x: pos_t)
: Lemma (get_validator_error_pos x == x) [SMTPat (get_validator_error_pos x)] | [
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": 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_validator_error_pos_eq_pos (x: pos_t) : Lemma
(get_validator_error_pos x == x)
[SMTPat (get_validator_error_pos x)]
= BF.get_bitfield_size pos_width 64 (U64.v x) 0 pos_width;
BF.get_bitfield_full #pos_width (U64.v x);
BF.lt_pow2_get_bitfield_hi #64 (U64.v x) (64 - error_width);
assert (BF.get_bitfield #64 (U64.v x) pos_width 64 == 0);
BF.get_bitfield_set_bitfield_other #64 (U64.v x) pos_width 64 0 0 pos_width;
BF.get_bitfield_set_bitfield_same #64 (U64.v x) pos_width 64 0;
BF.get_bitfield_partition_2 #64 (64 - error_width) (U64.v x)
(U64.v (BF.uint64.BF.set_bitfield x pos_width 64 0uL)) | val get_validator_error_pos_eq_pos (x: pos_t)
: Lemma (get_validator_error_pos x == x) [SMTPat (get_validator_error_pos x)]
let get_validator_error_pos_eq_pos (x: pos_t)
: Lemma (get_validator_error_pos x == x) [SMTPat (get_validator_error_pos x)] = | false | null | true | BF.get_bitfield_size pos_width 64 (U64.v x) 0 pos_width;
BF.get_bitfield_full #pos_width (U64.v x);
BF.lt_pow2_get_bitfield_hi #64 (U64.v x) (64 - error_width);
assert (BF.get_bitfield #64 (U64.v x) pos_width 64 == 0);
BF.get_bitfield_set_bitfield_other #64 (U64.v x) pos_width 64 0 0 pos_width;
BF.get_bitfield_set_bitfield_same #64 (U64.v x) pos_width 64 0;
BF.get_bitfield_partition_2 #64
(64 - error_width)
(U64.v x)
(U64.v (BF.uint64.BF.set_bitfield x pos_width 64 0uL)) | {
"checked_file": "EverParse3d.ErrorCode.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "EverParse3d.ErrorCode.fst"
} | [
"lemma"
] | [
"EverParse3d.ErrorCode.pos_t",
"LowParse.BitFields.get_bitfield_partition_2",
"Prims.op_Subtraction",
"EverParse3d.ErrorCode.error_width",
"FStar.UInt64.v",
"LowParse.BitFields.__proj__Mkuint_t__item__set_bitfield",
"FStar.UInt64.t",
"LowParse.BitFields.uint64",
"EverParse3d.ErrorCode.pos_width",
"FStar.UInt64.__uint_to_t",
"Prims.unit",
"LowParse.BitFields.get_bitfield_set_bitfield_same",
"LowParse.BitFields.get_bitfield_set_bitfield_other",
"Prims._assert",
"Prims.eq2",
"Prims.int",
"LowParse.BitFields.get_bitfield",
"LowParse.BitFields.lt_pow2_get_bitfield_hi",
"LowParse.BitFields.get_bitfield_full",
"LowParse.BitFields.get_bitfield_size",
"Prims.l_True",
"Prims.squash",
"EverParse3d.ErrorCode.get_validator_error_pos",
"Prims.Cons",
"FStar.Pervasives.pattern",
"FStar.Pervasives.smt_pat",
"Prims.Nil"
] | [] | module EverParse3d.ErrorCode
module U64 = FStar.UInt64
module BF = LowParse.BitFields
inline_for_extraction
noextract
let error_width = 4
inline_for_extraction
noextract
let pos_width = normalize_term (64 - error_width)
[@ CMacro ]
let validator_max_length : (u: U64.t { 4 <= U64.v u /\ U64.v u == pow2 pos_width - 1 } ) =
FStar.Math.Lemmas.pow2_le_compat 64 pos_width;
[@inline_let]
let x = U64.uint_to_t (pow2 pos_width - 1) in
normalize_term_spec x;
normalize_term x
let is_error (positionOrError: U64.t) : Tot bool = positionOrError `U64.gt` validator_max_length
let is_success (positionOrError: U64.t) : Tot bool = positionOrError `U64.lte` validator_max_length
inline_for_extraction
noextract
type validator_error = (u: U64.t { is_error u } )
inline_for_extraction
noextract
let pos_t = (pos: U64.t {is_success pos})
module BF = LowParse.BitFields
#push-options "--z3rlimit 16"
inline_for_extraction
noextract
let get_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < pow2 (hi - lo) }) =
[@inline_let]
let res =
BF.uint64.BF.get_bitfield x (pos_width + lo) (pos_width + hi)
in
res
inline_for_extraction
noextract
let set_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) (code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) }) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield x (pos_width + lo) (pos_width + hi) code
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_same #64 (U64.v x) (pos_width + lo) (pos_width + hi) (U64.v code);
BF.get_bitfield_zero_inner (U64.v res) pos_width 64 (pos_width + lo) (pos_width + hi);
assert (BF.get_bitfield (U64.v res) pos_width 64 > 0);
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
let get_validator_error_field_set_validator_error_field
(x: U64.t)
(lo: nat)
(hi: nat { lo < hi /\ hi <= error_width })
(code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) })
: Lemma
(get_validator_error_field (set_validator_error_field x lo hi code) lo hi == code)
= ()
let set_validator_error_pos (error: validator_error) (position: pos_t) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield error 0 pos_width position
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_other (U64.v error) 0 pos_width (U64.v position) pos_width 64;
assert (BF.get_bitfield (U64.v res) pos_width 64 == BF.get_bitfield (U64.v error) pos_width 64);
Classical.move_requires (BF.get_bitfield_hi_lt_pow2 (U64.v error)) pos_width;
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
#pop-options
let get_validator_error_pos (x: U64.t) : Tot pos_t =
(BF.uint64.BF.get_bitfield x 0 pos_width)
let set_validator_error_kind (error: U64.t) (code: U64.t { 0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) : Tot validator_error =
normalize_term_spec (pow2 error_width);
set_validator_error_field error 0 error_width code
let get_validator_error_kind (error: U64.t) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) =
normalize_term_spec (pow2 error_width);
get_validator_error_field error 0 error_width
let get_validator_error_kind_set_validator_error_kind (error: U64.t) (code: U64.t {0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width)}) : Lemma
(get_validator_error_kind (set_validator_error_kind error code) == code)
[SMTPat (get_validator_error_kind (set_validator_error_kind error code))]
= assert_norm (normalize_term (pow2 error_width) == pow2 error_width);
get_validator_error_field_set_validator_error_field error 0 error_width code
let get_validator_error_pos_eq_pos (x: pos_t) : Lemma
(get_validator_error_pos x == x) | false | false | EverParse3d.ErrorCode.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"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": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val get_validator_error_pos_eq_pos (x: pos_t)
: Lemma (get_validator_error_pos x == x) [SMTPat (get_validator_error_pos x)] | [] | EverParse3d.ErrorCode.get_validator_error_pos_eq_pos | {
"file_name": "src/3d/prelude/EverParse3d.ErrorCode.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | x: EverParse3d.ErrorCode.pos_t
-> FStar.Pervasives.Lemma (ensures EverParse3d.ErrorCode.get_validator_error_pos x == x)
[SMTPat (EverParse3d.ErrorCode.get_validator_error_pos x)] | {
"end_col": 58,
"end_line": 117,
"start_col": 2,
"start_line": 110
} |
Prims.Tot | val set_validator_error_pos (error: validator_error) (position: pos_t) : Tot validator_error | [
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": 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 set_validator_error_pos (error: validator_error) (position: pos_t) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield error 0 pos_width position
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_other (U64.v error) 0 pos_width (U64.v position) pos_width 64;
assert (BF.get_bitfield (U64.v res) pos_width 64 == BF.get_bitfield (U64.v error) pos_width 64);
Classical.move_requires (BF.get_bitfield_hi_lt_pow2 (U64.v error)) pos_width;
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res | val set_validator_error_pos (error: validator_error) (position: pos_t) : Tot validator_error
let set_validator_error_pos (error: validator_error) (position: pos_t) : Tot validator_error = | false | null | false | [@@ inline_let ]let res = BF.uint64.BF.set_bitfield error 0 pos_width position in
[@@ inline_let ]let _ =
BF.get_bitfield_set_bitfield_other (U64.v error) 0 pos_width (U64.v position) pos_width 64;
assert (BF.get_bitfield (U64.v res) pos_width 64 == BF.get_bitfield (U64.v error) pos_width 64);
Classical.move_requires (BF.get_bitfield_hi_lt_pow2 (U64.v error)) pos_width;
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res | {
"checked_file": "EverParse3d.ErrorCode.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "EverParse3d.ErrorCode.fst"
} | [
"total"
] | [
"EverParse3d.ErrorCode.validator_error",
"EverParse3d.ErrorCode.pos_t",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"Prims.pow2",
"EverParse3d.ErrorCode.pos_width",
"Prims.op_Addition",
"FStar.UInt64.v",
"EverParse3d.ErrorCode.validator_max_length",
"FStar.Classical.move_requires",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.UInt64.n",
"Prims.op_LessThan",
"LowParse.BitFields.get_bitfield",
"LowParse.BitFields.lt_pow2_get_bitfield_hi",
"LowParse.BitFields.get_bitfield_hi_lt_pow2",
"Prims._assert",
"LowParse.BitFields.ubitfield",
"Prims.op_Subtraction",
"LowParse.BitFields.get_bitfield_set_bitfield_other",
"FStar.UInt64.t",
"FStar.UInt.uint_t",
"LowParse.BitFields.__proj__Mkuint_t__item__v",
"LowParse.BitFields.uint64",
"LowParse.BitFields.set_bitfield",
"LowParse.BitFields.__proj__Mkuint_t__item__set_bitfield"
] | [] | module EverParse3d.ErrorCode
module U64 = FStar.UInt64
module BF = LowParse.BitFields
inline_for_extraction
noextract
let error_width = 4
inline_for_extraction
noextract
let pos_width = normalize_term (64 - error_width)
[@ CMacro ]
let validator_max_length : (u: U64.t { 4 <= U64.v u /\ U64.v u == pow2 pos_width - 1 } ) =
FStar.Math.Lemmas.pow2_le_compat 64 pos_width;
[@inline_let]
let x = U64.uint_to_t (pow2 pos_width - 1) in
normalize_term_spec x;
normalize_term x
let is_error (positionOrError: U64.t) : Tot bool = positionOrError `U64.gt` validator_max_length
let is_success (positionOrError: U64.t) : Tot bool = positionOrError `U64.lte` validator_max_length
inline_for_extraction
noextract
type validator_error = (u: U64.t { is_error u } )
inline_for_extraction
noextract
let pos_t = (pos: U64.t {is_success pos})
module BF = LowParse.BitFields
#push-options "--z3rlimit 16"
inline_for_extraction
noextract
let get_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < pow2 (hi - lo) }) =
[@inline_let]
let res =
BF.uint64.BF.get_bitfield x (pos_width + lo) (pos_width + hi)
in
res
inline_for_extraction
noextract
let set_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) (code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) }) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield x (pos_width + lo) (pos_width + hi) code
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_same #64 (U64.v x) (pos_width + lo) (pos_width + hi) (U64.v code);
BF.get_bitfield_zero_inner (U64.v res) pos_width 64 (pos_width + lo) (pos_width + hi);
assert (BF.get_bitfield (U64.v res) pos_width 64 > 0);
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
let get_validator_error_field_set_validator_error_field
(x: U64.t)
(lo: nat)
(hi: nat { lo < hi /\ hi <= error_width })
(code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) })
: Lemma
(get_validator_error_field (set_validator_error_field x lo hi code) lo hi == code)
= () | false | true | EverParse3d.ErrorCode.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"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": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 16,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val set_validator_error_pos (error: validator_error) (position: pos_t) : Tot validator_error | [] | EverParse3d.ErrorCode.set_validator_error_pos | {
"file_name": "src/3d/prelude/EverParse3d.ErrorCode.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | error: EverParse3d.ErrorCode.validator_error -> position: EverParse3d.ErrorCode.pos_t
-> EverParse3d.ErrorCode.validator_error | {
"end_col": 5,
"end_line": 86,
"start_col": 2,
"start_line": 74
} |
Prims.Tot | val get_validator_error_kind (error: U64.t)
: Tot (code: U64.t{0 <= U64.v code /\ U64.v code < normalize_term (pow2 error_width)}) | [
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": 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_validator_error_kind (error: U64.t) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) =
normalize_term_spec (pow2 error_width);
get_validator_error_field error 0 error_width | val get_validator_error_kind (error: U64.t)
: Tot (code: U64.t{0 <= U64.v code /\ U64.v code < normalize_term (pow2 error_width)})
let get_validator_error_kind (error: U64.t)
: Tot (code: U64.t{0 <= U64.v code /\ U64.v code < normalize_term (pow2 error_width)}) = | false | null | false | normalize_term_spec (pow2 error_width);
get_validator_error_field error 0 error_width | {
"checked_file": "EverParse3d.ErrorCode.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "EverParse3d.ErrorCode.fst"
} | [
"total"
] | [
"FStar.UInt64.t",
"EverParse3d.ErrorCode.get_validator_error_field",
"EverParse3d.ErrorCode.error_width",
"Prims.unit",
"FStar.Pervasives.normalize_term_spec",
"Prims.pos",
"Prims.pow2",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.UInt64.v",
"Prims.op_LessThan",
"FStar.Pervasives.normalize_term",
"Prims.int"
] | [] | module EverParse3d.ErrorCode
module U64 = FStar.UInt64
module BF = LowParse.BitFields
inline_for_extraction
noextract
let error_width = 4
inline_for_extraction
noextract
let pos_width = normalize_term (64 - error_width)
[@ CMacro ]
let validator_max_length : (u: U64.t { 4 <= U64.v u /\ U64.v u == pow2 pos_width - 1 } ) =
FStar.Math.Lemmas.pow2_le_compat 64 pos_width;
[@inline_let]
let x = U64.uint_to_t (pow2 pos_width - 1) in
normalize_term_spec x;
normalize_term x
let is_error (positionOrError: U64.t) : Tot bool = positionOrError `U64.gt` validator_max_length
let is_success (positionOrError: U64.t) : Tot bool = positionOrError `U64.lte` validator_max_length
inline_for_extraction
noextract
type validator_error = (u: U64.t { is_error u } )
inline_for_extraction
noextract
let pos_t = (pos: U64.t {is_success pos})
module BF = LowParse.BitFields
#push-options "--z3rlimit 16"
inline_for_extraction
noextract
let get_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < pow2 (hi - lo) }) =
[@inline_let]
let res =
BF.uint64.BF.get_bitfield x (pos_width + lo) (pos_width + hi)
in
res
inline_for_extraction
noextract
let set_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) (code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) }) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield x (pos_width + lo) (pos_width + hi) code
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_same #64 (U64.v x) (pos_width + lo) (pos_width + hi) (U64.v code);
BF.get_bitfield_zero_inner (U64.v res) pos_width 64 (pos_width + lo) (pos_width + hi);
assert (BF.get_bitfield (U64.v res) pos_width 64 > 0);
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
let get_validator_error_field_set_validator_error_field
(x: U64.t)
(lo: nat)
(hi: nat { lo < hi /\ hi <= error_width })
(code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) })
: Lemma
(get_validator_error_field (set_validator_error_field x lo hi code) lo hi == code)
= ()
let set_validator_error_pos (error: validator_error) (position: pos_t) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield error 0 pos_width position
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_other (U64.v error) 0 pos_width (U64.v position) pos_width 64;
assert (BF.get_bitfield (U64.v res) pos_width 64 == BF.get_bitfield (U64.v error) pos_width 64);
Classical.move_requires (BF.get_bitfield_hi_lt_pow2 (U64.v error)) pos_width;
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
#pop-options
let get_validator_error_pos (x: U64.t) : Tot pos_t =
(BF.uint64.BF.get_bitfield x 0 pos_width)
let set_validator_error_kind (error: U64.t) (code: U64.t { 0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) : Tot validator_error =
normalize_term_spec (pow2 error_width);
set_validator_error_field error 0 error_width code | false | false | EverParse3d.ErrorCode.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"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": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val get_validator_error_kind (error: U64.t)
: Tot (code: U64.t{0 <= U64.v code /\ U64.v code < normalize_term (pow2 error_width)}) | [] | EverParse3d.ErrorCode.get_validator_error_kind | {
"file_name": "src/3d/prelude/EverParse3d.ErrorCode.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | error: FStar.UInt64.t
-> code:
FStar.UInt64.t
{ 0 <= FStar.UInt64.v code /\
FStar.UInt64.v code <
FStar.Pervasives.normalize_term (Prims.pow2 EverParse3d.ErrorCode.error_width) } | {
"end_col": 47,
"end_line": 99,
"start_col": 2,
"start_line": 98
} |
Prims.Tot | val validator_max_length:(u: U64.t{4 <= U64.v u /\ U64.v u == pow2 pos_width - 1}) | [
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": 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 validator_max_length : (u: U64.t { 4 <= U64.v u /\ U64.v u == pow2 pos_width - 1 } ) =
FStar.Math.Lemmas.pow2_le_compat 64 pos_width;
[@inline_let]
let x = U64.uint_to_t (pow2 pos_width - 1) in
normalize_term_spec x;
normalize_term x | val validator_max_length:(u: U64.t{4 <= U64.v u /\ U64.v u == pow2 pos_width - 1})
let validator_max_length:(u: U64.t{4 <= U64.v u /\ U64.v u == pow2 pos_width - 1}) = | false | null | false | FStar.Math.Lemmas.pow2_le_compat 64 pos_width;
[@@ inline_let ]let x = U64.uint_to_t (pow2 pos_width - 1) in
normalize_term_spec x;
normalize_term x | {
"checked_file": "EverParse3d.ErrorCode.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "EverParse3d.ErrorCode.fst"
} | [
"total"
] | [
"FStar.Pervasives.normalize_term",
"FStar.UInt64.t",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.UInt64.v",
"Prims.eq2",
"Prims.int",
"Prims.op_Subtraction",
"Prims.pow2",
"EverParse3d.ErrorCode.pos_width",
"Prims.unit",
"FStar.Pervasives.normalize_term_spec",
"FStar.UInt64.uint_to_t",
"FStar.Math.Lemmas.pow2_le_compat"
] | [] | module EverParse3d.ErrorCode
module U64 = FStar.UInt64
module BF = LowParse.BitFields
inline_for_extraction
noextract
let error_width = 4
inline_for_extraction
noextract
let pos_width = normalize_term (64 - error_width)
[@ CMacro ] | false | false | EverParse3d.ErrorCode.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"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": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val validator_max_length:(u: U64.t{4 <= U64.v u /\ U64.v u == pow2 pos_width - 1}) | [] | EverParse3d.ErrorCode.validator_max_length | {
"file_name": "src/3d/prelude/EverParse3d.ErrorCode.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | u0:
FStar.UInt64.t
{4 <= FStar.UInt64.v u0 /\ FStar.UInt64.v u0 == Prims.pow2 EverParse3d.ErrorCode.pos_width - 1} | {
"end_col": 18,
"end_line": 20,
"start_col": 2,
"start_line": 16
} |
Prims.Tot | val get_validator_error_field (x: U64.t) (lo: nat) (hi: nat{lo < hi /\ hi <= error_width})
: Tot (code: U64.t{0 <= U64.v code /\ U64.v code < pow2 (hi - lo)}) | [
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": 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_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < pow2 (hi - lo) }) =
[@inline_let]
let res =
BF.uint64.BF.get_bitfield x (pos_width + lo) (pos_width + hi)
in
res | val get_validator_error_field (x: U64.t) (lo: nat) (hi: nat{lo < hi /\ hi <= error_width})
: Tot (code: U64.t{0 <= U64.v code /\ U64.v code < pow2 (hi - lo)})
let get_validator_error_field (x: U64.t) (lo: nat) (hi: nat{lo < hi /\ hi <= error_width})
: Tot (code: U64.t{0 <= U64.v code /\ U64.v code < pow2 (hi - lo)}) = | false | null | false | [@@ inline_let ]let res = BF.uint64.BF.get_bitfield x (pos_width + lo) (pos_width + hi) in
res | {
"checked_file": "EverParse3d.ErrorCode.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "EverParse3d.ErrorCode.fst"
} | [
"total"
] | [
"FStar.UInt64.t",
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.op_LessThanOrEqual",
"EverParse3d.ErrorCode.error_width",
"Prims.eq2",
"FStar.UInt.uint_t",
"LowParse.BitFields.__proj__Mkuint_t__item__v",
"LowParse.BitFields.uint64",
"LowParse.BitFields.get_bitfield",
"Prims.op_Addition",
"EverParse3d.ErrorCode.pos_width",
"LowParse.BitFields.__proj__Mkuint_t__item__get_bitfield",
"FStar.UInt64.v",
"Prims.pow2",
"Prims.op_Subtraction"
] | [] | module EverParse3d.ErrorCode
module U64 = FStar.UInt64
module BF = LowParse.BitFields
inline_for_extraction
noextract
let error_width = 4
inline_for_extraction
noextract
let pos_width = normalize_term (64 - error_width)
[@ CMacro ]
let validator_max_length : (u: U64.t { 4 <= U64.v u /\ U64.v u == pow2 pos_width - 1 } ) =
FStar.Math.Lemmas.pow2_le_compat 64 pos_width;
[@inline_let]
let x = U64.uint_to_t (pow2 pos_width - 1) in
normalize_term_spec x;
normalize_term x
let is_error (positionOrError: U64.t) : Tot bool = positionOrError `U64.gt` validator_max_length
let is_success (positionOrError: U64.t) : Tot bool = positionOrError `U64.lte` validator_max_length
inline_for_extraction
noextract
type validator_error = (u: U64.t { is_error u } )
inline_for_extraction
noextract
let pos_t = (pos: U64.t {is_success pos})
module BF = LowParse.BitFields
#push-options "--z3rlimit 16"
inline_for_extraction
noextract | false | false | EverParse3d.ErrorCode.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"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": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 16,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val get_validator_error_field (x: U64.t) (lo: nat) (hi: nat{lo < hi /\ hi <= error_width})
: Tot (code: U64.t{0 <= U64.v code /\ U64.v code < pow2 (hi - lo)}) | [] | EverParse3d.ErrorCode.get_validator_error_field | {
"file_name": "src/3d/prelude/EverParse3d.ErrorCode.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
x: FStar.UInt64.t ->
lo: Prims.nat ->
hi: Prims.nat{lo < hi /\ hi <= EverParse3d.ErrorCode.error_width}
-> code: FStar.UInt64.t{0 <= FStar.UInt64.v code /\ FStar.UInt64.v code < Prims.pow2 (hi - lo)} | {
"end_col": 5,
"end_line": 45,
"start_col": 2,
"start_line": 41
} |
Prims.Tot | val set_validator_error_kind
(error: U64.t)
(code: U64.t{0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width)})
: Tot validator_error | [
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": 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 set_validator_error_kind (error: U64.t) (code: U64.t { 0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) : Tot validator_error =
normalize_term_spec (pow2 error_width);
set_validator_error_field error 0 error_width code | val set_validator_error_kind
(error: U64.t)
(code: U64.t{0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width)})
: Tot validator_error
let set_validator_error_kind
(error: U64.t)
(code: U64.t{0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width)})
: Tot validator_error = | false | null | false | normalize_term_spec (pow2 error_width);
set_validator_error_field error 0 error_width code | {
"checked_file": "EverParse3d.ErrorCode.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "EverParse3d.ErrorCode.fst"
} | [
"total"
] | [
"FStar.UInt64.t",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.UInt64.v",
"FStar.Pervasives.normalize_term",
"Prims.int",
"Prims.pow2",
"EverParse3d.ErrorCode.error_width",
"EverParse3d.ErrorCode.set_validator_error_field",
"Prims.unit",
"FStar.Pervasives.normalize_term_spec",
"Prims.pos",
"EverParse3d.ErrorCode.validator_error"
] | [] | module EverParse3d.ErrorCode
module U64 = FStar.UInt64
module BF = LowParse.BitFields
inline_for_extraction
noextract
let error_width = 4
inline_for_extraction
noextract
let pos_width = normalize_term (64 - error_width)
[@ CMacro ]
let validator_max_length : (u: U64.t { 4 <= U64.v u /\ U64.v u == pow2 pos_width - 1 } ) =
FStar.Math.Lemmas.pow2_le_compat 64 pos_width;
[@inline_let]
let x = U64.uint_to_t (pow2 pos_width - 1) in
normalize_term_spec x;
normalize_term x
let is_error (positionOrError: U64.t) : Tot bool = positionOrError `U64.gt` validator_max_length
let is_success (positionOrError: U64.t) : Tot bool = positionOrError `U64.lte` validator_max_length
inline_for_extraction
noextract
type validator_error = (u: U64.t { is_error u } )
inline_for_extraction
noextract
let pos_t = (pos: U64.t {is_success pos})
module BF = LowParse.BitFields
#push-options "--z3rlimit 16"
inline_for_extraction
noextract
let get_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < pow2 (hi - lo) }) =
[@inline_let]
let res =
BF.uint64.BF.get_bitfield x (pos_width + lo) (pos_width + hi)
in
res
inline_for_extraction
noextract
let set_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) (code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) }) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield x (pos_width + lo) (pos_width + hi) code
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_same #64 (U64.v x) (pos_width + lo) (pos_width + hi) (U64.v code);
BF.get_bitfield_zero_inner (U64.v res) pos_width 64 (pos_width + lo) (pos_width + hi);
assert (BF.get_bitfield (U64.v res) pos_width 64 > 0);
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
let get_validator_error_field_set_validator_error_field
(x: U64.t)
(lo: nat)
(hi: nat { lo < hi /\ hi <= error_width })
(code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) })
: Lemma
(get_validator_error_field (set_validator_error_field x lo hi code) lo hi == code)
= ()
let set_validator_error_pos (error: validator_error) (position: pos_t) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield error 0 pos_width position
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_other (U64.v error) 0 pos_width (U64.v position) pos_width 64;
assert (BF.get_bitfield (U64.v res) pos_width 64 == BF.get_bitfield (U64.v error) pos_width 64);
Classical.move_requires (BF.get_bitfield_hi_lt_pow2 (U64.v error)) pos_width;
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
#pop-options
let get_validator_error_pos (x: U64.t) : Tot pos_t =
(BF.uint64.BF.get_bitfield x 0 pos_width) | false | false | EverParse3d.ErrorCode.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"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": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val set_validator_error_kind
(error: U64.t)
(code: U64.t{0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width)})
: Tot validator_error | [] | EverParse3d.ErrorCode.set_validator_error_kind | {
"file_name": "src/3d/prelude/EverParse3d.ErrorCode.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
error: FStar.UInt64.t ->
code:
FStar.UInt64.t
{ 0 < FStar.UInt64.v code /\
FStar.UInt64.v code <
FStar.Pervasives.normalize_term (Prims.pow2 EverParse3d.ErrorCode.error_width) }
-> EverParse3d.ErrorCode.validator_error | {
"end_col": 52,
"end_line": 95,
"start_col": 2,
"start_line": 94
} |
FStar.Pervasives.Lemma | val get_validator_error_kind_set_validator_error_kind
(error: U64.t)
(code: U64.t{0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width)})
: Lemma (get_validator_error_kind (set_validator_error_kind error code) == code)
[SMTPat (get_validator_error_kind (set_validator_error_kind error code))] | [
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": 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_validator_error_kind_set_validator_error_kind (error: U64.t) (code: U64.t {0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width)}) : Lemma
(get_validator_error_kind (set_validator_error_kind error code) == code)
[SMTPat (get_validator_error_kind (set_validator_error_kind error code))]
= assert_norm (normalize_term (pow2 error_width) == pow2 error_width);
get_validator_error_field_set_validator_error_field error 0 error_width code | val get_validator_error_kind_set_validator_error_kind
(error: U64.t)
(code: U64.t{0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width)})
: Lemma (get_validator_error_kind (set_validator_error_kind error code) == code)
[SMTPat (get_validator_error_kind (set_validator_error_kind error code))]
let get_validator_error_kind_set_validator_error_kind
(error: U64.t)
(code: U64.t{0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width)})
: Lemma (get_validator_error_kind (set_validator_error_kind error code) == code)
[SMTPat (get_validator_error_kind (set_validator_error_kind error code))] = | false | null | true | assert_norm (normalize_term (pow2 error_width) == pow2 error_width);
get_validator_error_field_set_validator_error_field error 0 error_width code | {
"checked_file": "EverParse3d.ErrorCode.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "EverParse3d.ErrorCode.fst"
} | [
"lemma"
] | [
"FStar.UInt64.t",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.UInt64.v",
"FStar.Pervasives.normalize_term",
"Prims.int",
"Prims.pow2",
"EverParse3d.ErrorCode.error_width",
"EverParse3d.ErrorCode.get_validator_error_field_set_validator_error_field",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.pos",
"Prims.l_True",
"Prims.squash",
"Prims.l_or",
"Prims.op_LessThanOrEqual",
"EverParse3d.ErrorCode.get_validator_error_kind",
"EverParse3d.ErrorCode.set_validator_error_kind",
"Prims.Cons",
"FStar.Pervasives.pattern",
"FStar.Pervasives.smt_pat",
"Prims.Nil"
] | [] | module EverParse3d.ErrorCode
module U64 = FStar.UInt64
module BF = LowParse.BitFields
inline_for_extraction
noextract
let error_width = 4
inline_for_extraction
noextract
let pos_width = normalize_term (64 - error_width)
[@ CMacro ]
let validator_max_length : (u: U64.t { 4 <= U64.v u /\ U64.v u == pow2 pos_width - 1 } ) =
FStar.Math.Lemmas.pow2_le_compat 64 pos_width;
[@inline_let]
let x = U64.uint_to_t (pow2 pos_width - 1) in
normalize_term_spec x;
normalize_term x
let is_error (positionOrError: U64.t) : Tot bool = positionOrError `U64.gt` validator_max_length
let is_success (positionOrError: U64.t) : Tot bool = positionOrError `U64.lte` validator_max_length
inline_for_extraction
noextract
type validator_error = (u: U64.t { is_error u } )
inline_for_extraction
noextract
let pos_t = (pos: U64.t {is_success pos})
module BF = LowParse.BitFields
#push-options "--z3rlimit 16"
inline_for_extraction
noextract
let get_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < pow2 (hi - lo) }) =
[@inline_let]
let res =
BF.uint64.BF.get_bitfield x (pos_width + lo) (pos_width + hi)
in
res
inline_for_extraction
noextract
let set_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) (code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) }) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield x (pos_width + lo) (pos_width + hi) code
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_same #64 (U64.v x) (pos_width + lo) (pos_width + hi) (U64.v code);
BF.get_bitfield_zero_inner (U64.v res) pos_width 64 (pos_width + lo) (pos_width + hi);
assert (BF.get_bitfield (U64.v res) pos_width 64 > 0);
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
let get_validator_error_field_set_validator_error_field
(x: U64.t)
(lo: nat)
(hi: nat { lo < hi /\ hi <= error_width })
(code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) })
: Lemma
(get_validator_error_field (set_validator_error_field x lo hi code) lo hi == code)
= ()
let set_validator_error_pos (error: validator_error) (position: pos_t) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield error 0 pos_width position
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_other (U64.v error) 0 pos_width (U64.v position) pos_width 64;
assert (BF.get_bitfield (U64.v res) pos_width 64 == BF.get_bitfield (U64.v error) pos_width 64);
Classical.move_requires (BF.get_bitfield_hi_lt_pow2 (U64.v error)) pos_width;
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
#pop-options
let get_validator_error_pos (x: U64.t) : Tot pos_t =
(BF.uint64.BF.get_bitfield x 0 pos_width)
let set_validator_error_kind (error: U64.t) (code: U64.t { 0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) : Tot validator_error =
normalize_term_spec (pow2 error_width);
set_validator_error_field error 0 error_width code
let get_validator_error_kind (error: U64.t) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) =
normalize_term_spec (pow2 error_width);
get_validator_error_field error 0 error_width
let get_validator_error_kind_set_validator_error_kind (error: U64.t) (code: U64.t {0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width)}) : Lemma
(get_validator_error_kind (set_validator_error_kind error code) == code) | false | false | EverParse3d.ErrorCode.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"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": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val get_validator_error_kind_set_validator_error_kind
(error: U64.t)
(code: U64.t{0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width)})
: Lemma (get_validator_error_kind (set_validator_error_kind error code) == code)
[SMTPat (get_validator_error_kind (set_validator_error_kind error code))] | [] | EverParse3d.ErrorCode.get_validator_error_kind_set_validator_error_kind | {
"file_name": "src/3d/prelude/EverParse3d.ErrorCode.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
error: FStar.UInt64.t ->
code:
FStar.UInt64.t
{ 0 < FStar.UInt64.v code /\
FStar.UInt64.v code <
FStar.Pervasives.normalize_term (Prims.pow2 EverParse3d.ErrorCode.error_width) }
-> FStar.Pervasives.Lemma
(ensures
EverParse3d.ErrorCode.get_validator_error_kind (EverParse3d.ErrorCode.set_validator_error_kind
error
code) ==
code)
[
SMTPat (EverParse3d.ErrorCode.get_validator_error_kind (EverParse3d.ErrorCode.set_validator_error_kind
error
code))
] | {
"end_col": 78,
"end_line": 105,
"start_col": 2,
"start_line": 104
} |
Prims.Tot | val set_validator_error_field
(x: U64.t)
(lo: nat)
(hi: nat{lo < hi /\ hi <= error_width})
(code: U64.t{0 < U64.v code /\ U64.v code < pow2 (hi - lo)})
: Tot validator_error | [
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": 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 set_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) (code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) }) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield x (pos_width + lo) (pos_width + hi) code
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_same #64 (U64.v x) (pos_width + lo) (pos_width + hi) (U64.v code);
BF.get_bitfield_zero_inner (U64.v res) pos_width 64 (pos_width + lo) (pos_width + hi);
assert (BF.get_bitfield (U64.v res) pos_width 64 > 0);
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res | val set_validator_error_field
(x: U64.t)
(lo: nat)
(hi: nat{lo < hi /\ hi <= error_width})
(code: U64.t{0 < U64.v code /\ U64.v code < pow2 (hi - lo)})
: Tot validator_error
let set_validator_error_field
(x: U64.t)
(lo: nat)
(hi: nat{lo < hi /\ hi <= error_width})
(code: U64.t{0 < U64.v code /\ U64.v code < pow2 (hi - lo)})
: Tot validator_error = | false | null | false | [@@ inline_let ]let res = BF.uint64.BF.set_bitfield x (pos_width + lo) (pos_width + hi) code in
[@@ inline_let ]let _ =
BF.get_bitfield_set_bitfield_same #64 (U64.v x) (pos_width + lo) (pos_width + hi) (U64.v code);
BF.get_bitfield_zero_inner (U64.v res) pos_width 64 (pos_width + lo) (pos_width + hi);
assert (BF.get_bitfield (U64.v res) pos_width 64 > 0);
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res | {
"checked_file": "EverParse3d.ErrorCode.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "EverParse3d.ErrorCode.fst"
} | [
"total"
] | [
"FStar.UInt64.t",
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.op_LessThanOrEqual",
"EverParse3d.ErrorCode.error_width",
"FStar.UInt64.v",
"Prims.pow2",
"Prims.op_Subtraction",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"EverParse3d.ErrorCode.pos_width",
"Prims.op_Addition",
"EverParse3d.ErrorCode.validator_max_length",
"FStar.Classical.move_requires",
"FStar.UInt64.n",
"LowParse.BitFields.get_bitfield",
"LowParse.BitFields.lt_pow2_get_bitfield_hi",
"Prims._assert",
"Prims.op_GreaterThan",
"LowParse.BitFields.get_bitfield_zero_inner",
"LowParse.BitFields.get_bitfield_set_bitfield_same",
"FStar.UInt.uint_t",
"LowParse.BitFields.__proj__Mkuint_t__item__v",
"LowParse.BitFields.uint64",
"LowParse.BitFields.set_bitfield",
"LowParse.BitFields.__proj__Mkuint_t__item__set_bitfield",
"EverParse3d.ErrorCode.validator_error"
] | [] | module EverParse3d.ErrorCode
module U64 = FStar.UInt64
module BF = LowParse.BitFields
inline_for_extraction
noextract
let error_width = 4
inline_for_extraction
noextract
let pos_width = normalize_term (64 - error_width)
[@ CMacro ]
let validator_max_length : (u: U64.t { 4 <= U64.v u /\ U64.v u == pow2 pos_width - 1 } ) =
FStar.Math.Lemmas.pow2_le_compat 64 pos_width;
[@inline_let]
let x = U64.uint_to_t (pow2 pos_width - 1) in
normalize_term_spec x;
normalize_term x
let is_error (positionOrError: U64.t) : Tot bool = positionOrError `U64.gt` validator_max_length
let is_success (positionOrError: U64.t) : Tot bool = positionOrError `U64.lte` validator_max_length
inline_for_extraction
noextract
type validator_error = (u: U64.t { is_error u } )
inline_for_extraction
noextract
let pos_t = (pos: U64.t {is_success pos})
module BF = LowParse.BitFields
#push-options "--z3rlimit 16"
inline_for_extraction
noextract
let get_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < pow2 (hi - lo) }) =
[@inline_let]
let res =
BF.uint64.BF.get_bitfield x (pos_width + lo) (pos_width + hi)
in
res
inline_for_extraction
noextract | false | false | EverParse3d.ErrorCode.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"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": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 16,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val set_validator_error_field
(x: U64.t)
(lo: nat)
(hi: nat{lo < hi /\ hi <= error_width})
(code: U64.t{0 < U64.v code /\ U64.v code < pow2 (hi - lo)})
: Tot validator_error | [] | EverParse3d.ErrorCode.set_validator_error_field | {
"file_name": "src/3d/prelude/EverParse3d.ErrorCode.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
x: FStar.UInt64.t ->
lo: Prims.nat ->
hi: Prims.nat{lo < hi /\ hi <= EverParse3d.ErrorCode.error_width} ->
code: FStar.UInt64.t{0 < FStar.UInt64.v code /\ FStar.UInt64.v code < Prims.pow2 (hi - lo)}
-> EverParse3d.ErrorCode.validator_error | {
"end_col": 5,
"end_line": 62,
"start_col": 2,
"start_line": 50
} |
Prims.Tot | val is_range_okay (size offset access_size: U32.t) : bool | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "LowParse.BitFields",
"short_module": "BF"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": 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 is_range_okay (size offset access_size:U32.t)
: bool
= let open U32 in
size >=^ access_size &&
size -^ access_size >=^ offset | val is_range_okay (size offset access_size: U32.t) : bool
let is_range_okay (size offset access_size: U32.t) : bool = | false | null | false | let open U32 in size >=^ access_size && size -^ access_size >=^ offset | {
"checked_file": "EverParse3d.ErrorCode.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "EverParse3d.ErrorCode.fst"
} | [
"total"
] | [
"FStar.UInt32.t",
"Prims.op_AmpAmp",
"FStar.UInt32.op_Greater_Equals_Hat",
"FStar.UInt32.op_Subtraction_Hat",
"Prims.bool"
] | [] | module EverParse3d.ErrorCode
module U64 = FStar.UInt64
module BF = LowParse.BitFields
inline_for_extraction
noextract
let error_width = 4
inline_for_extraction
noextract
let pos_width = normalize_term (64 - error_width)
[@ CMacro ]
let validator_max_length : (u: U64.t { 4 <= U64.v u /\ U64.v u == pow2 pos_width - 1 } ) =
FStar.Math.Lemmas.pow2_le_compat 64 pos_width;
[@inline_let]
let x = U64.uint_to_t (pow2 pos_width - 1) in
normalize_term_spec x;
normalize_term x
let is_error (positionOrError: U64.t) : Tot bool = positionOrError `U64.gt` validator_max_length
let is_success (positionOrError: U64.t) : Tot bool = positionOrError `U64.lte` validator_max_length
inline_for_extraction
noextract
type validator_error = (u: U64.t { is_error u } )
inline_for_extraction
noextract
let pos_t = (pos: U64.t {is_success pos})
module BF = LowParse.BitFields
#push-options "--z3rlimit 16"
inline_for_extraction
noextract
let get_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < pow2 (hi - lo) }) =
[@inline_let]
let res =
BF.uint64.BF.get_bitfield x (pos_width + lo) (pos_width + hi)
in
res
inline_for_extraction
noextract
let set_validator_error_field (x: U64.t) (lo: nat) (hi: nat { lo < hi /\ hi <= error_width }) (code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) }) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield x (pos_width + lo) (pos_width + hi) code
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_same #64 (U64.v x) (pos_width + lo) (pos_width + hi) (U64.v code);
BF.get_bitfield_zero_inner (U64.v res) pos_width 64 (pos_width + lo) (pos_width + hi);
assert (BF.get_bitfield (U64.v res) pos_width 64 > 0);
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
let get_validator_error_field_set_validator_error_field
(x: U64.t)
(lo: nat)
(hi: nat { lo < hi /\ hi <= error_width })
(code: U64.t { 0 < U64.v code /\ U64.v code < pow2 (hi - lo) })
: Lemma
(get_validator_error_field (set_validator_error_field x lo hi code) lo hi == code)
= ()
let set_validator_error_pos (error: validator_error) (position: pos_t) : Tot validator_error =
[@inline_let]
let res =
BF.uint64.BF.set_bitfield error 0 pos_width position
in
[@inline_let]
let _ =
BF.get_bitfield_set_bitfield_other (U64.v error) 0 pos_width (U64.v position) pos_width 64;
assert (BF.get_bitfield (U64.v res) pos_width 64 == BF.get_bitfield (U64.v error) pos_width 64);
Classical.move_requires (BF.get_bitfield_hi_lt_pow2 (U64.v error)) pos_width;
Classical.move_requires (BF.lt_pow2_get_bitfield_hi (U64.v res)) pos_width;
assert_norm (pow2 pos_width == U64.v validator_max_length + 1)
in
res
#pop-options
let get_validator_error_pos (x: U64.t) : Tot pos_t =
(BF.uint64.BF.get_bitfield x 0 pos_width)
let set_validator_error_kind (error: U64.t) (code: U64.t { 0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) : Tot validator_error =
normalize_term_spec (pow2 error_width);
set_validator_error_field error 0 error_width code
let get_validator_error_kind (error: U64.t) : Tot (code: U64.t { 0 <= U64.v code /\ U64.v code < normalize_term (pow2 error_width) }) =
normalize_term_spec (pow2 error_width);
get_validator_error_field error 0 error_width
let get_validator_error_kind_set_validator_error_kind (error: U64.t) (code: U64.t {0 < U64.v code /\ U64.v code < normalize_term (pow2 error_width)}) : Lemma
(get_validator_error_kind (set_validator_error_kind error code) == code)
[SMTPat (get_validator_error_kind (set_validator_error_kind error code))]
= assert_norm (normalize_term (pow2 error_width) == pow2 error_width);
get_validator_error_field_set_validator_error_field error 0 error_width code
let get_validator_error_pos_eq_pos (x: pos_t) : Lemma
(get_validator_error_pos x == x)
[SMTPat (get_validator_error_pos x)]
= BF.get_bitfield_size pos_width 64 (U64.v x) 0 pos_width;
BF.get_bitfield_full #pos_width (U64.v x);
BF.lt_pow2_get_bitfield_hi #64 (U64.v x) (64 - error_width);
assert (BF.get_bitfield #64 (U64.v x) pos_width 64 == 0);
BF.get_bitfield_set_bitfield_other #64 (U64.v x) pos_width 64 0 0 pos_width;
BF.get_bitfield_set_bitfield_same #64 (U64.v x) pos_width 64 0;
BF.get_bitfield_partition_2 #64 (64 - error_width) (U64.v x)
(U64.v (BF.uint64.BF.set_bitfield x pos_width 64 0uL))
[@ CMacro ]
let validator_error_generic : validator_error = normalize_term (set_validator_error_kind 0uL 1uL)
[@ CMacro ]
let validator_error_not_enough_data : validator_error = normalize_term (set_validator_error_kind 0uL 2uL)
[@ CMacro ]
let validator_error_impossible : validator_error = normalize_term (set_validator_error_kind 0uL 3uL)
[@ CMacro ]
let validator_error_list_size_not_multiple : validator_error = normalize_term (set_validator_error_kind 0uL 4uL)
[@ CMacro ]
let validator_error_action_failed : validator_error = normalize_term (set_validator_error_kind 0uL 5uL)
[@ CMacro ]
let validator_error_constraint_failed : validator_error = normalize_term (set_validator_error_kind 0uL 6uL)
[@ CMacro ]
let validator_error_unexpected_padding : validator_error = normalize_term (set_validator_error_kind 0uL 7uL)
let error_reason_of_result (code:U64.t) : string =
match (get_validator_error_kind code) with
| 1uL -> "generic error"
| 2uL -> "not enough data"
| 3uL -> "impossible"
| 4uL -> "list size not multiple of element size"
| 5uL -> "action failed"
| 6uL -> "constraint failed"
| 7uL -> "unexpected padding"
| _ -> "unspecified"
let check_constraint_ok (ok:bool) (position: pos_t): Tot U64.t =
if ok
then position
else set_validator_error_pos validator_error_constraint_failed position
////////////////////////////////////////////////////////////////////////////////
// Some generic helpers
////////////////////////////////////////////////////////////////////////////////
module U32 = FStar.UInt32
let is_range_okay (size offset access_size:U32.t) | false | true | EverParse3d.ErrorCode.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"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": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val is_range_okay (size offset access_size: U32.t) : bool | [] | EverParse3d.ErrorCode.is_range_okay | {
"file_name": "src/3d/prelude/EverParse3d.ErrorCode.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | size: FStar.UInt32.t -> offset: FStar.UInt32.t -> access_size: FStar.UInt32.t -> Prims.bool | {
"end_col": 34,
"end_line": 166,
"start_col": 4,
"start_line": 164
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Spec.Salsa20",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Salsa20",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Salsa20",
"short_module": null
},
{
"abbrev": 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 index = i:size_t{size_v i < 16} | let index = | false | null | false | i: size_t{size_v i < 16} | {
"checked_file": "Hacl.Impl.Salsa20.Core32.fst.checked",
"dependencies": [
"Spec.Salsa20.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Salsa20.Core32.fst"
} | [
"total"
] | [
"Lib.IntTypes.size_t",
"Prims.b2t",
"Prims.op_LessThan",
"Lib.IntTypes.size_v"
] | [] | module Hacl.Impl.Salsa20.Core32
open FStar.HyperStack
open FStar.HyperStack.All
open Lib.IntTypes
open Lib.Sequence
open Lib.Buffer
open Lib.ByteBuffer
module ST = FStar.HyperStack.ST
module Spec = Spec.Salsa20 | false | true | Hacl.Impl.Salsa20.Core32.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": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val index : Type0 | [] | Hacl.Impl.Salsa20.Core32.index | {
"file_name": "code/salsa20/Hacl.Impl.Salsa20.Core32.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 35,
"end_line": 16,
"start_col": 12,
"start_line": 16
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Spec.Salsa20",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Salsa20",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Salsa20",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let state = lbuffer uint32 16ul | let state = | false | null | false | lbuffer uint32 16ul | {
"checked_file": "Hacl.Impl.Salsa20.Core32.fst.checked",
"dependencies": [
"Spec.Salsa20.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Salsa20.Core32.fst"
} | [
"total"
] | [
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint32",
"FStar.UInt32.__uint_to_t"
] | [] | module Hacl.Impl.Salsa20.Core32
open FStar.HyperStack
open FStar.HyperStack.All
open Lib.IntTypes
open Lib.Sequence
open Lib.Buffer
open Lib.ByteBuffer
module ST = FStar.HyperStack.ST
module Spec = Spec.Salsa20 | false | true | Hacl.Impl.Salsa20.Core32.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": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val state : Type0 | [] | Hacl.Impl.Salsa20.Core32.state | {
"file_name": "code/salsa20/Hacl.Impl.Salsa20.Core32.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 31,
"end_line": 15,
"start_col": 12,
"start_line": 15
} |
|
FStar.HyperStack.ST.Stack | val copy_state:
st:state
-> ost:state ->
Stack unit
(requires fun h -> live h st /\ live h ost /\ disjoint st ost)
(ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\
as_seq h1 st == as_seq h0 ost) | [
{
"abbrev": true,
"full_module": "Spec.Salsa20",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Salsa20",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Salsa20",
"short_module": null
},
{
"abbrev": 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 copy_state st ost = copy #MUT #uint32 #(size 16) st ost | val copy_state:
st:state
-> ost:state ->
Stack unit
(requires fun h -> live h st /\ live h ost /\ disjoint st ost)
(ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\
as_seq h1 st == as_seq h0 ost)
let copy_state st ost = | true | null | false | copy #MUT #uint32 #(size 16) st ost | {
"checked_file": "Hacl.Impl.Salsa20.Core32.fst.checked",
"dependencies": [
"Spec.Salsa20.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Salsa20.Core32.fst"
} | [] | [
"Hacl.Impl.Salsa20.Core32.state",
"Lib.Buffer.copy",
"Lib.Buffer.MUT",
"Lib.IntTypes.uint32",
"Lib.IntTypes.size",
"Prims.unit"
] | [] | module Hacl.Impl.Salsa20.Core32
open FStar.HyperStack
open FStar.HyperStack.All
open Lib.IntTypes
open Lib.Sequence
open Lib.Buffer
open Lib.ByteBuffer
module ST = FStar.HyperStack.ST
module Spec = Spec.Salsa20
let state = lbuffer uint32 16ul
let index = i:size_t{size_v i < 16}
inline_for_extraction
val create_state: unit ->
StackInline state
(requires fun h -> True)
(ensures fun h0 r h1 -> live h1 r /\
as_seq h1 r == Seq.create 16 (u32 0) /\
stack_allocated r h0 h1 (Seq.create 16 (u32 0)))
let create_state () = create (size 16) (u32 0)
inline_for_extraction
val load_state:
st:state
-> b:lbuffer uint8 64ul ->
Stack unit
(requires fun h -> live h st /\ live h b /\ disjoint st b)
(ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\
as_seq h1 st == Lib.ByteSequence.uints_from_bytes_le (as_seq h0 b))
let load_state st b =
uints_from_bytes_le st b
inline_for_extraction
val store_state:
b:lbuffer uint8 64ul
-> st:state ->
Stack unit
(requires fun h -> live h st /\ live h b /\ disjoint st b)
(ensures fun h0 _ h1 -> modifies (loc b) h0 h1 /\
as_seq h1 b == Lib.ByteSequence.uints_to_bytes_le (as_seq h0 st))
let store_state st b =
uints_to_bytes_le 16ul st b
inline_for_extraction
val set_counter:
st:state
-> c:size_t ->
Stack unit
(requires fun h -> live h st)
(ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\
as_seq h1 st == Seq.upd (as_seq h0 st) 8 (size_to_uint32 c))
let set_counter st c =
st.(size 8) <- size_to_uint32 c
inline_for_extraction
val copy_state:
st:state
-> ost:state ->
Stack unit
(requires fun h -> live h st /\ live h ost /\ disjoint st ost)
(ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\
as_seq h1 st == as_seq h0 ost) | false | false | Hacl.Impl.Salsa20.Core32.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": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val copy_state:
st:state
-> ost:state ->
Stack unit
(requires fun h -> live h st /\ live h ost /\ disjoint st ost)
(ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\
as_seq h1 st == as_seq h0 ost) | [] | Hacl.Impl.Salsa20.Core32.copy_state | {
"file_name": "code/salsa20/Hacl.Impl.Salsa20.Core32.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | st: Hacl.Impl.Salsa20.Core32.state -> ost: Hacl.Impl.Salsa20.Core32.state
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 59,
"end_line": 78,
"start_col": 24,
"start_line": 78
} |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.