file_name
stringlengths
5
52
name
stringlengths
4
95
original_source_type
stringlengths
0
23k
source_type
stringlengths
9
23k
source_definition
stringlengths
9
57.9k
source
dict
source_range
dict
file_context
stringlengths
0
721k
dependencies
dict
opens_and_abbrevs
listlengths
2
94
vconfig
dict
interleaved
bool
1 class
verbose_type
stringlengths
1
7.42k
effect
stringclasses
118 values
effect_flags
sequencelengths
0
2
mutual_with
sequencelengths
0
11
ideal_premises
sequencelengths
0
236
proof_features
sequencelengths
0
1
is_simple_lemma
bool
2 classes
is_div
bool
2 classes
is_proof
bool
2 classes
is_simply_typed
bool
2 classes
is_type
bool
2 classes
partial_definition
stringlengths
5
3.99k
completed_definiton
stringlengths
1
1.63M
isa_cross_project_example
bool
1 class
FStar.IntegerIntervals.fst
FStar.IntegerIntervals.indices_seq
val indices_seq (n: nat) : (f: FStar.Seq.Base.seq (under n) {FStar.Seq.Base.length f = n /\ (forall (k: under n). FStar.Seq.Base.index f k = k)})
val indices_seq (n: nat) : (f: FStar.Seq.Base.seq (under n) {FStar.Seq.Base.length f = n /\ (forall (k: under n). FStar.Seq.Base.index f k = k)})
let indices_seq (n: nat) : (f:FStar.Seq.Base.seq (under n) { FStar.Seq.Base.length f = n /\ (forall (k: under n). FStar.Seq.Base.index f k = k) }) = FStar.Seq.Base.init n (fun (x:under n) -> x)
{ "file_name": "ulib/FStar.IntegerIntervals.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 48, "end_line": 84, "start_col": 0, "start_line": 79 }
(* Copyright 2008-2022 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Author: A. Rozanov *) module FStar.IntegerIntervals (* Aliases to all kinds of integer intervals *) (* general infinite integer intervals *) type less_than (k: int) = x:int{x<k} type greater_than (k: int) = x:int{x>k} type not_less_than (x: int) = greater_than (x-1) type not_greater_than (x: int) = less_than (x+1) (* Type coercion. While supposed to be absolutely trivial, might still be invoked directly under extremely low rlimits *) let coerce_to_less_than #n (x: not_greater_than n) : less_than (n+1) = x let coerce_to_not_less_than #n (x: greater_than n) : not_less_than (n+1) = x let interval_condition (x y t: int) = (x <= t) && (t < y) type interval_type (x y:int) = z : Type0{ z == t:int{interval_condition x y t} } (* Default interval is half-open, which is the most frequently used case *) type interval (x y: int) : interval_type x y = t:int{interval_condition x y t} (* general finite integer intervals *) type efrom_eto (x y: int) = interval (x+1) y type efrom_ito (x y: int) = interval (x+1) (y+1) type ifrom_eto (x y: int) = interval x y type ifrom_ito (x y: int) = interval x (y+1) (* Special case for naturals under k, to use in sequences, lists, arrays, etc *) type under (k: nat) = interval 0 k (* If we define our intervals this way, then the following lemma comes for free: *) private let closed_interval_lemma (x y:int) : Lemma (interval x (y+1) == ifrom_ito x y) = () (* how many numbers fall into an interval? *) let interval_size (#x #y: int) (interval: interval_type x y) : nat = if y >= x then y-x else 0 (* when we want a zero-based index that runs over an interval, we use this *) type counter_for (#x #y:int) (interval: interval_type x y) = under (interval_size interval) (* special case for closed intervals, used in FStar.Algebra.CommMonoid.Fold *) let closed_interval_size (x y: int) : nat = interval_size (ifrom_ito x y) (* A usage example and a test at the same time: *) private let _ = assert (interval_size (interval 5 10) = 5) private let _ = assert (interval_size (ifrom_ito 5 10) = 6) private let _ = assert (interval_size (ifrom_ito 15 10) = 0) (* This lemma, especially when used with forall_intro, helps the prover verify the index ranges of sequences that correspond to arbitrary folds. It is supposed to be invoked to decrease the toll we put on rlimit, i.e. will be redundant in most use cases. *) let counter_bounds_lemma (x y:int) (i: (counter_for (ifrom_ito x y))) : Lemma (x+i >= x /\ x+i <= y) = () (* An integer sequence [0..n), n values in total,
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.IntegerIntervals.fst" }
[ { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
n: Prims.nat -> f: FStar.Seq.Base.seq (FStar.IntegerIntervals.under n) { FStar.Seq.Base.length f = n /\ (forall (k: FStar.IntegerIntervals.under n). FStar.Seq.Base.index f k = k) }
Prims.Tot
[ "total" ]
[]
[ "Prims.nat", "FStar.Seq.Base.init", "FStar.IntegerIntervals.under", "FStar.Seq.Base.seq", "Prims.l_and", "Prims.b2t", "Prims.op_Equality", "FStar.Seq.Base.length", "Prims.l_Forall", "FStar.Seq.Base.index" ]
[]
false
false
false
false
false
let indices_seq (n: nat) : (f: FStar.Seq.Base.seq (under n) {FStar.Seq.Base.length f = n /\ (forall (k: under n). FStar.Seq.Base.index f k = k)}) =
FStar.Seq.Base.init n (fun (x: under n) -> x)
false
Hacl.Bignum.AlmostMontExponentiation.fst
Hacl.Bignum.AlmostMontExponentiation.bn_almost_mont_mul
val bn_almost_mont_mul: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lmul_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu)
val bn_almost_mont_mul: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lmul_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu)
let bn_almost_mont_mul #t k n mu ctx aM bM resM = let h0 = ST.get () in SA.bn_almost_mont_mul_lemma n mu (as_seq h0 aM) (as_seq h0 bM); A.almost_mont_mul_is_mont_mul_lemma (bits t) (v k.AM.bn.BN.len) (BD.bn_v n) (v mu) (bn_v h0 aM) (bn_v h0 bM); let ctx_n = sub ctx 0ul k.AM.bn.BN.len in k.AM.mul ctx_n mu aM bM resM
{ "file_name": "code/bignum/Hacl.Bignum.AlmostMontExponentiation.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 30, "end_line": 113, "start_col": 0, "start_line": 108 }
module Hacl.Bignum.AlmostMontExponentiation open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer open Hacl.Bignum.Definitions module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module BD = Hacl.Spec.Bignum.Definitions module SN = Hacl.Spec.Bignum module SM = Hacl.Spec.Bignum.Montgomery module SA = Hacl.Spec.Bignum.AlmostMontgomery module BN = Hacl.Bignum module BM = Hacl.Bignum.Montgomery module AM = Hacl.Bignum.AlmostMontgomery module LE = Lib.Exponentiation module BE = Hacl.Impl.Exponentiation module E = Hacl.Spec.Exponentiation.Lemmas module A = Hacl.Spec.AlmostMontgomery.Lemmas module M = Hacl.Spec.Montgomery.Lemmas module ME = Hacl.Spec.Bignum.MontExponentiation module S = Hacl.Spec.Bignum.AlmostMontExponentiation #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let a_spec (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len{0 < BD.bn_v n}) = Lib.NatMod.nat_mod (BD.bn_v n) inline_for_extraction noextract let linv (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len) (a:BD.lbignum t len) : Type0 = BD.bn_v a < pow2 (bits t * len) inline_for_extraction noextract let refl (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len{0 < BD.bn_v n}) (a:BD.lbignum t len{linv n a}) : a_spec n = BD.bn_v a % BD.bn_v n inline_for_extraction noextract let linv_ctx (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len) (ctx:BD.lbignum t (len + len)) : Type0 = let ctx_n = LSeq.sub ctx 0 len in let ctx_r2 = LSeq.sub ctx len len in ctx_n == n /\ 0 < BD.bn_v n /\ BD.bn_v ctx_r2 = pow2 (2 * bits t * len) % BD.bn_v n inline_for_extraction noextract let mk_to_nat_mont_ll_comm_monoid (t:limb_t) (len:BN.meta_len t) (n:BD.lbignum t (v len)) (mu:limb t{SM.bn_mont_pre n mu}) : BE.to_comm_monoid t len (len +! len) = { BE.a_spec = a_spec n; BE.comm_monoid = E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (BD.bn_v n) (v mu); BE.linv_ctx = linv_ctx n; BE.linv = linv n; BE.refl = refl n; } inline_for_extraction noextract val bn_almost_mont_one: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lone_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu) let bn_almost_mont_one #t k n mu ctx oneM = [@inline_let] let len = k.AM.bn.BN.len in let k1 = Ghost.hide (E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (BD.bn_v n) (v mu)) in let ctx_n = sub ctx 0ul len in let ctx_r2 = sub ctx len len in let h0 = ST.get () in BM.bn_mont_one len k.AM.from ctx_n mu ctx_r2 oneM; let h1 = ST.get () in SM.bn_mont_one_lemma n mu (as_seq h0 ctx_r2); assert (BD.bn_v (as_seq h1 oneM) == M.mont_one (bits t) (v len) (BD.bn_v n) (v mu)); assert (BD.bn_v (as_seq h1 oneM) < BD.bn_v n); BD.bn_eval_bound n (v len); assert (linv n (as_seq h1 oneM)); Math.Lemmas.small_mod (BD.bn_v (as_seq h1 oneM)) (BD.bn_v n); assert (BD.bn_v (as_seq h1 oneM) % BD.bn_v n == E.mont_one_ll (bits t) (v len) (BD.bn_v n) (v mu)) inline_for_extraction noextract val bn_almost_mont_mul: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lmul_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "Hacl.Spec.Exponentiation.Lemmas.fst.checked", "Hacl.Spec.Bignum.Montgomery.fsti.checked", "Hacl.Spec.Bignum.MontExponentiation.fst.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Spec.Bignum.AlmostMontExponentiation.fst.checked", "Hacl.Spec.Bignum.fsti.checked", "Hacl.Spec.AlmostMontgomery.Lemmas.fst.checked", "Hacl.Impl.Exponentiation.fsti.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.Definitions.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Bignum.AlmostMontExponentiation.fst" }
[ { "abbrev": true, "full_module": "Hacl.Spec.Bignum.AlmostMontExponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.MontExponentiation", "short_module": "ME" }, { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": true, "full_module": "Hacl.Spec.AlmostMontgomery.Lemmas", "short_module": "A" }, { "abbrev": true, "full_module": "Hacl.Spec.Exponentiation.Lemmas", "short_module": "E" }, { "abbrev": true, "full_module": "Hacl.Impl.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.AlmostMontgomery", "short_module": "SA" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Montgomery", "short_module": "SM" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum", "short_module": "SN" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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 } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
k: Hacl.Bignum.AlmostMontgomery.almost_mont t -> n: FStar.Ghost.erased (Hacl.Spec.Bignum.Definitions.lbignum t (Lib.IntTypes.v (Mkbn?.len (Mkalmost_mont?.bn k)))) -> mu: Hacl.Bignum.Definitions.limb t {Hacl.Spec.Bignum.Montgomery.bn_mont_pre (FStar.Ghost.reveal n) mu} -> Hacl.Impl.Exponentiation.Definitions.lmul_st t (Mkbn?.len (Mkalmost_mont?.bn k)) (Mkbn?.len (Mkalmost_mont?.bn k) +! Mkbn?.len (Mkalmost_mont?.bn k)) (Hacl.Bignum.AlmostMontExponentiation.mk_to_nat_mont_ll_comm_monoid t (Mkbn?.len (Mkalmost_mont?.bn k)) (FStar.Ghost.reveal n) mu)
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.Definitions.limb_t", "Hacl.Bignum.AlmostMontgomery.almost_mont", "FStar.Ghost.erased", "Hacl.Spec.Bignum.Definitions.lbignum", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Bignum.__proj__Mkbn__item__len", "Hacl.Bignum.AlmostMontgomery.__proj__Mkalmost_mont__item__bn", "Hacl.Bignum.Definitions.limb", "Hacl.Spec.Bignum.Montgomery.bn_mont_pre", "FStar.Ghost.reveal", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint_t", "Lib.IntTypes.SEC", "Lib.IntTypes.op_Plus_Bang", "Hacl.Bignum.AlmostMontgomery.__proj__Mkalmost_mont__item__mul", "Prims.unit", "Lib.Buffer.lbuffer_t", "Lib.Buffer.MUT", "Lib.IntTypes.int_t", "Lib.Buffer.sub", "FStar.UInt32.__uint_to_t", "Hacl.Spec.AlmostMontgomery.Lemmas.almost_mont_mul_is_mont_mul_lemma", "Lib.IntTypes.bits", "Hacl.Spec.Bignum.Definitions.bn_v", "Hacl.Bignum.Definitions.bn_v", "Hacl.Spec.Bignum.AlmostMontgomery.bn_almost_mont_mul_lemma", "Lib.Buffer.as_seq", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get" ]
[]
false
false
false
false
false
let bn_almost_mont_mul #t k n mu ctx aM bM resM =
let h0 = ST.get () in SA.bn_almost_mont_mul_lemma n mu (as_seq h0 aM) (as_seq h0 bM); A.almost_mont_mul_is_mont_mul_lemma (bits t) (v k.AM.bn.BN.len) (BD.bn_v n) (v mu) (bn_v h0 aM) (bn_v h0 bM); let ctx_n = sub ctx 0ul k.AM.bn.BN.len in k.AM.mul ctx_n mu aM bM resM
false
Hacl.Bignum.AlmostMontExponentiation.fst
Hacl.Bignum.AlmostMontExponentiation.mk_ctx
val mk_ctx: #t:limb_t -> len:BN.meta_len t -> n:lbignum t len -> r2:lbignum t len -> ctx:lbignum t (len +! len) -> Stack unit (requires fun h -> live h n /\ live h r2 /\ live h ctx /\ disjoint n ctx /\ disjoint r2 ctx /\ 0 < bn_v h n /\ bn_v h r2 == pow2 (2 * bits t * v len) % bn_v h n) (ensures fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\ linv_ctx (as_seq h0 n) (as_seq h1 ctx))
val mk_ctx: #t:limb_t -> len:BN.meta_len t -> n:lbignum t len -> r2:lbignum t len -> ctx:lbignum t (len +! len) -> Stack unit (requires fun h -> live h n /\ live h r2 /\ live h ctx /\ disjoint n ctx /\ disjoint r2 ctx /\ 0 < bn_v h n /\ bn_v h r2 == pow2 (2 * bits t * v len) % bn_v h n) (ensures fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\ linv_ctx (as_seq h0 n) (as_seq h1 ctx))
let mk_ctx #t len n r2 ctx = let h0 = ST.get () in update_sub ctx 0ul len n; let h1 = ST.get () in assert (LSeq.sub (as_seq h1 ctx) 0 (v len) == as_seq h0 n); update_sub ctx len len r2; let h2 = ST.get () in LSeq.eq_intro (LSeq.sub (as_seq h2 ctx) 0 (v len)) (LSeq.sub (as_seq h1 ctx) 0 (v len)); assert (LSeq.sub (as_seq h2 ctx) 0 (v len) == as_seq h0 n); assert (LSeq.sub (as_seq h2 ctx) (v len) (v len) == as_seq h0 r2)
{ "file_name": "code/bignum/Hacl.Bignum.AlmostMontExponentiation.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 67, "end_line": 176, "start_col": 0, "start_line": 165 }
module Hacl.Bignum.AlmostMontExponentiation open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer open Hacl.Bignum.Definitions module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module BD = Hacl.Spec.Bignum.Definitions module SN = Hacl.Spec.Bignum module SM = Hacl.Spec.Bignum.Montgomery module SA = Hacl.Spec.Bignum.AlmostMontgomery module BN = Hacl.Bignum module BM = Hacl.Bignum.Montgomery module AM = Hacl.Bignum.AlmostMontgomery module LE = Lib.Exponentiation module BE = Hacl.Impl.Exponentiation module E = Hacl.Spec.Exponentiation.Lemmas module A = Hacl.Spec.AlmostMontgomery.Lemmas module M = Hacl.Spec.Montgomery.Lemmas module ME = Hacl.Spec.Bignum.MontExponentiation module S = Hacl.Spec.Bignum.AlmostMontExponentiation #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let a_spec (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len{0 < BD.bn_v n}) = Lib.NatMod.nat_mod (BD.bn_v n) inline_for_extraction noextract let linv (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len) (a:BD.lbignum t len) : Type0 = BD.bn_v a < pow2 (bits t * len) inline_for_extraction noextract let refl (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len{0 < BD.bn_v n}) (a:BD.lbignum t len{linv n a}) : a_spec n = BD.bn_v a % BD.bn_v n inline_for_extraction noextract let linv_ctx (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len) (ctx:BD.lbignum t (len + len)) : Type0 = let ctx_n = LSeq.sub ctx 0 len in let ctx_r2 = LSeq.sub ctx len len in ctx_n == n /\ 0 < BD.bn_v n /\ BD.bn_v ctx_r2 = pow2 (2 * bits t * len) % BD.bn_v n inline_for_extraction noextract let mk_to_nat_mont_ll_comm_monoid (t:limb_t) (len:BN.meta_len t) (n:BD.lbignum t (v len)) (mu:limb t{SM.bn_mont_pre n mu}) : BE.to_comm_monoid t len (len +! len) = { BE.a_spec = a_spec n; BE.comm_monoid = E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (BD.bn_v n) (v mu); BE.linv_ctx = linv_ctx n; BE.linv = linv n; BE.refl = refl n; } inline_for_extraction noextract val bn_almost_mont_one: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lone_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu) let bn_almost_mont_one #t k n mu ctx oneM = [@inline_let] let len = k.AM.bn.BN.len in let k1 = Ghost.hide (E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (BD.bn_v n) (v mu)) in let ctx_n = sub ctx 0ul len in let ctx_r2 = sub ctx len len in let h0 = ST.get () in BM.bn_mont_one len k.AM.from ctx_n mu ctx_r2 oneM; let h1 = ST.get () in SM.bn_mont_one_lemma n mu (as_seq h0 ctx_r2); assert (BD.bn_v (as_seq h1 oneM) == M.mont_one (bits t) (v len) (BD.bn_v n) (v mu)); assert (BD.bn_v (as_seq h1 oneM) < BD.bn_v n); BD.bn_eval_bound n (v len); assert (linv n (as_seq h1 oneM)); Math.Lemmas.small_mod (BD.bn_v (as_seq h1 oneM)) (BD.bn_v n); assert (BD.bn_v (as_seq h1 oneM) % BD.bn_v n == E.mont_one_ll (bits t) (v len) (BD.bn_v n) (v mu)) inline_for_extraction noextract val bn_almost_mont_mul: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lmul_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu) let bn_almost_mont_mul #t k n mu ctx aM bM resM = let h0 = ST.get () in SA.bn_almost_mont_mul_lemma n mu (as_seq h0 aM) (as_seq h0 bM); A.almost_mont_mul_is_mont_mul_lemma (bits t) (v k.AM.bn.BN.len) (BD.bn_v n) (v mu) (bn_v h0 aM) (bn_v h0 bM); let ctx_n = sub ctx 0ul k.AM.bn.BN.len in k.AM.mul ctx_n mu aM bM resM inline_for_extraction noextract val bn_almost_mont_sqr: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lsqr_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu) let bn_almost_mont_sqr #t k n mu ctx aM resM = let h0 = ST.get () in SA.bn_almost_mont_sqr_lemma n mu (as_seq h0 aM); SA.bn_almost_mont_mul_lemma n mu (as_seq h0 aM) (as_seq h0 aM); A.almost_mont_mul_is_mont_mul_lemma (bits t) (v k.AM.bn.BN.len) (BD.bn_v n) (v mu) (bn_v h0 aM) (bn_v h0 aM); let ctx_n = sub ctx 0ul k.AM.bn.BN.len in k.AM.sqr ctx_n mu aM resM inline_for_extraction noextract let mk_bn_almost_mont_concrete_ops (t:limb_t) (k:AM.almost_mont t) (n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len))) (mu:limb t{SM.bn_mont_pre n mu}) : BE.concrete_ops t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) = { BE.to = mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu; BE.lone = bn_almost_mont_one k n mu; BE.lmul = bn_almost_mont_mul k n mu; BE.lsqr = bn_almost_mont_sqr k n mu; } /////////////////////////////////////////////////////////////////////// inline_for_extraction noextract val mk_ctx: #t:limb_t -> len:BN.meta_len t -> n:lbignum t len -> r2:lbignum t len -> ctx:lbignum t (len +! len) -> Stack unit (requires fun h -> live h n /\ live h r2 /\ live h ctx /\ disjoint n ctx /\ disjoint r2 ctx /\ 0 < bn_v h n /\ bn_v h r2 == pow2 (2 * bits t * v len) % bn_v h n) (ensures fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\ linv_ctx (as_seq h0 n) (as_seq h1 ctx))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "Hacl.Spec.Exponentiation.Lemmas.fst.checked", "Hacl.Spec.Bignum.Montgomery.fsti.checked", "Hacl.Spec.Bignum.MontExponentiation.fst.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Spec.Bignum.AlmostMontExponentiation.fst.checked", "Hacl.Spec.Bignum.fsti.checked", "Hacl.Spec.AlmostMontgomery.Lemmas.fst.checked", "Hacl.Impl.Exponentiation.fsti.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.Definitions.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Bignum.AlmostMontExponentiation.fst" }
[ { "abbrev": true, "full_module": "Hacl.Spec.Bignum.AlmostMontExponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.MontExponentiation", "short_module": "ME" }, { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": true, "full_module": "Hacl.Spec.AlmostMontgomery.Lemmas", "short_module": "A" }, { "abbrev": true, "full_module": "Hacl.Spec.Exponentiation.Lemmas", "short_module": "E" }, { "abbrev": true, "full_module": "Hacl.Impl.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.AlmostMontgomery", "short_module": "SA" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Montgomery", "short_module": "SM" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum", "short_module": "SN" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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 } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
len: Hacl.Bignum.meta_len t -> n: Hacl.Bignum.Definitions.lbignum t len -> r2: Hacl.Bignum.Definitions.lbignum t len -> ctx: Hacl.Bignum.Definitions.lbignum t (len +! len) -> FStar.HyperStack.ST.Stack Prims.unit
FStar.HyperStack.ST.Stack
[]
[]
[ "Hacl.Bignum.Definitions.limb_t", "Hacl.Bignum.meta_len", "Hacl.Bignum.Definitions.lbignum", "Lib.IntTypes.op_Plus_Bang", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Prims._assert", "Prims.eq2", "Lib.Sequence.lseq", "Hacl.Bignum.Definitions.limb", "Lib.IntTypes.v", "Lib.Sequence.sub", "Lib.Buffer.as_seq", "Lib.Buffer.MUT", "Prims.unit", "Lib.Sequence.eq_intro", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "Lib.Buffer.update_sub", "FStar.UInt32.__uint_to_t" ]
[]
false
true
false
false
false
let mk_ctx #t len n r2 ctx =
let h0 = ST.get () in update_sub ctx 0ul len n; let h1 = ST.get () in assert (LSeq.sub (as_seq h1 ctx) 0 (v len) == as_seq h0 n); update_sub ctx len len r2; let h2 = ST.get () in LSeq.eq_intro (LSeq.sub (as_seq h2 ctx) 0 (v len)) (LSeq.sub (as_seq h1 ctx) 0 (v len)); assert (LSeq.sub (as_seq h2 ctx) 0 (v len) == as_seq h0 n); assert (LSeq.sub (as_seq h2 ctx) (v len) (v len) == as_seq h0 r2)
false
Vale.Test.X64.Vale_memcpy.fst
Vale.Test.X64.Vale_memcpy.va_quick_InnerMemcpy
val va_quick_InnerMemcpy (dst src: buffer64) : (va_quickCode unit (va_code_InnerMemcpy ()))
val va_quick_InnerMemcpy (dst src: buffer64) : (va_quickCode unit (va_code_InnerMemcpy ()))
let va_quick_InnerMemcpy (dst:buffer64) (src:buffer64) : (va_quickCode unit (va_code_InnerMemcpy ())) = (va_QProc (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) (va_wp_InnerMemcpy dst src) (va_wpProof_InnerMemcpy dst src))
{ "file_name": "obj/Vale.Test.X64.Vale_memcpy.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 97, "end_line": 137, "start_col": 0, "start_line": 134 }
module Vale.Test.X64.Vale_memcpy open Vale.Arch.HeapImpl open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsVector open Vale.X64.QuickCode open Vale.X64.QuickCodes #set-options "--z3rlimit 20" //-- InnerMemcpy val va_code_InnerMemcpy : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_InnerMemcpy () = (va_Block (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRdx) 8 Secret) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8 Secret) (va_CNil ())))))) val va_codegen_success_InnerMemcpy : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_InnerMemcpy () = (va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRdx) 8 Secret) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8 Secret) (va_ttrue ()))))) [@ "opaque_to_smt" va_qattr] let va_qcode_InnerMemcpy (va_mods:va_mods_t) (dst:buffer64) (src:buffer64) : (va_quickCode unit (va_code_InnerMemcpy ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 38 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret src 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 39 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRdx) 8 Secret src 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 40 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rRax) 0 Secret dst 0) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 41 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8 Secret dst 1) (fun (va_s:va_state) _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 42 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (FStar.Seq.Base.equal #(Vale.X64.Memory.base_typ_as_vale_type Vale.X64.Memory.vuint64) (Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_s) dst) (Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_s) src)) (va_QEmpty (())))))))) val va_lemma_InnerMemcpy : va_b0:va_code -> va_s0:va_state -> dst:buffer64 -> src:buffer64 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_InnerMemcpy ()) va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdx va_s0) src 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 dst == 2)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst == Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\ Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst) (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))) [@"opaque_to_smt"] let va_lemma_InnerMemcpy va_b0 va_s0 dst src = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_InnerMemcpy va_mods dst src in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_InnerMemcpy ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 21 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 35 column 63 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst == Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 36 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst) (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_InnerMemcpy (dst:buffer64) (src:buffer64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdx va_s0) src 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 dst == 2 /\ (forall (va_x_mem:vale_heap) (va_x_rax:nat64) (va_x_rcx:nat64) (va_x_r9:nat64) (va_x_heap1:vale_heap) . let va_sM = va_upd_mem_heaplet 1 va_x_heap1 (va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRax va_x_rax (va_upd_mem va_x_mem va_s0)))) in va_get_ok va_sM /\ Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst == Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\ Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst) (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) ==> va_k va_sM (()))) val va_wpProof_InnerMemcpy : dst:buffer64 -> src:buffer64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_InnerMemcpy dst src va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_InnerMemcpy dst src va_s0 va_k = let (va_sM, va_f0) = va_lemma_InnerMemcpy (va_code_InnerMemcpy ()) va_s0 dst src in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g)
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsVector.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.Test.X64.Vale_memcpy.fst" }
[ { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Test.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.Test.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
dst: Vale.X64.Memory.buffer64 -> src: Vale.X64.Memory.buffer64 -> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.Test.X64.Vale_memcpy.va_code_InnerMemcpy ())
Prims.Tot
[ "total" ]
[]
[ "Vale.X64.Memory.buffer64", "Vale.X64.QuickCode.va_QProc", "Prims.unit", "Vale.Test.X64.Vale_memcpy.va_code_InnerMemcpy", "Prims.Cons", "Vale.X64.QuickCode.mod_t", "Vale.X64.QuickCode.va_Mod_mem_heaplet", "Vale.X64.QuickCode.va_Mod_reg64", "Vale.X64.Machine_s.rR9", "Vale.X64.Machine_s.rRcx", "Vale.X64.Machine_s.rRax", "Vale.X64.QuickCode.va_Mod_mem", "Prims.Nil", "Vale.Test.X64.Vale_memcpy.va_wp_InnerMemcpy", "Vale.Test.X64.Vale_memcpy.va_wpProof_InnerMemcpy", "Vale.X64.QuickCode.va_quickCode" ]
[]
false
false
false
false
false
let va_quick_InnerMemcpy (dst src: buffer64) : (va_quickCode unit (va_code_InnerMemcpy ())) =
(va_QProc (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) (va_wp_InnerMemcpy dst src) (va_wpProof_InnerMemcpy dst src))
false
Vale.Test.X64.Vale_memcpy.fst
Vale.Test.X64.Vale_memcpy.va_wpProof_InnerMemcpy
val va_wpProof_InnerMemcpy : dst:buffer64 -> src:buffer64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_InnerMemcpy dst src va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
val va_wpProof_InnerMemcpy : dst:buffer64 -> src:buffer64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_InnerMemcpy dst src va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
let va_wpProof_InnerMemcpy dst src va_s0 va_k = let (va_sM, va_f0) = va_lemma_InnerMemcpy (va_code_InnerMemcpy ()) va_s0 dst src in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g)
{ "file_name": "obj/Vale.Test.X64.Vale_memcpy.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 22, "end_line": 131, "start_col": 0, "start_line": 122 }
module Vale.Test.X64.Vale_memcpy open Vale.Arch.HeapImpl open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsVector open Vale.X64.QuickCode open Vale.X64.QuickCodes #set-options "--z3rlimit 20" //-- InnerMemcpy val va_code_InnerMemcpy : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_InnerMemcpy () = (va_Block (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRdx) 8 Secret) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8 Secret) (va_CNil ())))))) val va_codegen_success_InnerMemcpy : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_InnerMemcpy () = (va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRdx) 8 Secret) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8 Secret) (va_ttrue ()))))) [@ "opaque_to_smt" va_qattr] let va_qcode_InnerMemcpy (va_mods:va_mods_t) (dst:buffer64) (src:buffer64) : (va_quickCode unit (va_code_InnerMemcpy ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 38 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret src 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 39 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRdx) 8 Secret src 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 40 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rRax) 0 Secret dst 0) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 41 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8 Secret dst 1) (fun (va_s:va_state) _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 42 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (FStar.Seq.Base.equal #(Vale.X64.Memory.base_typ_as_vale_type Vale.X64.Memory.vuint64) (Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_s) dst) (Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_s) src)) (va_QEmpty (())))))))) val va_lemma_InnerMemcpy : va_b0:va_code -> va_s0:va_state -> dst:buffer64 -> src:buffer64 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_InnerMemcpy ()) va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdx va_s0) src 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 dst == 2)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst == Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\ Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst) (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))) [@"opaque_to_smt"] let va_lemma_InnerMemcpy va_b0 va_s0 dst src = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_InnerMemcpy va_mods dst src in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_InnerMemcpy ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 21 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 35 column 63 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst == Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 36 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst) (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_InnerMemcpy (dst:buffer64) (src:buffer64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdx va_s0) src 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 dst == 2 /\ (forall (va_x_mem:vale_heap) (va_x_rax:nat64) (va_x_rcx:nat64) (va_x_r9:nat64) (va_x_heap1:vale_heap) . let va_sM = va_upd_mem_heaplet 1 va_x_heap1 (va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRax va_x_rax (va_upd_mem va_x_mem va_s0)))) in va_get_ok va_sM /\ Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst == Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\ Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst) (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) ==> va_k va_sM (()))) val va_wpProof_InnerMemcpy : dst:buffer64 -> src:buffer64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_InnerMemcpy dst src va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsVector.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.Test.X64.Vale_memcpy.fst" }
[ { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Test.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.Test.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
dst: Vale.X64.Memory.buffer64 -> src: Vale.X64.Memory.buffer64 -> va_s0: Vale.X64.Decls.va_state -> va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0) -> Prims.Ghost ((Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) * Prims.unit)
Prims.Ghost
[]
[]
[ "Vale.X64.Memory.buffer64", "Vale.X64.Decls.va_state", "Prims.unit", "Vale.X64.Decls.va_fuel", "FStar.Pervasives.Native.Mktuple3", "Vale.X64.QuickCode.va_lemma_norm_mods", "Prims.Cons", "Vale.X64.QuickCode.mod_t", "Vale.X64.QuickCode.va_Mod_mem_heaplet", "Vale.X64.QuickCode.va_Mod_reg64", "Vale.X64.Machine_s.rR9", "Vale.X64.Machine_s.rRcx", "Vale.X64.Machine_s.rRax", "Vale.X64.QuickCode.va_Mod_mem", "Prims.Nil", "Prims._assert", "Vale.X64.Decls.va_state_eq", "Vale.X64.Decls.va_update_mem_heaplet", "Vale.X64.Decls.va_update_reg64", "Vale.X64.Decls.va_update_ok", "Vale.X64.Decls.va_update_mem", "Vale.X64.Decls.va_lemma_upd_update", "FStar.Pervasives.Native.tuple3", "FStar.Pervasives.Native.tuple2", "Vale.X64.State.vale_state", "Vale.Test.X64.Vale_memcpy.va_lemma_InnerMemcpy", "Vale.Test.X64.Vale_memcpy.va_code_InnerMemcpy" ]
[]
false
false
false
false
false
let va_wpProof_InnerMemcpy dst src va_s0 va_k =
let va_sM, va_f0 = va_lemma_InnerMemcpy (va_code_InnerMemcpy ()) va_s0 dst src in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))); va_lemma_norm_mods ([ va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem ]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g)
false
Vale.Test.X64.Vale_memcpy.fst
Vale.Test.X64.Vale_memcpy.va_wpProof_Memcpy
val va_wpProof_Memcpy : win:bool -> dst:buffer64 -> src:buffer64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Memcpy win dst src va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Memcpy win) ([va_Mod_mem_heaplet 1; va_Mod_mem_layout; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
val va_wpProof_Memcpy : win:bool -> dst:buffer64 -> src:buffer64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Memcpy win dst src va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Memcpy win) ([va_Mod_mem_heaplet 1; va_Mod_mem_layout; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
let va_wpProof_Memcpy win dst src va_s0 va_k = let (va_sM, va_f0) = va_lemma_Memcpy (va_code_Memcpy win) va_s0 win dst src in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_mem_layout va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_mem_layout; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g)
{ "file_name": "obj/Vale.Test.X64.Vale_memcpy.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 22, "end_line": 242, "start_col": 0, "start_line": 233 }
module Vale.Test.X64.Vale_memcpy open Vale.Arch.HeapImpl open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsVector open Vale.X64.QuickCode open Vale.X64.QuickCodes #set-options "--z3rlimit 20" //-- InnerMemcpy val va_code_InnerMemcpy : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_InnerMemcpy () = (va_Block (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRdx) 8 Secret) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8 Secret) (va_CNil ())))))) val va_codegen_success_InnerMemcpy : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_InnerMemcpy () = (va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRdx) 8 Secret) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8 Secret) (va_ttrue ()))))) [@ "opaque_to_smt" va_qattr] let va_qcode_InnerMemcpy (va_mods:va_mods_t) (dst:buffer64) (src:buffer64) : (va_quickCode unit (va_code_InnerMemcpy ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 38 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret src 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 39 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRdx) 8 Secret src 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 40 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rRax) 0 Secret dst 0) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 41 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8 Secret dst 1) (fun (va_s:va_state) _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 42 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (FStar.Seq.Base.equal #(Vale.X64.Memory.base_typ_as_vale_type Vale.X64.Memory.vuint64) (Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_s) dst) (Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_s) src)) (va_QEmpty (())))))))) val va_lemma_InnerMemcpy : va_b0:va_code -> va_s0:va_state -> dst:buffer64 -> src:buffer64 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_InnerMemcpy ()) va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdx va_s0) src 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 dst == 2)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst == Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\ Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst) (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))) [@"opaque_to_smt"] let va_lemma_InnerMemcpy va_b0 va_s0 dst src = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_InnerMemcpy va_mods dst src in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_InnerMemcpy ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 21 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 35 column 63 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst == Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 36 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst) (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_InnerMemcpy (dst:buffer64) (src:buffer64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdx va_s0) src 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 dst == 2 /\ (forall (va_x_mem:vale_heap) (va_x_rax:nat64) (va_x_rcx:nat64) (va_x_r9:nat64) (va_x_heap1:vale_heap) . let va_sM = va_upd_mem_heaplet 1 va_x_heap1 (va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRax va_x_rax (va_upd_mem va_x_mem va_s0)))) in va_get_ok va_sM /\ Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst == Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\ Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst) (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) ==> va_k va_sM (()))) val va_wpProof_InnerMemcpy : dst:buffer64 -> src:buffer64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_InnerMemcpy dst src va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_InnerMemcpy dst src va_s0 va_k = let (va_sM, va_f0) = va_lemma_InnerMemcpy (va_code_InnerMemcpy ()) va_s0 dst src in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_InnerMemcpy (dst:buffer64) (src:buffer64) : (va_quickCode unit (va_code_InnerMemcpy ())) = (va_QProc (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) (va_wp_InnerMemcpy dst src) (va_wpProof_InnerMemcpy dst src)) //-- //-- Memcpy [@ "opaque_to_smt" va_qattr] let va_code_Memcpy win = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (if win then va_Block (va_CCons (va_code_InnerMemcpy ()) (va_CNil ())) else va_Block (va_CCons (va_code_Mem64_lemma ()) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRax) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 0 Secret)) (va_CCons (va_code_Mem64_lemma ()) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 Secret)) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRcx) 8 Secret) (va_CNil ())))))))) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ()))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Memcpy win = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (if win then va_pbool_and (va_codegen_success_InnerMemcpy ()) (va_ttrue ()) else va_pbool_and (va_codegen_success_Mem64_lemma ()) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRax) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 0 Secret)) (va_pbool_and (va_codegen_success_Mem64_lemma ()) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 Secret)) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRcx) 8 Secret) (va_ttrue ()))))))) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ())))) [@ "opaque_to_smt" va_qattr] let va_qcode_Memcpy (va_mods:va_mods_t) (win:bool) (dst:buffer64) (src:buffer64) : (va_quickCode unit (va_code_Memcpy win)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 67 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_CreateHeaplets ([declare_buffer64 src 0 Secret Immutable; declare_buffer64 dst 1 Secret Mutable])) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 71 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 73 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_InnerMemcpy dst src) (va_QEmpty (())))) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 77 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Mem64_lemma (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 0 src 0 Secret) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 77 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 0 Secret)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 78 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Mem64_lemma (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 src 1 Secret) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 78 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 Secret)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 79 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRax) 0 Secret dst 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 80 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRcx) 8 Secret dst 1) (va_QEmpty (())))))))))) (fun (va_s:va_state) va_g -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 82 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (FStar.Seq.Base.equal #(Vale.X64.Memory.base_typ_as_vale_type Vale.X64.Memory.vuint64) (Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_s) dst) (Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_s) src)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 84 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))) [@"opaque_to_smt"] let va_lemma_Memcpy va_b0 va_s0 win dst src = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_mem_layout; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Memcpy va_mods win dst src in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Memcpy win) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 45 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 63 column 59 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) dst == Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) src) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 65 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst) (va_get_mem va_s0) (va_get_mem va_sM))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_mem_layout; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM)
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsVector.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.Test.X64.Vale_memcpy.fst" }
[ { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Test.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.Test.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
win: Prims.bool -> dst: Vale.X64.Memory.buffer64 -> src: Vale.X64.Memory.buffer64 -> va_s0: Vale.X64.Decls.va_state -> va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0) -> Prims.Ghost ((Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) * Prims.unit)
Prims.Ghost
[]
[]
[ "Prims.bool", "Vale.X64.Memory.buffer64", "Vale.X64.Decls.va_state", "Prims.unit", "Vale.X64.Decls.va_fuel", "FStar.Pervasives.Native.Mktuple3", "Vale.X64.QuickCode.va_lemma_norm_mods", "Prims.Cons", "Vale.X64.QuickCode.mod_t", "Vale.X64.QuickCode.va_Mod_mem_heaplet", "Vale.X64.QuickCode.va_Mod_mem_layout", "Vale.X64.QuickCode.va_Mod_reg64", "Vale.X64.Machine_s.rR9", "Vale.X64.Machine_s.rRcx", "Vale.X64.Machine_s.rRax", "Vale.X64.QuickCode.va_Mod_mem", "Prims.Nil", "Prims._assert", "Vale.X64.Decls.va_state_eq", "Vale.X64.Decls.va_update_mem_heaplet", "Vale.X64.Decls.va_update_mem_layout", "Vale.X64.Decls.va_update_reg64", "Vale.X64.Decls.va_update_ok", "Vale.X64.Decls.va_update_mem", "Vale.X64.Decls.va_lemma_upd_update", "FStar.Pervasives.Native.tuple3", "FStar.Pervasives.Native.tuple2", "Vale.X64.State.vale_state", "Vale.Test.X64.Vale_memcpy.va_lemma_Memcpy", "Vale.Test.X64.Vale_memcpy.va_code_Memcpy" ]
[]
false
false
false
false
false
let va_wpProof_Memcpy win dst src va_s0 va_k =
let va_sM, va_f0 = va_lemma_Memcpy (va_code_Memcpy win) va_s0 win dst src in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_mem_layout va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))) )))); va_lemma_norm_mods ([ va_Mod_mem_heaplet 1; va_Mod_mem_layout; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem ]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g)
false
Hacl.Bignum.AlmostMontExponentiation.fst
Hacl.Bignum.AlmostMontExponentiation.bn_almost_mont_sqr
val bn_almost_mont_sqr: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lsqr_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu)
val bn_almost_mont_sqr: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lsqr_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu)
let bn_almost_mont_sqr #t k n mu ctx aM resM = let h0 = ST.get () in SA.bn_almost_mont_sqr_lemma n mu (as_seq h0 aM); SA.bn_almost_mont_mul_lemma n mu (as_seq h0 aM) (as_seq h0 aM); A.almost_mont_mul_is_mont_mul_lemma (bits t) (v k.AM.bn.BN.len) (BD.bn_v n) (v mu) (bn_v h0 aM) (bn_v h0 aM); let ctx_n = sub ctx 0ul k.AM.bn.BN.len in k.AM.sqr ctx_n mu aM resM
{ "file_name": "code/bignum/Hacl.Bignum.AlmostMontExponentiation.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 27, "end_line": 131, "start_col": 0, "start_line": 125 }
module Hacl.Bignum.AlmostMontExponentiation open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer open Hacl.Bignum.Definitions module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module BD = Hacl.Spec.Bignum.Definitions module SN = Hacl.Spec.Bignum module SM = Hacl.Spec.Bignum.Montgomery module SA = Hacl.Spec.Bignum.AlmostMontgomery module BN = Hacl.Bignum module BM = Hacl.Bignum.Montgomery module AM = Hacl.Bignum.AlmostMontgomery module LE = Lib.Exponentiation module BE = Hacl.Impl.Exponentiation module E = Hacl.Spec.Exponentiation.Lemmas module A = Hacl.Spec.AlmostMontgomery.Lemmas module M = Hacl.Spec.Montgomery.Lemmas module ME = Hacl.Spec.Bignum.MontExponentiation module S = Hacl.Spec.Bignum.AlmostMontExponentiation #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let a_spec (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len{0 < BD.bn_v n}) = Lib.NatMod.nat_mod (BD.bn_v n) inline_for_extraction noextract let linv (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len) (a:BD.lbignum t len) : Type0 = BD.bn_v a < pow2 (bits t * len) inline_for_extraction noextract let refl (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len{0 < BD.bn_v n}) (a:BD.lbignum t len{linv n a}) : a_spec n = BD.bn_v a % BD.bn_v n inline_for_extraction noextract let linv_ctx (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len) (ctx:BD.lbignum t (len + len)) : Type0 = let ctx_n = LSeq.sub ctx 0 len in let ctx_r2 = LSeq.sub ctx len len in ctx_n == n /\ 0 < BD.bn_v n /\ BD.bn_v ctx_r2 = pow2 (2 * bits t * len) % BD.bn_v n inline_for_extraction noextract let mk_to_nat_mont_ll_comm_monoid (t:limb_t) (len:BN.meta_len t) (n:BD.lbignum t (v len)) (mu:limb t{SM.bn_mont_pre n mu}) : BE.to_comm_monoid t len (len +! len) = { BE.a_spec = a_spec n; BE.comm_monoid = E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (BD.bn_v n) (v mu); BE.linv_ctx = linv_ctx n; BE.linv = linv n; BE.refl = refl n; } inline_for_extraction noextract val bn_almost_mont_one: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lone_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu) let bn_almost_mont_one #t k n mu ctx oneM = [@inline_let] let len = k.AM.bn.BN.len in let k1 = Ghost.hide (E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (BD.bn_v n) (v mu)) in let ctx_n = sub ctx 0ul len in let ctx_r2 = sub ctx len len in let h0 = ST.get () in BM.bn_mont_one len k.AM.from ctx_n mu ctx_r2 oneM; let h1 = ST.get () in SM.bn_mont_one_lemma n mu (as_seq h0 ctx_r2); assert (BD.bn_v (as_seq h1 oneM) == M.mont_one (bits t) (v len) (BD.bn_v n) (v mu)); assert (BD.bn_v (as_seq h1 oneM) < BD.bn_v n); BD.bn_eval_bound n (v len); assert (linv n (as_seq h1 oneM)); Math.Lemmas.small_mod (BD.bn_v (as_seq h1 oneM)) (BD.bn_v n); assert (BD.bn_v (as_seq h1 oneM) % BD.bn_v n == E.mont_one_ll (bits t) (v len) (BD.bn_v n) (v mu)) inline_for_extraction noextract val bn_almost_mont_mul: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lmul_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu) let bn_almost_mont_mul #t k n mu ctx aM bM resM = let h0 = ST.get () in SA.bn_almost_mont_mul_lemma n mu (as_seq h0 aM) (as_seq h0 bM); A.almost_mont_mul_is_mont_mul_lemma (bits t) (v k.AM.bn.BN.len) (BD.bn_v n) (v mu) (bn_v h0 aM) (bn_v h0 bM); let ctx_n = sub ctx 0ul k.AM.bn.BN.len in k.AM.mul ctx_n mu aM bM resM inline_for_extraction noextract val bn_almost_mont_sqr: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lsqr_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "Hacl.Spec.Exponentiation.Lemmas.fst.checked", "Hacl.Spec.Bignum.Montgomery.fsti.checked", "Hacl.Spec.Bignum.MontExponentiation.fst.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Spec.Bignum.AlmostMontExponentiation.fst.checked", "Hacl.Spec.Bignum.fsti.checked", "Hacl.Spec.AlmostMontgomery.Lemmas.fst.checked", "Hacl.Impl.Exponentiation.fsti.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.Definitions.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Bignum.AlmostMontExponentiation.fst" }
[ { "abbrev": true, "full_module": "Hacl.Spec.Bignum.AlmostMontExponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.MontExponentiation", "short_module": "ME" }, { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": true, "full_module": "Hacl.Spec.AlmostMontgomery.Lemmas", "short_module": "A" }, { "abbrev": true, "full_module": "Hacl.Spec.Exponentiation.Lemmas", "short_module": "E" }, { "abbrev": true, "full_module": "Hacl.Impl.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.AlmostMontgomery", "short_module": "SA" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Montgomery", "short_module": "SM" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum", "short_module": "SN" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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 } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
k: Hacl.Bignum.AlmostMontgomery.almost_mont t -> n: FStar.Ghost.erased (Hacl.Spec.Bignum.Definitions.lbignum t (Lib.IntTypes.v (Mkbn?.len (Mkalmost_mont?.bn k)))) -> mu: Hacl.Bignum.Definitions.limb t {Hacl.Spec.Bignum.Montgomery.bn_mont_pre (FStar.Ghost.reveal n) mu} -> Hacl.Impl.Exponentiation.Definitions.lsqr_st t (Mkbn?.len (Mkalmost_mont?.bn k)) (Mkbn?.len (Mkalmost_mont?.bn k) +! Mkbn?.len (Mkalmost_mont?.bn k)) (Hacl.Bignum.AlmostMontExponentiation.mk_to_nat_mont_ll_comm_monoid t (Mkbn?.len (Mkalmost_mont?.bn k)) (FStar.Ghost.reveal n) mu)
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.Definitions.limb_t", "Hacl.Bignum.AlmostMontgomery.almost_mont", "FStar.Ghost.erased", "Hacl.Spec.Bignum.Definitions.lbignum", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Bignum.__proj__Mkbn__item__len", "Hacl.Bignum.AlmostMontgomery.__proj__Mkalmost_mont__item__bn", "Hacl.Bignum.Definitions.limb", "Hacl.Spec.Bignum.Montgomery.bn_mont_pre", "FStar.Ghost.reveal", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint_t", "Lib.IntTypes.SEC", "Lib.IntTypes.op_Plus_Bang", "Hacl.Bignum.AlmostMontgomery.__proj__Mkalmost_mont__item__sqr", "Prims.unit", "Lib.Buffer.lbuffer_t", "Lib.Buffer.MUT", "Lib.IntTypes.int_t", "Lib.Buffer.sub", "FStar.UInt32.__uint_to_t", "Hacl.Spec.AlmostMontgomery.Lemmas.almost_mont_mul_is_mont_mul_lemma", "Lib.IntTypes.bits", "Hacl.Spec.Bignum.Definitions.bn_v", "Hacl.Bignum.Definitions.bn_v", "Hacl.Spec.Bignum.AlmostMontgomery.bn_almost_mont_mul_lemma", "Lib.Buffer.as_seq", "Hacl.Spec.Bignum.AlmostMontgomery.bn_almost_mont_sqr_lemma", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get" ]
[]
false
false
false
false
false
let bn_almost_mont_sqr #t k n mu ctx aM resM =
let h0 = ST.get () in SA.bn_almost_mont_sqr_lemma n mu (as_seq h0 aM); SA.bn_almost_mont_mul_lemma n mu (as_seq h0 aM) (as_seq h0 aM); A.almost_mont_mul_is_mont_mul_lemma (bits t) (v k.AM.bn.BN.len) (BD.bn_v n) (v mu) (bn_v h0 aM) (bn_v h0 aM); let ctx_n = sub ctx 0ul k.AM.bn.BN.len in k.AM.sqr ctx_n mu aM resM
false
Vale.Test.X64.Vale_memcpy.fst
Vale.Test.X64.Vale_memcpy.va_lemma_Memcpy
val va_lemma_Memcpy : va_b0:va_code -> va_s0:va_state -> win:bool -> dst:buffer64 -> src:buffer64 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Memcpy win) va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ Vale.X64.Decls.locs_disjoint ([Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst; Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 src]) /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) (if win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) src 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0) (if win then va_get_reg64 rRcx va_s0 else va_get_reg64 rRdi va_s0) dst 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 dst == 2)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) dst == Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) src /\ Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst) (va_get_mem va_s0) (va_get_mem va_sM) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_mem_layout va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))
val va_lemma_Memcpy : va_b0:va_code -> va_s0:va_state -> win:bool -> dst:buffer64 -> src:buffer64 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Memcpy win) va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\ Vale.X64.Decls.locs_disjoint ([Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst; Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 src]) /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) (if win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) src 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0) (if win then va_get_reg64 rRcx va_s0 else va_get_reg64 rRdi va_s0) dst 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 dst == 2)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) dst == Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) src /\ Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst) (va_get_mem va_s0) (va_get_mem va_sM) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_mem_layout va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))
let va_lemma_Memcpy va_b0 va_s0 win dst src = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_mem_layout; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Memcpy va_mods win dst src in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Memcpy win) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 45 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 63 column 59 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) dst == Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) src) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 65 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst) (va_get_mem va_s0) (va_get_mem va_sM))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_mem_layout; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM)
{ "file_name": "obj/Vale.Test.X64.Vale_memcpy.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 16, "end_line": 229, "start_col": 0, "start_line": 211 }
module Vale.Test.X64.Vale_memcpy open Vale.Arch.HeapImpl open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsVector open Vale.X64.QuickCode open Vale.X64.QuickCodes #set-options "--z3rlimit 20" //-- InnerMemcpy val va_code_InnerMemcpy : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_InnerMemcpy () = (va_Block (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRdx) 8 Secret) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8 Secret) (va_CNil ())))))) val va_codegen_success_InnerMemcpy : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_InnerMemcpy () = (va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRdx) 8 Secret) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8 Secret) (va_ttrue ()))))) [@ "opaque_to_smt" va_qattr] let va_qcode_InnerMemcpy (va_mods:va_mods_t) (dst:buffer64) (src:buffer64) : (va_quickCode unit (va_code_InnerMemcpy ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 38 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret src 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 39 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRdx) 8 Secret src 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 40 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rRax) 0 Secret dst 0) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 41 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8 Secret dst 1) (fun (va_s:va_state) _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 42 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (FStar.Seq.Base.equal #(Vale.X64.Memory.base_typ_as_vale_type Vale.X64.Memory.vuint64) (Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_s) dst) (Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_s) src)) (va_QEmpty (())))))))) val va_lemma_InnerMemcpy : va_b0:va_code -> va_s0:va_state -> dst:buffer64 -> src:buffer64 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_InnerMemcpy ()) va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdx va_s0) src 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 dst == 2)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst == Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\ Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst) (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))) [@"opaque_to_smt"] let va_lemma_InnerMemcpy va_b0 va_s0 dst src = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_InnerMemcpy va_mods dst src in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_InnerMemcpy ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 21 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 35 column 63 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst == Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 36 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst) (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_InnerMemcpy (dst:buffer64) (src:buffer64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdx va_s0) src 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 dst == 2 /\ (forall (va_x_mem:vale_heap) (va_x_rax:nat64) (va_x_rcx:nat64) (va_x_r9:nat64) (va_x_heap1:vale_heap) . let va_sM = va_upd_mem_heaplet 1 va_x_heap1 (va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRax va_x_rax (va_upd_mem va_x_mem va_s0)))) in va_get_ok va_sM /\ Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst == Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\ Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst) (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) ==> va_k va_sM (()))) val va_wpProof_InnerMemcpy : dst:buffer64 -> src:buffer64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_InnerMemcpy dst src va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_InnerMemcpy dst src va_s0 va_k = let (va_sM, va_f0) = va_lemma_InnerMemcpy (va_code_InnerMemcpy ()) va_s0 dst src in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_InnerMemcpy (dst:buffer64) (src:buffer64) : (va_quickCode unit (va_code_InnerMemcpy ())) = (va_QProc (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) (va_wp_InnerMemcpy dst src) (va_wpProof_InnerMemcpy dst src)) //-- //-- Memcpy [@ "opaque_to_smt" va_qattr] let va_code_Memcpy win = (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (if win then va_Block (va_CCons (va_code_InnerMemcpy ()) (va_CNil ())) else va_Block (va_CCons (va_code_Mem64_lemma ()) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRax) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 0 Secret)) (va_CCons (va_code_Mem64_lemma ()) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 Secret)) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRcx) 8 Secret) (va_CNil ())))))))) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ()))))) [@ "opaque_to_smt" va_qattr] let va_codegen_success_Memcpy win = (va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (if win then va_pbool_and (va_codegen_success_InnerMemcpy ()) (va_ttrue ()) else va_pbool_and (va_codegen_success_Mem64_lemma ()) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRax) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 0 Secret)) (va_pbool_and (va_codegen_success_Mem64_lemma ()) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 Secret)) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRcx) 8 Secret) (va_ttrue ()))))))) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ())))) [@ "opaque_to_smt" va_qattr] let va_qcode_Memcpy (va_mods:va_mods_t) (win:bool) (dst:buffer64) (src:buffer64) : (va_quickCode unit (va_code_Memcpy win)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 67 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_CreateHeaplets ([declare_buffer64 src 0 Secret Immutable; declare_buffer64 dst 1 Secret Mutable])) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 71 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 73 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_InnerMemcpy dst src) (va_QEmpty (())))) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 77 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Mem64_lemma (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 0 src 0 Secret) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 77 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 0 Secret)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 78 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Mem64_lemma (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 src 1 Secret) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 78 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 Secret)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 79 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRax) 0 Secret dst 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 80 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRcx) 8 Secret dst 1) (va_QEmpty (())))))))))) (fun (va_s:va_state) va_g -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 82 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (FStar.Seq.Base.equal #(Vale.X64.Memory.base_typ_as_vale_type Vale.X64.Memory.vuint64) (Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_s) dst) (Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_s) src)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 84 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_DestroyHeaplets ()) (va_QEmpty (())))))))
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsVector.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.Test.X64.Vale_memcpy.fst" }
[ { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Test.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.Test.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_b0: Vale.X64.Decls.va_code -> va_s0: Vale.X64.Decls.va_state -> win: Prims.bool -> dst: Vale.X64.Memory.buffer64 -> src: Vale.X64.Memory.buffer64 -> Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel)
Prims.Ghost
[]
[]
[ "Vale.X64.Decls.va_code", "Vale.X64.Decls.va_state", "Prims.bool", "Vale.X64.Memory.buffer64", "Vale.X64.QuickCodes.fuel", "Prims.unit", "FStar.Pervasives.Native.Mktuple2", "Vale.X64.Decls.va_fuel", "Vale.X64.QuickCode.va_lemma_norm_mods", "Prims.Cons", "Vale.X64.QuickCode.mod_t", "Vale.X64.QuickCode.va_Mod_mem_heaplet", "Vale.X64.QuickCode.va_Mod_mem_layout", "Vale.X64.QuickCode.va_Mod_reg64", "Vale.X64.Machine_s.rR9", "Vale.X64.Machine_s.rRcx", "Vale.X64.Machine_s.rRax", "Vale.X64.QuickCode.va_Mod_ok", "Vale.X64.QuickCode.va_Mod_mem", "Prims.Nil", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.list", "Vale.X64.QuickCode.__proj__QProc__item__mods", "Vale.Test.X64.Vale_memcpy.va_code_Memcpy", "FStar.Pervasives.Native.tuple2", "FStar.Pervasives.Native.tuple3", "Vale.X64.State.vale_state", "Vale.X64.QuickCodes.va_wp_sound_code_norm", "Prims.l_and", "Vale.X64.QuickCodes.label", "Vale.X64.QuickCodes.va_range1", "Prims.b2t", "Vale.X64.Decls.va_get_ok", "FStar.Seq.Base.seq", "Vale.X64.Memory.base_typ_as_vale_type", "Vale.X64.Memory.vuint64", "Vale.X64.Memory.buffer_as_seq", "Vale.X64.Decls.va_get_mem", "Vale.X64.Decls.modifies_mem", "Vale.X64.Decls.loc_buffer", "Vale.X64.QuickCode.quickCode", "Vale.Test.X64.Vale_memcpy.va_qcode_Memcpy" ]
[]
false
false
false
false
false
let va_lemma_Memcpy va_b0 va_s0 win dst src =
let va_mods:va_mods_t = [ va_Mod_mem_heaplet 1; va_Mod_mem_layout; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem ] in let va_qc = va_qcode_Memcpy va_mods win dst src in let va_sM, va_fM, va_g = va_wp_sound_code_norm (va_code_Memcpy win) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 45 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 63 column 59 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) dst == Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) src) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 65 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst) (va_get_mem va_s0) (va_get_mem va_sM))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([ va_Mod_mem_heaplet 1; va_Mod_mem_layout; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem ]) va_sM va_s0; (va_sM, va_fM)
false
Vale.Test.X64.Vale_memcpy.fst
Vale.Test.X64.Vale_memcpy.va_lemma_InnerMemcpy
val va_lemma_InnerMemcpy : va_b0:va_code -> va_s0:va_state -> dst:buffer64 -> src:buffer64 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_InnerMemcpy ()) va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdx va_s0) src 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 dst == 2)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst == Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\ Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst) (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))
val va_lemma_InnerMemcpy : va_b0:va_code -> va_s0:va_state -> dst:buffer64 -> src:buffer64 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_InnerMemcpy ()) va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdx va_s0) src 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 dst == 2)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst == Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\ Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst) (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))
let va_lemma_InnerMemcpy va_b0 va_s0 dst src = let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_InnerMemcpy va_mods dst src in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_InnerMemcpy ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 21 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 35 column 63 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst == Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 36 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst) (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM)
{ "file_name": "obj/Vale.Test.X64.Vale_memcpy.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 16, "end_line": 95, "start_col": 0, "start_line": 77 }
module Vale.Test.X64.Vale_memcpy open Vale.Arch.HeapImpl open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsVector open Vale.X64.QuickCode open Vale.X64.QuickCodes #set-options "--z3rlimit 20" //-- InnerMemcpy val va_code_InnerMemcpy : va_dummy:unit -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_InnerMemcpy () = (va_Block (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRdx) 8 Secret) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8 Secret) (va_CNil ())))))) val va_codegen_success_InnerMemcpy : va_dummy:unit -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_InnerMemcpy () = (va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRdx) 8 Secret) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8 Secret) (va_ttrue ()))))) [@ "opaque_to_smt" va_qattr] let va_qcode_InnerMemcpy (va_mods:va_mods_t) (dst:buffer64) (src:buffer64) : (va_quickCode unit (va_code_InnerMemcpy ())) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 38 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret src 0) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 39 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRdx) 8 Secret src 1) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 40 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rRax) 0 Secret dst 0) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 41 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8 Secret dst 1) (fun (va_s:va_state) _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 42 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (FStar.Seq.Base.equal #(Vale.X64.Memory.base_typ_as_vale_type Vale.X64.Memory.vuint64) (Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_s) dst) (Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_s) src)) (va_QEmpty (())))))))) val va_lemma_InnerMemcpy : va_b0:va_code -> va_s0:va_state -> dst:buffer64 -> src:buffer64 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_InnerMemcpy ()) va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdx va_s0) src 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 dst == 2)) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst == Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\ Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst) (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsVector.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.Test.X64.Vale_memcpy.fst" }
[ { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Test.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.Test.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_b0: Vale.X64.Decls.va_code -> va_s0: Vale.X64.Decls.va_state -> dst: Vale.X64.Memory.buffer64 -> src: Vale.X64.Memory.buffer64 -> Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel)
Prims.Ghost
[]
[]
[ "Vale.X64.Decls.va_code", "Vale.X64.Decls.va_state", "Vale.X64.Memory.buffer64", "Vale.X64.QuickCodes.fuel", "Prims.unit", "FStar.Pervasives.Native.Mktuple2", "Vale.X64.Decls.va_fuel", "Vale.X64.QuickCode.va_lemma_norm_mods", "Prims.Cons", "Vale.X64.QuickCode.mod_t", "Vale.X64.QuickCode.va_Mod_mem_heaplet", "Vale.X64.QuickCode.va_Mod_reg64", "Vale.X64.Machine_s.rR9", "Vale.X64.Machine_s.rRcx", "Vale.X64.Machine_s.rRax", "Vale.X64.QuickCode.va_Mod_ok", "Vale.X64.QuickCode.va_Mod_mem", "Prims.Nil", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.list", "Vale.X64.QuickCode.__proj__QProc__item__mods", "Vale.Test.X64.Vale_memcpy.va_code_InnerMemcpy", "FStar.Pervasives.Native.tuple2", "FStar.Pervasives.Native.tuple3", "Vale.X64.State.vale_state", "Vale.X64.QuickCodes.va_wp_sound_code_norm", "Prims.l_and", "Vale.X64.QuickCodes.label", "Vale.X64.QuickCodes.va_range1", "Prims.b2t", "Vale.X64.Decls.va_get_ok", "FStar.Seq.Base.seq", "Vale.X64.Memory.base_typ_as_vale_type", "Vale.X64.Memory.vuint64", "Vale.X64.Memory.buffer_as_seq", "Vale.X64.Decls.va_get_mem_heaplet", "Vale.X64.Decls.modifies_mem", "Vale.X64.Decls.loc_buffer", "Vale.X64.QuickCode.quickCode", "Vale.Test.X64.Vale_memcpy.va_qcode_InnerMemcpy" ]
[]
false
false
false
false
false
let va_lemma_InnerMemcpy va_b0 va_s0 dst src =
let va_mods:va_mods_t = [ va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem ] in let va_qc = va_qcode_InnerMemcpy va_mods dst src in let va_sM, va_fM, va_g = va_wp_sound_code_norm (va_code_InnerMemcpy ()) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 21 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (va_get_ok va_sM) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 35 column 63 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst == Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 36 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****" (Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst) (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([ va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem ]) va_sM va_s0; (va_sM, va_fM)
false
Spec.Agile.HKDF.fsti
Spec.Agile.HKDF.lbytes
val lbytes : l: Prims.nat -> Type0
let lbytes (l:nat) = b:bytes {Seq.length b = l}
{ "file_name": "specs/Spec.Agile.HKDF.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 47, "end_line": 6, "start_col": 0, "start_line": 6 }
module Spec.Agile.HKDF open FStar.Mul open Spec.Hash.Definitions
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HMAC.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Agile.HKDF.fsti" }
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
l: Prims.nat -> Type0
Prims.Tot
[ "total" ]
[]
[ "Prims.nat", "Spec.Hash.Definitions.bytes", "Prims.b2t", "Prims.op_Equality", "FStar.Seq.Base.length", "Lib.IntTypes.uint8" ]
[]
false
false
false
true
true
let lbytes (l: nat) =
b: bytes{Seq.length b = l}
false
Hacl.Bignum.AlmostMontExponentiation.fst
Hacl.Bignum.AlmostMontExponentiation.bn_almost_mont_one
val bn_almost_mont_one: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lone_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu)
val bn_almost_mont_one: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lone_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu)
let bn_almost_mont_one #t k n mu ctx oneM = [@inline_let] let len = k.AM.bn.BN.len in let k1 = Ghost.hide (E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (BD.bn_v n) (v mu)) in let ctx_n = sub ctx 0ul len in let ctx_r2 = sub ctx len len in let h0 = ST.get () in BM.bn_mont_one len k.AM.from ctx_n mu ctx_r2 oneM; let h1 = ST.get () in SM.bn_mont_one_lemma n mu (as_seq h0 ctx_r2); assert (BD.bn_v (as_seq h1 oneM) == M.mont_one (bits t) (v len) (BD.bn_v n) (v mu)); assert (BD.bn_v (as_seq h1 oneM) < BD.bn_v n); BD.bn_eval_bound n (v len); assert (linv n (as_seq h1 oneM)); Math.Lemmas.small_mod (BD.bn_v (as_seq h1 oneM)) (BD.bn_v n); assert (BD.bn_v (as_seq h1 oneM) % BD.bn_v n == E.mont_one_ll (bits t) (v len) (BD.bn_v n) (v mu))
{ "file_name": "code/bignum/Hacl.Bignum.AlmostMontExponentiation.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 54, "end_line": 96, "start_col": 0, "start_line": 81 }
module Hacl.Bignum.AlmostMontExponentiation open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer open Hacl.Bignum.Definitions module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module BD = Hacl.Spec.Bignum.Definitions module SN = Hacl.Spec.Bignum module SM = Hacl.Spec.Bignum.Montgomery module SA = Hacl.Spec.Bignum.AlmostMontgomery module BN = Hacl.Bignum module BM = Hacl.Bignum.Montgomery module AM = Hacl.Bignum.AlmostMontgomery module LE = Lib.Exponentiation module BE = Hacl.Impl.Exponentiation module E = Hacl.Spec.Exponentiation.Lemmas module A = Hacl.Spec.AlmostMontgomery.Lemmas module M = Hacl.Spec.Montgomery.Lemmas module ME = Hacl.Spec.Bignum.MontExponentiation module S = Hacl.Spec.Bignum.AlmostMontExponentiation #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let a_spec (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len{0 < BD.bn_v n}) = Lib.NatMod.nat_mod (BD.bn_v n) inline_for_extraction noextract let linv (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len) (a:BD.lbignum t len) : Type0 = BD.bn_v a < pow2 (bits t * len) inline_for_extraction noextract let refl (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len{0 < BD.bn_v n}) (a:BD.lbignum t len{linv n a}) : a_spec n = BD.bn_v a % BD.bn_v n inline_for_extraction noextract let linv_ctx (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len) (ctx:BD.lbignum t (len + len)) : Type0 = let ctx_n = LSeq.sub ctx 0 len in let ctx_r2 = LSeq.sub ctx len len in ctx_n == n /\ 0 < BD.bn_v n /\ BD.bn_v ctx_r2 = pow2 (2 * bits t * len) % BD.bn_v n inline_for_extraction noextract let mk_to_nat_mont_ll_comm_monoid (t:limb_t) (len:BN.meta_len t) (n:BD.lbignum t (v len)) (mu:limb t{SM.bn_mont_pre n mu}) : BE.to_comm_monoid t len (len +! len) = { BE.a_spec = a_spec n; BE.comm_monoid = E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (BD.bn_v n) (v mu); BE.linv_ctx = linv_ctx n; BE.linv = linv n; BE.refl = refl n; } inline_for_extraction noextract val bn_almost_mont_one: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lone_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "Hacl.Spec.Exponentiation.Lemmas.fst.checked", "Hacl.Spec.Bignum.Montgomery.fsti.checked", "Hacl.Spec.Bignum.MontExponentiation.fst.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Spec.Bignum.AlmostMontExponentiation.fst.checked", "Hacl.Spec.Bignum.fsti.checked", "Hacl.Spec.AlmostMontgomery.Lemmas.fst.checked", "Hacl.Impl.Exponentiation.fsti.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.Definitions.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Bignum.AlmostMontExponentiation.fst" }
[ { "abbrev": true, "full_module": "Hacl.Spec.Bignum.AlmostMontExponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.MontExponentiation", "short_module": "ME" }, { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": true, "full_module": "Hacl.Spec.AlmostMontgomery.Lemmas", "short_module": "A" }, { "abbrev": true, "full_module": "Hacl.Spec.Exponentiation.Lemmas", "short_module": "E" }, { "abbrev": true, "full_module": "Hacl.Impl.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.AlmostMontgomery", "short_module": "SA" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Montgomery", "short_module": "SM" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum", "short_module": "SN" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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 } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
k: Hacl.Bignum.AlmostMontgomery.almost_mont t -> n: FStar.Ghost.erased (Hacl.Spec.Bignum.Definitions.lbignum t (Lib.IntTypes.v (Mkbn?.len (Mkalmost_mont?.bn k)))) -> mu: Hacl.Bignum.Definitions.limb t {Hacl.Spec.Bignum.Montgomery.bn_mont_pre (FStar.Ghost.reveal n) mu} -> Hacl.Impl.Exponentiation.Definitions.lone_st t (Mkbn?.len (Mkalmost_mont?.bn k)) (Mkbn?.len (Mkalmost_mont?.bn k) +! Mkbn?.len (Mkalmost_mont?.bn k)) (Hacl.Bignum.AlmostMontExponentiation.mk_to_nat_mont_ll_comm_monoid t (Mkbn?.len (Mkalmost_mont?.bn k)) (FStar.Ghost.reveal n) mu)
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.Definitions.limb_t", "Hacl.Bignum.AlmostMontgomery.almost_mont", "FStar.Ghost.erased", "Hacl.Spec.Bignum.Definitions.lbignum", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Bignum.__proj__Mkbn__item__len", "Hacl.Bignum.AlmostMontgomery.__proj__Mkalmost_mont__item__bn", "Hacl.Bignum.Definitions.limb", "Hacl.Spec.Bignum.Montgomery.bn_mont_pre", "FStar.Ghost.reveal", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint_t", "Lib.IntTypes.SEC", "Lib.IntTypes.op_Plus_Bang", "Prims._assert", "Prims.eq2", "Prims.int", "Prims.op_Modulus", "Hacl.Spec.Bignum.Definitions.bn_v", "Lib.Buffer.as_seq", "Lib.Buffer.MUT", "Hacl.Spec.Exponentiation.Lemmas.mont_one_ll", "Lib.IntTypes.bits", "Prims.unit", "FStar.Math.Lemmas.small_mod", "Hacl.Bignum.AlmostMontExponentiation.linv", "Hacl.Spec.Bignum.Definitions.bn_eval_bound", "Prims.b2t", "Prims.op_LessThan", "Prims.nat", "Hacl.Spec.Montgomery.Lemmas.mont_one", "Hacl.Spec.Bignum.Montgomery.bn_mont_one_lemma", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "Hacl.Bignum.Montgomery.bn_mont_one", "Hacl.Bignum.AlmostMontgomery.__proj__Mkalmost_mont__item__from", "Lib.Buffer.lbuffer_t", "Lib.IntTypes.int_t", "Lib.Buffer.sub", "FStar.UInt32.__uint_to_t", "Lib.Exponentiation.Definition.comm_monoid", "Lib.NatMod.nat_mod", "FStar.Ghost.hide", "Hacl.Spec.Exponentiation.Lemmas.mk_nat_mont_ll_comm_monoid", "Hacl.Bignum.meta_len" ]
[]
false
false
false
false
false
let bn_almost_mont_one #t k n mu ctx oneM =
[@@ inline_let ]let len = k.AM.bn.BN.len in let k1 = Ghost.hide (E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (BD.bn_v n) (v mu)) in let ctx_n = sub ctx 0ul len in let ctx_r2 = sub ctx len len in let h0 = ST.get () in BM.bn_mont_one len k.AM.from ctx_n mu ctx_r2 oneM; let h1 = ST.get () in SM.bn_mont_one_lemma n mu (as_seq h0 ctx_r2); assert (BD.bn_v (as_seq h1 oneM) == M.mont_one (bits t) (v len) (BD.bn_v n) (v mu)); assert (BD.bn_v (as_seq h1 oneM) < BD.bn_v n); BD.bn_eval_bound n (v len); assert (linv n (as_seq h1 oneM)); Math.Lemmas.small_mod (BD.bn_v (as_seq h1 oneM)) (BD.bn_v n); assert (BD.bn_v (as_seq h1 oneM) % BD.bn_v n == E.mont_one_ll (bits t) (v len) (BD.bn_v n) (v mu))
false
Lib.UpdateMulti.Lemmas.fsti
Lib.UpdateMulti.Lemmas.uint8
val uint8 : Type0
let uint8 = Lib.IntTypes.uint8
{ "file_name": "lib/Lib.UpdateMulti.Lemmas.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 30, "end_line": 8, "start_col": 0, "start_line": 8 }
module Lib.UpdateMulti.Lemmas module S = FStar.Seq open Lib.UpdateMulti open FStar.Mul
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Lib.UpdateMulti.Lemmas.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Lib.UpdateMulti", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": false, "full_module": "Lib.UpdateMulti", "short_module": null }, { "abbrev": false, "full_module": "Lib.UpdateMulti", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Type0
Prims.Tot
[ "total" ]
[]
[ "Lib.IntTypes.uint8" ]
[]
false
false
false
true
true
let uint8 =
Lib.IntTypes.uint8
false
Lib.UpdateMulti.Lemmas.fsti
Lib.UpdateMulti.Lemmas.repeat_l
val repeat_l (#a: _) (block_length: pos{block_length < pow2 32}) (update_last: (a -> s: S.seq uint8 {S.length s < block_length} -> a)) (input: S.seq uint8) (l: Lib.IntTypes.size_nat{l < block_length}) (s: Lib.Sequence.lseq uint8 l) (acc: a) : a
val repeat_l (#a: _) (block_length: pos{block_length < pow2 32}) (update_last: (a -> s: S.seq uint8 {S.length s < block_length} -> a)) (input: S.seq uint8) (l: Lib.IntTypes.size_nat{l < block_length}) (s: Lib.Sequence.lseq uint8 l) (acc: a) : a
let repeat_l #a (block_length:pos { block_length < pow2 32 }) (update_last: (a -> s:S.seq uint8 { S.length s < block_length } -> a)) (input:S.seq uint8) (l: Lib.IntTypes.size_nat { l < block_length }) (s: Lib.Sequence.lseq uint8 l) (acc: a): a = update_last acc s
{ "file_name": "lib/Lib.UpdateMulti.Lemmas.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 19, "end_line": 58, "start_col": 0, "start_line": 51 }
module Lib.UpdateMulti.Lemmas module S = FStar.Seq open Lib.UpdateMulti open FStar.Mul let uint8 = Lib.IntTypes.uint8 #set-options "--fuel 0 --ifuel 0" /// This module establishes some equivalence between the update-multi style used /// for specifications in the streaming functor, and the lib-based repeat /// imperative combinators. /// The following lemmas characterize the result of ``split_at_last_lazy`` with /// conditions which are easy to assess, and is very useful when using it in order /// to implement a stream hash, to prove properties about how to update the internal /// buffer so that its content is actually the correct remainder of the data seen /// so far. /// This first auxiliary lemma only manipulates the lengths of the sequences. val split_at_last_lazy_nb_rem_spec (l : pos) (d n rest: nat) : Lemma (requires ( rest <= l /\ (rest = 0 ==> d = 0) /\ d = n * l + rest)) (ensures ((n, rest) = split_at_last_lazy_nb_rem l d)) /// This second lemma characterizes the sequences themselves. val split_at_last_lazy_spec (l : pos) (b blocks rest: S.seq uint8) : Lemma (requires ( S.length blocks % l = 0 /\ S.length rest <= l /\ (S.length rest = 0 ==> S.length b = 0) /\ b `Seq.equal` Seq.append blocks rest)) (ensures ( (blocks, rest) == split_at_last_lazy l b)) /// Some helpers to flip the order of arguments let repeat_f #a (block_length:pos { block_length < pow2 32 }) (update: (a -> s:S.seq uint8 { S.length s = block_length } -> a)) (b: S.seq uint8 { S.length b = block_length }) (acc: a): a = update acc b
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Lib.UpdateMulti.Lemmas.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Lib.UpdateMulti", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": false, "full_module": "Lib.UpdateMulti", "short_module": null }, { "abbrev": false, "full_module": "Lib.UpdateMulti", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
block_length: Prims.pos{block_length < Prims.pow2 32} -> update_last: ( _: a -> s: FStar.Seq.Base.seq Lib.UpdateMulti.Lemmas.uint8 {FStar.Seq.Base.length s < block_length} -> a) -> input: FStar.Seq.Base.seq Lib.UpdateMulti.Lemmas.uint8 -> l: Lib.IntTypes.size_nat{l < block_length} -> s: Lib.Sequence.lseq Lib.UpdateMulti.Lemmas.uint8 l -> acc: a -> a
Prims.Tot
[ "total" ]
[]
[ "Prims.pos", "Prims.b2t", "Prims.op_LessThan", "Prims.pow2", "FStar.Seq.Base.seq", "Lib.UpdateMulti.Lemmas.uint8", "FStar.Seq.Base.length", "Lib.IntTypes.size_nat", "Lib.Sequence.lseq" ]
[]
false
false
false
false
false
let repeat_l #a (block_length: pos{block_length < pow2 32}) (update_last: (a -> s: S.seq uint8 {S.length s < block_length} -> a)) (input: S.seq uint8) (l: Lib.IntTypes.size_nat{l < block_length}) (s: Lib.Sequence.lseq uint8 l) (acc: a) : a =
update_last acc s
false
Lib.UpdateMulti.Lemmas.fsti
Lib.UpdateMulti.Lemmas.repeat_f
val repeat_f (#a: _) (block_length: pos{block_length < pow2 32}) (update: (a -> s: S.seq uint8 {S.length s = block_length} -> a)) (b: S.seq uint8 {S.length b = block_length}) (acc: a) : a
val repeat_f (#a: _) (block_length: pos{block_length < pow2 32}) (update: (a -> s: S.seq uint8 {S.length s = block_length} -> a)) (b: S.seq uint8 {S.length b = block_length}) (acc: a) : a
let repeat_f #a (block_length:pos { block_length < pow2 32 }) (update: (a -> s:S.seq uint8 { S.length s = block_length } -> a)) (b: S.seq uint8 { S.length b = block_length }) (acc: a): a = update acc b
{ "file_name": "lib/Lib.UpdateMulti.Lemmas.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 14, "end_line": 49, "start_col": 0, "start_line": 45 }
module Lib.UpdateMulti.Lemmas module S = FStar.Seq open Lib.UpdateMulti open FStar.Mul let uint8 = Lib.IntTypes.uint8 #set-options "--fuel 0 --ifuel 0" /// This module establishes some equivalence between the update-multi style used /// for specifications in the streaming functor, and the lib-based repeat /// imperative combinators. /// The following lemmas characterize the result of ``split_at_last_lazy`` with /// conditions which are easy to assess, and is very useful when using it in order /// to implement a stream hash, to prove properties about how to update the internal /// buffer so that its content is actually the correct remainder of the data seen /// so far. /// This first auxiliary lemma only manipulates the lengths of the sequences. val split_at_last_lazy_nb_rem_spec (l : pos) (d n rest: nat) : Lemma (requires ( rest <= l /\ (rest = 0 ==> d = 0) /\ d = n * l + rest)) (ensures ((n, rest) = split_at_last_lazy_nb_rem l d)) /// This second lemma characterizes the sequences themselves. val split_at_last_lazy_spec (l : pos) (b blocks rest: S.seq uint8) : Lemma (requires ( S.length blocks % l = 0 /\ S.length rest <= l /\ (S.length rest = 0 ==> S.length b = 0) /\ b `Seq.equal` Seq.append blocks rest)) (ensures ( (blocks, rest) == split_at_last_lazy l b))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Lib.UpdateMulti.Lemmas.fsti" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Lib.UpdateMulti", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": false, "full_module": "Lib.UpdateMulti", "short_module": null }, { "abbrev": false, "full_module": "Lib.UpdateMulti", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
block_length: Prims.pos{block_length < Prims.pow2 32} -> update: ( _: a -> s: FStar.Seq.Base.seq Lib.UpdateMulti.Lemmas.uint8 {FStar.Seq.Base.length s = block_length} -> a) -> b: FStar.Seq.Base.seq Lib.UpdateMulti.Lemmas.uint8 {FStar.Seq.Base.length b = block_length} -> acc: a -> a
Prims.Tot
[ "total" ]
[]
[ "Prims.pos", "Prims.b2t", "Prims.op_LessThan", "Prims.pow2", "FStar.Seq.Base.seq", "Lib.UpdateMulti.Lemmas.uint8", "Prims.op_Equality", "Prims.int", "Prims.l_or", "Prims.op_GreaterThanOrEqual", "Prims.l_and", "Prims.op_GreaterThan", "FStar.Seq.Base.length" ]
[]
false
false
false
false
false
let repeat_f #a (block_length: pos{block_length < pow2 32}) (update: (a -> s: S.seq uint8 {S.length s = block_length} -> a)) (b: S.seq uint8 {S.length b = block_length}) (acc: a) : a =
update acc b
false
Hacl.Bignum.AlmostMontExponentiation.fst
Hacl.Bignum.AlmostMontExponentiation.bn_exp_almost_mont_fw_vartime
val bn_exp_almost_mont_fw_vartime: #t:limb_t -> k:AM.almost_mont t -> l:size_t{0 < v l /\ v l < bits U32 /\ pow2 (v l) * v k.AM.bn.BN.len <= max_size_t} -> bn_exp_almost_mont_st t k.AM.bn.BN.len
val bn_exp_almost_mont_fw_vartime: #t:limb_t -> k:AM.almost_mont t -> l:size_t{0 < v l /\ v l < bits U32 /\ pow2 (v l) * v k.AM.bn.BN.len <= max_size_t} -> bn_exp_almost_mont_st t k.AM.bn.BN.len
let bn_exp_almost_mont_fw_vartime #t k l n mu r2 aM bBits b resM = push_frame (); let h0 = ST.get () in [@inline_let] let len = k.AM.bn.BN.len in let bLen = blocks0 bBits (size (bits t)) in let k1 = Ghost.hide (E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (bn_v h0 n) (v mu)) in let ctx = create (len +! len) (uint #t #SEC 0) in mk_ctx #t len n r2 ctx; BE.lexp_fw_vartime len (len +! len) (mk_bn_almost_mont_concrete_ops t k (as_seq h0 n) mu) l ctx aM bLen bBits b resM; LE.exp_fw_lemma k1 (bn_v h0 aM % bn_v h0 n) (v bBits) (bn_v h0 b) (v l); E.pow_nat_mont_ll_mod_base (bits t) (v len) (bn_v h0 n) (v mu) (bn_v h0 aM) (bn_v h0 b); pop_frame ()
{ "file_name": "code/bignum/Hacl.Bignum.AlmostMontExponentiation.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 14, "end_line": 275, "start_col": 0, "start_line": 263 }
module Hacl.Bignum.AlmostMontExponentiation open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer open Hacl.Bignum.Definitions module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module BD = Hacl.Spec.Bignum.Definitions module SN = Hacl.Spec.Bignum module SM = Hacl.Spec.Bignum.Montgomery module SA = Hacl.Spec.Bignum.AlmostMontgomery module BN = Hacl.Bignum module BM = Hacl.Bignum.Montgomery module AM = Hacl.Bignum.AlmostMontgomery module LE = Lib.Exponentiation module BE = Hacl.Impl.Exponentiation module E = Hacl.Spec.Exponentiation.Lemmas module A = Hacl.Spec.AlmostMontgomery.Lemmas module M = Hacl.Spec.Montgomery.Lemmas module ME = Hacl.Spec.Bignum.MontExponentiation module S = Hacl.Spec.Bignum.AlmostMontExponentiation #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let a_spec (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len{0 < BD.bn_v n}) = Lib.NatMod.nat_mod (BD.bn_v n) inline_for_extraction noextract let linv (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len) (a:BD.lbignum t len) : Type0 = BD.bn_v a < pow2 (bits t * len) inline_for_extraction noextract let refl (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len{0 < BD.bn_v n}) (a:BD.lbignum t len{linv n a}) : a_spec n = BD.bn_v a % BD.bn_v n inline_for_extraction noextract let linv_ctx (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len) (ctx:BD.lbignum t (len + len)) : Type0 = let ctx_n = LSeq.sub ctx 0 len in let ctx_r2 = LSeq.sub ctx len len in ctx_n == n /\ 0 < BD.bn_v n /\ BD.bn_v ctx_r2 = pow2 (2 * bits t * len) % BD.bn_v n inline_for_extraction noextract let mk_to_nat_mont_ll_comm_monoid (t:limb_t) (len:BN.meta_len t) (n:BD.lbignum t (v len)) (mu:limb t{SM.bn_mont_pre n mu}) : BE.to_comm_monoid t len (len +! len) = { BE.a_spec = a_spec n; BE.comm_monoid = E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (BD.bn_v n) (v mu); BE.linv_ctx = linv_ctx n; BE.linv = linv n; BE.refl = refl n; } inline_for_extraction noextract val bn_almost_mont_one: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lone_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu) let bn_almost_mont_one #t k n mu ctx oneM = [@inline_let] let len = k.AM.bn.BN.len in let k1 = Ghost.hide (E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (BD.bn_v n) (v mu)) in let ctx_n = sub ctx 0ul len in let ctx_r2 = sub ctx len len in let h0 = ST.get () in BM.bn_mont_one len k.AM.from ctx_n mu ctx_r2 oneM; let h1 = ST.get () in SM.bn_mont_one_lemma n mu (as_seq h0 ctx_r2); assert (BD.bn_v (as_seq h1 oneM) == M.mont_one (bits t) (v len) (BD.bn_v n) (v mu)); assert (BD.bn_v (as_seq h1 oneM) < BD.bn_v n); BD.bn_eval_bound n (v len); assert (linv n (as_seq h1 oneM)); Math.Lemmas.small_mod (BD.bn_v (as_seq h1 oneM)) (BD.bn_v n); assert (BD.bn_v (as_seq h1 oneM) % BD.bn_v n == E.mont_one_ll (bits t) (v len) (BD.bn_v n) (v mu)) inline_for_extraction noextract val bn_almost_mont_mul: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lmul_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu) let bn_almost_mont_mul #t k n mu ctx aM bM resM = let h0 = ST.get () in SA.bn_almost_mont_mul_lemma n mu (as_seq h0 aM) (as_seq h0 bM); A.almost_mont_mul_is_mont_mul_lemma (bits t) (v k.AM.bn.BN.len) (BD.bn_v n) (v mu) (bn_v h0 aM) (bn_v h0 bM); let ctx_n = sub ctx 0ul k.AM.bn.BN.len in k.AM.mul ctx_n mu aM bM resM inline_for_extraction noextract val bn_almost_mont_sqr: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lsqr_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu) let bn_almost_mont_sqr #t k n mu ctx aM resM = let h0 = ST.get () in SA.bn_almost_mont_sqr_lemma n mu (as_seq h0 aM); SA.bn_almost_mont_mul_lemma n mu (as_seq h0 aM) (as_seq h0 aM); A.almost_mont_mul_is_mont_mul_lemma (bits t) (v k.AM.bn.BN.len) (BD.bn_v n) (v mu) (bn_v h0 aM) (bn_v h0 aM); let ctx_n = sub ctx 0ul k.AM.bn.BN.len in k.AM.sqr ctx_n mu aM resM inline_for_extraction noextract let mk_bn_almost_mont_concrete_ops (t:limb_t) (k:AM.almost_mont t) (n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len))) (mu:limb t{SM.bn_mont_pre n mu}) : BE.concrete_ops t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) = { BE.to = mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu; BE.lone = bn_almost_mont_one k n mu; BE.lmul = bn_almost_mont_mul k n mu; BE.lsqr = bn_almost_mont_sqr k n mu; } /////////////////////////////////////////////////////////////////////// inline_for_extraction noextract val mk_ctx: #t:limb_t -> len:BN.meta_len t -> n:lbignum t len -> r2:lbignum t len -> ctx:lbignum t (len +! len) -> Stack unit (requires fun h -> live h n /\ live h r2 /\ live h ctx /\ disjoint n ctx /\ disjoint r2 ctx /\ 0 < bn_v h n /\ bn_v h r2 == pow2 (2 * bits t * v len) % bn_v h n) (ensures fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\ linv_ctx (as_seq h0 n) (as_seq h1 ctx)) let mk_ctx #t len n r2 ctx = let h0 = ST.get () in update_sub ctx 0ul len n; let h1 = ST.get () in assert (LSeq.sub (as_seq h1 ctx) 0 (v len) == as_seq h0 n); update_sub ctx len len r2; let h2 = ST.get () in LSeq.eq_intro (LSeq.sub (as_seq h2 ctx) 0 (v len)) (LSeq.sub (as_seq h1 ctx) 0 (v len)); assert (LSeq.sub (as_seq h2 ctx) 0 (v len) == as_seq h0 n); assert (LSeq.sub (as_seq h2 ctx) (v len) (v len) == as_seq h0 r2) noextract let bn_exp_almost_mont_pre (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len) (mu:limb t) (r2:BD.lbignum t len) (aM:BD.lbignum t len) (bBits:size_nat) (b:BD.lbignum t (BD.blocks0 bBits (bits t))) = SM.bn_mont_pre n mu /\ BD.bn_v r2 == pow2 (2 * bits t * len) % BD.bn_v n /\ BD.bn_v b < pow2 bBits /\ BD.bn_v aM < BD.bn_v n inline_for_extraction noextract let bn_exp_almost_mont_st (t:limb_t) (len:BN.meta_len t) = n:lbignum t len -> mu:limb t -> r2:lbignum t len -> aM:lbignum t len -> bBits:size_t -> b:lbignum t (blocks0 bBits (size (bits t))) -> resM:lbignum t len -> Stack unit (requires fun h -> live h n /\ live h aM /\ live h b /\ live h resM /\ live h r2 /\ disjoint resM aM /\ disjoint resM b /\ disjoint resM n /\ disjoint n aM /\ disjoint resM r2 /\ disjoint aM r2 /\ disjoint n r2 /\ disjoint aM b /\ bn_exp_almost_mont_pre (as_seq h n) mu (as_seq h r2) (as_seq h aM) (v bBits) (as_seq h b)) (ensures fun h0 _ h1 -> modifies (loc aM |+| loc resM) h0 h1 /\ (let k1 = E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (bn_v h0 n) (v mu) in bn_v h1 resM % bn_v h0 n == LE.pow k1 (bn_v h0 aM) (bn_v h0 b))) // This function is *NOT* constant-time on the exponent b. inline_for_extraction noextract val bn_exp_almost_mont_bm_vartime: #t:limb_t -> k:AM.almost_mont t -> bn_exp_almost_mont_st t k.AM.bn.BN.len let bn_exp_almost_mont_bm_vartime #t k n mu r2 aM bBits b resM = push_frame (); let h0 = ST.get () in [@inline_let] let len = k.AM.bn.BN.len in [@inline_let] let bLen = blocks0 bBits (size (bits t)) in let k1 = Ghost.hide (E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (bn_v h0 n) (v mu)) in let ctx = create (len +! len) (uint #t #SEC 0) in mk_ctx #t len n r2 ctx; BD.bn_eval_bound (as_seq h0 aM) (v len); BE.lexp_rl_vartime len (len +! len) (mk_bn_almost_mont_concrete_ops t k (as_seq h0 n) mu) ctx aM bLen bBits b resM; LE.exp_rl_lemma k1 (bn_v h0 aM % bn_v h0 n) (v bBits) (bn_v h0 b); E.pow_nat_mont_ll_mod_base (bits t) (v len) (bn_v h0 n) (v mu) (bn_v h0 aM) (bn_v h0 b); pop_frame () // This function is constant-time on the exponent b. inline_for_extraction noextract val bn_exp_almost_mont_bm_consttime: #t:limb_t -> k:AM.almost_mont t -> bn_exp_almost_mont_st t k.AM.bn.BN.len let bn_exp_almost_mont_bm_consttime #t k n mu r2 aM bBits b resM = push_frame (); let h0 = ST.get () in [@inline_let] let len = k.AM.bn.BN.len in [@inline_let] let bLen = blocks0 bBits (size (bits t)) in let k1 = Ghost.hide (E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (bn_v h0 n) (v mu)) in let ctx = create (len +! len) (uint #t #SEC 0) in mk_ctx #t len n r2 ctx; BE.lexp_mont_ladder_swap_consttime len (len +! len) (mk_bn_almost_mont_concrete_ops t k (as_seq h0 n) mu) ctx aM bLen bBits b resM; LE.exp_mont_ladder_swap_lemma k1 (bn_v h0 aM % bn_v h0 n) (v bBits) (bn_v h0 b); LE.exp_mont_ladder_lemma k1 (bn_v h0 aM % bn_v h0 n) (v bBits) (bn_v h0 b); E.pow_nat_mont_ll_mod_base (bits t) (v len) (bn_v h0 n) (v mu) (bn_v h0 aM) (bn_v h0 b); pop_frame () // This function is *NOT* constant-time on the exponent b. inline_for_extraction noextract val bn_exp_almost_mont_fw_vartime: #t:limb_t -> k:AM.almost_mont t -> l:size_t{0 < v l /\ v l < bits U32 /\ pow2 (v l) * v k.AM.bn.BN.len <= max_size_t} -> bn_exp_almost_mont_st t k.AM.bn.BN.len
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "Hacl.Spec.Exponentiation.Lemmas.fst.checked", "Hacl.Spec.Bignum.Montgomery.fsti.checked", "Hacl.Spec.Bignum.MontExponentiation.fst.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Spec.Bignum.AlmostMontExponentiation.fst.checked", "Hacl.Spec.Bignum.fsti.checked", "Hacl.Spec.AlmostMontgomery.Lemmas.fst.checked", "Hacl.Impl.Exponentiation.fsti.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.Definitions.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Bignum.AlmostMontExponentiation.fst" }
[ { "abbrev": true, "full_module": "Hacl.Spec.Bignum.AlmostMontExponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.MontExponentiation", "short_module": "ME" }, { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": true, "full_module": "Hacl.Spec.AlmostMontgomery.Lemmas", "short_module": "A" }, { "abbrev": true, "full_module": "Hacl.Spec.Exponentiation.Lemmas", "short_module": "E" }, { "abbrev": true, "full_module": "Hacl.Impl.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.AlmostMontgomery", "short_module": "SA" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Montgomery", "short_module": "SM" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum", "short_module": "SN" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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 } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
k: Hacl.Bignum.AlmostMontgomery.almost_mont t -> l: Lib.IntTypes.size_t { 0 < Lib.IntTypes.v l /\ Lib.IntTypes.v l < Lib.IntTypes.bits Lib.IntTypes.U32 /\ Prims.pow2 (Lib.IntTypes.v l) * Lib.IntTypes.v (Mkbn?.len (Mkalmost_mont?.bn k)) <= Lib.IntTypes.max_size_t } -> Hacl.Bignum.AlmostMontExponentiation.bn_exp_almost_mont_st t (Mkbn?.len (Mkalmost_mont?.bn k))
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.Definitions.limb_t", "Hacl.Bignum.AlmostMontgomery.almost_mont", "Lib.IntTypes.size_t", "Prims.l_and", "Prims.b2t", "Prims.op_LessThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Lib.IntTypes.bits", "Prims.op_LessThanOrEqual", "FStar.Mul.op_Star", "Prims.pow2", "Hacl.Bignum.__proj__Mkbn__item__len", "Hacl.Bignum.AlmostMontgomery.__proj__Mkalmost_mont__item__bn", "Lib.IntTypes.max_size_t", "Hacl.Bignum.Definitions.lbignum", "Hacl.Bignum.Definitions.limb", "Hacl.Bignum.Definitions.blocks0", "Lib.IntTypes.size", "FStar.HyperStack.ST.pop_frame", "Prims.unit", "Hacl.Spec.Exponentiation.Lemmas.pow_nat_mont_ll_mod_base", "Hacl.Bignum.Definitions.bn_v", "Lib.IntTypes.SEC", "Lib.Exponentiation.exp_fw_lemma", "Lib.NatMod.nat_mod", "FStar.Ghost.reveal", "Lib.Exponentiation.Definition.comm_monoid", "Prims.op_Modulus", "Hacl.Impl.Exponentiation.lexp_fw_vartime", "Lib.IntTypes.op_Plus_Bang", "Hacl.Bignum.AlmostMontExponentiation.mk_bn_almost_mont_concrete_ops", "FStar.Ghost.hide", "Hacl.Spec.Bignum.Definitions.lbignum", "Lib.Buffer.as_seq", "Lib.Buffer.MUT", "Hacl.Bignum.AlmostMontExponentiation.mk_ctx", "Lib.Buffer.lbuffer_t", "Lib.IntTypes.add", "Lib.Buffer.create", "Lib.IntTypes.uint", "Lib.Buffer.lbuffer", "FStar.Ghost.erased", "Hacl.Spec.Exponentiation.Lemmas.mk_nat_mont_ll_comm_monoid", "Lib.IntTypes.int_t", "Prims.eq2", "Prims.int", "Prims.l_or", "Lib.IntTypes.range", "Prims.op_GreaterThan", "Prims.op_Subtraction", "Prims.op_Multiply", "Lib.IntTypes.mk_int", "Hacl.Spec.Bignum.Definitions.blocks0", "Hacl.Bignum.meta_len", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "FStar.HyperStack.ST.push_frame" ]
[]
false
false
false
false
false
let bn_exp_almost_mont_fw_vartime #t k l n mu r2 aM bBits b resM =
push_frame (); let h0 = ST.get () in [@@ inline_let ]let len = k.AM.bn.BN.len in let bLen = blocks0 bBits (size (bits t)) in let k1 = Ghost.hide (E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (bn_v h0 n) (v mu)) in let ctx = create (len +! len) (uint #t #SEC 0) in mk_ctx #t len n r2 ctx; BE.lexp_fw_vartime len (len +! len) (mk_bn_almost_mont_concrete_ops t k (as_seq h0 n) mu) l ctx aM bLen bBits b resM; LE.exp_fw_lemma k1 (bn_v h0 aM % bn_v h0 n) (v bBits) (bn_v h0 b) (v l); E.pow_nat_mont_ll_mod_base (bits t) (v len) (bn_v h0 n) (v mu) (bn_v h0 aM) (bn_v h0 b); pop_frame ()
false
Hacl.Bignum.AlmostMontExponentiation.fst
Hacl.Bignum.AlmostMontExponentiation.bn_exp_almost_mont_fw_consttime
val bn_exp_almost_mont_fw_consttime: #t:limb_t -> k:AM.almost_mont t -> l:size_t{0 < v l /\ v l < bits U32 /\ pow2 (v l) * v k.AM.bn.BN.len <= max_size_t} -> bn_exp_almost_mont_st t k.AM.bn.BN.len
val bn_exp_almost_mont_fw_consttime: #t:limb_t -> k:AM.almost_mont t -> l:size_t{0 < v l /\ v l < bits U32 /\ pow2 (v l) * v k.AM.bn.BN.len <= max_size_t} -> bn_exp_almost_mont_st t k.AM.bn.BN.len
let bn_exp_almost_mont_fw_consttime #t k l n mu r2 aM bBits b resM = push_frame (); let h0 = ST.get () in [@inline_let] let len = k.AM.bn.BN.len in let bLen = blocks0 bBits (size (bits t)) in let k1 = Ghost.hide (E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (bn_v h0 n) (v mu)) in let ctx = create (len +! len) (uint #t #SEC 0) in mk_ctx #t len n r2 ctx; BE.lexp_fw_consttime len (len +! len) (mk_bn_almost_mont_concrete_ops t k (as_seq h0 n) mu) l ctx aM bLen bBits b resM; LE.exp_fw_lemma k1 (bn_v h0 aM % bn_v h0 n) (v bBits) (bn_v h0 b) (v l); E.pow_nat_mont_ll_mod_base (bits t) (v len) (bn_v h0 n) (v mu) (bn_v h0 aM) (bn_v h0 b); pop_frame ()
{ "file_name": "code/bignum/Hacl.Bignum.AlmostMontExponentiation.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 14, "end_line": 298, "start_col": 0, "start_line": 286 }
module Hacl.Bignum.AlmostMontExponentiation open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer open Hacl.Bignum.Definitions module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module BD = Hacl.Spec.Bignum.Definitions module SN = Hacl.Spec.Bignum module SM = Hacl.Spec.Bignum.Montgomery module SA = Hacl.Spec.Bignum.AlmostMontgomery module BN = Hacl.Bignum module BM = Hacl.Bignum.Montgomery module AM = Hacl.Bignum.AlmostMontgomery module LE = Lib.Exponentiation module BE = Hacl.Impl.Exponentiation module E = Hacl.Spec.Exponentiation.Lemmas module A = Hacl.Spec.AlmostMontgomery.Lemmas module M = Hacl.Spec.Montgomery.Lemmas module ME = Hacl.Spec.Bignum.MontExponentiation module S = Hacl.Spec.Bignum.AlmostMontExponentiation #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let a_spec (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len{0 < BD.bn_v n}) = Lib.NatMod.nat_mod (BD.bn_v n) inline_for_extraction noextract let linv (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len) (a:BD.lbignum t len) : Type0 = BD.bn_v a < pow2 (bits t * len) inline_for_extraction noextract let refl (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len{0 < BD.bn_v n}) (a:BD.lbignum t len{linv n a}) : a_spec n = BD.bn_v a % BD.bn_v n inline_for_extraction noextract let linv_ctx (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len) (ctx:BD.lbignum t (len + len)) : Type0 = let ctx_n = LSeq.sub ctx 0 len in let ctx_r2 = LSeq.sub ctx len len in ctx_n == n /\ 0 < BD.bn_v n /\ BD.bn_v ctx_r2 = pow2 (2 * bits t * len) % BD.bn_v n inline_for_extraction noextract let mk_to_nat_mont_ll_comm_monoid (t:limb_t) (len:BN.meta_len t) (n:BD.lbignum t (v len)) (mu:limb t{SM.bn_mont_pre n mu}) : BE.to_comm_monoid t len (len +! len) = { BE.a_spec = a_spec n; BE.comm_monoid = E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (BD.bn_v n) (v mu); BE.linv_ctx = linv_ctx n; BE.linv = linv n; BE.refl = refl n; } inline_for_extraction noextract val bn_almost_mont_one: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lone_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu) let bn_almost_mont_one #t k n mu ctx oneM = [@inline_let] let len = k.AM.bn.BN.len in let k1 = Ghost.hide (E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (BD.bn_v n) (v mu)) in let ctx_n = sub ctx 0ul len in let ctx_r2 = sub ctx len len in let h0 = ST.get () in BM.bn_mont_one len k.AM.from ctx_n mu ctx_r2 oneM; let h1 = ST.get () in SM.bn_mont_one_lemma n mu (as_seq h0 ctx_r2); assert (BD.bn_v (as_seq h1 oneM) == M.mont_one (bits t) (v len) (BD.bn_v n) (v mu)); assert (BD.bn_v (as_seq h1 oneM) < BD.bn_v n); BD.bn_eval_bound n (v len); assert (linv n (as_seq h1 oneM)); Math.Lemmas.small_mod (BD.bn_v (as_seq h1 oneM)) (BD.bn_v n); assert (BD.bn_v (as_seq h1 oneM) % BD.bn_v n == E.mont_one_ll (bits t) (v len) (BD.bn_v n) (v mu)) inline_for_extraction noextract val bn_almost_mont_mul: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lmul_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu) let bn_almost_mont_mul #t k n mu ctx aM bM resM = let h0 = ST.get () in SA.bn_almost_mont_mul_lemma n mu (as_seq h0 aM) (as_seq h0 bM); A.almost_mont_mul_is_mont_mul_lemma (bits t) (v k.AM.bn.BN.len) (BD.bn_v n) (v mu) (bn_v h0 aM) (bn_v h0 bM); let ctx_n = sub ctx 0ul k.AM.bn.BN.len in k.AM.mul ctx_n mu aM bM resM inline_for_extraction noextract val bn_almost_mont_sqr: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lsqr_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu) let bn_almost_mont_sqr #t k n mu ctx aM resM = let h0 = ST.get () in SA.bn_almost_mont_sqr_lemma n mu (as_seq h0 aM); SA.bn_almost_mont_mul_lemma n mu (as_seq h0 aM) (as_seq h0 aM); A.almost_mont_mul_is_mont_mul_lemma (bits t) (v k.AM.bn.BN.len) (BD.bn_v n) (v mu) (bn_v h0 aM) (bn_v h0 aM); let ctx_n = sub ctx 0ul k.AM.bn.BN.len in k.AM.sqr ctx_n mu aM resM inline_for_extraction noextract let mk_bn_almost_mont_concrete_ops (t:limb_t) (k:AM.almost_mont t) (n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len))) (mu:limb t{SM.bn_mont_pre n mu}) : BE.concrete_ops t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) = { BE.to = mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu; BE.lone = bn_almost_mont_one k n mu; BE.lmul = bn_almost_mont_mul k n mu; BE.lsqr = bn_almost_mont_sqr k n mu; } /////////////////////////////////////////////////////////////////////// inline_for_extraction noextract val mk_ctx: #t:limb_t -> len:BN.meta_len t -> n:lbignum t len -> r2:lbignum t len -> ctx:lbignum t (len +! len) -> Stack unit (requires fun h -> live h n /\ live h r2 /\ live h ctx /\ disjoint n ctx /\ disjoint r2 ctx /\ 0 < bn_v h n /\ bn_v h r2 == pow2 (2 * bits t * v len) % bn_v h n) (ensures fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\ linv_ctx (as_seq h0 n) (as_seq h1 ctx)) let mk_ctx #t len n r2 ctx = let h0 = ST.get () in update_sub ctx 0ul len n; let h1 = ST.get () in assert (LSeq.sub (as_seq h1 ctx) 0 (v len) == as_seq h0 n); update_sub ctx len len r2; let h2 = ST.get () in LSeq.eq_intro (LSeq.sub (as_seq h2 ctx) 0 (v len)) (LSeq.sub (as_seq h1 ctx) 0 (v len)); assert (LSeq.sub (as_seq h2 ctx) 0 (v len) == as_seq h0 n); assert (LSeq.sub (as_seq h2 ctx) (v len) (v len) == as_seq h0 r2) noextract let bn_exp_almost_mont_pre (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len) (mu:limb t) (r2:BD.lbignum t len) (aM:BD.lbignum t len) (bBits:size_nat) (b:BD.lbignum t (BD.blocks0 bBits (bits t))) = SM.bn_mont_pre n mu /\ BD.bn_v r2 == pow2 (2 * bits t * len) % BD.bn_v n /\ BD.bn_v b < pow2 bBits /\ BD.bn_v aM < BD.bn_v n inline_for_extraction noextract let bn_exp_almost_mont_st (t:limb_t) (len:BN.meta_len t) = n:lbignum t len -> mu:limb t -> r2:lbignum t len -> aM:lbignum t len -> bBits:size_t -> b:lbignum t (blocks0 bBits (size (bits t))) -> resM:lbignum t len -> Stack unit (requires fun h -> live h n /\ live h aM /\ live h b /\ live h resM /\ live h r2 /\ disjoint resM aM /\ disjoint resM b /\ disjoint resM n /\ disjoint n aM /\ disjoint resM r2 /\ disjoint aM r2 /\ disjoint n r2 /\ disjoint aM b /\ bn_exp_almost_mont_pre (as_seq h n) mu (as_seq h r2) (as_seq h aM) (v bBits) (as_seq h b)) (ensures fun h0 _ h1 -> modifies (loc aM |+| loc resM) h0 h1 /\ (let k1 = E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (bn_v h0 n) (v mu) in bn_v h1 resM % bn_v h0 n == LE.pow k1 (bn_v h0 aM) (bn_v h0 b))) // This function is *NOT* constant-time on the exponent b. inline_for_extraction noextract val bn_exp_almost_mont_bm_vartime: #t:limb_t -> k:AM.almost_mont t -> bn_exp_almost_mont_st t k.AM.bn.BN.len let bn_exp_almost_mont_bm_vartime #t k n mu r2 aM bBits b resM = push_frame (); let h0 = ST.get () in [@inline_let] let len = k.AM.bn.BN.len in [@inline_let] let bLen = blocks0 bBits (size (bits t)) in let k1 = Ghost.hide (E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (bn_v h0 n) (v mu)) in let ctx = create (len +! len) (uint #t #SEC 0) in mk_ctx #t len n r2 ctx; BD.bn_eval_bound (as_seq h0 aM) (v len); BE.lexp_rl_vartime len (len +! len) (mk_bn_almost_mont_concrete_ops t k (as_seq h0 n) mu) ctx aM bLen bBits b resM; LE.exp_rl_lemma k1 (bn_v h0 aM % bn_v h0 n) (v bBits) (bn_v h0 b); E.pow_nat_mont_ll_mod_base (bits t) (v len) (bn_v h0 n) (v mu) (bn_v h0 aM) (bn_v h0 b); pop_frame () // This function is constant-time on the exponent b. inline_for_extraction noextract val bn_exp_almost_mont_bm_consttime: #t:limb_t -> k:AM.almost_mont t -> bn_exp_almost_mont_st t k.AM.bn.BN.len let bn_exp_almost_mont_bm_consttime #t k n mu r2 aM bBits b resM = push_frame (); let h0 = ST.get () in [@inline_let] let len = k.AM.bn.BN.len in [@inline_let] let bLen = blocks0 bBits (size (bits t)) in let k1 = Ghost.hide (E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (bn_v h0 n) (v mu)) in let ctx = create (len +! len) (uint #t #SEC 0) in mk_ctx #t len n r2 ctx; BE.lexp_mont_ladder_swap_consttime len (len +! len) (mk_bn_almost_mont_concrete_ops t k (as_seq h0 n) mu) ctx aM bLen bBits b resM; LE.exp_mont_ladder_swap_lemma k1 (bn_v h0 aM % bn_v h0 n) (v bBits) (bn_v h0 b); LE.exp_mont_ladder_lemma k1 (bn_v h0 aM % bn_v h0 n) (v bBits) (bn_v h0 b); E.pow_nat_mont_ll_mod_base (bits t) (v len) (bn_v h0 n) (v mu) (bn_v h0 aM) (bn_v h0 b); pop_frame () // This function is *NOT* constant-time on the exponent b. inline_for_extraction noextract val bn_exp_almost_mont_fw_vartime: #t:limb_t -> k:AM.almost_mont t -> l:size_t{0 < v l /\ v l < bits U32 /\ pow2 (v l) * v k.AM.bn.BN.len <= max_size_t} -> bn_exp_almost_mont_st t k.AM.bn.BN.len let bn_exp_almost_mont_fw_vartime #t k l n mu r2 aM bBits b resM = push_frame (); let h0 = ST.get () in [@inline_let] let len = k.AM.bn.BN.len in let bLen = blocks0 bBits (size (bits t)) in let k1 = Ghost.hide (E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (bn_v h0 n) (v mu)) in let ctx = create (len +! len) (uint #t #SEC 0) in mk_ctx #t len n r2 ctx; BE.lexp_fw_vartime len (len +! len) (mk_bn_almost_mont_concrete_ops t k (as_seq h0 n) mu) l ctx aM bLen bBits b resM; LE.exp_fw_lemma k1 (bn_v h0 aM % bn_v h0 n) (v bBits) (bn_v h0 b) (v l); E.pow_nat_mont_ll_mod_base (bits t) (v len) (bn_v h0 n) (v mu) (bn_v h0 aM) (bn_v h0 b); pop_frame () // This function is constant-time on the exponent b. inline_for_extraction noextract val bn_exp_almost_mont_fw_consttime: #t:limb_t -> k:AM.almost_mont t -> l:size_t{0 < v l /\ v l < bits U32 /\ pow2 (v l) * v k.AM.bn.BN.len <= max_size_t} -> bn_exp_almost_mont_st t k.AM.bn.BN.len
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "Hacl.Spec.Exponentiation.Lemmas.fst.checked", "Hacl.Spec.Bignum.Montgomery.fsti.checked", "Hacl.Spec.Bignum.MontExponentiation.fst.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Spec.Bignum.AlmostMontExponentiation.fst.checked", "Hacl.Spec.Bignum.fsti.checked", "Hacl.Spec.AlmostMontgomery.Lemmas.fst.checked", "Hacl.Impl.Exponentiation.fsti.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.Definitions.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Bignum.AlmostMontExponentiation.fst" }
[ { "abbrev": true, "full_module": "Hacl.Spec.Bignum.AlmostMontExponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.MontExponentiation", "short_module": "ME" }, { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": true, "full_module": "Hacl.Spec.AlmostMontgomery.Lemmas", "short_module": "A" }, { "abbrev": true, "full_module": "Hacl.Spec.Exponentiation.Lemmas", "short_module": "E" }, { "abbrev": true, "full_module": "Hacl.Impl.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.AlmostMontgomery", "short_module": "SA" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Montgomery", "short_module": "SM" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum", "short_module": "SN" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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 } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
k: Hacl.Bignum.AlmostMontgomery.almost_mont t -> l: Lib.IntTypes.size_t { 0 < Lib.IntTypes.v l /\ Lib.IntTypes.v l < Lib.IntTypes.bits Lib.IntTypes.U32 /\ Prims.pow2 (Lib.IntTypes.v l) * Lib.IntTypes.v (Mkbn?.len (Mkalmost_mont?.bn k)) <= Lib.IntTypes.max_size_t } -> Hacl.Bignum.AlmostMontExponentiation.bn_exp_almost_mont_st t (Mkbn?.len (Mkalmost_mont?.bn k))
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.Definitions.limb_t", "Hacl.Bignum.AlmostMontgomery.almost_mont", "Lib.IntTypes.size_t", "Prims.l_and", "Prims.b2t", "Prims.op_LessThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Lib.IntTypes.bits", "Prims.op_LessThanOrEqual", "FStar.Mul.op_Star", "Prims.pow2", "Hacl.Bignum.__proj__Mkbn__item__len", "Hacl.Bignum.AlmostMontgomery.__proj__Mkalmost_mont__item__bn", "Lib.IntTypes.max_size_t", "Hacl.Bignum.Definitions.lbignum", "Hacl.Bignum.Definitions.limb", "Hacl.Bignum.Definitions.blocks0", "Lib.IntTypes.size", "FStar.HyperStack.ST.pop_frame", "Prims.unit", "Hacl.Spec.Exponentiation.Lemmas.pow_nat_mont_ll_mod_base", "Hacl.Bignum.Definitions.bn_v", "Lib.IntTypes.SEC", "Lib.Exponentiation.exp_fw_lemma", "Lib.NatMod.nat_mod", "FStar.Ghost.reveal", "Lib.Exponentiation.Definition.comm_monoid", "Prims.op_Modulus", "Hacl.Impl.Exponentiation.lexp_fw_consttime", "Lib.IntTypes.op_Plus_Bang", "Hacl.Bignum.AlmostMontExponentiation.mk_bn_almost_mont_concrete_ops", "FStar.Ghost.hide", "Hacl.Spec.Bignum.Definitions.lbignum", "Lib.Buffer.as_seq", "Lib.Buffer.MUT", "Hacl.Bignum.AlmostMontExponentiation.mk_ctx", "Lib.Buffer.lbuffer_t", "Lib.IntTypes.add", "Lib.Buffer.create", "Lib.IntTypes.uint", "Lib.Buffer.lbuffer", "FStar.Ghost.erased", "Hacl.Spec.Exponentiation.Lemmas.mk_nat_mont_ll_comm_monoid", "Lib.IntTypes.int_t", "Prims.eq2", "Prims.int", "Prims.l_or", "Lib.IntTypes.range", "Prims.op_GreaterThan", "Prims.op_Subtraction", "Prims.op_Multiply", "Lib.IntTypes.mk_int", "Hacl.Spec.Bignum.Definitions.blocks0", "Hacl.Bignum.meta_len", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "FStar.HyperStack.ST.push_frame" ]
[]
false
false
false
false
false
let bn_exp_almost_mont_fw_consttime #t k l n mu r2 aM bBits b resM =
push_frame (); let h0 = ST.get () in [@@ inline_let ]let len = k.AM.bn.BN.len in let bLen = blocks0 bBits (size (bits t)) in let k1 = Ghost.hide (E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (bn_v h0 n) (v mu)) in let ctx = create (len +! len) (uint #t #SEC 0) in mk_ctx #t len n r2 ctx; BE.lexp_fw_consttime len (len +! len) (mk_bn_almost_mont_concrete_ops t k (as_seq h0 n) mu) l ctx aM bLen bBits b resM; LE.exp_fw_lemma k1 (bn_v h0 aM % bn_v h0 n) (v bBits) (bn_v h0 b) (v l); E.pow_nat_mont_ll_mod_base (bits t) (v len) (bn_v h0 n) (v mu) (bn_v h0 aM) (bn_v h0 b); pop_frame ()
false
Hacl.Bignum.AlmostMontExponentiation.fst
Hacl.Bignum.AlmostMontExponentiation.bn_exp_almost_mont_bm_consttime
val bn_exp_almost_mont_bm_consttime: #t:limb_t -> k:AM.almost_mont t -> bn_exp_almost_mont_st t k.AM.bn.BN.len
val bn_exp_almost_mont_bm_consttime: #t:limb_t -> k:AM.almost_mont t -> bn_exp_almost_mont_st t k.AM.bn.BN.len
let bn_exp_almost_mont_bm_consttime #t k n mu r2 aM bBits b resM = push_frame (); let h0 = ST.get () in [@inline_let] let len = k.AM.bn.BN.len in [@inline_let] let bLen = blocks0 bBits (size (bits t)) in let k1 = Ghost.hide (E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (bn_v h0 n) (v mu)) in let ctx = create (len +! len) (uint #t #SEC 0) in mk_ctx #t len n r2 ctx; BE.lexp_mont_ladder_swap_consttime len (len +! len) (mk_bn_almost_mont_concrete_ops t k (as_seq h0 n) mu) ctx aM bLen bBits b resM; LE.exp_mont_ladder_swap_lemma k1 (bn_v h0 aM % bn_v h0 n) (v bBits) (bn_v h0 b); LE.exp_mont_ladder_lemma k1 (bn_v h0 aM % bn_v h0 n) (v bBits) (bn_v h0 b); E.pow_nat_mont_ll_mod_base (bits t) (v len) (bn_v h0 n) (v mu) (bn_v h0 aM) (bn_v h0 b); pop_frame ()
{ "file_name": "code/bignum/Hacl.Bignum.AlmostMontExponentiation.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 14, "end_line": 252, "start_col": 0, "start_line": 239 }
module Hacl.Bignum.AlmostMontExponentiation open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer open Hacl.Bignum.Definitions module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module BD = Hacl.Spec.Bignum.Definitions module SN = Hacl.Spec.Bignum module SM = Hacl.Spec.Bignum.Montgomery module SA = Hacl.Spec.Bignum.AlmostMontgomery module BN = Hacl.Bignum module BM = Hacl.Bignum.Montgomery module AM = Hacl.Bignum.AlmostMontgomery module LE = Lib.Exponentiation module BE = Hacl.Impl.Exponentiation module E = Hacl.Spec.Exponentiation.Lemmas module A = Hacl.Spec.AlmostMontgomery.Lemmas module M = Hacl.Spec.Montgomery.Lemmas module ME = Hacl.Spec.Bignum.MontExponentiation module S = Hacl.Spec.Bignum.AlmostMontExponentiation #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let a_spec (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len{0 < BD.bn_v n}) = Lib.NatMod.nat_mod (BD.bn_v n) inline_for_extraction noextract let linv (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len) (a:BD.lbignum t len) : Type0 = BD.bn_v a < pow2 (bits t * len) inline_for_extraction noextract let refl (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len{0 < BD.bn_v n}) (a:BD.lbignum t len{linv n a}) : a_spec n = BD.bn_v a % BD.bn_v n inline_for_extraction noextract let linv_ctx (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len) (ctx:BD.lbignum t (len + len)) : Type0 = let ctx_n = LSeq.sub ctx 0 len in let ctx_r2 = LSeq.sub ctx len len in ctx_n == n /\ 0 < BD.bn_v n /\ BD.bn_v ctx_r2 = pow2 (2 * bits t * len) % BD.bn_v n inline_for_extraction noextract let mk_to_nat_mont_ll_comm_monoid (t:limb_t) (len:BN.meta_len t) (n:BD.lbignum t (v len)) (mu:limb t{SM.bn_mont_pre n mu}) : BE.to_comm_monoid t len (len +! len) = { BE.a_spec = a_spec n; BE.comm_monoid = E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (BD.bn_v n) (v mu); BE.linv_ctx = linv_ctx n; BE.linv = linv n; BE.refl = refl n; } inline_for_extraction noextract val bn_almost_mont_one: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lone_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu) let bn_almost_mont_one #t k n mu ctx oneM = [@inline_let] let len = k.AM.bn.BN.len in let k1 = Ghost.hide (E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (BD.bn_v n) (v mu)) in let ctx_n = sub ctx 0ul len in let ctx_r2 = sub ctx len len in let h0 = ST.get () in BM.bn_mont_one len k.AM.from ctx_n mu ctx_r2 oneM; let h1 = ST.get () in SM.bn_mont_one_lemma n mu (as_seq h0 ctx_r2); assert (BD.bn_v (as_seq h1 oneM) == M.mont_one (bits t) (v len) (BD.bn_v n) (v mu)); assert (BD.bn_v (as_seq h1 oneM) < BD.bn_v n); BD.bn_eval_bound n (v len); assert (linv n (as_seq h1 oneM)); Math.Lemmas.small_mod (BD.bn_v (as_seq h1 oneM)) (BD.bn_v n); assert (BD.bn_v (as_seq h1 oneM) % BD.bn_v n == E.mont_one_ll (bits t) (v len) (BD.bn_v n) (v mu)) inline_for_extraction noextract val bn_almost_mont_mul: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lmul_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu) let bn_almost_mont_mul #t k n mu ctx aM bM resM = let h0 = ST.get () in SA.bn_almost_mont_mul_lemma n mu (as_seq h0 aM) (as_seq h0 bM); A.almost_mont_mul_is_mont_mul_lemma (bits t) (v k.AM.bn.BN.len) (BD.bn_v n) (v mu) (bn_v h0 aM) (bn_v h0 bM); let ctx_n = sub ctx 0ul k.AM.bn.BN.len in k.AM.mul ctx_n mu aM bM resM inline_for_extraction noextract val bn_almost_mont_sqr: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lsqr_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu) let bn_almost_mont_sqr #t k n mu ctx aM resM = let h0 = ST.get () in SA.bn_almost_mont_sqr_lemma n mu (as_seq h0 aM); SA.bn_almost_mont_mul_lemma n mu (as_seq h0 aM) (as_seq h0 aM); A.almost_mont_mul_is_mont_mul_lemma (bits t) (v k.AM.bn.BN.len) (BD.bn_v n) (v mu) (bn_v h0 aM) (bn_v h0 aM); let ctx_n = sub ctx 0ul k.AM.bn.BN.len in k.AM.sqr ctx_n mu aM resM inline_for_extraction noextract let mk_bn_almost_mont_concrete_ops (t:limb_t) (k:AM.almost_mont t) (n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len))) (mu:limb t{SM.bn_mont_pre n mu}) : BE.concrete_ops t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) = { BE.to = mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu; BE.lone = bn_almost_mont_one k n mu; BE.lmul = bn_almost_mont_mul k n mu; BE.lsqr = bn_almost_mont_sqr k n mu; } /////////////////////////////////////////////////////////////////////// inline_for_extraction noextract val mk_ctx: #t:limb_t -> len:BN.meta_len t -> n:lbignum t len -> r2:lbignum t len -> ctx:lbignum t (len +! len) -> Stack unit (requires fun h -> live h n /\ live h r2 /\ live h ctx /\ disjoint n ctx /\ disjoint r2 ctx /\ 0 < bn_v h n /\ bn_v h r2 == pow2 (2 * bits t * v len) % bn_v h n) (ensures fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\ linv_ctx (as_seq h0 n) (as_seq h1 ctx)) let mk_ctx #t len n r2 ctx = let h0 = ST.get () in update_sub ctx 0ul len n; let h1 = ST.get () in assert (LSeq.sub (as_seq h1 ctx) 0 (v len) == as_seq h0 n); update_sub ctx len len r2; let h2 = ST.get () in LSeq.eq_intro (LSeq.sub (as_seq h2 ctx) 0 (v len)) (LSeq.sub (as_seq h1 ctx) 0 (v len)); assert (LSeq.sub (as_seq h2 ctx) 0 (v len) == as_seq h0 n); assert (LSeq.sub (as_seq h2 ctx) (v len) (v len) == as_seq h0 r2) noextract let bn_exp_almost_mont_pre (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len) (mu:limb t) (r2:BD.lbignum t len) (aM:BD.lbignum t len) (bBits:size_nat) (b:BD.lbignum t (BD.blocks0 bBits (bits t))) = SM.bn_mont_pre n mu /\ BD.bn_v r2 == pow2 (2 * bits t * len) % BD.bn_v n /\ BD.bn_v b < pow2 bBits /\ BD.bn_v aM < BD.bn_v n inline_for_extraction noextract let bn_exp_almost_mont_st (t:limb_t) (len:BN.meta_len t) = n:lbignum t len -> mu:limb t -> r2:lbignum t len -> aM:lbignum t len -> bBits:size_t -> b:lbignum t (blocks0 bBits (size (bits t))) -> resM:lbignum t len -> Stack unit (requires fun h -> live h n /\ live h aM /\ live h b /\ live h resM /\ live h r2 /\ disjoint resM aM /\ disjoint resM b /\ disjoint resM n /\ disjoint n aM /\ disjoint resM r2 /\ disjoint aM r2 /\ disjoint n r2 /\ disjoint aM b /\ bn_exp_almost_mont_pre (as_seq h n) mu (as_seq h r2) (as_seq h aM) (v bBits) (as_seq h b)) (ensures fun h0 _ h1 -> modifies (loc aM |+| loc resM) h0 h1 /\ (let k1 = E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (bn_v h0 n) (v mu) in bn_v h1 resM % bn_v h0 n == LE.pow k1 (bn_v h0 aM) (bn_v h0 b))) // This function is *NOT* constant-time on the exponent b. inline_for_extraction noextract val bn_exp_almost_mont_bm_vartime: #t:limb_t -> k:AM.almost_mont t -> bn_exp_almost_mont_st t k.AM.bn.BN.len let bn_exp_almost_mont_bm_vartime #t k n mu r2 aM bBits b resM = push_frame (); let h0 = ST.get () in [@inline_let] let len = k.AM.bn.BN.len in [@inline_let] let bLen = blocks0 bBits (size (bits t)) in let k1 = Ghost.hide (E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (bn_v h0 n) (v mu)) in let ctx = create (len +! len) (uint #t #SEC 0) in mk_ctx #t len n r2 ctx; BD.bn_eval_bound (as_seq h0 aM) (v len); BE.lexp_rl_vartime len (len +! len) (mk_bn_almost_mont_concrete_ops t k (as_seq h0 n) mu) ctx aM bLen bBits b resM; LE.exp_rl_lemma k1 (bn_v h0 aM % bn_v h0 n) (v bBits) (bn_v h0 b); E.pow_nat_mont_ll_mod_base (bits t) (v len) (bn_v h0 n) (v mu) (bn_v h0 aM) (bn_v h0 b); pop_frame () // This function is constant-time on the exponent b. inline_for_extraction noextract
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "Hacl.Spec.Exponentiation.Lemmas.fst.checked", "Hacl.Spec.Bignum.Montgomery.fsti.checked", "Hacl.Spec.Bignum.MontExponentiation.fst.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Spec.Bignum.AlmostMontExponentiation.fst.checked", "Hacl.Spec.Bignum.fsti.checked", "Hacl.Spec.AlmostMontgomery.Lemmas.fst.checked", "Hacl.Impl.Exponentiation.fsti.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.Definitions.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Bignum.AlmostMontExponentiation.fst" }
[ { "abbrev": true, "full_module": "Hacl.Spec.Bignum.AlmostMontExponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.MontExponentiation", "short_module": "ME" }, { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": true, "full_module": "Hacl.Spec.AlmostMontgomery.Lemmas", "short_module": "A" }, { "abbrev": true, "full_module": "Hacl.Spec.Exponentiation.Lemmas", "short_module": "E" }, { "abbrev": true, "full_module": "Hacl.Impl.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.AlmostMontgomery", "short_module": "SA" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Montgomery", "short_module": "SM" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum", "short_module": "SN" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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 } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
k: Hacl.Bignum.AlmostMontgomery.almost_mont t -> Hacl.Bignum.AlmostMontExponentiation.bn_exp_almost_mont_st t (Mkbn?.len (Mkalmost_mont?.bn k))
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.Definitions.limb_t", "Hacl.Bignum.AlmostMontgomery.almost_mont", "Hacl.Bignum.Definitions.lbignum", "Hacl.Bignum.__proj__Mkbn__item__len", "Hacl.Bignum.AlmostMontgomery.__proj__Mkalmost_mont__item__bn", "Hacl.Bignum.Definitions.limb", "Lib.IntTypes.size_t", "Hacl.Bignum.Definitions.blocks0", "Lib.IntTypes.size", "Lib.IntTypes.bits", "FStar.HyperStack.ST.pop_frame", "Prims.unit", "Hacl.Spec.Exponentiation.Lemmas.pow_nat_mont_ll_mod_base", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Bignum.Definitions.bn_v", "Lib.IntTypes.SEC", "Lib.Exponentiation.exp_mont_ladder_lemma", "Lib.NatMod.nat_mod", "FStar.Ghost.reveal", "Lib.Exponentiation.Definition.comm_monoid", "Prims.op_Modulus", "Lib.Exponentiation.exp_mont_ladder_swap_lemma", "Hacl.Impl.Exponentiation.lexp_mont_ladder_swap_consttime", "Lib.IntTypes.op_Plus_Bang", "Hacl.Bignum.AlmostMontExponentiation.mk_bn_almost_mont_concrete_ops", "FStar.Ghost.hide", "Hacl.Spec.Bignum.Definitions.lbignum", "Lib.Buffer.as_seq", "Lib.Buffer.MUT", "Hacl.Bignum.AlmostMontExponentiation.mk_ctx", "Lib.Buffer.lbuffer_t", "Lib.IntTypes.add", "Lib.Buffer.create", "Lib.IntTypes.uint", "Lib.Buffer.lbuffer", "FStar.Ghost.erased", "Hacl.Spec.Exponentiation.Lemmas.mk_nat_mont_ll_comm_monoid", "Lib.IntTypes.int_t", "Prims.eq2", "Prims.int", "Prims.l_or", "Lib.IntTypes.range", "Prims.l_and", "Prims.b2t", "Prims.op_GreaterThan", "Prims.op_LessThanOrEqual", "Prims.op_Subtraction", "Prims.pow2", "Prims.op_Multiply", "Lib.IntTypes.mk_int", "Hacl.Spec.Bignum.Definitions.blocks0", "Hacl.Bignum.meta_len", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "FStar.HyperStack.ST.push_frame" ]
[]
false
false
false
false
false
let bn_exp_almost_mont_bm_consttime #t k n mu r2 aM bBits b resM =
push_frame (); let h0 = ST.get () in [@@ inline_let ]let len = k.AM.bn.BN.len in [@@ inline_let ]let bLen = blocks0 bBits (size (bits t)) in let k1 = Ghost.hide (E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (bn_v h0 n) (v mu)) in let ctx = create (len +! len) (uint #t #SEC 0) in mk_ctx #t len n r2 ctx; BE.lexp_mont_ladder_swap_consttime len (len +! len) (mk_bn_almost_mont_concrete_ops t k (as_seq h0 n) mu) ctx aM bLen bBits b resM; LE.exp_mont_ladder_swap_lemma k1 (bn_v h0 aM % bn_v h0 n) (v bBits) (bn_v h0 b); LE.exp_mont_ladder_lemma k1 (bn_v h0 aM % bn_v h0 n) (v bBits) (bn_v h0 b); E.pow_nat_mont_ll_mod_base (bits t) (v len) (bn_v h0 n) (v mu) (bn_v h0 aM) (bn_v h0 b); pop_frame ()
false
Hacl.Bignum.AlmostMontExponentiation.fst
Hacl.Bignum.AlmostMontExponentiation.bn_exp_almost_mont_bm_vartime
val bn_exp_almost_mont_bm_vartime: #t:limb_t -> k:AM.almost_mont t -> bn_exp_almost_mont_st t k.AM.bn.BN.len
val bn_exp_almost_mont_bm_vartime: #t:limb_t -> k:AM.almost_mont t -> bn_exp_almost_mont_st t k.AM.bn.BN.len
let bn_exp_almost_mont_bm_vartime #t k n mu r2 aM bBits b resM = push_frame (); let h0 = ST.get () in [@inline_let] let len = k.AM.bn.BN.len in [@inline_let] let bLen = blocks0 bBits (size (bits t)) in let k1 = Ghost.hide (E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (bn_v h0 n) (v mu)) in let ctx = create (len +! len) (uint #t #SEC 0) in mk_ctx #t len n r2 ctx; BD.bn_eval_bound (as_seq h0 aM) (v len); BE.lexp_rl_vartime len (len +! len) (mk_bn_almost_mont_concrete_ops t k (as_seq h0 n) mu) ctx aM bLen bBits b resM; LE.exp_rl_lemma k1 (bn_v h0 aM % bn_v h0 n) (v bBits) (bn_v h0 b); E.pow_nat_mont_ll_mod_base (bits t) (v len) (bn_v h0 n) (v mu) (bn_v h0 aM) (bn_v h0 b); pop_frame ()
{ "file_name": "code/bignum/Hacl.Bignum.AlmostMontExponentiation.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 14, "end_line": 233, "start_col": 0, "start_line": 220 }
module Hacl.Bignum.AlmostMontExponentiation open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer open Hacl.Bignum.Definitions module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module BD = Hacl.Spec.Bignum.Definitions module SN = Hacl.Spec.Bignum module SM = Hacl.Spec.Bignum.Montgomery module SA = Hacl.Spec.Bignum.AlmostMontgomery module BN = Hacl.Bignum module BM = Hacl.Bignum.Montgomery module AM = Hacl.Bignum.AlmostMontgomery module LE = Lib.Exponentiation module BE = Hacl.Impl.Exponentiation module E = Hacl.Spec.Exponentiation.Lemmas module A = Hacl.Spec.AlmostMontgomery.Lemmas module M = Hacl.Spec.Montgomery.Lemmas module ME = Hacl.Spec.Bignum.MontExponentiation module S = Hacl.Spec.Bignum.AlmostMontExponentiation #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let a_spec (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len{0 < BD.bn_v n}) = Lib.NatMod.nat_mod (BD.bn_v n) inline_for_extraction noextract let linv (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len) (a:BD.lbignum t len) : Type0 = BD.bn_v a < pow2 (bits t * len) inline_for_extraction noextract let refl (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len{0 < BD.bn_v n}) (a:BD.lbignum t len{linv n a}) : a_spec n = BD.bn_v a % BD.bn_v n inline_for_extraction noextract let linv_ctx (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len) (ctx:BD.lbignum t (len + len)) : Type0 = let ctx_n = LSeq.sub ctx 0 len in let ctx_r2 = LSeq.sub ctx len len in ctx_n == n /\ 0 < BD.bn_v n /\ BD.bn_v ctx_r2 = pow2 (2 * bits t * len) % BD.bn_v n inline_for_extraction noextract let mk_to_nat_mont_ll_comm_monoid (t:limb_t) (len:BN.meta_len t) (n:BD.lbignum t (v len)) (mu:limb t{SM.bn_mont_pre n mu}) : BE.to_comm_monoid t len (len +! len) = { BE.a_spec = a_spec n; BE.comm_monoid = E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (BD.bn_v n) (v mu); BE.linv_ctx = linv_ctx n; BE.linv = linv n; BE.refl = refl n; } inline_for_extraction noextract val bn_almost_mont_one: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lone_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu) let bn_almost_mont_one #t k n mu ctx oneM = [@inline_let] let len = k.AM.bn.BN.len in let k1 = Ghost.hide (E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (BD.bn_v n) (v mu)) in let ctx_n = sub ctx 0ul len in let ctx_r2 = sub ctx len len in let h0 = ST.get () in BM.bn_mont_one len k.AM.from ctx_n mu ctx_r2 oneM; let h1 = ST.get () in SM.bn_mont_one_lemma n mu (as_seq h0 ctx_r2); assert (BD.bn_v (as_seq h1 oneM) == M.mont_one (bits t) (v len) (BD.bn_v n) (v mu)); assert (BD.bn_v (as_seq h1 oneM) < BD.bn_v n); BD.bn_eval_bound n (v len); assert (linv n (as_seq h1 oneM)); Math.Lemmas.small_mod (BD.bn_v (as_seq h1 oneM)) (BD.bn_v n); assert (BD.bn_v (as_seq h1 oneM) % BD.bn_v n == E.mont_one_ll (bits t) (v len) (BD.bn_v n) (v mu)) inline_for_extraction noextract val bn_almost_mont_mul: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lmul_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu) let bn_almost_mont_mul #t k n mu ctx aM bM resM = let h0 = ST.get () in SA.bn_almost_mont_mul_lemma n mu (as_seq h0 aM) (as_seq h0 bM); A.almost_mont_mul_is_mont_mul_lemma (bits t) (v k.AM.bn.BN.len) (BD.bn_v n) (v mu) (bn_v h0 aM) (bn_v h0 bM); let ctx_n = sub ctx 0ul k.AM.bn.BN.len in k.AM.mul ctx_n mu aM bM resM inline_for_extraction noextract val bn_almost_mont_sqr: #t:limb_t -> k:AM.almost_mont t -> n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len)) -> mu:limb t{SM.bn_mont_pre n mu} -> BE.lsqr_st t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) (mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu) let bn_almost_mont_sqr #t k n mu ctx aM resM = let h0 = ST.get () in SA.bn_almost_mont_sqr_lemma n mu (as_seq h0 aM); SA.bn_almost_mont_mul_lemma n mu (as_seq h0 aM) (as_seq h0 aM); A.almost_mont_mul_is_mont_mul_lemma (bits t) (v k.AM.bn.BN.len) (BD.bn_v n) (v mu) (bn_v h0 aM) (bn_v h0 aM); let ctx_n = sub ctx 0ul k.AM.bn.BN.len in k.AM.sqr ctx_n mu aM resM inline_for_extraction noextract let mk_bn_almost_mont_concrete_ops (t:limb_t) (k:AM.almost_mont t) (n:Ghost.erased (BD.lbignum t (v k.AM.bn.BN.len))) (mu:limb t{SM.bn_mont_pre n mu}) : BE.concrete_ops t k.AM.bn.BN.len (k.AM.bn.BN.len +! k.AM.bn.BN.len) = { BE.to = mk_to_nat_mont_ll_comm_monoid t k.AM.bn.BN.len n mu; BE.lone = bn_almost_mont_one k n mu; BE.lmul = bn_almost_mont_mul k n mu; BE.lsqr = bn_almost_mont_sqr k n mu; } /////////////////////////////////////////////////////////////////////// inline_for_extraction noextract val mk_ctx: #t:limb_t -> len:BN.meta_len t -> n:lbignum t len -> r2:lbignum t len -> ctx:lbignum t (len +! len) -> Stack unit (requires fun h -> live h n /\ live h r2 /\ live h ctx /\ disjoint n ctx /\ disjoint r2 ctx /\ 0 < bn_v h n /\ bn_v h r2 == pow2 (2 * bits t * v len) % bn_v h n) (ensures fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\ linv_ctx (as_seq h0 n) (as_seq h1 ctx)) let mk_ctx #t len n r2 ctx = let h0 = ST.get () in update_sub ctx 0ul len n; let h1 = ST.get () in assert (LSeq.sub (as_seq h1 ctx) 0 (v len) == as_seq h0 n); update_sub ctx len len r2; let h2 = ST.get () in LSeq.eq_intro (LSeq.sub (as_seq h2 ctx) 0 (v len)) (LSeq.sub (as_seq h1 ctx) 0 (v len)); assert (LSeq.sub (as_seq h2 ctx) 0 (v len) == as_seq h0 n); assert (LSeq.sub (as_seq h2 ctx) (v len) (v len) == as_seq h0 r2) noextract let bn_exp_almost_mont_pre (#t:limb_t) (#len:SN.bn_len t) (n:BD.lbignum t len) (mu:limb t) (r2:BD.lbignum t len) (aM:BD.lbignum t len) (bBits:size_nat) (b:BD.lbignum t (BD.blocks0 bBits (bits t))) = SM.bn_mont_pre n mu /\ BD.bn_v r2 == pow2 (2 * bits t * len) % BD.bn_v n /\ BD.bn_v b < pow2 bBits /\ BD.bn_v aM < BD.bn_v n inline_for_extraction noextract let bn_exp_almost_mont_st (t:limb_t) (len:BN.meta_len t) = n:lbignum t len -> mu:limb t -> r2:lbignum t len -> aM:lbignum t len -> bBits:size_t -> b:lbignum t (blocks0 bBits (size (bits t))) -> resM:lbignum t len -> Stack unit (requires fun h -> live h n /\ live h aM /\ live h b /\ live h resM /\ live h r2 /\ disjoint resM aM /\ disjoint resM b /\ disjoint resM n /\ disjoint n aM /\ disjoint resM r2 /\ disjoint aM r2 /\ disjoint n r2 /\ disjoint aM b /\ bn_exp_almost_mont_pre (as_seq h n) mu (as_seq h r2) (as_seq h aM) (v bBits) (as_seq h b)) (ensures fun h0 _ h1 -> modifies (loc aM |+| loc resM) h0 h1 /\ (let k1 = E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (bn_v h0 n) (v mu) in bn_v h1 resM % bn_v h0 n == LE.pow k1 (bn_v h0 aM) (bn_v h0 b))) // This function is *NOT* constant-time on the exponent b. inline_for_extraction noextract
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "Hacl.Spec.Exponentiation.Lemmas.fst.checked", "Hacl.Spec.Bignum.Montgomery.fsti.checked", "Hacl.Spec.Bignum.MontExponentiation.fst.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Spec.Bignum.AlmostMontExponentiation.fst.checked", "Hacl.Spec.Bignum.fsti.checked", "Hacl.Spec.AlmostMontgomery.Lemmas.fst.checked", "Hacl.Impl.Exponentiation.fsti.checked", "Hacl.Bignum.Montgomery.fsti.checked", "Hacl.Bignum.Definitions.fst.checked", "Hacl.Bignum.AlmostMontgomery.fsti.checked", "Hacl.Bignum.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Bignum.AlmostMontExponentiation.fst" }
[ { "abbrev": true, "full_module": "Hacl.Spec.Bignum.AlmostMontExponentiation", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.MontExponentiation", "short_module": "ME" }, { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": true, "full_module": "Hacl.Spec.AlmostMontgomery.Lemmas", "short_module": "A" }, { "abbrev": true, "full_module": "Hacl.Spec.Exponentiation.Lemmas", "short_module": "E" }, { "abbrev": true, "full_module": "Hacl.Impl.Exponentiation", "short_module": "BE" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": true, "full_module": "Hacl.Bignum.AlmostMontgomery", "short_module": "AM" }, { "abbrev": true, "full_module": "Hacl.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Bignum", "short_module": "BN" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.AlmostMontgomery", "short_module": "SA" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Montgomery", "short_module": "SM" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum", "short_module": "SN" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "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 } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
k: Hacl.Bignum.AlmostMontgomery.almost_mont t -> Hacl.Bignum.AlmostMontExponentiation.bn_exp_almost_mont_st t (Mkbn?.len (Mkalmost_mont?.bn k))
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.Definitions.limb_t", "Hacl.Bignum.AlmostMontgomery.almost_mont", "Hacl.Bignum.Definitions.lbignum", "Hacl.Bignum.__proj__Mkbn__item__len", "Hacl.Bignum.AlmostMontgomery.__proj__Mkalmost_mont__item__bn", "Hacl.Bignum.Definitions.limb", "Lib.IntTypes.size_t", "Hacl.Bignum.Definitions.blocks0", "Lib.IntTypes.size", "Lib.IntTypes.bits", "FStar.HyperStack.ST.pop_frame", "Prims.unit", "Hacl.Spec.Exponentiation.Lemmas.pow_nat_mont_ll_mod_base", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Bignum.Definitions.bn_v", "Lib.IntTypes.SEC", "Lib.Exponentiation.exp_rl_lemma", "Lib.NatMod.nat_mod", "FStar.Ghost.reveal", "Lib.Exponentiation.Definition.comm_monoid", "Prims.op_Modulus", "Hacl.Impl.Exponentiation.lexp_rl_vartime", "Lib.IntTypes.op_Plus_Bang", "Hacl.Bignum.AlmostMontExponentiation.mk_bn_almost_mont_concrete_ops", "FStar.Ghost.hide", "Hacl.Spec.Bignum.Definitions.lbignum", "Lib.Buffer.as_seq", "Lib.Buffer.MUT", "Hacl.Spec.Bignum.Definitions.bn_eval_bound", "Hacl.Bignum.AlmostMontExponentiation.mk_ctx", "Lib.Buffer.lbuffer_t", "Lib.IntTypes.add", "Lib.Buffer.create", "Lib.IntTypes.uint", "Lib.Buffer.lbuffer", "FStar.Ghost.erased", "Hacl.Spec.Exponentiation.Lemmas.mk_nat_mont_ll_comm_monoid", "Lib.IntTypes.int_t", "Prims.eq2", "Prims.int", "Prims.l_or", "Lib.IntTypes.range", "Prims.l_and", "Prims.b2t", "Prims.op_GreaterThan", "Prims.op_LessThanOrEqual", "Prims.op_Subtraction", "Prims.pow2", "Prims.op_Multiply", "Lib.IntTypes.mk_int", "Hacl.Spec.Bignum.Definitions.blocks0", "Hacl.Bignum.meta_len", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "FStar.HyperStack.ST.push_frame" ]
[]
false
false
false
false
false
let bn_exp_almost_mont_bm_vartime #t k n mu r2 aM bBits b resM =
push_frame (); let h0 = ST.get () in [@@ inline_let ]let len = k.AM.bn.BN.len in [@@ inline_let ]let bLen = blocks0 bBits (size (bits t)) in let k1 = Ghost.hide (E.mk_nat_mont_ll_comm_monoid (bits t) (v len) (bn_v h0 n) (v mu)) in let ctx = create (len +! len) (uint #t #SEC 0) in mk_ctx #t len n r2 ctx; BD.bn_eval_bound (as_seq h0 aM) (v len); BE.lexp_rl_vartime len (len +! len) (mk_bn_almost_mont_concrete_ops t k (as_seq h0 n) mu) ctx aM bLen bBits b resM; LE.exp_rl_lemma k1 (bn_v h0 aM % bn_v h0 n) (v bBits) (bn_v h0 b); E.pow_nat_mont_ll_mod_base (bits t) (v len) (bn_v h0 n) (v mu) (bn_v h0 aM) (bn_v h0 b); pop_frame ()
false
LowParse.SLow.BitSum.fst
LowParse.SLow.BitSum.serialize32_bitsum_cond
val serialize32_bitsum_cond (#tot: pos) (#t: eqtype) (#cl: uint_t tot t) (b: bitsum' cl tot) (k: parser_kind) (type_of_tag: (bitsum'_key_type b -> Tot Type)) (f: (x: bitsum'_key_type b -> Tot (k: parser_kind & parser k (type_of_tag x)))) : Tot bool
val serialize32_bitsum_cond (#tot: pos) (#t: eqtype) (#cl: uint_t tot t) (b: bitsum' cl tot) (k: parser_kind) (type_of_tag: (bitsum'_key_type b -> Tot Type)) (f: (x: bitsum'_key_type b -> Tot (k: parser_kind & parser k (type_of_tag x)))) : Tot bool
let serialize32_bitsum_cond (#tot: pos) (#t: eqtype) (#cl: uint_t tot t) (b: bitsum' cl tot) (k: parser_kind) (type_of_tag: (bitsum'_key_type b -> Tot Type)) (f: (x: bitsum'_key_type b) -> Tot (k: parser_kind & parser k (type_of_tag x))) : Tot bool = match k.parser_kind_high, (weaken_parse_bitsum_cases_kind b type_of_tag f).parser_kind_high with | Some max1, Some max2 -> max1 + max2 < 4294967296 | _ -> false
{ "file_name": "src/lowparse/LowParse.SLow.BitSum.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 14, "end_line": 56, "start_col": 0, "start_line": 45 }
module LowParse.SLow.BitSum include LowParse.SLow.Enum include LowParse.BitFields include LowParse.Spec.BitSum module U32 = FStar.UInt32 module B32 = FStar.Bytes (* WARNING: these functions currently does not extract to C *) inline_for_extraction let parse32_bitsum (#kt: parser_kind) (#tot: pos) (#t: eqtype) (#cl: uint_t tot t) (b: bitsum' cl tot) (#data: Type) (tag_of_data: (data -> Tot (bitsum'_type b))) (type_of_tag: (bitsum'_key_type b -> Tot Type)) (synth_case: synth_case_t b data tag_of_data type_of_tag) (#p: parser kt t) (p32: parser32 p) (f: (x: bitsum'_key_type b) -> Tot (k: parser_kind & parser k (type_of_tag x))) (f32: (x: bitsum'_key_type b) -> Tot (parser32 (dsnd (f x)))) : Tot (parser32 (parse_bitsum b tag_of_data type_of_tag synth_case p f)) = fun x -> parse_bitsum_eq' b tag_of_data type_of_tag synth_case p f (B32.reveal x); match p32 x with | None -> None | Some (tg', consumed1) -> if filter_bitsum' b tg' then let tg = synth_bitsum' b tg' in let x' = B32.slice x consumed1 (B32.len x) in begin match f32 (bitsum'_key_of_t b tg) x' with | None -> None | Some (y, consumed2) -> Some ((synth_case.f tg y <: data), consumed1 `U32.add` consumed2) end else None
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowParse.Spec.BitSum.fst.checked", "LowParse.SLow.Enum.fst.checked", "LowParse.BitFields.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Bytes.fsti.checked" ], "interface_file": false, "source_file": "LowParse.SLow.BitSum.fst" }
[ { "abbrev": true, "full_module": "FStar.Bytes", "short_module": "B32" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.BitSum", "short_module": null }, { "abbrev": false, "full_module": "LowParse.BitFields", "short_module": null }, { "abbrev": false, "full_module": "LowParse.SLow.Enum", "short_module": null }, { "abbrev": false, "full_module": "LowParse.SLow", "short_module": null }, { "abbrev": false, "full_module": "LowParse.SLow", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
b: LowParse.Spec.BitSum.bitsum' cl tot -> k: LowParse.Spec.Base.parser_kind -> type_of_tag: (_: LowParse.Spec.BitSum.bitsum'_key_type b -> Type) -> f: (x: LowParse.Spec.BitSum.bitsum'_key_type b -> Prims.dtuple2 LowParse.Spec.Base.parser_kind (fun k -> LowParse.Spec.Base.parser k (type_of_tag x))) -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "Prims.pos", "Prims.eqtype", "LowParse.BitFields.uint_t", "LowParse.Spec.BitSum.bitsum'", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.BitSum.bitsum'_key_type", "Prims.dtuple2", "LowParse.Spec.Base.parser", "FStar.Pervasives.Native.Mktuple2", "FStar.Pervasives.Native.option", "Prims.nat", "LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_high", "LowParse.Spec.BitSum.weaken_parse_bitsum_cases_kind", "Prims.op_LessThan", "Prims.op_Addition", "FStar.Pervasives.Native.tuple2", "Prims.bool" ]
[]
false
false
false
false
false
let serialize32_bitsum_cond (#tot: pos) (#t: eqtype) (#cl: uint_t tot t) (b: bitsum' cl tot) (k: parser_kind) (type_of_tag: (bitsum'_key_type b -> Tot Type)) (f: (x: bitsum'_key_type b -> Tot (k: parser_kind & parser k (type_of_tag x)))) : Tot bool =
match k.parser_kind_high, (weaken_parse_bitsum_cases_kind b type_of_tag f).parser_kind_high with | Some max1, Some max2 -> max1 + max2 < 4294967296 | _ -> false
false
Hacl.Impl.Ed25519.PointConstants.fst
Hacl.Impl.Ed25519.PointConstants.make_g
val make_g: g:point -> Stack unit (requires fun h -> live h g) (ensures fun h0 _ h1 -> modifies (loc g) h0 h1 /\ F51.point_inv_t h1 g /\ F51.inv_ext_point (as_seq h1 g) /\ F51.point_eval h1 g == S.g)
val make_g: g:point -> Stack unit (requires fun h -> live h g) (ensures fun h0 _ h1 -> modifies (loc g) h0 h1 /\ F51.point_inv_t h1 g /\ F51.inv_ext_point (as_seq h1 g) /\ F51.point_eval h1 g == S.g)
let make_g g = let gx = getx g in let gy = gety g in let gz = getz g in let gt = gett g in [@inline_let] let (x0, x1, x2, x3, x4) = (u64 0x00062d608f25d51a, u64 0x000412a4b4f6592a, u64 0x00075b7171a4b31d, u64 0x0001ff60527118fe, u64 0x000216936d3cd6e5) in [@inline_let] let (y0, y1, y2, y3, y4) = (u64 0x0006666666666658, u64 0x0004cccccccccccc, u64 0x0001999999999999, u64 0x0003333333333333, u64 0x0006666666666666) in [@inline_let] let (t0, t1, t2, t3, t4) = (u64 0x00068ab3a5b7dda3, u64 0x00000eea2a5eadbb, u64 0x0002af8df483c27e, u64 0x000332b375274732, u64 0x00067875f0fd78b7) in make_u64_5 gx x0 x1 x2 x3 x4; make_u64_5 gy y0 y1 y2 y3 y4; make_one gz; make_u64_5 gt t0 t1 t2 t3 t4; (**) assert_norm (Spec.Ed25519.g_x == S51.as_nat5 (x0, x1, x2, x3, x4) % Spec.Curve25519.prime); (**) assert_norm (Spec.Ed25519.g_y == S51.as_nat5 (y0, y1, y2, y3, y4) % Spec.Curve25519.prime); (**) assert_norm (Mktuple4?._4 Spec.Ed25519.g == S51.as_nat5 (t0, t1, t2, t3, t4) % Spec.Curve25519.prime); let h1 = ST.get () in assert (F51.point_inv_t h1 g); assert (F51.point_eval h1 g == Spec.Ed25519.g); Spec.Ed25519.Lemmas.g_is_on_curve ()
{ "file_name": "code/ed25519/Hacl.Impl.Ed25519.PointConstants.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 38, "end_line": 90, "start_col": 0, "start_line": 49 }
module Hacl.Impl.Ed25519.PointConstants module ST = FStar.HyperStack.ST open FStar.HyperStack open FStar.HyperStack.All open FStar.Mul open Lib.IntTypes open Lib.Buffer open Hacl.Bignum25519 module F51 = Hacl.Impl.Ed25519.Field51 module S51 = Hacl.Spec.Curve25519.Field51.Definition module S = Spec.Ed25519 #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" val make_point_inf: b:lbuffer uint64 20ul -> Stack unit (requires fun h -> live h b) (ensures fun h0 _ h1 -> modifies (loc b) h0 h1 /\ F51.point_inv_t h1 b /\ F51.inv_ext_point (as_seq h1 b) /\ S.to_aff_point (F51.point_eval h1 b) == S.aff_point_at_infinity) let make_point_inf b = let x = getx b in let y = gety b in let z = getz b in let t = gett b in make_zero x; make_one y; make_one z; make_zero t; let h1 = ST.get () in assert (F51.point_eval h1 b == S.point_at_infinity); Spec.Ed25519.Lemmas.to_aff_point_at_infinity_lemma () inline_for_extraction noextract val make_g: g:point -> Stack unit (requires fun h -> live h g) (ensures fun h0 _ h1 -> modifies (loc g) h0 h1 /\ F51.point_inv_t h1 g /\ F51.inv_ext_point (as_seq h1 g) /\ F51.point_eval h1 g == S.g)
{ "checked_file": "/", "dependencies": [ "Spec.Ed25519.Lemmas.fsti.checked", "Spec.Ed25519.fst.checked", "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Curve25519.Field51.Definition.fst.checked", "Hacl.Impl.Ed25519.Field51.fst.checked", "Hacl.Bignum25519.fsti.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.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.Ed25519.PointConstants.fst" }
[ { "abbrev": true, "full_module": "Spec.Ed25519", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.Curve25519.Field51.Definition", "short_module": "S51" }, { "abbrev": true, "full_module": "Hacl.Impl.Ed25519.Field51", "short_module": "F51" }, { "abbrev": false, "full_module": "Hacl.Bignum25519", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Impl.Ed25519", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Ed25519", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
g: Hacl.Bignum25519.point -> FStar.HyperStack.ST.Stack Prims.unit
FStar.HyperStack.ST.Stack
[]
[]
[ "Hacl.Bignum25519.point", "Lib.IntTypes.uint64", "Spec.Ed25519.Lemmas.g_is_on_curve", "Prims.unit", "Prims._assert", "Prims.eq2", "Spec.Ed25519.PointOps.ext_point", "Hacl.Impl.Ed25519.Field51.point_eval", "Spec.Ed25519.PointOps.g", "Hacl.Impl.Ed25519.Field51.point_inv_t", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "FStar.Pervasives.assert_norm", "Prims.int", "FStar.Pervasives.Native.__proj__Mktuple4__item___4", "Spec.Curve25519.elem", "Prims.op_Modulus", "Hacl.Spec.Curve25519.Field51.Definition.as_nat5", "FStar.Pervasives.Native.Mktuple5", "Spec.Curve25519.prime", "Spec.Ed25519.PointOps.g_y", "Spec.Ed25519.PointOps.g_x", "Hacl.Bignum25519.make_u64_5", "Hacl.Bignum25519.make_one", "FStar.Pervasives.Native.tuple5", "Lib.IntTypes.int_t", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "Lib.IntTypes.u64", "Hacl.Bignum25519.felem", "Hacl.Bignum25519.gett", "Hacl.Bignum25519.getz", "Hacl.Bignum25519.gety", "Hacl.Bignum25519.getx" ]
[]
false
true
false
false
false
let make_g g =
let gx = getx g in let gy = gety g in let gz = getz g in let gt = gett g in [@@ inline_let ]let x0, x1, x2, x3, x4 = (u64 0x00062d608f25d51a, u64 0x000412a4b4f6592a, u64 0x00075b7171a4b31d, u64 0x0001ff60527118fe, u64 0x000216936d3cd6e5) in [@@ inline_let ]let y0, y1, y2, y3, y4 = (u64 0x0006666666666658, u64 0x0004cccccccccccc, u64 0x0001999999999999, u64 0x0003333333333333, u64 0x0006666666666666) in [@@ inline_let ]let t0, t1, t2, t3, t4 = (u64 0x00068ab3a5b7dda3, u64 0x00000eea2a5eadbb, u64 0x0002af8df483c27e, u64 0x000332b375274732, u64 0x00067875f0fd78b7) in make_u64_5 gx x0 x1 x2 x3 x4; make_u64_5 gy y0 y1 y2 y3 y4; make_one gz; make_u64_5 gt t0 t1 t2 t3 t4; assert_norm (Spec.Ed25519.g_x == S51.as_nat5 (x0, x1, x2, x3, x4) % Spec.Curve25519.prime); assert_norm (Spec.Ed25519.g_y == S51.as_nat5 (y0, y1, y2, y3, y4) % Spec.Curve25519.prime); assert_norm (Mktuple4?._4 Spec.Ed25519.g == S51.as_nat5 (t0, t1, t2, t3, t4) % Spec.Curve25519.prime ); let h1 = ST.get () in assert (F51.point_inv_t h1 g); assert (F51.point_eval h1 g == Spec.Ed25519.g); Spec.Ed25519.Lemmas.g_is_on_curve ()
false
Hacl.Impl.Ed25519.PointConstants.fst
Hacl.Impl.Ed25519.PointConstants.make_point_inf
val make_point_inf: b:lbuffer uint64 20ul -> Stack unit (requires fun h -> live h b) (ensures fun h0 _ h1 -> modifies (loc b) h0 h1 /\ F51.point_inv_t h1 b /\ F51.inv_ext_point (as_seq h1 b) /\ S.to_aff_point (F51.point_eval h1 b) == S.aff_point_at_infinity)
val make_point_inf: b:lbuffer uint64 20ul -> Stack unit (requires fun h -> live h b) (ensures fun h0 _ h1 -> modifies (loc b) h0 h1 /\ F51.point_inv_t h1 b /\ F51.inv_ext_point (as_seq h1 b) /\ S.to_aff_point (F51.point_eval h1 b) == S.aff_point_at_infinity)
let make_point_inf b = let x = getx b in let y = gety b in let z = getz b in let t = gett b in make_zero x; make_one y; make_one z; make_zero t; let h1 = ST.get () in assert (F51.point_eval h1 b == S.point_at_infinity); Spec.Ed25519.Lemmas.to_aff_point_at_infinity_lemma ()
{ "file_name": "code/ed25519/Hacl.Impl.Ed25519.PointConstants.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 55, "end_line": 39, "start_col": 0, "start_line": 28 }
module Hacl.Impl.Ed25519.PointConstants module ST = FStar.HyperStack.ST open FStar.HyperStack open FStar.HyperStack.All open FStar.Mul open Lib.IntTypes open Lib.Buffer open Hacl.Bignum25519 module F51 = Hacl.Impl.Ed25519.Field51 module S51 = Hacl.Spec.Curve25519.Field51.Definition module S = Spec.Ed25519 #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" val make_point_inf: b:lbuffer uint64 20ul -> Stack unit (requires fun h -> live h b) (ensures fun h0 _ h1 -> modifies (loc b) h0 h1 /\ F51.point_inv_t h1 b /\ F51.inv_ext_point (as_seq h1 b) /\ S.to_aff_point (F51.point_eval h1 b) == S.aff_point_at_infinity)
{ "checked_file": "/", "dependencies": [ "Spec.Ed25519.Lemmas.fsti.checked", "Spec.Ed25519.fst.checked", "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Curve25519.Field51.Definition.fst.checked", "Hacl.Impl.Ed25519.Field51.fst.checked", "Hacl.Bignum25519.fsti.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.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.Ed25519.PointConstants.fst" }
[ { "abbrev": true, "full_module": "Spec.Ed25519", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.Curve25519.Field51.Definition", "short_module": "S51" }, { "abbrev": true, "full_module": "Hacl.Impl.Ed25519.Field51", "short_module": "F51" }, { "abbrev": false, "full_module": "Hacl.Bignum25519", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Impl.Ed25519", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Ed25519", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
b: Lib.Buffer.lbuffer Lib.IntTypes.uint64 20ul -> FStar.HyperStack.ST.Stack Prims.unit
FStar.HyperStack.ST.Stack
[]
[]
[ "Lib.Buffer.lbuffer", "Lib.IntTypes.uint64", "FStar.UInt32.__uint_to_t", "Spec.Ed25519.Lemmas.to_aff_point_at_infinity_lemma", "Prims.unit", "Prims._assert", "Prims.eq2", "Spec.Ed25519.PointOps.ext_point", "Hacl.Impl.Ed25519.Field51.point_eval", "Spec.Ed25519.PointOps.point_at_infinity", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "Hacl.Bignum25519.make_zero", "Hacl.Bignum25519.make_one", "Hacl.Bignum25519.felem", "Hacl.Bignum25519.gett", "Hacl.Bignum25519.getz", "Hacl.Bignum25519.gety", "Hacl.Bignum25519.getx" ]
[]
false
true
false
false
false
let make_point_inf b =
let x = getx b in let y = gety b in let z = getz b in let t = gett b in make_zero x; make_one y; make_one z; make_zero t; let h1 = ST.get () in assert (F51.point_eval h1 b == S.point_at_infinity); Spec.Ed25519.Lemmas.to_aff_point_at_infinity_lemma ()
false
LowParse.SLow.BitSum.fst
LowParse.SLow.BitSum.parse32_bitsum
val parse32_bitsum (#kt: parser_kind) (#tot: pos) (#t: eqtype) (#cl: uint_t tot t) (b: bitsum' cl tot) (#data: Type) (tag_of_data: (data -> Tot (bitsum'_type b))) (type_of_tag: (bitsum'_key_type b -> Tot Type)) (synth_case: synth_case_t b data tag_of_data type_of_tag) (#p: parser kt t) (p32: parser32 p) (f: (x: bitsum'_key_type b -> Tot (k: parser_kind & parser k (type_of_tag x)))) (f32: (x: bitsum'_key_type b -> Tot (parser32 (dsnd (f x))))) : Tot (parser32 (parse_bitsum b tag_of_data type_of_tag synth_case p f))
val parse32_bitsum (#kt: parser_kind) (#tot: pos) (#t: eqtype) (#cl: uint_t tot t) (b: bitsum' cl tot) (#data: Type) (tag_of_data: (data -> Tot (bitsum'_type b))) (type_of_tag: (bitsum'_key_type b -> Tot Type)) (synth_case: synth_case_t b data tag_of_data type_of_tag) (#p: parser kt t) (p32: parser32 p) (f: (x: bitsum'_key_type b -> Tot (k: parser_kind & parser k (type_of_tag x)))) (f32: (x: bitsum'_key_type b -> Tot (parser32 (dsnd (f x))))) : Tot (parser32 (parse_bitsum b tag_of_data type_of_tag synth_case p f))
let parse32_bitsum (#kt: parser_kind) (#tot: pos) (#t: eqtype) (#cl: uint_t tot t) (b: bitsum' cl tot) (#data: Type) (tag_of_data: (data -> Tot (bitsum'_type b))) (type_of_tag: (bitsum'_key_type b -> Tot Type)) (synth_case: synth_case_t b data tag_of_data type_of_tag) (#p: parser kt t) (p32: parser32 p) (f: (x: bitsum'_key_type b) -> Tot (k: parser_kind & parser k (type_of_tag x))) (f32: (x: bitsum'_key_type b) -> Tot (parser32 (dsnd (f x)))) : Tot (parser32 (parse_bitsum b tag_of_data type_of_tag synth_case p f)) = fun x -> parse_bitsum_eq' b tag_of_data type_of_tag synth_case p f (B32.reveal x); match p32 x with | None -> None | Some (tg', consumed1) -> if filter_bitsum' b tg' then let tg = synth_bitsum' b tg' in let x' = B32.slice x consumed1 (B32.len x) in begin match f32 (bitsum'_key_of_t b tg) x' with | None -> None | Some (y, consumed2) -> Some ((synth_case.f tg y <: data), consumed1 `U32.add` consumed2) end else None
{ "file_name": "src/lowparse/LowParse.SLow.BitSum.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 10, "end_line": 43, "start_col": 0, "start_line": 13 }
module LowParse.SLow.BitSum include LowParse.SLow.Enum include LowParse.BitFields include LowParse.Spec.BitSum module U32 = FStar.UInt32 module B32 = FStar.Bytes (* WARNING: these functions currently does not extract to C *)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowParse.Spec.BitSum.fst.checked", "LowParse.SLow.Enum.fst.checked", "LowParse.BitFields.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Bytes.fsti.checked" ], "interface_file": false, "source_file": "LowParse.SLow.BitSum.fst" }
[ { "abbrev": true, "full_module": "FStar.Bytes", "short_module": "B32" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.BitSum", "short_module": null }, { "abbrev": false, "full_module": "LowParse.BitFields", "short_module": null }, { "abbrev": false, "full_module": "LowParse.SLow.Enum", "short_module": null }, { "abbrev": false, "full_module": "LowParse.SLow", "short_module": null }, { "abbrev": false, "full_module": "LowParse.SLow", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
b: LowParse.Spec.BitSum.bitsum' cl tot -> tag_of_data: (_: data -> LowParse.Spec.BitSum.bitsum'_type b) -> type_of_tag: (_: LowParse.Spec.BitSum.bitsum'_key_type b -> Type) -> synth_case: LowParse.Spec.BitSum.synth_case_t b data tag_of_data type_of_tag -> p32: LowParse.SLow.Base.parser32 p -> f: (x: LowParse.Spec.BitSum.bitsum'_key_type b -> Prims.dtuple2 LowParse.Spec.Base.parser_kind (fun k -> LowParse.Spec.Base.parser k (type_of_tag x))) -> f32: (x: LowParse.Spec.BitSum.bitsum'_key_type b -> LowParse.SLow.Base.parser32 (FStar.Pervasives.dsnd (f x))) -> LowParse.SLow.Base.parser32 (LowParse.Spec.BitSum.parse_bitsum b tag_of_data type_of_tag synth_case p f)
Prims.Tot
[ "total" ]
[]
[ "LowParse.Spec.Base.parser_kind", "Prims.pos", "Prims.eqtype", "LowParse.BitFields.uint_t", "LowParse.Spec.BitSum.bitsum'", "LowParse.Spec.BitSum.bitsum'_type", "LowParse.Spec.BitSum.bitsum'_key_type", "LowParse.Spec.BitSum.synth_case_t", "LowParse.Spec.Base.parser", "LowParse.SLow.Base.parser32", "Prims.dtuple2", "Prims.__proj__Mkdtuple2__item___1", "FStar.Pervasives.dsnd", "LowParse.SLow.Base.bytes32", "FStar.Pervasives.Native.None", "FStar.Pervasives.Native.tuple2", "FStar.UInt32.t", "LowParse.Spec.BitSum.filter_bitsum'", "LowParse.Spec.BitSum.bitsum'_key_of_t", "FStar.Pervasives.Native.Some", "FStar.Pervasives.Native.Mktuple2", "LowParse.Spec.BitSum.__proj__SynthCase__item__f", "FStar.UInt32.add", "FStar.Pervasives.Native.option", "LowParse.SLow.Base.parser32_correct", "LowParse.Spec.BitSum.parse_bitsum_kind", "LowParse.Spec.BitSum.parse_bitsum", "FStar.Bytes.bytes", "Prims.eq2", "FStar.Seq.Base.seq", "FStar.UInt8.t", "FStar.Bytes.reveal", "FStar.Seq.Base.slice", "FStar.UInt32.v", "FStar.Bytes.len", "FStar.Bytes.slice", "LowParse.Spec.BitSum.synth_bitsum'", "Prims.bool", "Prims.unit", "LowParse.Spec.BitSum.parse_bitsum_eq'" ]
[]
false
false
false
false
false
let parse32_bitsum (#kt: parser_kind) (#tot: pos) (#t: eqtype) (#cl: uint_t tot t) (b: bitsum' cl tot) (#data: Type) (tag_of_data: (data -> Tot (bitsum'_type b))) (type_of_tag: (bitsum'_key_type b -> Tot Type)) (synth_case: synth_case_t b data tag_of_data type_of_tag) (#p: parser kt t) (p32: parser32 p) (f: (x: bitsum'_key_type b -> Tot (k: parser_kind & parser k (type_of_tag x)))) (f32: (x: bitsum'_key_type b -> Tot (parser32 (dsnd (f x))))) : Tot (parser32 (parse_bitsum b tag_of_data type_of_tag synth_case p f)) =
fun x -> parse_bitsum_eq' b tag_of_data type_of_tag synth_case p f (B32.reveal x); match p32 x with | None -> None | Some (tg', consumed1) -> if filter_bitsum' b tg' then let tg = synth_bitsum' b tg' in let x' = B32.slice x consumed1 (B32.len x) in match f32 (bitsum'_key_of_t b tg) x' with | None -> None | Some (y, consumed2) -> Some ((synth_case.f tg y <: data), consumed1 `U32.add` consumed2) else None
false
Vale.Math.Poly2.Defs_s.fst
Vale.Math.Poly2.Defs_s.poly
val poly : Type0
let poly = s:(seq bool){valid s}
{ "file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 32, "end_line": 18, "start_col": 0, "start_line": 18 }
module Vale.Math.Poly2.Defs_s open FStar.Mul open FStar.Seq unfold let max = FStar.Math.Lib.max // Polynomials cn * x^n + ... + c0 * x^0 // where coefficients ck are treated mod 2 let valid (s:seq bool) : bool = length s = 0 || index s (length s - 1) // Each coefficient of a polynomial is 0 (false) or 1 (true). // Each polynomial has a unique valid representation: // - zero is [] // - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term) // The unique representation ensures that mathematically equal polynomials are = in F*.
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Defs_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Type0
Prims.Tot
[ "total" ]
[]
[ "FStar.Seq.Base.seq", "Prims.bool", "Prims.b2t", "Vale.Math.Poly2.Defs_s.valid" ]
[]
false
false
false
true
true
let poly =
s: (seq bool){valid s}
false
Vale.Math.Poly2.Defs_s.fst
Vale.Math.Poly2.Defs_s.zero
val zero : FStar.Seq.Base.seq Prims.bool
let zero = create 0 false
{ "file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 25, "end_line": 21, "start_col": 0, "start_line": 21 }
module Vale.Math.Poly2.Defs_s open FStar.Mul open FStar.Seq unfold let max = FStar.Math.Lib.max // Polynomials cn * x^n + ... + c0 * x^0 // where coefficients ck are treated mod 2 let valid (s:seq bool) : bool = length s = 0 || index s (length s - 1) // Each coefficient of a polynomial is 0 (false) or 1 (true). // Each polynomial has a unique valid representation: // - zero is [] // - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term) // The unique representation ensures that mathematically equal polynomials are = in F*. // s[0] is lowest-order term (x^0). let poly = s:(seq bool){valid s}
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Defs_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
FStar.Seq.Base.seq Prims.bool
Prims.Tot
[ "total" ]
[]
[ "FStar.Seq.Base.create", "Prims.bool" ]
[]
false
false
false
true
false
let zero =
create 0 false
false
Vale.Math.Poly2.Defs_s.fst
Vale.Math.Poly2.Defs_s.max
val max : x: Prims.int -> y: Prims.int -> z: Prims.int{(x >= y ==> z = x) /\ (x < y ==> z = y)}
let max = FStar.Math.Lib.max
{ "file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 35, "end_line": 4, "start_col": 7, "start_line": 4 }
module Vale.Math.Poly2.Defs_s open FStar.Mul
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Defs_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: Prims.int -> y: Prims.int -> z: Prims.int{(x >= y ==> z = x) /\ (x < y ==> z = y)}
Prims.Tot
[ "total" ]
[]
[ "FStar.Math.Lib.max" ]
[]
false
false
false
false
false
let max =
FStar.Math.Lib.max
false
Vale.Math.Poly2.Defs_s.fst
Vale.Math.Poly2.Defs_s.degree
val degree (p: poly) : int
val degree (p: poly) : int
let degree (p:poly) : int = length p - 1
{ "file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 40, "end_line": 20, "start_col": 0, "start_line": 20 }
module Vale.Math.Poly2.Defs_s open FStar.Mul open FStar.Seq unfold let max = FStar.Math.Lib.max // Polynomials cn * x^n + ... + c0 * x^0 // where coefficients ck are treated mod 2 let valid (s:seq bool) : bool = length s = 0 || index s (length s - 1) // Each coefficient of a polynomial is 0 (false) or 1 (true). // Each polynomial has a unique valid representation: // - zero is [] // - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term) // The unique representation ensures that mathematically equal polynomials are = in F*. // s[0] is lowest-order term (x^0). let poly = s:(seq bool){valid s}
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Defs_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: Vale.Math.Poly2.Defs_s.poly -> Prims.int
Prims.Tot
[ "total" ]
[]
[ "Vale.Math.Poly2.Defs_s.poly", "Prims.op_Subtraction", "FStar.Seq.Base.length", "Prims.bool", "Prims.int" ]
[]
false
false
false
true
false
let degree (p: poly) : int =
length p - 1
false
Vale.Math.Poly2.Defs_s.fst
Vale.Math.Poly2.Defs_s.one
val one : FStar.Seq.Base.seq Prims.bool
let one = create 1 true
{ "file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 23, "end_line": 22, "start_col": 0, "start_line": 22 }
module Vale.Math.Poly2.Defs_s open FStar.Mul open FStar.Seq unfold let max = FStar.Math.Lib.max // Polynomials cn * x^n + ... + c0 * x^0 // where coefficients ck are treated mod 2 let valid (s:seq bool) : bool = length s = 0 || index s (length s - 1) // Each coefficient of a polynomial is 0 (false) or 1 (true). // Each polynomial has a unique valid representation: // - zero is [] // - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term) // The unique representation ensures that mathematically equal polynomials are = in F*. // s[0] is lowest-order term (x^0). let poly = s:(seq bool){valid s} let degree (p:poly) : int = length p - 1
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Defs_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
FStar.Seq.Base.seq Prims.bool
Prims.Tot
[ "total" ]
[]
[ "FStar.Seq.Base.create", "Prims.bool" ]
[]
false
false
false
true
false
let one =
create 1 true
false
LowParse.SLow.BitSum.fst
LowParse.SLow.BitSum.serialize32_bitsum
val serialize32_bitsum (#kt: parser_kind) (#tot: pos) (#t: eqtype) (#cl: uint_t tot t) (b: bitsum' cl tot) (#data: Type) (tag_of_data: (data -> Tot (bitsum'_type b))) (type_of_tag: (bitsum'_key_type b -> Tot Type)) (synth_case: synth_case_t b data tag_of_data type_of_tag) (#p: parser kt t) (#s: serializer p) (s32: serializer32 s {kt.parser_kind_subkind == Some ParserStrong}) (#f: (x: bitsum'_key_type b -> Tot (k: parser_kind & parser k (type_of_tag x)))) (g: (x: bitsum'_key_type b -> Tot (serializer (dsnd (f x))))) (g32: (x: bitsum'_key_type b -> Tot (serializer32 (g x)))) (sq: squash (serialize32_bitsum_cond b kt type_of_tag f)) : Tot (serializer32 (serialize_bitsum b tag_of_data type_of_tag synth_case s #f g))
val serialize32_bitsum (#kt: parser_kind) (#tot: pos) (#t: eqtype) (#cl: uint_t tot t) (b: bitsum' cl tot) (#data: Type) (tag_of_data: (data -> Tot (bitsum'_type b))) (type_of_tag: (bitsum'_key_type b -> Tot Type)) (synth_case: synth_case_t b data tag_of_data type_of_tag) (#p: parser kt t) (#s: serializer p) (s32: serializer32 s {kt.parser_kind_subkind == Some ParserStrong}) (#f: (x: bitsum'_key_type b -> Tot (k: parser_kind & parser k (type_of_tag x)))) (g: (x: bitsum'_key_type b -> Tot (serializer (dsnd (f x))))) (g32: (x: bitsum'_key_type b -> Tot (serializer32 (g x)))) (sq: squash (serialize32_bitsum_cond b kt type_of_tag f)) : Tot (serializer32 (serialize_bitsum b tag_of_data type_of_tag synth_case s #f g))
let serialize32_bitsum (#kt: parser_kind) (#tot: pos) (#t: eqtype) (#cl: uint_t tot t) (b: bitsum' cl tot) (#data: Type) (tag_of_data: (data -> Tot (bitsum'_type b))) (type_of_tag: (bitsum'_key_type b -> Tot Type)) (synth_case: synth_case_t b data tag_of_data type_of_tag) (#p: parser kt t) (#s: serializer p) (s32: serializer32 s { kt.parser_kind_subkind == Some ParserStrong } ) (#f: (x: bitsum'_key_type b) -> Tot (k: parser_kind & parser k (type_of_tag x))) (g: (x: bitsum'_key_type b) -> Tot (serializer (dsnd (f x)))) (g32: (x: bitsum'_key_type b) -> Tot (serializer32 (g x))) (sq: squash ( serialize32_bitsum_cond b kt type_of_tag f )) : Tot (serializer32 (serialize_bitsum b tag_of_data type_of_tag synth_case s #f g)) = fun x -> serialize_bitsum_eq b tag_of_data type_of_tag synth_case s g x; let tg = tag_of_data x in let k = bitsum'_key_of_t b tg in let payload = synth_case.g tg x in let s_tg = s32 (synth_bitsum'_recip b tg) in let s_pl = g32 k payload in s_tg `B32.append` s_pl
{ "file_name": "src/lowparse/LowParse.SLow.BitSum.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 26, "end_line": 87, "start_col": 0, "start_line": 59 }
module LowParse.SLow.BitSum include LowParse.SLow.Enum include LowParse.BitFields include LowParse.Spec.BitSum module U32 = FStar.UInt32 module B32 = FStar.Bytes (* WARNING: these functions currently does not extract to C *) inline_for_extraction let parse32_bitsum (#kt: parser_kind) (#tot: pos) (#t: eqtype) (#cl: uint_t tot t) (b: bitsum' cl tot) (#data: Type) (tag_of_data: (data -> Tot (bitsum'_type b))) (type_of_tag: (bitsum'_key_type b -> Tot Type)) (synth_case: synth_case_t b data tag_of_data type_of_tag) (#p: parser kt t) (p32: parser32 p) (f: (x: bitsum'_key_type b) -> Tot (k: parser_kind & parser k (type_of_tag x))) (f32: (x: bitsum'_key_type b) -> Tot (parser32 (dsnd (f x)))) : Tot (parser32 (parse_bitsum b tag_of_data type_of_tag synth_case p f)) = fun x -> parse_bitsum_eq' b tag_of_data type_of_tag synth_case p f (B32.reveal x); match p32 x with | None -> None | Some (tg', consumed1) -> if filter_bitsum' b tg' then let tg = synth_bitsum' b tg' in let x' = B32.slice x consumed1 (B32.len x) in begin match f32 (bitsum'_key_of_t b tg) x' with | None -> None | Some (y, consumed2) -> Some ((synth_case.f tg y <: data), consumed1 `U32.add` consumed2) end else None let serialize32_bitsum_cond (#tot: pos) (#t: eqtype) (#cl: uint_t tot t) (b: bitsum' cl tot) (k: parser_kind) (type_of_tag: (bitsum'_key_type b -> Tot Type)) (f: (x: bitsum'_key_type b) -> Tot (k: parser_kind & parser k (type_of_tag x))) : Tot bool = match k.parser_kind_high, (weaken_parse_bitsum_cases_kind b type_of_tag f).parser_kind_high with | Some max1, Some max2 -> max1 + max2 < 4294967296 | _ -> false
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowParse.Spec.BitSum.fst.checked", "LowParse.SLow.Enum.fst.checked", "LowParse.BitFields.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Bytes.fsti.checked" ], "interface_file": false, "source_file": "LowParse.SLow.BitSum.fst" }
[ { "abbrev": true, "full_module": "FStar.Bytes", "short_module": "B32" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.BitSum", "short_module": null }, { "abbrev": false, "full_module": "LowParse.BitFields", "short_module": null }, { "abbrev": false, "full_module": "LowParse.SLow.Enum", "short_module": null }, { "abbrev": false, "full_module": "LowParse.SLow", "short_module": null }, { "abbrev": false, "full_module": "LowParse.SLow", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
b: LowParse.Spec.BitSum.bitsum' cl tot -> tag_of_data: (_: data -> LowParse.Spec.BitSum.bitsum'_type b) -> type_of_tag: (_: LowParse.Spec.BitSum.bitsum'_key_type b -> Type) -> synth_case: LowParse.Spec.BitSum.synth_case_t b data tag_of_data type_of_tag -> s32: LowParse.SLow.Base.serializer32 s { Mkparser_kind'?.parser_kind_subkind kt == FStar.Pervasives.Native.Some LowParse.Spec.Base.ParserStrong } -> g: (x: LowParse.Spec.BitSum.bitsum'_key_type b -> LowParse.Spec.Base.serializer (FStar.Pervasives.dsnd (f x))) -> g32: (x: LowParse.Spec.BitSum.bitsum'_key_type b -> LowParse.SLow.Base.serializer32 (g x)) -> sq: Prims.squash (LowParse.SLow.BitSum.serialize32_bitsum_cond b kt type_of_tag f) -> LowParse.SLow.Base.serializer32 (LowParse.Spec.BitSum.serialize_bitsum b tag_of_data type_of_tag synth_case s g)
Prims.Tot
[ "total" ]
[]
[ "LowParse.Spec.Base.parser_kind", "Prims.pos", "Prims.eqtype", "LowParse.BitFields.uint_t", "LowParse.Spec.BitSum.bitsum'", "LowParse.Spec.BitSum.bitsum'_type", "LowParse.Spec.BitSum.bitsum'_key_type", "LowParse.Spec.BitSum.synth_case_t", "LowParse.Spec.Base.parser", "LowParse.Spec.Base.serializer", "LowParse.SLow.Base.serializer32", "Prims.eq2", "FStar.Pervasives.Native.option", "LowParse.Spec.Base.parser_subkind", "LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_subkind", "FStar.Pervasives.Native.Some", "LowParse.Spec.Base.ParserStrong", "Prims.dtuple2", "Prims.__proj__Mkdtuple2__item___1", "FStar.Pervasives.dsnd", "Prims.squash", "Prims.b2t", "LowParse.SLow.BitSum.serialize32_bitsum_cond", "FStar.Bytes.append", "LowParse.SLow.Base.bytes32", "LowParse.SLow.Base.serializer32_correct", "LowParse.Spec.BitSum.synth_bitsum'_recip", "LowParse.Spec.BitSum.bitsum'_key_of_t", "LowParse.Spec.BitSum.__proj__SynthCase__item__g", "Prims.unit", "LowParse.Spec.BitSum.serialize_bitsum_eq", "LowParse.Spec.BitSum.parse_bitsum_kind", "LowParse.Spec.BitSum.parse_bitsum", "LowParse.Spec.BitSum.serialize_bitsum" ]
[]
false
false
false
false
false
let serialize32_bitsum (#kt: parser_kind) (#tot: pos) (#t: eqtype) (#cl: uint_t tot t) (b: bitsum' cl tot) (#data: Type) (tag_of_data: (data -> Tot (bitsum'_type b))) (type_of_tag: (bitsum'_key_type b -> Tot Type)) (synth_case: synth_case_t b data tag_of_data type_of_tag) (#p: parser kt t) (#s: serializer p) (s32: serializer32 s {kt.parser_kind_subkind == Some ParserStrong}) (#f: (x: bitsum'_key_type b -> Tot (k: parser_kind & parser k (type_of_tag x)))) (g: (x: bitsum'_key_type b -> Tot (serializer (dsnd (f x))))) (g32: (x: bitsum'_key_type b -> Tot (serializer32 (g x)))) (sq: squash (serialize32_bitsum_cond b kt type_of_tag f)) : Tot (serializer32 (serialize_bitsum b tag_of_data type_of_tag synth_case s #f g)) =
fun x -> serialize_bitsum_eq b tag_of_data type_of_tag synth_case s g x; let tg = tag_of_data x in let k = bitsum'_key_of_t b tg in let payload = synth_case.g tg x in let s_tg = s32 (synth_bitsum'_recip b tg) in let s_pl = g32 k payload in s_tg `B32.append` s_pl
false
Vale.Math.Poly2.Defs_s.fst
Vale.Math.Poly2.Defs_s.mod
val mod (a: poly) (b: poly{length b > 0}) : poly
val mod (a: poly) (b: poly{length b > 0}) : poly
let mod (a:poly) (b:poly{length b > 0}) : poly = snd (divmod a b)
{ "file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 65, "end_line": 132, "start_col": 0, "start_line": 132 }
module Vale.Math.Poly2.Defs_s open FStar.Mul open FStar.Seq unfold let max = FStar.Math.Lib.max // Polynomials cn * x^n + ... + c0 * x^0 // where coefficients ck are treated mod 2 let valid (s:seq bool) : bool = length s = 0 || index s (length s - 1) // Each coefficient of a polynomial is 0 (false) or 1 (true). // Each polynomial has a unique valid representation: // - zero is [] // - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term) // The unique representation ensures that mathematically equal polynomials are = in F*. // s[0] is lowest-order term (x^0). let poly = s:(seq bool){valid s} let degree (p:poly) : int = length p - 1 let zero = create 0 false let one = create 1 true let monomial (n:nat) : poly = append (create n false) one let lshift (p:poly) (n:nat) : poly = if length p = 0 then p else append (create n false) p let rshift (p:poly) (n:nat) : poly = if length p <= n then zero else slice p n (length p) let shift (p:poly) (n:int) : poly = if n >= 0 then lshift p n else rshift p (-n) // Index any coefficient, where all coefficients beyond highest-order term are zero // (and n < 0 returns zero) let poly_index (p:poly) (n:int) : bool = if 0 <= n && n < length p then index p n else false unfold let ( .[] ) = poly_index let to_seq (p:poly) (n:nat) : Pure (seq bool) (requires True) (ensures fun s -> length s == n /\ (forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i) ) = init n (poly_index p) let rec of_seq (s:seq bool) : Pure poly (requires True) (ensures fun p -> length p <= length s /\ (forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i) ) (decreases (length s)) = if valid s then s else of_seq (slice s 0 (length s - 1)) [@"opaque_to_smt"] let of_fun (len:nat) (f:nat -> bool) : Pure poly (requires True) (ensures fun p -> length p <= len /\ (forall (i:nat).{:pattern p.[i] \/ (f i)} i < len ==> p.[i] == f i) /\ (forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i < len) ) = of_seq (init len f) [@"opaque_to_smt"] let reverse (a:poly) (n:nat) : Pure poly (requires True) (ensures fun p -> length p <= n + 1 /\ (forall (i:nat).{:pattern p.[i]} p.[i] == a.[n - i]) /\ (forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i <= n) ) = of_fun (n + 1) (fun (i:nat) -> a.[n - i]) [@"opaque_to_smt"] let add (a b:poly) : Pure poly (requires True) (ensures fun p -> let len = max (length a) (length b) in length p <= len /\ (forall (i:int).{:pattern p.[i] \/ a.[i] \/ b.[i]} p.[i] == (a.[i] <> b.[i])) ) = let len = max (length a) (length b) in of_fun len (fun (i:nat) -> a.[i] <> b.[i]) // f j + f (j + 1) + ... + f (k - 1) let rec sum_of_bools (j k:int) (f:int -> bool) : Tot bool (decreases (k - j)) = if j >= k then false else (sum_of_bools j (k - 1) f) <> f (k - 1) let mul_element_fun (a b:poly) (k i:int) : bool = a.[i] && b.[k - i] // a0 * bk + a1 * b(k-1) + ... + ak * b0 let mul_element (a b:poly) (k:int) : bool = sum_of_bools 0 (k + 1) (mul_element_fun a b k) [@"opaque_to_smt"] let mul (a b:poly) : Pure poly (requires True) (ensures fun p -> let len = length a + length b in length p <= len /\ (forall (i:nat).{:pattern p.[i]} i < len ==> p.[i] == mul_element a b i) ) = let len = length a + length b in of_fun len (fun (i:nat) -> mul_element a b i) let rec divmod (a:poly) (b:poly{length b > 0}) : Tot (poly & poly) (decreases (length a)) = if length a < length b then (zero, a) else let _ = assert (a.[length a - 1]) in let a' = add a (shift b (length a - length b)) in let (d, m) = divmod a' b in (add d (monomial (length a - length b)), m)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Defs_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Vale.Math.Poly2.Defs_s.poly -> b: Vale.Math.Poly2.Defs_s.poly{FStar.Seq.Base.length b > 0} -> Vale.Math.Poly2.Defs_s.poly
Prims.Tot
[ "total" ]
[]
[ "Vale.Math.Poly2.Defs_s.poly", "Prims.b2t", "Prims.op_GreaterThan", "FStar.Seq.Base.length", "Prims.bool", "FStar.Pervasives.Native.snd", "Vale.Math.Poly2.Defs_s.divmod" ]
[]
false
false
false
false
false
let mod (a: poly) (b: poly{length b > 0}) : poly =
snd (divmod a b)
false
Vale.Math.Poly2.Defs_s.fst
Vale.Math.Poly2.Defs_s.mul_element
val mul_element (a b: poly) (k: int) : bool
val mul_element (a b: poly) (k: int) : bool
let mul_element (a b:poly) (k:int) : bool = sum_of_bools 0 (k + 1) (mul_element_fun a b k)
{ "file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 48, "end_line": 108, "start_col": 0, "start_line": 107 }
module Vale.Math.Poly2.Defs_s open FStar.Mul open FStar.Seq unfold let max = FStar.Math.Lib.max // Polynomials cn * x^n + ... + c0 * x^0 // where coefficients ck are treated mod 2 let valid (s:seq bool) : bool = length s = 0 || index s (length s - 1) // Each coefficient of a polynomial is 0 (false) or 1 (true). // Each polynomial has a unique valid representation: // - zero is [] // - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term) // The unique representation ensures that mathematically equal polynomials are = in F*. // s[0] is lowest-order term (x^0). let poly = s:(seq bool){valid s} let degree (p:poly) : int = length p - 1 let zero = create 0 false let one = create 1 true let monomial (n:nat) : poly = append (create n false) one let lshift (p:poly) (n:nat) : poly = if length p = 0 then p else append (create n false) p let rshift (p:poly) (n:nat) : poly = if length p <= n then zero else slice p n (length p) let shift (p:poly) (n:int) : poly = if n >= 0 then lshift p n else rshift p (-n) // Index any coefficient, where all coefficients beyond highest-order term are zero // (and n < 0 returns zero) let poly_index (p:poly) (n:int) : bool = if 0 <= n && n < length p then index p n else false unfold let ( .[] ) = poly_index let to_seq (p:poly) (n:nat) : Pure (seq bool) (requires True) (ensures fun s -> length s == n /\ (forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i) ) = init n (poly_index p) let rec of_seq (s:seq bool) : Pure poly (requires True) (ensures fun p -> length p <= length s /\ (forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i) ) (decreases (length s)) = if valid s then s else of_seq (slice s 0 (length s - 1)) [@"opaque_to_smt"] let of_fun (len:nat) (f:nat -> bool) : Pure poly (requires True) (ensures fun p -> length p <= len /\ (forall (i:nat).{:pattern p.[i] \/ (f i)} i < len ==> p.[i] == f i) /\ (forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i < len) ) = of_seq (init len f) [@"opaque_to_smt"] let reverse (a:poly) (n:nat) : Pure poly (requires True) (ensures fun p -> length p <= n + 1 /\ (forall (i:nat).{:pattern p.[i]} p.[i] == a.[n - i]) /\ (forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i <= n) ) = of_fun (n + 1) (fun (i:nat) -> a.[n - i]) [@"opaque_to_smt"] let add (a b:poly) : Pure poly (requires True) (ensures fun p -> let len = max (length a) (length b) in length p <= len /\ (forall (i:int).{:pattern p.[i] \/ a.[i] \/ b.[i]} p.[i] == (a.[i] <> b.[i])) ) = let len = max (length a) (length b) in of_fun len (fun (i:nat) -> a.[i] <> b.[i]) // f j + f (j + 1) + ... + f (k - 1) let rec sum_of_bools (j k:int) (f:int -> bool) : Tot bool (decreases (k - j)) = if j >= k then false else (sum_of_bools j (k - 1) f) <> f (k - 1) let mul_element_fun (a b:poly) (k i:int) : bool = a.[i] && b.[k - i]
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Defs_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Vale.Math.Poly2.Defs_s.poly -> b: Vale.Math.Poly2.Defs_s.poly -> k: Prims.int -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "Vale.Math.Poly2.Defs_s.poly", "Prims.int", "Vale.Math.Poly2.Defs_s.sum_of_bools", "Prims.op_Addition", "Vale.Math.Poly2.Defs_s.mul_element_fun", "Prims.bool" ]
[]
false
false
false
true
false
let mul_element (a b: poly) (k: int) : bool =
sum_of_bools 0 (k + 1) (mul_element_fun a b k)
false
Vale.Math.Poly2.Defs_s.fst
Vale.Math.Poly2.Defs_s.mul_element_fun
val mul_element_fun (a b: poly) (k i: int) : bool
val mul_element_fun (a b: poly) (k i: int) : bool
let mul_element_fun (a b:poly) (k i:int) : bool = a.[i] && b.[k - i]
{ "file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 68, "end_line": 104, "start_col": 0, "start_line": 104 }
module Vale.Math.Poly2.Defs_s open FStar.Mul open FStar.Seq unfold let max = FStar.Math.Lib.max // Polynomials cn * x^n + ... + c0 * x^0 // where coefficients ck are treated mod 2 let valid (s:seq bool) : bool = length s = 0 || index s (length s - 1) // Each coefficient of a polynomial is 0 (false) or 1 (true). // Each polynomial has a unique valid representation: // - zero is [] // - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term) // The unique representation ensures that mathematically equal polynomials are = in F*. // s[0] is lowest-order term (x^0). let poly = s:(seq bool){valid s} let degree (p:poly) : int = length p - 1 let zero = create 0 false let one = create 1 true let monomial (n:nat) : poly = append (create n false) one let lshift (p:poly) (n:nat) : poly = if length p = 0 then p else append (create n false) p let rshift (p:poly) (n:nat) : poly = if length p <= n then zero else slice p n (length p) let shift (p:poly) (n:int) : poly = if n >= 0 then lshift p n else rshift p (-n) // Index any coefficient, where all coefficients beyond highest-order term are zero // (and n < 0 returns zero) let poly_index (p:poly) (n:int) : bool = if 0 <= n && n < length p then index p n else false unfold let ( .[] ) = poly_index let to_seq (p:poly) (n:nat) : Pure (seq bool) (requires True) (ensures fun s -> length s == n /\ (forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i) ) = init n (poly_index p) let rec of_seq (s:seq bool) : Pure poly (requires True) (ensures fun p -> length p <= length s /\ (forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i) ) (decreases (length s)) = if valid s then s else of_seq (slice s 0 (length s - 1)) [@"opaque_to_smt"] let of_fun (len:nat) (f:nat -> bool) : Pure poly (requires True) (ensures fun p -> length p <= len /\ (forall (i:nat).{:pattern p.[i] \/ (f i)} i < len ==> p.[i] == f i) /\ (forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i < len) ) = of_seq (init len f) [@"opaque_to_smt"] let reverse (a:poly) (n:nat) : Pure poly (requires True) (ensures fun p -> length p <= n + 1 /\ (forall (i:nat).{:pattern p.[i]} p.[i] == a.[n - i]) /\ (forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i <= n) ) = of_fun (n + 1) (fun (i:nat) -> a.[n - i]) [@"opaque_to_smt"] let add (a b:poly) : Pure poly (requires True) (ensures fun p -> let len = max (length a) (length b) in length p <= len /\ (forall (i:int).{:pattern p.[i] \/ a.[i] \/ b.[i]} p.[i] == (a.[i] <> b.[i])) ) = let len = max (length a) (length b) in of_fun len (fun (i:nat) -> a.[i] <> b.[i]) // f j + f (j + 1) + ... + f (k - 1) let rec sum_of_bools (j k:int) (f:int -> bool) : Tot bool (decreases (k - j)) = if j >= k then false else (sum_of_bools j (k - 1) f) <> f (k - 1)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Defs_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Vale.Math.Poly2.Defs_s.poly -> b: Vale.Math.Poly2.Defs_s.poly -> k: Prims.int -> i: Prims.int -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "Vale.Math.Poly2.Defs_s.poly", "Prims.int", "Prims.op_AmpAmp", "Vale.Math.Poly2.Defs_s.op_String_Access", "Prims.op_Subtraction", "Prims.bool" ]
[]
false
false
false
true
false
let mul_element_fun (a b: poly) (k i: int) : bool =
a.[ i ] && b.[ k - i ]
false
Vale.Math.Poly2.Defs_s.fst
Vale.Math.Poly2.Defs_s.div
val div (a: poly) (b: poly{length b > 0}) : poly
val div (a: poly) (b: poly{length b > 0}) : poly
let div (a:poly) (b:poly{length b > 0}) : poly = fst (divmod a b)
{ "file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 65, "end_line": 131, "start_col": 0, "start_line": 131 }
module Vale.Math.Poly2.Defs_s open FStar.Mul open FStar.Seq unfold let max = FStar.Math.Lib.max // Polynomials cn * x^n + ... + c0 * x^0 // where coefficients ck are treated mod 2 let valid (s:seq bool) : bool = length s = 0 || index s (length s - 1) // Each coefficient of a polynomial is 0 (false) or 1 (true). // Each polynomial has a unique valid representation: // - zero is [] // - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term) // The unique representation ensures that mathematically equal polynomials are = in F*. // s[0] is lowest-order term (x^0). let poly = s:(seq bool){valid s} let degree (p:poly) : int = length p - 1 let zero = create 0 false let one = create 1 true let monomial (n:nat) : poly = append (create n false) one let lshift (p:poly) (n:nat) : poly = if length p = 0 then p else append (create n false) p let rshift (p:poly) (n:nat) : poly = if length p <= n then zero else slice p n (length p) let shift (p:poly) (n:int) : poly = if n >= 0 then lshift p n else rshift p (-n) // Index any coefficient, where all coefficients beyond highest-order term are zero // (and n < 0 returns zero) let poly_index (p:poly) (n:int) : bool = if 0 <= n && n < length p then index p n else false unfold let ( .[] ) = poly_index let to_seq (p:poly) (n:nat) : Pure (seq bool) (requires True) (ensures fun s -> length s == n /\ (forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i) ) = init n (poly_index p) let rec of_seq (s:seq bool) : Pure poly (requires True) (ensures fun p -> length p <= length s /\ (forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i) ) (decreases (length s)) = if valid s then s else of_seq (slice s 0 (length s - 1)) [@"opaque_to_smt"] let of_fun (len:nat) (f:nat -> bool) : Pure poly (requires True) (ensures fun p -> length p <= len /\ (forall (i:nat).{:pattern p.[i] \/ (f i)} i < len ==> p.[i] == f i) /\ (forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i < len) ) = of_seq (init len f) [@"opaque_to_smt"] let reverse (a:poly) (n:nat) : Pure poly (requires True) (ensures fun p -> length p <= n + 1 /\ (forall (i:nat).{:pattern p.[i]} p.[i] == a.[n - i]) /\ (forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i <= n) ) = of_fun (n + 1) (fun (i:nat) -> a.[n - i]) [@"opaque_to_smt"] let add (a b:poly) : Pure poly (requires True) (ensures fun p -> let len = max (length a) (length b) in length p <= len /\ (forall (i:int).{:pattern p.[i] \/ a.[i] \/ b.[i]} p.[i] == (a.[i] <> b.[i])) ) = let len = max (length a) (length b) in of_fun len (fun (i:nat) -> a.[i] <> b.[i]) // f j + f (j + 1) + ... + f (k - 1) let rec sum_of_bools (j k:int) (f:int -> bool) : Tot bool (decreases (k - j)) = if j >= k then false else (sum_of_bools j (k - 1) f) <> f (k - 1) let mul_element_fun (a b:poly) (k i:int) : bool = a.[i] && b.[k - i] // a0 * bk + a1 * b(k-1) + ... + ak * b0 let mul_element (a b:poly) (k:int) : bool = sum_of_bools 0 (k + 1) (mul_element_fun a b k) [@"opaque_to_smt"] let mul (a b:poly) : Pure poly (requires True) (ensures fun p -> let len = length a + length b in length p <= len /\ (forall (i:nat).{:pattern p.[i]} i < len ==> p.[i] == mul_element a b i) ) = let len = length a + length b in of_fun len (fun (i:nat) -> mul_element a b i) let rec divmod (a:poly) (b:poly{length b > 0}) : Tot (poly & poly) (decreases (length a)) = if length a < length b then (zero, a) else let _ = assert (a.[length a - 1]) in let a' = add a (shift b (length a - length b)) in let (d, m) = divmod a' b in (add d (monomial (length a - length b)), m)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Defs_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Vale.Math.Poly2.Defs_s.poly -> b: Vale.Math.Poly2.Defs_s.poly{FStar.Seq.Base.length b > 0} -> Vale.Math.Poly2.Defs_s.poly
Prims.Tot
[ "total" ]
[]
[ "Vale.Math.Poly2.Defs_s.poly", "Prims.b2t", "Prims.op_GreaterThan", "FStar.Seq.Base.length", "Prims.bool", "FStar.Pervasives.Native.fst", "Vale.Math.Poly2.Defs_s.divmod" ]
[]
false
false
false
false
false
let div (a: poly) (b: poly{length b > 0}) : poly =
fst (divmod a b)
false
Vale.Math.Poly2.Defs_s.fst
Vale.Math.Poly2.Defs_s.valid
val valid (s: seq bool) : bool
val valid (s: seq bool) : bool
let valid (s:seq bool) : bool = length s = 0 || index s (length s - 1)
{ "file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 40, "end_line": 10, "start_col": 0, "start_line": 9 }
module Vale.Math.Poly2.Defs_s open FStar.Mul open FStar.Seq unfold let max = FStar.Math.Lib.max // Polynomials cn * x^n + ... + c0 * x^0 // where coefficients ck are treated mod 2
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Defs_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: FStar.Seq.Base.seq Prims.bool -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "FStar.Seq.Base.seq", "Prims.bool", "Prims.op_BarBar", "Prims.op_Equality", "Prims.int", "FStar.Seq.Base.length", "FStar.Seq.Base.index", "Prims.op_Subtraction" ]
[]
false
false
false
true
false
let valid (s: seq bool) : bool =
length s = 0 || index s (length s - 1)
false
Vale.Math.Poly2.Defs_s.fst
Vale.Math.Poly2.Defs_s.poly_index
val poly_index (p: poly) (n: int) : bool
val poly_index (p: poly) (n: int) : bool
let poly_index (p:poly) (n:int) : bool = if 0 <= n && n < length p then index p n else false
{ "file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 12, "end_line": 40, "start_col": 0, "start_line": 38 }
module Vale.Math.Poly2.Defs_s open FStar.Mul open FStar.Seq unfold let max = FStar.Math.Lib.max // Polynomials cn * x^n + ... + c0 * x^0 // where coefficients ck are treated mod 2 let valid (s:seq bool) : bool = length s = 0 || index s (length s - 1) // Each coefficient of a polynomial is 0 (false) or 1 (true). // Each polynomial has a unique valid representation: // - zero is [] // - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term) // The unique representation ensures that mathematically equal polynomials are = in F*. // s[0] is lowest-order term (x^0). let poly = s:(seq bool){valid s} let degree (p:poly) : int = length p - 1 let zero = create 0 false let one = create 1 true let monomial (n:nat) : poly = append (create n false) one let lshift (p:poly) (n:nat) : poly = if length p = 0 then p else append (create n false) p let rshift (p:poly) (n:nat) : poly = if length p <= n then zero else slice p n (length p) let shift (p:poly) (n:int) : poly = if n >= 0 then lshift p n else rshift p (-n) // Index any coefficient, where all coefficients beyond highest-order term are zero
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Defs_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: Vale.Math.Poly2.Defs_s.poly -> n: Prims.int -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "Vale.Math.Poly2.Defs_s.poly", "Prims.int", "Prims.op_AmpAmp", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "FStar.Seq.Base.length", "Prims.bool", "FStar.Seq.Base.index" ]
[]
false
false
false
true
false
let poly_index (p: poly) (n: int) : bool =
if 0 <= n && n < length p then index p n else false
false
Vale.Math.Poly2.Defs_s.fst
Vale.Math.Poly2.Defs_s.lshift
val lshift (p: poly) (n: nat) : poly
val lshift (p: poly) (n: nat) : poly
let lshift (p:poly) (n:nat) : poly = if length p = 0 then p else append (create n false) p
{ "file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 32, "end_line": 27, "start_col": 0, "start_line": 25 }
module Vale.Math.Poly2.Defs_s open FStar.Mul open FStar.Seq unfold let max = FStar.Math.Lib.max // Polynomials cn * x^n + ... + c0 * x^0 // where coefficients ck are treated mod 2 let valid (s:seq bool) : bool = length s = 0 || index s (length s - 1) // Each coefficient of a polynomial is 0 (false) or 1 (true). // Each polynomial has a unique valid representation: // - zero is [] // - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term) // The unique representation ensures that mathematically equal polynomials are = in F*. // s[0] is lowest-order term (x^0). let poly = s:(seq bool){valid s} let degree (p:poly) : int = length p - 1 let zero = create 0 false let one = create 1 true let monomial (n:nat) : poly = append (create n false) one
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Defs_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: Vale.Math.Poly2.Defs_s.poly -> n: Prims.nat -> Vale.Math.Poly2.Defs_s.poly
Prims.Tot
[ "total" ]
[]
[ "Vale.Math.Poly2.Defs_s.poly", "Prims.nat", "Prims.op_Equality", "Prims.int", "FStar.Seq.Base.length", "Prims.bool", "FStar.Seq.Base.append", "FStar.Seq.Base.create" ]
[]
false
false
false
true
false
let lshift (p: poly) (n: nat) : poly =
if length p = 0 then p else append (create n false) p
false
Vale.Math.Poly2.Defs_s.fst
Vale.Math.Poly2.Defs_s.shift
val shift (p: poly) (n: int) : poly
val shift (p: poly) (n: int) : poly
let shift (p:poly) (n:int) : poly = if n >= 0 then lshift p n else rshift p (-n)
{ "file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 46, "end_line": 34, "start_col": 0, "start_line": 33 }
module Vale.Math.Poly2.Defs_s open FStar.Mul open FStar.Seq unfold let max = FStar.Math.Lib.max // Polynomials cn * x^n + ... + c0 * x^0 // where coefficients ck are treated mod 2 let valid (s:seq bool) : bool = length s = 0 || index s (length s - 1) // Each coefficient of a polynomial is 0 (false) or 1 (true). // Each polynomial has a unique valid representation: // - zero is [] // - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term) // The unique representation ensures that mathematically equal polynomials are = in F*. // s[0] is lowest-order term (x^0). let poly = s:(seq bool){valid s} let degree (p:poly) : int = length p - 1 let zero = create 0 false let one = create 1 true let monomial (n:nat) : poly = append (create n false) one let lshift (p:poly) (n:nat) : poly = if length p = 0 then p else append (create n false) p let rshift (p:poly) (n:nat) : poly = if length p <= n then zero else slice p n (length p)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Defs_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: Vale.Math.Poly2.Defs_s.poly -> n: Prims.int -> Vale.Math.Poly2.Defs_s.poly
Prims.Tot
[ "total" ]
[]
[ "Vale.Math.Poly2.Defs_s.poly", "Prims.int", "Prims.op_GreaterThanOrEqual", "Vale.Math.Poly2.Defs_s.lshift", "Prims.bool", "Vale.Math.Poly2.Defs_s.rshift", "Prims.op_Minus" ]
[]
false
false
false
true
false
let shift (p: poly) (n: int) : poly =
if n >= 0 then lshift p n else rshift p (- n)
false
Vale.Math.Poly2.Defs_s.fst
Vale.Math.Poly2.Defs_s.monomial
val monomial (n: nat) : poly
val monomial (n: nat) : poly
let monomial (n:nat) : poly = append (create n false) one
{ "file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 57, "end_line": 23, "start_col": 0, "start_line": 23 }
module Vale.Math.Poly2.Defs_s open FStar.Mul open FStar.Seq unfold let max = FStar.Math.Lib.max // Polynomials cn * x^n + ... + c0 * x^0 // where coefficients ck are treated mod 2 let valid (s:seq bool) : bool = length s = 0 || index s (length s - 1) // Each coefficient of a polynomial is 0 (false) or 1 (true). // Each polynomial has a unique valid representation: // - zero is [] // - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term) // The unique representation ensures that mathematically equal polynomials are = in F*. // s[0] is lowest-order term (x^0). let poly = s:(seq bool){valid s} let degree (p:poly) : int = length p - 1 let zero = create 0 false
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Defs_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
n: Prims.nat -> Vale.Math.Poly2.Defs_s.poly
Prims.Tot
[ "total" ]
[]
[ "Prims.nat", "FStar.Seq.Base.append", "Prims.bool", "FStar.Seq.Base.create", "Vale.Math.Poly2.Defs_s.one", "Vale.Math.Poly2.Defs_s.poly" ]
[]
false
false
false
true
false
let monomial (n: nat) : poly =
append (create n false) one
false
Vale.Math.Poly2.Defs_s.fst
Vale.Math.Poly2.Defs_s.rshift
val rshift (p: poly) (n: nat) : poly
val rshift (p: poly) (n: nat) : poly
let rshift (p:poly) (n:nat) : poly = if length p <= n then zero else slice p n (length p)
{ "file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 27, "end_line": 31, "start_col": 0, "start_line": 29 }
module Vale.Math.Poly2.Defs_s open FStar.Mul open FStar.Seq unfold let max = FStar.Math.Lib.max // Polynomials cn * x^n + ... + c0 * x^0 // where coefficients ck are treated mod 2 let valid (s:seq bool) : bool = length s = 0 || index s (length s - 1) // Each coefficient of a polynomial is 0 (false) or 1 (true). // Each polynomial has a unique valid representation: // - zero is [] // - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term) // The unique representation ensures that mathematically equal polynomials are = in F*. // s[0] is lowest-order term (x^0). let poly = s:(seq bool){valid s} let degree (p:poly) : int = length p - 1 let zero = create 0 false let one = create 1 true let monomial (n:nat) : poly = append (create n false) one let lshift (p:poly) (n:nat) : poly = if length p = 0 then p else append (create n false) p
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Defs_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: Vale.Math.Poly2.Defs_s.poly -> n: Prims.nat -> Vale.Math.Poly2.Defs_s.poly
Prims.Tot
[ "total" ]
[]
[ "Vale.Math.Poly2.Defs_s.poly", "Prims.nat", "Prims.op_LessThanOrEqual", "FStar.Seq.Base.length", "Prims.bool", "Vale.Math.Poly2.Defs_s.zero", "FStar.Seq.Base.slice" ]
[]
false
false
false
true
false
let rshift (p: poly) (n: nat) : poly =
if length p <= n then zero else slice p n (length p)
false
Vale.Math.Poly2.Defs_s.fst
Vale.Math.Poly2.Defs_s.add
val add (a b: poly) : Pure poly (requires True) (ensures fun p -> let len = max (length a) (length b) in length p <= len /\ (forall (i: int). {:pattern p.[ i ]\/a.[ i ]\/b.[ i ]} p.[ i ] == (a.[ i ] <> b.[ i ])))
val add (a b: poly) : Pure poly (requires True) (ensures fun p -> let len = max (length a) (length b) in length p <= len /\ (forall (i: int). {:pattern p.[ i ]\/a.[ i ]\/b.[ i ]} p.[ i ] == (a.[ i ] <> b.[ i ])))
let add (a b:poly) : Pure poly (requires True) (ensures fun p -> let len = max (length a) (length b) in length p <= len /\ (forall (i:int).{:pattern p.[i] \/ a.[i] \/ b.[i]} p.[i] == (a.[i] <> b.[i])) ) = let len = max (length a) (length b) in of_fun len (fun (i:nat) -> a.[i] <> b.[i])
{ "file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 44, "end_line": 97, "start_col": 0, "start_line": 88 }
module Vale.Math.Poly2.Defs_s open FStar.Mul open FStar.Seq unfold let max = FStar.Math.Lib.max // Polynomials cn * x^n + ... + c0 * x^0 // where coefficients ck are treated mod 2 let valid (s:seq bool) : bool = length s = 0 || index s (length s - 1) // Each coefficient of a polynomial is 0 (false) or 1 (true). // Each polynomial has a unique valid representation: // - zero is [] // - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term) // The unique representation ensures that mathematically equal polynomials are = in F*. // s[0] is lowest-order term (x^0). let poly = s:(seq bool){valid s} let degree (p:poly) : int = length p - 1 let zero = create 0 false let one = create 1 true let monomial (n:nat) : poly = append (create n false) one let lshift (p:poly) (n:nat) : poly = if length p = 0 then p else append (create n false) p let rshift (p:poly) (n:nat) : poly = if length p <= n then zero else slice p n (length p) let shift (p:poly) (n:int) : poly = if n >= 0 then lshift p n else rshift p (-n) // Index any coefficient, where all coefficients beyond highest-order term are zero // (and n < 0 returns zero) let poly_index (p:poly) (n:int) : bool = if 0 <= n && n < length p then index p n else false unfold let ( .[] ) = poly_index let to_seq (p:poly) (n:nat) : Pure (seq bool) (requires True) (ensures fun s -> length s == n /\ (forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i) ) = init n (poly_index p) let rec of_seq (s:seq bool) : Pure poly (requires True) (ensures fun p -> length p <= length s /\ (forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i) ) (decreases (length s)) = if valid s then s else of_seq (slice s 0 (length s - 1)) [@"opaque_to_smt"] let of_fun (len:nat) (f:nat -> bool) : Pure poly (requires True) (ensures fun p -> length p <= len /\ (forall (i:nat).{:pattern p.[i] \/ (f i)} i < len ==> p.[i] == f i) /\ (forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i < len) ) = of_seq (init len f) [@"opaque_to_smt"] let reverse (a:poly) (n:nat) : Pure poly (requires True) (ensures fun p -> length p <= n + 1 /\ (forall (i:nat).{:pattern p.[i]} p.[i] == a.[n - i]) /\ (forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i <= n) ) = of_fun (n + 1) (fun (i:nat) -> a.[n - i])
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Defs_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Vale.Math.Poly2.Defs_s.poly -> b: Vale.Math.Poly2.Defs_s.poly -> Prims.Pure Vale.Math.Poly2.Defs_s.poly
Prims.Pure
[]
[]
[ "Vale.Math.Poly2.Defs_s.poly", "Vale.Math.Poly2.Defs_s.of_fun", "Prims.nat", "Prims.op_disEquality", "Prims.bool", "Vale.Math.Poly2.Defs_s.op_String_Access", "Prims.int", "Prims.l_and", "Prims.l_imp", "Prims.b2t", "Prims.op_GreaterThanOrEqual", "FStar.Seq.Base.length", "Prims.op_Equality", "Prims.op_LessThan", "Vale.Math.Poly2.Defs_s.max", "Prims.l_True", "Prims.op_LessThanOrEqual", "Prims.l_Forall", "Prims.eq2" ]
[]
false
false
false
false
false
let add (a b: poly) : Pure poly (requires True) (ensures fun p -> let len = max (length a) (length b) in length p <= len /\ (forall (i: int). {:pattern p.[ i ]\/a.[ i ]\/b.[ i ]} p.[ i ] == (a.[ i ] <> b.[ i ]))) =
let len = max (length a) (length b) in of_fun len (fun (i: nat) -> a.[ i ] <> b.[ i ])
false
Vale.Math.Poly2.Defs_s.fst
Vale.Math.Poly2.Defs_s.of_fun
val of_fun (len: nat) (f: (nat -> bool)) : Pure poly (requires True) (ensures fun p -> length p <= len /\ (forall (i: nat). {:pattern p.[ i ]\/(f i)} i < len ==> p.[ i ] == f i) /\ (forall (i: int). {:pattern p.[ i ]} p.[ i ] ==> 0 <= i /\ i < len))
val of_fun (len: nat) (f: (nat -> bool)) : Pure poly (requires True) (ensures fun p -> length p <= len /\ (forall (i: nat). {:pattern p.[ i ]\/(f i)} i < len ==> p.[ i ] == f i) /\ (forall (i: int). {:pattern p.[ i ]} p.[ i ] ==> 0 <= i /\ i < len))
let of_fun (len:nat) (f:nat -> bool) : Pure poly (requires True) (ensures fun p -> length p <= len /\ (forall (i:nat).{:pattern p.[i] \/ (f i)} i < len ==> p.[i] == f i) /\ (forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i < len) ) = of_seq (init len f)
{ "file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 21, "end_line": 74, "start_col": 0, "start_line": 66 }
module Vale.Math.Poly2.Defs_s open FStar.Mul open FStar.Seq unfold let max = FStar.Math.Lib.max // Polynomials cn * x^n + ... + c0 * x^0 // where coefficients ck are treated mod 2 let valid (s:seq bool) : bool = length s = 0 || index s (length s - 1) // Each coefficient of a polynomial is 0 (false) or 1 (true). // Each polynomial has a unique valid representation: // - zero is [] // - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term) // The unique representation ensures that mathematically equal polynomials are = in F*. // s[0] is lowest-order term (x^0). let poly = s:(seq bool){valid s} let degree (p:poly) : int = length p - 1 let zero = create 0 false let one = create 1 true let monomial (n:nat) : poly = append (create n false) one let lshift (p:poly) (n:nat) : poly = if length p = 0 then p else append (create n false) p let rshift (p:poly) (n:nat) : poly = if length p <= n then zero else slice p n (length p) let shift (p:poly) (n:int) : poly = if n >= 0 then lshift p n else rshift p (-n) // Index any coefficient, where all coefficients beyond highest-order term are zero // (and n < 0 returns zero) let poly_index (p:poly) (n:int) : bool = if 0 <= n && n < length p then index p n else false unfold let ( .[] ) = poly_index let to_seq (p:poly) (n:nat) : Pure (seq bool) (requires True) (ensures fun s -> length s == n /\ (forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i) ) = init n (poly_index p) let rec of_seq (s:seq bool) : Pure poly (requires True) (ensures fun p -> length p <= length s /\ (forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i) ) (decreases (length s)) = if valid s then s else of_seq (slice s 0 (length s - 1))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Defs_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
len: Prims.nat -> f: (_: Prims.nat -> Prims.bool) -> Prims.Pure Vale.Math.Poly2.Defs_s.poly
Prims.Pure
[]
[]
[ "Prims.nat", "Prims.bool", "Vale.Math.Poly2.Defs_s.of_seq", "FStar.Seq.Base.init", "Vale.Math.Poly2.Defs_s.poly", "Prims.l_True", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.Seq.Base.length", "Prims.l_Forall", "Prims.l_imp", "Prims.op_LessThan", "Prims.eq2", "Vale.Math.Poly2.Defs_s.op_String_Access", "Prims.int" ]
[]
false
false
false
false
false
let of_fun (len: nat) (f: (nat -> bool)) : Pure poly (requires True) (ensures fun p -> length p <= len /\ (forall (i: nat). {:pattern p.[ i ]\/(f i)} i < len ==> p.[ i ] == f i) /\ (forall (i: int). {:pattern p.[ i ]} p.[ i ] ==> 0 <= i /\ i < len)) =
of_seq (init len f)
false
Vale.Math.Poly2.Defs_s.fst
Vale.Math.Poly2.Defs_s.of_seq
val of_seq (s: seq bool) : Pure poly (requires True) (ensures fun p -> length p <= length s /\ (forall (i: nat). {:pattern (p.[ i ])\/(index s i)} i < length s ==> p.[ i ] == index s i) ) (decreases (length s))
val of_seq (s: seq bool) : Pure poly (requires True) (ensures fun p -> length p <= length s /\ (forall (i: nat). {:pattern (p.[ i ])\/(index s i)} i < length s ==> p.[ i ] == index s i) ) (decreases (length s))
let rec of_seq (s:seq bool) : Pure poly (requires True) (ensures fun p -> length p <= length s /\ (forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i) ) (decreases (length s)) = if valid s then s else of_seq (slice s 0 (length s - 1))
{ "file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 37, "end_line": 63, "start_col": 0, "start_line": 53 }
module Vale.Math.Poly2.Defs_s open FStar.Mul open FStar.Seq unfold let max = FStar.Math.Lib.max // Polynomials cn * x^n + ... + c0 * x^0 // where coefficients ck are treated mod 2 let valid (s:seq bool) : bool = length s = 0 || index s (length s - 1) // Each coefficient of a polynomial is 0 (false) or 1 (true). // Each polynomial has a unique valid representation: // - zero is [] // - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term) // The unique representation ensures that mathematically equal polynomials are = in F*. // s[0] is lowest-order term (x^0). let poly = s:(seq bool){valid s} let degree (p:poly) : int = length p - 1 let zero = create 0 false let one = create 1 true let monomial (n:nat) : poly = append (create n false) one let lshift (p:poly) (n:nat) : poly = if length p = 0 then p else append (create n false) p let rshift (p:poly) (n:nat) : poly = if length p <= n then zero else slice p n (length p) let shift (p:poly) (n:int) : poly = if n >= 0 then lshift p n else rshift p (-n) // Index any coefficient, where all coefficients beyond highest-order term are zero // (and n < 0 returns zero) let poly_index (p:poly) (n:int) : bool = if 0 <= n && n < length p then index p n else false unfold let ( .[] ) = poly_index let to_seq (p:poly) (n:nat) : Pure (seq bool) (requires True) (ensures fun s -> length s == n /\ (forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i) ) = init n (poly_index p)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Defs_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: FStar.Seq.Base.seq Prims.bool -> Prims.Pure Vale.Math.Poly2.Defs_s.poly
Prims.Pure
[ "" ]
[]
[ "FStar.Seq.Base.seq", "Prims.bool", "Vale.Math.Poly2.Defs_s.valid", "Vale.Math.Poly2.Defs_s.of_seq", "FStar.Seq.Base.slice", "Prims.op_Subtraction", "FStar.Seq.Base.length", "Vale.Math.Poly2.Defs_s.poly", "Prims.l_True", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.l_Forall", "Prims.nat", "Prims.l_imp", "Prims.op_LessThan", "Prims.eq2", "Vale.Math.Poly2.Defs_s.op_String_Access", "FStar.Seq.Base.index" ]
[ "recursion" ]
false
false
false
false
false
let rec of_seq (s: seq bool) : Pure poly (requires True) (ensures fun p -> length p <= length s /\ (forall (i: nat). {:pattern (p.[ i ])\/(index s i)} i < length s ==> p.[ i ] == index s i) ) (decreases (length s)) =
if valid s then s else of_seq (slice s 0 (length s - 1))
false
Vale.Math.Poly2.Defs_s.fst
Vale.Math.Poly2.Defs_s.to_seq
val to_seq (p: poly) (n: nat) : Pure (seq bool) (requires True) (ensures fun s -> length s == n /\ (forall (i: nat). {:pattern (p.[ i ])\/(index s i)} i < length s ==> p.[ i ] == index s i) )
val to_seq (p: poly) (n: nat) : Pure (seq bool) (requires True) (ensures fun s -> length s == n /\ (forall (i: nat). {:pattern (p.[ i ])\/(index s i)} i < length s ==> p.[ i ] == index s i) )
let to_seq (p:poly) (n:nat) : Pure (seq bool) (requires True) (ensures fun s -> length s == n /\ (forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i) ) = init n (poly_index p)
{ "file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 23, "end_line": 51, "start_col": 0, "start_line": 44 }
module Vale.Math.Poly2.Defs_s open FStar.Mul open FStar.Seq unfold let max = FStar.Math.Lib.max // Polynomials cn * x^n + ... + c0 * x^0 // where coefficients ck are treated mod 2 let valid (s:seq bool) : bool = length s = 0 || index s (length s - 1) // Each coefficient of a polynomial is 0 (false) or 1 (true). // Each polynomial has a unique valid representation: // - zero is [] // - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term) // The unique representation ensures that mathematically equal polynomials are = in F*. // s[0] is lowest-order term (x^0). let poly = s:(seq bool){valid s} let degree (p:poly) : int = length p - 1 let zero = create 0 false let one = create 1 true let monomial (n:nat) : poly = append (create n false) one let lshift (p:poly) (n:nat) : poly = if length p = 0 then p else append (create n false) p let rshift (p:poly) (n:nat) : poly = if length p <= n then zero else slice p n (length p) let shift (p:poly) (n:int) : poly = if n >= 0 then lshift p n else rshift p (-n) // Index any coefficient, where all coefficients beyond highest-order term are zero // (and n < 0 returns zero) let poly_index (p:poly) (n:int) : bool = if 0 <= n && n < length p then index p n else false unfold let ( .[] ) = poly_index
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Defs_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: Vale.Math.Poly2.Defs_s.poly -> n: Prims.nat -> Prims.Pure (FStar.Seq.Base.seq Prims.bool)
Prims.Pure
[]
[]
[ "Vale.Math.Poly2.Defs_s.poly", "Prims.nat", "FStar.Seq.Base.init", "Prims.bool", "Vale.Math.Poly2.Defs_s.poly_index", "FStar.Seq.Base.seq", "Prims.l_True", "Prims.l_and", "Prims.eq2", "FStar.Seq.Base.length", "Prims.l_Forall", "Prims.l_imp", "Prims.b2t", "Prims.op_LessThan", "Vale.Math.Poly2.Defs_s.op_String_Access", "FStar.Seq.Base.index" ]
[]
false
false
false
false
false
let to_seq (p: poly) (n: nat) : Pure (seq bool) (requires True) (ensures fun s -> length s == n /\ (forall (i: nat). {:pattern (p.[ i ])\/(index s i)} i < length s ==> p.[ i ] == index s i) ) =
init n (poly_index p)
false
Vale.Math.Poly2.Defs_s.fst
Vale.Math.Poly2.Defs_s.sum_of_bools
val sum_of_bools (j k: int) (f: (int -> bool)) : Tot bool (decreases (k - j))
val sum_of_bools (j k: int) (f: (int -> bool)) : Tot bool (decreases (k - j))
let rec sum_of_bools (j k:int) (f:int -> bool) : Tot bool (decreases (k - j)) = if j >= k then false else (sum_of_bools j (k - 1) f) <> f (k - 1)
{ "file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 46, "end_line": 102, "start_col": 0, "start_line": 100 }
module Vale.Math.Poly2.Defs_s open FStar.Mul open FStar.Seq unfold let max = FStar.Math.Lib.max // Polynomials cn * x^n + ... + c0 * x^0 // where coefficients ck are treated mod 2 let valid (s:seq bool) : bool = length s = 0 || index s (length s - 1) // Each coefficient of a polynomial is 0 (false) or 1 (true). // Each polynomial has a unique valid representation: // - zero is [] // - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term) // The unique representation ensures that mathematically equal polynomials are = in F*. // s[0] is lowest-order term (x^0). let poly = s:(seq bool){valid s} let degree (p:poly) : int = length p - 1 let zero = create 0 false let one = create 1 true let monomial (n:nat) : poly = append (create n false) one let lshift (p:poly) (n:nat) : poly = if length p = 0 then p else append (create n false) p let rshift (p:poly) (n:nat) : poly = if length p <= n then zero else slice p n (length p) let shift (p:poly) (n:int) : poly = if n >= 0 then lshift p n else rshift p (-n) // Index any coefficient, where all coefficients beyond highest-order term are zero // (and n < 0 returns zero) let poly_index (p:poly) (n:int) : bool = if 0 <= n && n < length p then index p n else false unfold let ( .[] ) = poly_index let to_seq (p:poly) (n:nat) : Pure (seq bool) (requires True) (ensures fun s -> length s == n /\ (forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i) ) = init n (poly_index p) let rec of_seq (s:seq bool) : Pure poly (requires True) (ensures fun p -> length p <= length s /\ (forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i) ) (decreases (length s)) = if valid s then s else of_seq (slice s 0 (length s - 1)) [@"opaque_to_smt"] let of_fun (len:nat) (f:nat -> bool) : Pure poly (requires True) (ensures fun p -> length p <= len /\ (forall (i:nat).{:pattern p.[i] \/ (f i)} i < len ==> p.[i] == f i) /\ (forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i < len) ) = of_seq (init len f) [@"opaque_to_smt"] let reverse (a:poly) (n:nat) : Pure poly (requires True) (ensures fun p -> length p <= n + 1 /\ (forall (i:nat).{:pattern p.[i]} p.[i] == a.[n - i]) /\ (forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i <= n) ) = of_fun (n + 1) (fun (i:nat) -> a.[n - i]) [@"opaque_to_smt"] let add (a b:poly) : Pure poly (requires True) (ensures fun p -> let len = max (length a) (length b) in length p <= len /\ (forall (i:int).{:pattern p.[i] \/ a.[i] \/ b.[i]} p.[i] == (a.[i] <> b.[i])) ) = let len = max (length a) (length b) in of_fun len (fun (i:nat) -> a.[i] <> b.[i])
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Defs_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
j: Prims.int -> k: Prims.int -> f: (_: Prims.int -> Prims.bool) -> Prims.Tot Prims.bool
Prims.Tot
[ "total", "" ]
[]
[ "Prims.int", "Prims.bool", "Prims.op_GreaterThanOrEqual", "Prims.op_disEquality", "Vale.Math.Poly2.Defs_s.sum_of_bools", "Prims.op_Subtraction" ]
[ "recursion" ]
false
false
false
true
false
let rec sum_of_bools (j k: int) (f: (int -> bool)) : Tot bool (decreases (k - j)) =
if j >= k then false else (sum_of_bools j (k - 1) f) <> f (k - 1)
false
Vale.Math.Poly2.Defs_s.fst
Vale.Math.Poly2.Defs_s.mul
val mul (a b: poly) : Pure poly (requires True) (ensures fun p -> let len = length a + length b in length p <= len /\ (forall (i: nat). {:pattern p.[ i ]} i < len ==> p.[ i ] == mul_element a b i))
val mul (a b: poly) : Pure poly (requires True) (ensures fun p -> let len = length a + length b in length p <= len /\ (forall (i: nat). {:pattern p.[ i ]} i < len ==> p.[ i ] == mul_element a b i))
let mul (a b:poly) : Pure poly (requires True) (ensures fun p -> let len = length a + length b in length p <= len /\ (forall (i:nat).{:pattern p.[i]} i < len ==> p.[i] == mul_element a b i) ) = let len = length a + length b in of_fun len (fun (i:nat) -> mul_element a b i)
{ "file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 47, "end_line": 120, "start_col": 0, "start_line": 111 }
module Vale.Math.Poly2.Defs_s open FStar.Mul open FStar.Seq unfold let max = FStar.Math.Lib.max // Polynomials cn * x^n + ... + c0 * x^0 // where coefficients ck are treated mod 2 let valid (s:seq bool) : bool = length s = 0 || index s (length s - 1) // Each coefficient of a polynomial is 0 (false) or 1 (true). // Each polynomial has a unique valid representation: // - zero is [] // - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term) // The unique representation ensures that mathematically equal polynomials are = in F*. // s[0] is lowest-order term (x^0). let poly = s:(seq bool){valid s} let degree (p:poly) : int = length p - 1 let zero = create 0 false let one = create 1 true let monomial (n:nat) : poly = append (create n false) one let lshift (p:poly) (n:nat) : poly = if length p = 0 then p else append (create n false) p let rshift (p:poly) (n:nat) : poly = if length p <= n then zero else slice p n (length p) let shift (p:poly) (n:int) : poly = if n >= 0 then lshift p n else rshift p (-n) // Index any coefficient, where all coefficients beyond highest-order term are zero // (and n < 0 returns zero) let poly_index (p:poly) (n:int) : bool = if 0 <= n && n < length p then index p n else false unfold let ( .[] ) = poly_index let to_seq (p:poly) (n:nat) : Pure (seq bool) (requires True) (ensures fun s -> length s == n /\ (forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i) ) = init n (poly_index p) let rec of_seq (s:seq bool) : Pure poly (requires True) (ensures fun p -> length p <= length s /\ (forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i) ) (decreases (length s)) = if valid s then s else of_seq (slice s 0 (length s - 1)) [@"opaque_to_smt"] let of_fun (len:nat) (f:nat -> bool) : Pure poly (requires True) (ensures fun p -> length p <= len /\ (forall (i:nat).{:pattern p.[i] \/ (f i)} i < len ==> p.[i] == f i) /\ (forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i < len) ) = of_seq (init len f) [@"opaque_to_smt"] let reverse (a:poly) (n:nat) : Pure poly (requires True) (ensures fun p -> length p <= n + 1 /\ (forall (i:nat).{:pattern p.[i]} p.[i] == a.[n - i]) /\ (forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i <= n) ) = of_fun (n + 1) (fun (i:nat) -> a.[n - i]) [@"opaque_to_smt"] let add (a b:poly) : Pure poly (requires True) (ensures fun p -> let len = max (length a) (length b) in length p <= len /\ (forall (i:int).{:pattern p.[i] \/ a.[i] \/ b.[i]} p.[i] == (a.[i] <> b.[i])) ) = let len = max (length a) (length b) in of_fun len (fun (i:nat) -> a.[i] <> b.[i]) // f j + f (j + 1) + ... + f (k - 1) let rec sum_of_bools (j k:int) (f:int -> bool) : Tot bool (decreases (k - j)) = if j >= k then false else (sum_of_bools j (k - 1) f) <> f (k - 1) let mul_element_fun (a b:poly) (k i:int) : bool = a.[i] && b.[k - i] // a0 * bk + a1 * b(k-1) + ... + ak * b0 let mul_element (a b:poly) (k:int) : bool = sum_of_bools 0 (k + 1) (mul_element_fun a b k)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Defs_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Vale.Math.Poly2.Defs_s.poly -> b: Vale.Math.Poly2.Defs_s.poly -> Prims.Pure Vale.Math.Poly2.Defs_s.poly
Prims.Pure
[]
[]
[ "Vale.Math.Poly2.Defs_s.poly", "Vale.Math.Poly2.Defs_s.of_fun", "Prims.nat", "Vale.Math.Poly2.Defs_s.mul_element", "Prims.bool", "Prims.int", "Prims.op_Addition", "FStar.Seq.Base.length", "Prims.l_True", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.l_Forall", "Prims.l_imp", "Prims.op_LessThan", "Prims.eq2", "Vale.Math.Poly2.Defs_s.op_String_Access" ]
[]
false
false
false
false
false
let mul (a b: poly) : Pure poly (requires True) (ensures fun p -> let len = length a + length b in length p <= len /\ (forall (i: nat). {:pattern p.[ i ]} i < len ==> p.[ i ] == mul_element a b i)) =
let len = length a + length b in of_fun len (fun (i: nat) -> mul_element a b i)
false
Vale.Math.Poly2.Defs_s.fst
Vale.Math.Poly2.Defs_s.reverse
val reverse (a: poly) (n: nat) : Pure poly (requires True) (ensures fun p -> length p <= n + 1 /\ (forall (i: nat). {:pattern p.[ i ]} p.[ i ] == a.[ n - i ]) /\ (forall (i: int). {:pattern p.[ i ]} p.[ i ] ==> 0 <= i /\ i <= n))
val reverse (a: poly) (n: nat) : Pure poly (requires True) (ensures fun p -> length p <= n + 1 /\ (forall (i: nat). {:pattern p.[ i ]} p.[ i ] == a.[ n - i ]) /\ (forall (i: int). {:pattern p.[ i ]} p.[ i ] ==> 0 <= i /\ i <= n))
let reverse (a:poly) (n:nat) : Pure poly (requires True) (ensures fun p -> length p <= n + 1 /\ (forall (i:nat).{:pattern p.[i]} p.[i] == a.[n - i]) /\ (forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i <= n) ) = of_fun (n + 1) (fun (i:nat) -> a.[n - i])
{ "file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 43, "end_line": 85, "start_col": 0, "start_line": 77 }
module Vale.Math.Poly2.Defs_s open FStar.Mul open FStar.Seq unfold let max = FStar.Math.Lib.max // Polynomials cn * x^n + ... + c0 * x^0 // where coefficients ck are treated mod 2 let valid (s:seq bool) : bool = length s = 0 || index s (length s - 1) // Each coefficient of a polynomial is 0 (false) or 1 (true). // Each polynomial has a unique valid representation: // - zero is [] // - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term) // The unique representation ensures that mathematically equal polynomials are = in F*. // s[0] is lowest-order term (x^0). let poly = s:(seq bool){valid s} let degree (p:poly) : int = length p - 1 let zero = create 0 false let one = create 1 true let monomial (n:nat) : poly = append (create n false) one let lshift (p:poly) (n:nat) : poly = if length p = 0 then p else append (create n false) p let rshift (p:poly) (n:nat) : poly = if length p <= n then zero else slice p n (length p) let shift (p:poly) (n:int) : poly = if n >= 0 then lshift p n else rshift p (-n) // Index any coefficient, where all coefficients beyond highest-order term are zero // (and n < 0 returns zero) let poly_index (p:poly) (n:int) : bool = if 0 <= n && n < length p then index p n else false unfold let ( .[] ) = poly_index let to_seq (p:poly) (n:nat) : Pure (seq bool) (requires True) (ensures fun s -> length s == n /\ (forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i) ) = init n (poly_index p) let rec of_seq (s:seq bool) : Pure poly (requires True) (ensures fun p -> length p <= length s /\ (forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i) ) (decreases (length s)) = if valid s then s else of_seq (slice s 0 (length s - 1)) [@"opaque_to_smt"] let of_fun (len:nat) (f:nat -> bool) : Pure poly (requires True) (ensures fun p -> length p <= len /\ (forall (i:nat).{:pattern p.[i] \/ (f i)} i < len ==> p.[i] == f i) /\ (forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i < len) ) = of_seq (init len f)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Defs_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Vale.Math.Poly2.Defs_s.poly -> n: Prims.nat -> Prims.Pure Vale.Math.Poly2.Defs_s.poly
Prims.Pure
[]
[]
[ "Vale.Math.Poly2.Defs_s.poly", "Prims.nat", "Vale.Math.Poly2.Defs_s.of_fun", "Prims.op_Addition", "Vale.Math.Poly2.Defs_s.op_String_Access", "Prims.op_Subtraction", "Prims.bool", "Prims.l_True", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.Seq.Base.length", "Prims.l_Forall", "Prims.eq2", "Prims.int", "Prims.l_imp" ]
[]
false
false
false
false
false
let reverse (a: poly) (n: nat) : Pure poly (requires True) (ensures fun p -> length p <= n + 1 /\ (forall (i: nat). {:pattern p.[ i ]} p.[ i ] == a.[ n - i ]) /\ (forall (i: int). {:pattern p.[ i ]} p.[ i ] ==> 0 <= i /\ i <= n)) =
of_fun (n + 1) (fun (i: nat) -> a.[ n - i ])
false
Vale.Math.Poly2.Defs_s.fst
Vale.Math.Poly2.Defs_s.divmod
val divmod (a: poly) (b: poly{length b > 0}) : Tot (poly & poly) (decreases (length a))
val divmod (a: poly) (b: poly{length b > 0}) : Tot (poly & poly) (decreases (length a))
let rec divmod (a:poly) (b:poly{length b > 0}) : Tot (poly & poly) (decreases (length a)) = if length a < length b then (zero, a) else let _ = assert (a.[length a - 1]) in let a' = add a (shift b (length a - length b)) in let (d, m) = divmod a' b in (add d (monomial (length a - length b)), m)
{ "file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 47, "end_line": 129, "start_col": 0, "start_line": 122 }
module Vale.Math.Poly2.Defs_s open FStar.Mul open FStar.Seq unfold let max = FStar.Math.Lib.max // Polynomials cn * x^n + ... + c0 * x^0 // where coefficients ck are treated mod 2 let valid (s:seq bool) : bool = length s = 0 || index s (length s - 1) // Each coefficient of a polynomial is 0 (false) or 1 (true). // Each polynomial has a unique valid representation: // - zero is [] // - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term) // The unique representation ensures that mathematically equal polynomials are = in F*. // s[0] is lowest-order term (x^0). let poly = s:(seq bool){valid s} let degree (p:poly) : int = length p - 1 let zero = create 0 false let one = create 1 true let monomial (n:nat) : poly = append (create n false) one let lshift (p:poly) (n:nat) : poly = if length p = 0 then p else append (create n false) p let rshift (p:poly) (n:nat) : poly = if length p <= n then zero else slice p n (length p) let shift (p:poly) (n:int) : poly = if n >= 0 then lshift p n else rshift p (-n) // Index any coefficient, where all coefficients beyond highest-order term are zero // (and n < 0 returns zero) let poly_index (p:poly) (n:int) : bool = if 0 <= n && n < length p then index p n else false unfold let ( .[] ) = poly_index let to_seq (p:poly) (n:nat) : Pure (seq bool) (requires True) (ensures fun s -> length s == n /\ (forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i) ) = init n (poly_index p) let rec of_seq (s:seq bool) : Pure poly (requires True) (ensures fun p -> length p <= length s /\ (forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i) ) (decreases (length s)) = if valid s then s else of_seq (slice s 0 (length s - 1)) [@"opaque_to_smt"] let of_fun (len:nat) (f:nat -> bool) : Pure poly (requires True) (ensures fun p -> length p <= len /\ (forall (i:nat).{:pattern p.[i] \/ (f i)} i < len ==> p.[i] == f i) /\ (forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i < len) ) = of_seq (init len f) [@"opaque_to_smt"] let reverse (a:poly) (n:nat) : Pure poly (requires True) (ensures fun p -> length p <= n + 1 /\ (forall (i:nat).{:pattern p.[i]} p.[i] == a.[n - i]) /\ (forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i <= n) ) = of_fun (n + 1) (fun (i:nat) -> a.[n - i]) [@"opaque_to_smt"] let add (a b:poly) : Pure poly (requires True) (ensures fun p -> let len = max (length a) (length b) in length p <= len /\ (forall (i:int).{:pattern p.[i] \/ a.[i] \/ b.[i]} p.[i] == (a.[i] <> b.[i])) ) = let len = max (length a) (length b) in of_fun len (fun (i:nat) -> a.[i] <> b.[i]) // f j + f (j + 1) + ... + f (k - 1) let rec sum_of_bools (j k:int) (f:int -> bool) : Tot bool (decreases (k - j)) = if j >= k then false else (sum_of_bools j (k - 1) f) <> f (k - 1) let mul_element_fun (a b:poly) (k i:int) : bool = a.[i] && b.[k - i] // a0 * bk + a1 * b(k-1) + ... + ak * b0 let mul_element (a b:poly) (k:int) : bool = sum_of_bools 0 (k + 1) (mul_element_fun a b k) [@"opaque_to_smt"] let mul (a b:poly) : Pure poly (requires True) (ensures fun p -> let len = length a + length b in length p <= len /\ (forall (i:nat).{:pattern p.[i]} i < len ==> p.[i] == mul_element a b i) ) = let len = length a + length b in of_fun len (fun (i:nat) -> mul_element a b i)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lib.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Defs_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Vale.Math.Poly2.Defs_s.poly -> b: Vale.Math.Poly2.Defs_s.poly{FStar.Seq.Base.length b > 0} -> Prims.Tot (Vale.Math.Poly2.Defs_s.poly * Vale.Math.Poly2.Defs_s.poly)
Prims.Tot
[ "total", "" ]
[]
[ "Vale.Math.Poly2.Defs_s.poly", "Prims.b2t", "Prims.op_GreaterThan", "FStar.Seq.Base.length", "Prims.bool", "Prims.op_LessThan", "FStar.Pervasives.Native.Mktuple2", "Vale.Math.Poly2.Defs_s.zero", "Vale.Math.Poly2.Defs_s.add", "Vale.Math.Poly2.Defs_s.monomial", "Prims.op_Subtraction", "FStar.Pervasives.Native.tuple2", "Vale.Math.Poly2.Defs_s.divmod", "Vale.Math.Poly2.Defs_s.shift", "Prims.unit", "Prims._assert", "Vale.Math.Poly2.Defs_s.op_String_Access" ]
[ "recursion" ]
false
false
false
false
false
let rec divmod (a: poly) (b: poly{length b > 0}) : Tot (poly & poly) (decreases (length a)) =
if length a < length b then (zero, a) else let _ = assert (a.[ length a - 1 ]) in let a' = add a (shift b (length a - length b)) in let d, m = divmod a' b in (add d (monomial (length a - length b)), m)
false
Hacl.Spec.Bignum.fsti
Hacl.Spec.Bignum.bn_len
val bn_len : t: Hacl.Spec.Bignum.Definitions.limb_t -> Type0
let bn_len (t:limb_t) = len:size_pos{2 * bits t * len <= max_size_t}
{ "file_name": "code/bignum/Hacl.Spec.Bignum.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 68, "end_line": 16, "start_col": 0, "start_line": 16 }
module Hacl.Spec.Bignum open FStar.Mul open Lib.IntTypes open Lib.Sequence open Hacl.Spec.Bignum.Base open Hacl.Spec.Bignum.Definitions module BSeq = Lib.ByteSequence #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.Base.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Bignum.fsti" }
[ { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "BSeq" }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum.Base", "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.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
t: Hacl.Spec.Bignum.Definitions.limb_t -> Type0
Prims.Tot
[ "total" ]
[]
[ "Hacl.Spec.Bignum.Definitions.limb_t", "Lib.IntTypes.size_pos", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.Mul.op_Star", "Lib.IntTypes.bits", "Lib.IntTypes.max_size_t" ]
[]
false
false
false
true
true
let bn_len (t: limb_t) =
len: size_pos{(2 * bits t) * len <= max_size_t}
false
Hacl.Hash.SHA1.fst
Hacl.Hash.SHA1.update_last
val update_last: update_last_st (|SHA1, ()|)
val update_last: update_last_st (|SHA1, ()|)
let update_last: update_last_st (|SHA1, ()|) = Hacl.Hash.MD.mk_update_last SHA1 update_multi pad
{ "file_name": "code/hash/Hacl.Hash.SHA1.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 51, "end_line": 14, "start_col": 0, "start_line": 13 }
module Hacl.Hash.SHA1 open Hacl.Hash.Definitions open Spec.Hash.Definitions include Hacl.Hash.Core.SHA1 friend Hacl.Hash.MD let update_multi: update_multi_st (|SHA1, ()|) = Hacl.Hash.MD.mk_update_multi SHA1 update
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Hacl.Hash.MD.fst.checked", "Hacl.Hash.Definitions.fst.checked", "Hacl.Hash.Core.SHA1.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Hacl.Hash.SHA1.fst" }
[ { "abbrev": false, "full_module": "Hacl.Hash.Core.SHA1", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Hash.Definitions.update_last_st (| Spec.Hash.Definitions.SHA1, () |)
Prims.Tot
[ "total" ]
[]
[ "Hacl.Hash.MD.mk_update_last", "Spec.Hash.Definitions.SHA1", "Hacl.Hash.SHA1.update_multi", "Hacl.Hash.Core.SHA1.pad", "Hacl.Hash.Definitions.update_last_st", "Prims.Mkdtuple2", "Spec.Hash.Definitions.hash_alg", "Hacl.Hash.Definitions.m_spec" ]
[]
false
false
false
false
false
let update_last:update_last_st (| SHA1, () |) =
Hacl.Hash.MD.mk_update_last SHA1 update_multi pad
false
Hacl.Hash.SHA1.fst
Hacl.Hash.SHA1.update_multi
val update_multi: update_multi_st (|SHA1, ()|)
val update_multi: update_multi_st (|SHA1, ()|)
let update_multi: update_multi_st (|SHA1, ()|) = Hacl.Hash.MD.mk_update_multi SHA1 update
{ "file_name": "code/hash/Hacl.Hash.SHA1.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 42, "end_line": 11, "start_col": 0, "start_line": 10 }
module Hacl.Hash.SHA1 open Hacl.Hash.Definitions open Spec.Hash.Definitions include Hacl.Hash.Core.SHA1 friend Hacl.Hash.MD
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Hacl.Hash.MD.fst.checked", "Hacl.Hash.Definitions.fst.checked", "Hacl.Hash.Core.SHA1.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Hacl.Hash.SHA1.fst" }
[ { "abbrev": false, "full_module": "Hacl.Hash.Core.SHA1", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Hash.Definitions.update_multi_st (| Spec.Hash.Definitions.SHA1, () |)
Prims.Tot
[ "total" ]
[]
[ "Hacl.Hash.MD.mk_update_multi", "Spec.Hash.Definitions.SHA1", "Hacl.Hash.Core.SHA1.update", "Hacl.Hash.Definitions.update_multi_st", "Prims.Mkdtuple2", "Spec.Hash.Definitions.hash_alg", "Hacl.Hash.Definitions.m_spec" ]
[]
false
false
false
false
false
let update_multi:update_multi_st (| SHA1, () |) =
Hacl.Hash.MD.mk_update_multi SHA1 update
false
Hacl.Hash.SHA1.fst
Hacl.Hash.SHA1.hash_oneshot
val hash_oneshot: hash_st SHA1
val hash_oneshot: hash_st SHA1
let hash_oneshot: hash_st SHA1 = Hacl.Hash.MD.mk_hash SHA1 alloca update_multi update_last finish
{ "file_name": "code/hash/Hacl.Hash.SHA1.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 66, "end_line": 17, "start_col": 0, "start_line": 16 }
module Hacl.Hash.SHA1 open Hacl.Hash.Definitions open Spec.Hash.Definitions include Hacl.Hash.Core.SHA1 friend Hacl.Hash.MD let update_multi: update_multi_st (|SHA1, ()|) = Hacl.Hash.MD.mk_update_multi SHA1 update let update_last: update_last_st (|SHA1, ()|) = Hacl.Hash.MD.mk_update_last SHA1 update_multi pad
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Hacl.Hash.MD.fst.checked", "Hacl.Hash.Definitions.fst.checked", "Hacl.Hash.Core.SHA1.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Hacl.Hash.SHA1.fst" }
[ { "abbrev": false, "full_module": "Hacl.Hash.Core.SHA1", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Hash", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Hash.Definitions.hash_st Spec.Hash.Definitions.SHA1
Prims.Tot
[ "total" ]
[]
[ "Hacl.Hash.MD.mk_hash", "Spec.Hash.Definitions.SHA1", "Hacl.Hash.Core.SHA1.alloca", "Hacl.Hash.SHA1.update_multi", "Hacl.Hash.SHA1.update_last", "Hacl.Hash.Core.SHA1.finish", "Hacl.Hash.Definitions.hash_st" ]
[]
false
false
false
true
false
let hash_oneshot:hash_st SHA1 =
Hacl.Hash.MD.mk_hash SHA1 alloca update_multi update_last finish
false
LowParse.TacLib.fst
LowParse.TacLib.solve_vc
val solve_vc: Prims.unit -> Tac unit
val solve_vc: Prims.unit -> Tac unit
let solve_vc () : Tac unit = exact_guard (quote ()); conclude ()
{ "file_name": "src/lowparse/LowParse.TacLib.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 37, "end_line": 26, "start_col": 0, "start_line": 24 }
module LowParse.TacLib include FStar.Tactics include LowParse.Norm module L = FStar.List.Tot [@@ noextract_to "krml"] let conclude () : Tac unit = // dump "conclude before"; norm [delta; iota; primops]; begin if lax_on () then smt () else first [ trefl; trivial; ] end; // dump "conclude after"; qed ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowParse.Norm.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "LowParse.TacLib.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "LowParse.Norm", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "LowParse", "short_module": null }, { "abbrev": false, "full_module": "LowParse", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "LowParse.TacLib.conclude", "FStar.Tactics.V1.Derived.exact_guard", "FStar.Stubs.Reflection.Types.term" ]
[]
false
true
false
false
false
let solve_vc () : Tac unit =
exact_guard (quote ()); conclude ()
false
LowParse.TacLib.fst
LowParse.TacLib.conclude
val conclude: Prims.unit -> Tac unit
val conclude: Prims.unit -> Tac unit
let conclude () : Tac unit = // dump "conclude before"; norm [delta; iota; primops]; begin if lax_on () then smt () else first [ trefl; trivial; ] end; // dump "conclude after"; qed ()
{ "file_name": "src/lowparse/LowParse.TacLib.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 8, "end_line": 21, "start_col": 0, "start_line": 8 }
module LowParse.TacLib include FStar.Tactics include LowParse.Norm module L = FStar.List.Tot
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowParse.Norm.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "LowParse.TacLib.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "LowParse.Norm", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "LowParse", "short_module": null }, { "abbrev": false, "full_module": "LowParse", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Tactics.V1.Derived.qed", "FStar.Tactics.V1.Derived.smt", "Prims.bool", "FStar.Tactics.V1.Derived.first", "Prims.Cons", "FStar.Tactics.V1.Derived.trefl", "FStar.Tactics.V1.Derived.trivial", "Prims.Nil", "FStar.Stubs.Tactics.V1.Builtins.lax_on", "FStar.Stubs.Tactics.V1.Builtins.norm", "FStar.Pervasives.norm_step", "FStar.Pervasives.delta", "FStar.Pervasives.iota", "FStar.Pervasives.primops" ]
[]
false
true
false
false
false
let conclude () : Tac unit =
norm [delta; iota; primops]; if lax_on () then smt () else first [trefl; trivial]; qed ()
false
LowParse.TacLib.fst
LowParse.TacLib.app_head_tail
val app_head_tail (t: term) : Tac (term * list argv)
val app_head_tail (t: term) : Tac (term * list argv)
let app_head_tail (t: term) : Tac (term * list argv) = collect_app t
{ "file_name": "src/lowparse/LowParse.TacLib.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 15, "end_line": 31, "start_col": 0, "start_line": 29 }
module LowParse.TacLib include FStar.Tactics include LowParse.Norm module L = FStar.List.Tot [@@ noextract_to "krml"] let conclude () : Tac unit = // dump "conclude before"; norm [delta; iota; primops]; begin if lax_on () then smt () else first [ trefl; trivial; ] end; // dump "conclude after"; qed () [@@ noextract_to "krml"] let solve_vc () : Tac unit = exact_guard (quote ()); conclude ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowParse.Norm.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "LowParse.TacLib.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "LowParse.Norm", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "LowParse", "short_module": null }, { "abbrev": false, "full_module": "LowParse", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
t: FStar.Stubs.Reflection.Types.term -> FStar.Tactics.Effect.Tac (FStar.Stubs.Reflection.Types.term * Prims.list FStar.Stubs.Reflection.V1.Data.argv)
FStar.Tactics.Effect.Tac
[]
[]
[ "FStar.Stubs.Reflection.Types.term", "FStar.Tactics.V1.SyntaxHelpers.collect_app", "FStar.Pervasives.Native.tuple2", "Prims.list", "FStar.Stubs.Reflection.V1.Data.argv" ]
[]
false
true
false
false
false
let app_head_tail (t: term) : Tac (term * list argv) =
collect_app t
false
LowParse.TacLib.fst
LowParse.TacLib.to_all_goals
val to_all_goals (t: (unit -> Tac unit)) : Tac unit
val to_all_goals (t: (unit -> Tac unit)) : Tac unit
let rec to_all_goals (t: (unit -> Tac unit)) : Tac unit = if ngoals () = 0 then () else let _ = divide 1 t (fun () -> to_all_goals t) in ()
{ "file_name": "src/lowparse/LowParse.TacLib.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 55, "end_line": 46, "start_col": 0, "start_line": 42 }
module LowParse.TacLib include FStar.Tactics include LowParse.Norm module L = FStar.List.Tot [@@ noextract_to "krml"] let conclude () : Tac unit = // dump "conclude before"; norm [delta; iota; primops]; begin if lax_on () then smt () else first [ trefl; trivial; ] end; // dump "conclude after"; qed () [@@ noextract_to "krml"] let solve_vc () : Tac unit = exact_guard (quote ()); conclude () [@@ noextract_to "krml"] let app_head_tail (t: term) : Tac (term * list argv) = collect_app t [@@ noextract_to "krml"] let tassert (b: bool) : Tac (squash b) = if b then () else let s = term_to_string (quote b) in fail ("Tactic assertion failed: " ^ s)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowParse.Norm.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "LowParse.TacLib.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "LowParse.Norm", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "LowParse", "short_module": null }, { "abbrev": false, "full_module": "LowParse", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
t: (_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit) -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "Prims.bool", "FStar.Pervasives.Native.tuple2", "FStar.Tactics.V1.Derived.divide", "LowParse.TacLib.to_all_goals", "Prims.op_Equality", "Prims.int", "FStar.Tactics.V1.Derived.ngoals" ]
[ "recursion" ]
false
true
false
false
false
let rec to_all_goals (t: (unit -> Tac unit)) : Tac unit =
if ngoals () = 0 then () else let _ = divide 1 t (fun () -> to_all_goals t) in ()
false
LowParse.TacLib.fst
LowParse.TacLib.intros_until_squash
val intros_until_squash: Prims.unit -> Tac binder
val intros_until_squash: Prims.unit -> Tac binder
let rec intros_until_squash () : Tac binder = let i = intro () in let (tm, _) = app_head_tail (cur_goal ()) in if tm `is_fvar` (`%squash) then i else intros_until_squash ()
{ "file_name": "src/lowparse/LowParse.TacLib.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 29, "end_line": 56, "start_col": 0, "start_line": 49 }
module LowParse.TacLib include FStar.Tactics include LowParse.Norm module L = FStar.List.Tot [@@ noextract_to "krml"] let conclude () : Tac unit = // dump "conclude before"; norm [delta; iota; primops]; begin if lax_on () then smt () else first [ trefl; trivial; ] end; // dump "conclude after"; qed () [@@ noextract_to "krml"] let solve_vc () : Tac unit = exact_guard (quote ()); conclude () [@@ noextract_to "krml"] let app_head_tail (t: term) : Tac (term * list argv) = collect_app t [@@ noextract_to "krml"] let tassert (b: bool) : Tac (squash b) = if b then () else let s = term_to_string (quote b) in fail ("Tactic assertion failed: " ^ s) [@@ noextract_to "krml"] let rec to_all_goals (t: (unit -> Tac unit)) : Tac unit = if ngoals () = 0 then () else let _ = divide 1 t (fun () -> to_all_goals t) in ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowParse.Norm.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "LowParse.TacLib.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "LowParse.Norm", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "LowParse", "short_module": null }, { "abbrev": false, "full_module": "LowParse", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac FStar.Stubs.Reflection.Types.binder
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Stubs.Reflection.Types.term", "Prims.list", "FStar.Stubs.Reflection.V1.Data.argv", "FStar.Reflection.V1.Derived.is_fvar", "FStar.Stubs.Reflection.Types.binder", "Prims.bool", "LowParse.TacLib.intros_until_squash", "FStar.Pervasives.Native.tuple2", "LowParse.TacLib.app_head_tail", "FStar.Tactics.V1.Derived.cur_goal", "FStar.Stubs.Reflection.Types.typ", "FStar.Stubs.Tactics.V1.Builtins.intro" ]
[ "recursion" ]
false
true
false
false
false
let rec intros_until_squash () : Tac binder =
let i = intro () in let tm, _ = app_head_tail (cur_goal ()) in if tm `is_fvar` (`%squash) then i else intros_until_squash ()
false
LowParse.TacLib.fst
LowParse.TacLib.pp_norm_tac
val pp_norm_tac: Prims.unit -> Tac unit
val pp_norm_tac: Prims.unit -> Tac unit
let pp_norm_tac () : Tac unit = norm norm_steps; trefl (); to_all_goals (fun _ -> norm [delta; iota; zeta; primops]; smt () ); qed ()
{ "file_name": "src/lowparse/LowParse.TacLib.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 8, "end_line": 85, "start_col": 0, "start_line": 78 }
module LowParse.TacLib include FStar.Tactics include LowParse.Norm module L = FStar.List.Tot [@@ noextract_to "krml"] let conclude () : Tac unit = // dump "conclude before"; norm [delta; iota; primops]; begin if lax_on () then smt () else first [ trefl; trivial; ] end; // dump "conclude after"; qed () [@@ noextract_to "krml"] let solve_vc () : Tac unit = exact_guard (quote ()); conclude () [@@ noextract_to "krml"] let app_head_tail (t: term) : Tac (term * list argv) = collect_app t [@@ noextract_to "krml"] let tassert (b: bool) : Tac (squash b) = if b then () else let s = term_to_string (quote b) in fail ("Tactic assertion failed: " ^ s) [@@ noextract_to "krml"] let rec to_all_goals (t: (unit -> Tac unit)) : Tac unit = if ngoals () = 0 then () else let _ = divide 1 t (fun () -> to_all_goals t) in () [@@ noextract_to "krml"] let rec intros_until_squash () : Tac binder = let i = intro () in let (tm, _) = app_head_tail (cur_goal ()) in if tm `is_fvar` (`%squash) then i else intros_until_squash () [@@ noextract_to "krml"] let rec intros_until_eq_hyp () : Tac binder = let i = intro () in let (sq, ar) = app_head_tail (type_of_binder i) in let cond = if sq `is_fvar` (`%squash) then match ar with | (ar1, _) :: _ -> let (eq, _) = app_head_tail ar1 in eq `is_fvar` (`%eq2) | _ -> false else false in if cond then i else intros_until_eq_hyp ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowParse.Norm.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "LowParse.TacLib.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "LowParse.Norm", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "LowParse", "short_module": null }, { "abbrev": false, "full_module": "LowParse", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Tactics.V1.Derived.qed", "LowParse.TacLib.to_all_goals", "FStar.Tactics.V1.Derived.smt", "FStar.Stubs.Tactics.V1.Builtins.norm", "Prims.Cons", "FStar.Pervasives.norm_step", "FStar.Pervasives.delta", "FStar.Pervasives.iota", "FStar.Pervasives.zeta", "FStar.Pervasives.primops", "Prims.Nil", "FStar.Tactics.V1.Derived.trefl", "LowParse.Norm.norm_steps" ]
[]
false
true
false
false
false
let pp_norm_tac () : Tac unit =
norm norm_steps; trefl (); to_all_goals (fun _ -> norm [delta; iota; zeta; primops]; smt ()); qed ()
false
LowParse.TacLib.fst
LowParse.TacLib.intros_until_eq_hyp
val intros_until_eq_hyp: Prims.unit -> Tac binder
val intros_until_eq_hyp: Prims.unit -> Tac binder
let rec intros_until_eq_hyp () : Tac binder = let i = intro () in let (sq, ar) = app_head_tail (type_of_binder i) in let cond = if sq `is_fvar` (`%squash) then match ar with | (ar1, _) :: _ -> let (eq, _) = app_head_tail ar1 in eq `is_fvar` (`%eq2) | _ -> false else false in if cond then i else intros_until_eq_hyp ()
{ "file_name": "src/lowparse/LowParse.TacLib.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 29, "end_line": 75, "start_col": 0, "start_line": 59 }
module LowParse.TacLib include FStar.Tactics include LowParse.Norm module L = FStar.List.Tot [@@ noextract_to "krml"] let conclude () : Tac unit = // dump "conclude before"; norm [delta; iota; primops]; begin if lax_on () then smt () else first [ trefl; trivial; ] end; // dump "conclude after"; qed () [@@ noextract_to "krml"] let solve_vc () : Tac unit = exact_guard (quote ()); conclude () [@@ noextract_to "krml"] let app_head_tail (t: term) : Tac (term * list argv) = collect_app t [@@ noextract_to "krml"] let tassert (b: bool) : Tac (squash b) = if b then () else let s = term_to_string (quote b) in fail ("Tactic assertion failed: " ^ s) [@@ noextract_to "krml"] let rec to_all_goals (t: (unit -> Tac unit)) : Tac unit = if ngoals () = 0 then () else let _ = divide 1 t (fun () -> to_all_goals t) in () [@@ noextract_to "krml"] let rec intros_until_squash () : Tac binder = let i = intro () in let (tm, _) = app_head_tail (cur_goal ()) in if tm `is_fvar` (`%squash) then i else intros_until_squash ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowParse.Norm.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "LowParse.TacLib.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "LowParse.Norm", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "LowParse", "short_module": null }, { "abbrev": false, "full_module": "LowParse", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac FStar.Stubs.Reflection.Types.binder
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Stubs.Reflection.Types.term", "Prims.list", "FStar.Stubs.Reflection.V1.Data.argv", "FStar.Stubs.Reflection.Types.binder", "Prims.bool", "LowParse.TacLib.intros_until_eq_hyp", "FStar.Reflection.V1.Derived.is_fvar", "FStar.Stubs.Reflection.V1.Data.aqualv", "FStar.Pervasives.Native.tuple2", "LowParse.TacLib.app_head_tail", "FStar.Reflection.V1.Derived.type_of_binder", "FStar.Stubs.Tactics.V1.Builtins.intro" ]
[ "recursion" ]
false
true
false
false
false
let rec intros_until_eq_hyp () : Tac binder =
let i = intro () in let sq, ar = app_head_tail (type_of_binder i) in let cond = if sq `is_fvar` (`%squash) then match ar with | (ar1, _) :: _ -> let eq, _ = app_head_tail ar1 in eq `is_fvar` (`%eq2) | _ -> false else false in if cond then i else intros_until_eq_hyp ()
false
Spec.MD.Incremental.fst
Spec.MD.Incremental.md_is_hash_incremental
val md_is_hash_incremental (a:hash_alg{is_md a}) (input: bytes { S.length input `less_than_max_input_length` a }) (s:words_state a) : Lemma ( let blocks, rest = split_blocks a input in update_multi a s () (input `S.append` (pad a (S.length input))) == update_last a (update_multi a s () blocks) (S.length blocks) rest)
val md_is_hash_incremental (a:hash_alg{is_md a}) (input: bytes { S.length input `less_than_max_input_length` a }) (s:words_state a) : Lemma ( let blocks, rest = split_blocks a input in update_multi a s () (input `S.append` (pad a (S.length input))) == update_last a (update_multi a s () blocks) (S.length blocks) rest)
let md_is_hash_incremental (a:hash_alg{is_md a}) (input: bytes { S.length input `less_than_max_input_length` a }) (s:words_state a) : Lemma ( let blocks, rest = split_blocks a input in update_multi a s () (input `S.append` (pad a (S.length input))) == update_last a (update_multi a s () blocks) (S.length blocks) rest) = let blocks, rest = split_blocks a input in assert (S.length input == S.length blocks + S.length rest); let padding = pad a (S.length input) in calc (==) { update_last a (update_multi a s () blocks) (S.length blocks) rest; (==) { } update_multi a (update_multi a s () blocks) () S.(rest @| padding); (==) { update_multi_associative a s blocks S.(rest @| padding) } update_multi a s () S.(blocks @| (rest @| padding)); (==) { S.append_assoc blocks rest padding } update_multi a s () S.((blocks @| rest) @| padding); (==) { } update_multi a s () S.(input @| padding); }
{ "file_name": "specs/lemmas/Spec.MD.Incremental.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 6, "end_line": 38, "start_col": 0, "start_line": 17 }
module Spec.MD.Incremental module S = FStar.Seq open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.MD open Spec.Hash.Lemmas friend Spec.Agile.Hash open FStar.Mul #set-options "--fuel 0 --ifuel 0 --z3rlimit 100"
{ "checked_file": "/", "dependencies": [ "Spec.Hash.MD.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fst.checked", "Spec.Agile.Hash.fst.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Spec.MD.Incremental.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.MD", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.MD", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Incremental.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": false, "full_module": "Spec.MD", "short_module": null }, { "abbrev": false, "full_module": "Spec.MD", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 150, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Spec.Hash.Definitions.hash_alg{Spec.Hash.Definitions.is_md a} -> input: Spec.Hash.Definitions.bytes {Spec.Hash.Definitions.less_than_max_input_length (FStar.Seq.Base.length input) a} -> s: Spec.Hash.Definitions.words_state a -> FStar.Pervasives.Lemma (ensures (let _ = Spec.Hash.Incremental.Definitions.split_blocks a input in (let FStar.Pervasives.Native.Mktuple2 #_ #_ blocks rest = _ in Spec.Agile.Hash.update_multi a s () (FStar.Seq.Base.append input (Spec.Hash.MD.pad a (FStar.Seq.Base.length input))) == Spec.Hash.Incremental.Definitions.update_last a (Spec.Agile.Hash.update_multi a s () blocks) (FStar.Seq.Base.length blocks) rest) <: Type0))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Spec.Hash.Definitions.hash_alg", "Prims.b2t", "Spec.Hash.Definitions.is_md", "Spec.Hash.Definitions.bytes", "Spec.Hash.Definitions.less_than_max_input_length", "FStar.Seq.Base.length", "Lib.IntTypes.uint8", "Spec.Hash.Definitions.words_state", "Lib.ByteSequence.bytes", "FStar.Calc.calc_finish", "Prims.eq2", "Spec.Hash.Incremental.Definitions.update_last", "Spec.Agile.Hash.update_multi", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "FStar.Seq.Base.op_At_Bar", "Prims.Cons", "FStar.Preorder.relation", "Prims.Nil", "Prims.unit", "FStar.Calc.calc_step", "FStar.Calc.calc_init", "FStar.Calc.calc_pack", "Prims.squash", "Spec.Hash.Lemmas.update_multi_associative", "FStar.Seq.Base.append_assoc", "Prims.op_Equality", "Prims.int", "Prims.op_Modulus", "Prims.op_Addition", "Lib.IntTypes.int_t", "Spec.Hash.Definitions.block_length", "Spec.Hash.MD.pad", "Prims._assert", "FStar.Pervasives.Native.tuple2", "Lib.Sequence.seq", "Spec.Hash.Incremental.Definitions.split_blocks", "Prims.l_True", "FStar.Seq.Base.append", "FStar.Pervasives.pattern" ]
[]
false
false
true
false
false
let md_is_hash_incremental (a: hash_alg{is_md a}) (input: bytes{(S.length input) `less_than_max_input_length` a}) (s: words_state a) : Lemma (let blocks, rest = split_blocks a input in update_multi a s () (input `S.append` (pad a (S.length input))) == update_last a (update_multi a s () blocks) (S.length blocks) rest) =
let blocks, rest = split_blocks a input in assert (S.length input == S.length blocks + S.length rest); let padding = pad a (S.length input) in calc ( == ) { update_last a (update_multi a s () blocks) (S.length blocks) rest; ( == ) { () } update_multi a (update_multi a s () blocks) () S.(rest @| padding); ( == ) { update_multi_associative a s blocks S.(rest @| padding) } update_multi a s () S.(blocks @| (rest @| padding)); ( == ) { S.append_assoc blocks rest padding } update_multi a s () S.((blocks @| rest) @| padding); ( == ) { () } update_multi a s () S.(input @| padding); }
false
LowParse.TacLib.fst
LowParse.TacLib.tassert
val tassert (b: bool) : Tac (squash b)
val tassert (b: bool) : Tac (squash b)
let tassert (b: bool) : Tac (squash b) = if b then () else let s = term_to_string (quote b) in fail ("Tactic assertion failed: " ^ s)
{ "file_name": "src/lowparse/LowParse.TacLib.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 42, "end_line": 39, "start_col": 0, "start_line": 34 }
module LowParse.TacLib include FStar.Tactics include LowParse.Norm module L = FStar.List.Tot [@@ noextract_to "krml"] let conclude () : Tac unit = // dump "conclude before"; norm [delta; iota; primops]; begin if lax_on () then smt () else first [ trefl; trivial; ] end; // dump "conclude after"; qed () [@@ noextract_to "krml"] let solve_vc () : Tac unit = exact_guard (quote ()); conclude () [@@ noextract_to "krml"] let app_head_tail (t: term) : Tac (term * list argv) = collect_app t
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowParse.Norm.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "LowParse.TacLib.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "LowParse.Norm", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "LowParse", "short_module": null }, { "abbrev": false, "full_module": "LowParse", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
b: Prims.bool -> FStar.Tactics.Effect.Tac (Prims.squash b)
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.bool", "Prims.squash", "Prims.b2t", "FStar.Tactics.V1.Derived.fail", "Prims.op_Hat", "Prims.string", "FStar.Stubs.Tactics.V1.Builtins.term_to_string", "FStar.Stubs.Reflection.Types.term" ]
[]
false
true
true
false
false
let tassert (b: bool) : Tac (squash b) =
if b then () else let s = term_to_string (quote b) in fail ("Tactic assertion failed: " ^ s)
false
Hacl.Spec.Curve25519.Field51.Definition.fst
Hacl.Spec.Curve25519.Field51.Definition.felem5
val felem5 : Type0
let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64)
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 57, "end_line": 9, "start_col": 0, "start_line": 9 }
module Hacl.Spec.Curve25519.Field51.Definition open Lib.Sequence open Lib.IntTypes open Spec.Curve25519 #reset-options "--z3rlimit 20"
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst" }
[ { "abbrev": false, "full_module": "Spec.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Type0
Prims.Tot
[ "total" ]
[]
[ "FStar.Pervasives.Native.tuple5", "Lib.IntTypes.uint64" ]
[]
false
false
false
true
true
let felem5 =
((((uint64 * uint64) * uint64) * uint64) * uint64)
false
Hacl.Spec.Curve25519.Field51.Definition.fst
Hacl.Spec.Curve25519.Field51.Definition.scale128
val scale128 : Type0
let scale128 = s:nat{s <= 67108864}
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 35, "end_line": 13, "start_col": 0, "start_line": 13 }
module Hacl.Spec.Curve25519.Field51.Definition open Lib.Sequence open Lib.IntTypes open Spec.Curve25519 #reset-options "--z3rlimit 20" let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64) let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128)
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst" }
[ { "abbrev": false, "full_module": "Spec.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Type0
Prims.Tot
[ "total" ]
[]
[ "Prims.nat", "Prims.b2t", "Prims.op_LessThanOrEqual" ]
[]
false
false
false
true
true
let scale128 =
s: nat{s <= 67108864}
false
Hacl.Spec.Curve25519.Field51.Definition.fst
Hacl.Spec.Curve25519.Field51.Definition.scale64
val scale64 : Type0
let scale64 = s:nat{s <= 8192}
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 30, "end_line": 12, "start_col": 0, "start_line": 12 }
module Hacl.Spec.Curve25519.Field51.Definition open Lib.Sequence open Lib.IntTypes open Spec.Curve25519 #reset-options "--z3rlimit 20" let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64) let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128)
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst" }
[ { "abbrev": false, "full_module": "Spec.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Type0
Prims.Tot
[ "total" ]
[]
[ "Prims.nat", "Prims.b2t", "Prims.op_LessThanOrEqual" ]
[]
false
false
false
true
true
let scale64 =
s: nat{s <= 8192}
false
Hacl.Spec.Curve25519.Field51.Definition.fst
Hacl.Spec.Curve25519.Field51.Definition.scale128_5
val scale128_5 : Type0
let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864}
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 98, "end_line": 19, "start_col": 0, "start_line": 18 }
module Hacl.Spec.Curve25519.Field51.Definition open Lib.Sequence open Lib.IntTypes open Spec.Curve25519 #reset-options "--z3rlimit 20" let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64) let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128) let scale64 = s:nat{s <= 8192} let scale128 = s:nat{s <= 67108864} let nat5 = (nat * nat * nat * nat * nat) let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst" }
[ { "abbrev": false, "full_module": "Spec.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Type0
Prims.Tot
[ "total" ]
[]
[ "Hacl.Spec.Curve25519.Field51.Definition.nat5", "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual" ]
[]
false
false
false
true
true
let scale128_5 =
x: nat5 { let x1, x2, x3, x4, x5 = x in x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864 }
false
Hacl.Spec.Curve25519.Field51.Definition.fst
Hacl.Spec.Curve25519.Field51.Definition.scale64_5
val scale64_5 : Type0
let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192}
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 76, "end_line": 17, "start_col": 0, "start_line": 16 }
module Hacl.Spec.Curve25519.Field51.Definition open Lib.Sequence open Lib.IntTypes open Spec.Curve25519 #reset-options "--z3rlimit 20" let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64) let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128) let scale64 = s:nat{s <= 8192} let scale128 = s:nat{s <= 67108864} let nat5 = (nat * nat * nat * nat * nat)
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst" }
[ { "abbrev": false, "full_module": "Spec.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Type0
Prims.Tot
[ "total" ]
[]
[ "Hacl.Spec.Curve25519.Field51.Definition.nat5", "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual" ]
[]
false
false
false
true
true
let scale64_5 =
x: nat5 { let x1, x2, x3, x4, x5 = x in x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192 }
false
Hacl.Spec.Curve25519.Field51.Definition.fst
Hacl.Spec.Curve25519.Field51.Definition.felem_wide5
val felem_wide5 : Type0
let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128)
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 67, "end_line": 10, "start_col": 0, "start_line": 10 }
module Hacl.Spec.Curve25519.Field51.Definition open Lib.Sequence open Lib.IntTypes open Spec.Curve25519 #reset-options "--z3rlimit 20"
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst" }
[ { "abbrev": false, "full_module": "Spec.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Type0
Prims.Tot
[ "total" ]
[]
[ "FStar.Pervasives.Native.tuple5", "Lib.IntTypes.uint128" ]
[]
false
false
false
true
true
let felem_wide5 =
((((uint128 * uint128) * uint128) * uint128) * uint128)
false
Hacl.Spec.Curve25519.Field51.Definition.fst
Hacl.Spec.Curve25519.Field51.Definition.nat5
val nat5 : Type0
let nat5 = (nat * nat * nat * nat * nat)
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 40, "end_line": 14, "start_col": 0, "start_line": 14 }
module Hacl.Spec.Curve25519.Field51.Definition open Lib.Sequence open Lib.IntTypes open Spec.Curve25519 #reset-options "--z3rlimit 20" let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64) let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128) let scale64 = s:nat{s <= 8192}
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst" }
[ { "abbrev": false, "full_module": "Spec.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Type0
Prims.Tot
[ "total" ]
[]
[ "FStar.Pervasives.Native.tuple5", "Prims.nat" ]
[]
false
false
false
true
true
let nat5 =
((((nat * nat) * nat) * nat) * nat)
false
Test.Vectors.fst
Test.Vectors.hash_vectors_tmp
val hash_vectors_tmp : Prims.list (((Test.Vectors.hash_alg * Prims.string) * Test.Lowstarize.hex_encoded) * FStar.UInt32.t)
let hash_vectors_tmp = List.Tot.map (fun h -> h.hash_alg, h.input, h.output, h.repeat ) hash_vectors
{ "file_name": "providers/test/Test.Vectors.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 14, "end_line": 156, "start_col": 0, "start_line": 154 }
module Test.Vectors open Test.Lowstarize open EverCrypt.Hash open Spec.Hash.Definitions /// Hash algorithms type hash_alg = EverCrypt.Hash.alg #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" noeq noextract type hash_vector = { (* The input [input] is repeated [repeat] times. *) hash_alg: hash_alg; input: string; output: hex_encoded; repeat: UInt32.t; } noextract let hash_vectors = [{ hash_alg = MD5; input = ""; output = h"d41d8cd98f00b204e9800998ecf8427e"; repeat = 1ul }; { hash_alg = MD5; input = "a"; output = h"0cc175b9c0f1b6a831c399e269772661"; repeat = 1ul }; { hash_alg = MD5; input = "abc"; output = h"900150983cd24fb0d6963f7d28e17f72"; repeat = 1ul }; { hash_alg = MD5; input = "message digest"; output = h"f96b697d7cb7938d525a2f31aaf161d0"; repeat = 1ul }; { hash_alg = MD5; input = "abcdefghijklmnopqrstuvwxyz"; output = h"c3fcd3d76192e4007dfb496cca67e13b"; repeat = 1ul }; { hash_alg = MD5; input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; output = h"d174ab98d277d9f5a5611c2c9f419d9f"; repeat = 1ul }; { hash_alg = MD5; input = "12345678901234567890123456789012345678901234567890123456789012345678901234567890"; output = h"57edf4a22be3c955ac49da2e2107b67a"; repeat = 1ul }; { hash_alg = SHA1; input = "abc"; output = h"a9993e364706816aba3e25717850c26c9cd0d89d"; repeat = 1ul }; { hash_alg = SHA1; input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"; output = h"84983e441c3bd26ebaae4aa1f95129e5e54670f1"; repeat = 1ul }; { hash_alg = SHA1; input = "a"; output = h"34aa973cd4c4daa4f61eeb2bdbad27316534016f"; repeat = 1000000ul }; { hash_alg = SHA1; input = "0123456701234567012345670123456701234567012345670123456701234567"; output = h"dea356a2cddd90c7a7ecedc5ebb563934f460452"; repeat = 10ul }; { hash_alg = SHA2_256; input = "abc"; output = h"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"; repeat = 1ul }; { hash_alg = SHA2_256; input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"; output = h"248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1"; repeat = 1ul }; { hash_alg = SHA2_256; input = "a"; output = h"cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0"; repeat = 1000000ul }; { hash_alg = SHA2_256; input = "0123456701234567012345670123456701234567012345670123456701234567"; output = h"594847328451bdfa85056225462cc1d867d877fb388df0ce35f25ab5562bfbb5"; repeat = 10ul }; { hash_alg = SHA2_256; input = "\x19"; output = h"68aa2e2ee5dff96e3355e6c7ee373e3d6a4e17f75f9518d843709c0c9bc3e3d4"; repeat = 1ul };(* { hash_alg = SHA2_256; // 2018.05.26: Don't know how to encode byte literals in strings; this doesn't work // as in OCaml input = "\xe3\xd7\x25\x70\xdc\xdd\x78\x7c\xe3\x88\x7a\xb2\xcd\x68\x46\x52"; output = h"175ee69b02ba9b58e2b0a5fd13819cea573f3940a94f825128cf4209beabb4e8"; repeat = 1ul }; *){ hash_alg = SHA2_384; input = "abc"; output = h"cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7"; repeat = 1ul }; { hash_alg = SHA2_384; input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"; output = h"09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039"; repeat = 1ul }; { hash_alg = SHA2_384; input = "a"; output = h"9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985"; repeat = 1000000ul }; { hash_alg = SHA2_384; input = "0123456701234567012345670123456701234567012345670123456701234567"; output = h"2fc64a4f500ddb6828f6a3430b8dd72a368eb7f3a8322a70bc84275b9c0b3ab00d27a5cc3c2d224aa6b61a0d79fb4596"; repeat = 10ul }; { hash_alg = SHA2_512; input = "abc"; output = h"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f"; repeat = 1ul }; { hash_alg = SHA2_512; input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"; output = h"8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909"; repeat = 1ul }; { hash_alg = SHA2_512; input = "a"; output = h"e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b"; repeat = 1000000ul }; { hash_alg = SHA2_512; input = "0123456701234567012345670123456701234567012345670123456701234567"; output = h"89d05ba632c699c31231ded4ffc127d5a894dad412c0e024db872d1abd2ba8141a0f85072a9be1e2aa04cf33c765cb510813a39cd5a84c4acaa64d3f3fb7bae9"; repeat = 10ul } ]
{ "checked_file": "/", "dependencies": [ "Test.Lowstarize.fst.checked", "Spec.HMAC_DRBG.Test.Vectors.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "EverCrypt.Hash.fsti.checked" ], "interface_file": false, "source_file": "Test.Vectors.fst" }
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt.Hash", "short_module": null }, { "abbrev": false, "full_module": "Test.Lowstarize", "short_module": null }, { "abbrev": false, "full_module": "Test", "short_module": null }, { "abbrev": false, "full_module": "Test", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Prims.list (((Test.Vectors.hash_alg * Prims.string) * Test.Lowstarize.hex_encoded) * FStar.UInt32.t)
Prims.Tot
[ "total" ]
[]
[ "FStar.List.Tot.Base.map", "Test.Vectors.hash_vector", "FStar.Pervasives.Native.tuple4", "Test.Vectors.hash_alg", "Prims.string", "Test.Lowstarize.hex_encoded", "FStar.UInt32.t", "FStar.Pervasives.Native.Mktuple4", "Test.Vectors.__proj__Mkhash_vector__item__hash_alg", "Test.Vectors.__proj__Mkhash_vector__item__input", "Test.Vectors.__proj__Mkhash_vector__item__output", "Test.Vectors.__proj__Mkhash_vector__item__repeat", "Test.Vectors.hash_vectors" ]
[]
false
false
false
true
false
let hash_vectors_tmp =
List.Tot.map (fun h -> h.hash_alg, h.input, h.output, h.repeat) hash_vectors
false
Hacl.Spec.Curve25519.Field51.Definition.fst
Hacl.Spec.Curve25519.Field51.Definition.max51
val max51 : Prims.int
let max51 = pow51 - 1
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 21, "end_line": 90, "start_col": 0, "start_line": 90 }
module Hacl.Spec.Curve25519.Field51.Definition open Lib.Sequence open Lib.IntTypes open Spec.Curve25519 #reset-options "--z3rlimit 20" let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64) let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128) let scale64 = s:nat{s <= 8192} let scale128 = s:nat{s <= 67108864} let nat5 = (nat * nat * nat * nat * nat) let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192} let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864} let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x) let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x) open FStar.Mul let ( <=* ) (x:nat5) (y:nat5) : Type = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 <= y1) /\ (x2 <= y2) /\ (x3 <= y3) /\ (x4 <= y4) /\ (x5 <= y5) let ( +* ) (x:nat5) (y:nat5) : nat5 = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 + y1 , x2 + y2 , x3 + y3 , x4 + y4 , x5 + y5) let ( ** ) (x:nat5) (y:nat5) : nat5 = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 * y1 , x2 * y2 , x3 * y3 , x4 * y4 , x5 * y5) val lemma_mul_le_scale64: a:nat -> b:nat -> Lemma (requires a <= 8192 /\ b <= 8192) (ensures a * b <= 67108864) let lemma_mul_le_scale64 a b = let open FStar.Math.Lemmas in lemma_mult_le_left a b 8192; // a * b <= a * 8192 lemma_mult_le_right 8192 a 8192; // a * 8192 <= 8192 * 8192 assert (a * b <= 8192 * 8192); assert_norm (8192 * 8192 = 67108864) #set-options "--z3rlimit 100" let ( *^ ) (x:scale64) (y:scale64_5) : scale128_5 = let (y1,y2,y3,y4,y5) = y in lemma_mul_le_scale64 x y1; lemma_mul_le_scale64 x y2; lemma_mul_le_scale64 x y3; lemma_mul_le_scale64 x y4; lemma_mul_le_scale64 x y5; (x * y1 , x * y2 , x * y3 , x * y4 , x * y5) [@"opaque_to_smt"] let pow51: (pow51: pos { pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51 }) = let pow51: pos = normalize_term (pow2 51) in assert_norm (pow51 > 0); assert_norm (pow51 == pow2 51); assert_norm (pow2 64 == 8192 * pow51); assert_norm (pow2 128 == 67108864 * pow51 * pow51); pow51
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Prims.int
Prims.Tot
[ "total" ]
[]
[ "Prims.op_Subtraction", "Hacl.Spec.Curve25519.Field51.Definition.pow51" ]
[]
false
false
false
true
false
let max51 =
pow51 - 1
false
Hacl.Spec.Curve25519.Field51.Definition.fst
Hacl.Spec.Curve25519.Field51.Definition.felem_fits1
val felem_fits1 : x: Lib.IntTypes.uint64 -> m: Hacl.Spec.Curve25519.Field51.Definition.scale64 -> Prims.bool
let felem_fits1 (x:uint64) (m:scale64) = uint_v x <= m * max51
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 23, "end_line": 98, "start_col": 0, "start_line": 97 }
module Hacl.Spec.Curve25519.Field51.Definition open Lib.Sequence open Lib.IntTypes open Spec.Curve25519 #reset-options "--z3rlimit 20" let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64) let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128) let scale64 = s:nat{s <= 8192} let scale128 = s:nat{s <= 67108864} let nat5 = (nat * nat * nat * nat * nat) let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192} let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864} let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x) let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x) open FStar.Mul let ( <=* ) (x:nat5) (y:nat5) : Type = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 <= y1) /\ (x2 <= y2) /\ (x3 <= y3) /\ (x4 <= y4) /\ (x5 <= y5) let ( +* ) (x:nat5) (y:nat5) : nat5 = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 + y1 , x2 + y2 , x3 + y3 , x4 + y4 , x5 + y5) let ( ** ) (x:nat5) (y:nat5) : nat5 = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 * y1 , x2 * y2 , x3 * y3 , x4 * y4 , x5 * y5) val lemma_mul_le_scale64: a:nat -> b:nat -> Lemma (requires a <= 8192 /\ b <= 8192) (ensures a * b <= 67108864) let lemma_mul_le_scale64 a b = let open FStar.Math.Lemmas in lemma_mult_le_left a b 8192; // a * b <= a * 8192 lemma_mult_le_right 8192 a 8192; // a * 8192 <= 8192 * 8192 assert (a * b <= 8192 * 8192); assert_norm (8192 * 8192 = 67108864) #set-options "--z3rlimit 100" let ( *^ ) (x:scale64) (y:scale64_5) : scale128_5 = let (y1,y2,y3,y4,y5) = y in lemma_mul_le_scale64 x y1; lemma_mul_le_scale64 x y2; lemma_mul_le_scale64 x y3; lemma_mul_le_scale64 x y4; lemma_mul_le_scale64 x y5; (x * y1 , x * y2 , x * y3 , x * y4 , x * y5) [@"opaque_to_smt"] let pow51: (pow51: pos { pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51 }) = let pow51: pos = normalize_term (pow2 51) in assert_norm (pow51 > 0); assert_norm (pow51 == pow2 51); assert_norm (pow2 64 == 8192 * pow51); assert_norm (pow2 128 == 67108864 * pow51 * pow51); pow51 inline_for_extraction noextract let max51 = pow51 - 1 inline_for_extraction noextract let mask51 : x:uint64{v x == pow2 51 - 1} = assert_norm (pow2 51 - 1 == 0x7ffffffffffff); u64 0x7ffffffffffff
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: Lib.IntTypes.uint64 -> m: Hacl.Spec.Curve25519.Field51.Definition.scale64 -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "Lib.IntTypes.uint64", "Hacl.Spec.Curve25519.Field51.Definition.scale64", "Prims.op_LessThanOrEqual", "Lib.IntTypes.uint_v", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "FStar.Mul.op_Star", "Hacl.Spec.Curve25519.Field51.Definition.max51", "Prims.bool" ]
[]
false
false
false
true
false
let felem_fits1 (x: uint64) (m: scale64) =
uint_v x <= m * max51
false
Test.Vectors.fst
Test.Vectors.hmac_vectors_tmp
val hmac_vectors_tmp : Prims.list (((Test.Vectors.hash_alg * Test.Lowstarize.hex_encoded) * Test.Lowstarize.hex_encoded) * Test.Lowstarize.hex_encoded)
let hmac_vectors_tmp = List.Tot.map (fun h -> h.ha, h.key, h.data, h.output ) hmac_vectors
{ "file_name": "providers/test/Test.Vectors.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 14, "end_line": 190, "start_col": 0, "start_line": 188 }
module Test.Vectors open Test.Lowstarize open EverCrypt.Hash open Spec.Hash.Definitions /// Hash algorithms type hash_alg = EverCrypt.Hash.alg #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" noeq noextract type hash_vector = { (* The input [input] is repeated [repeat] times. *) hash_alg: hash_alg; input: string; output: hex_encoded; repeat: UInt32.t; } noextract let hash_vectors = [{ hash_alg = MD5; input = ""; output = h"d41d8cd98f00b204e9800998ecf8427e"; repeat = 1ul }; { hash_alg = MD5; input = "a"; output = h"0cc175b9c0f1b6a831c399e269772661"; repeat = 1ul }; { hash_alg = MD5; input = "abc"; output = h"900150983cd24fb0d6963f7d28e17f72"; repeat = 1ul }; { hash_alg = MD5; input = "message digest"; output = h"f96b697d7cb7938d525a2f31aaf161d0"; repeat = 1ul }; { hash_alg = MD5; input = "abcdefghijklmnopqrstuvwxyz"; output = h"c3fcd3d76192e4007dfb496cca67e13b"; repeat = 1ul }; { hash_alg = MD5; input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; output = h"d174ab98d277d9f5a5611c2c9f419d9f"; repeat = 1ul }; { hash_alg = MD5; input = "12345678901234567890123456789012345678901234567890123456789012345678901234567890"; output = h"57edf4a22be3c955ac49da2e2107b67a"; repeat = 1ul }; { hash_alg = SHA1; input = "abc"; output = h"a9993e364706816aba3e25717850c26c9cd0d89d"; repeat = 1ul }; { hash_alg = SHA1; input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"; output = h"84983e441c3bd26ebaae4aa1f95129e5e54670f1"; repeat = 1ul }; { hash_alg = SHA1; input = "a"; output = h"34aa973cd4c4daa4f61eeb2bdbad27316534016f"; repeat = 1000000ul }; { hash_alg = SHA1; input = "0123456701234567012345670123456701234567012345670123456701234567"; output = h"dea356a2cddd90c7a7ecedc5ebb563934f460452"; repeat = 10ul }; { hash_alg = SHA2_256; input = "abc"; output = h"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"; repeat = 1ul }; { hash_alg = SHA2_256; input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"; output = h"248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1"; repeat = 1ul }; { hash_alg = SHA2_256; input = "a"; output = h"cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0"; repeat = 1000000ul }; { hash_alg = SHA2_256; input = "0123456701234567012345670123456701234567012345670123456701234567"; output = h"594847328451bdfa85056225462cc1d867d877fb388df0ce35f25ab5562bfbb5"; repeat = 10ul }; { hash_alg = SHA2_256; input = "\x19"; output = h"68aa2e2ee5dff96e3355e6c7ee373e3d6a4e17f75f9518d843709c0c9bc3e3d4"; repeat = 1ul };(* { hash_alg = SHA2_256; // 2018.05.26: Don't know how to encode byte literals in strings; this doesn't work // as in OCaml input = "\xe3\xd7\x25\x70\xdc\xdd\x78\x7c\xe3\x88\x7a\xb2\xcd\x68\x46\x52"; output = h"175ee69b02ba9b58e2b0a5fd13819cea573f3940a94f825128cf4209beabb4e8"; repeat = 1ul }; *){ hash_alg = SHA2_384; input = "abc"; output = h"cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7"; repeat = 1ul }; { hash_alg = SHA2_384; input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"; output = h"09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039"; repeat = 1ul }; { hash_alg = SHA2_384; input = "a"; output = h"9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985"; repeat = 1000000ul }; { hash_alg = SHA2_384; input = "0123456701234567012345670123456701234567012345670123456701234567"; output = h"2fc64a4f500ddb6828f6a3430b8dd72a368eb7f3a8322a70bc84275b9c0b3ab00d27a5cc3c2d224aa6b61a0d79fb4596"; repeat = 10ul }; { hash_alg = SHA2_512; input = "abc"; output = h"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f"; repeat = 1ul }; { hash_alg = SHA2_512; input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"; output = h"8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909"; repeat = 1ul }; { hash_alg = SHA2_512; input = "a"; output = h"e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b"; repeat = 1000000ul }; { hash_alg = SHA2_512; input = "0123456701234567012345670123456701234567012345670123456701234567"; output = h"89d05ba632c699c31231ded4ffc127d5a894dad412c0e024db872d1abd2ba8141a0f85072a9be1e2aa04cf33c765cb510813a39cd5a84c4acaa64d3f3fb7bae9"; repeat = 10ul } ] noextract let hash_vectors_tmp = List.Tot.map (fun h -> h.hash_alg, h.input, h.output, h.repeat ) hash_vectors // 2018.08.06 SZ: I can't verify this in interactive mode but verifies from the command-line %splice[] (lowstarize_toplevel "hash_vectors_tmp" "hash_vectors_low") /// HMAC noeq noextract type hmac_vector = { ha: hash_alg; key: hex_encoded; data: hex_encoded; output: hex_encoded; } // selected test vectors from // https://tools.ietf.org/html/rfc4231#section-4.2 // pls extend me! noextract let hmac_vectors = [{ ha = SHA2_256; key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"; data = h"4869205468657265"; output = h"b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7"; }; { ha = SHA2_384; key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"; data = h"4869205468657265"; output = h"afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6"; }]
{ "checked_file": "/", "dependencies": [ "Test.Lowstarize.fst.checked", "Spec.HMAC_DRBG.Test.Vectors.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "EverCrypt.Hash.fsti.checked" ], "interface_file": false, "source_file": "Test.Vectors.fst" }
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt.Hash", "short_module": null }, { "abbrev": false, "full_module": "Test.Lowstarize", "short_module": null }, { "abbrev": false, "full_module": "Test", "short_module": null }, { "abbrev": false, "full_module": "Test", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Prims.list (((Test.Vectors.hash_alg * Test.Lowstarize.hex_encoded) * Test.Lowstarize.hex_encoded) * Test.Lowstarize.hex_encoded)
Prims.Tot
[ "total" ]
[]
[ "FStar.List.Tot.Base.map", "Test.Vectors.hmac_vector", "FStar.Pervasives.Native.tuple4", "Test.Vectors.hash_alg", "Test.Lowstarize.hex_encoded", "FStar.Pervasives.Native.Mktuple4", "Test.Vectors.__proj__Mkhmac_vector__item__ha", "Test.Vectors.__proj__Mkhmac_vector__item__key", "Test.Vectors.__proj__Mkhmac_vector__item__data", "Test.Vectors.__proj__Mkhmac_vector__item__output", "Test.Vectors.hmac_vectors" ]
[]
false
false
false
true
false
let hmac_vectors_tmp =
List.Tot.map (fun h -> h.ha, h.key, h.data, h.output) hmac_vectors
false
Hacl.Spec.Curve25519.Field51.Definition.fst
Hacl.Spec.Curve25519.Field51.Definition.felem_wide_fits1
val felem_wide_fits1 : x: Lib.IntTypes.uint128 -> m: Hacl.Spec.Curve25519.Field51.Definition.scale128 -> Prims.bool
let felem_wide_fits1 (x:uint128) (m:scale128) = uint_v x <= m * max51 * max51
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 31, "end_line": 101, "start_col": 0, "start_line": 100 }
module Hacl.Spec.Curve25519.Field51.Definition open Lib.Sequence open Lib.IntTypes open Spec.Curve25519 #reset-options "--z3rlimit 20" let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64) let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128) let scale64 = s:nat{s <= 8192} let scale128 = s:nat{s <= 67108864} let nat5 = (nat * nat * nat * nat * nat) let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192} let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864} let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x) let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x) open FStar.Mul let ( <=* ) (x:nat5) (y:nat5) : Type = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 <= y1) /\ (x2 <= y2) /\ (x3 <= y3) /\ (x4 <= y4) /\ (x5 <= y5) let ( +* ) (x:nat5) (y:nat5) : nat5 = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 + y1 , x2 + y2 , x3 + y3 , x4 + y4 , x5 + y5) let ( ** ) (x:nat5) (y:nat5) : nat5 = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 * y1 , x2 * y2 , x3 * y3 , x4 * y4 , x5 * y5) val lemma_mul_le_scale64: a:nat -> b:nat -> Lemma (requires a <= 8192 /\ b <= 8192) (ensures a * b <= 67108864) let lemma_mul_le_scale64 a b = let open FStar.Math.Lemmas in lemma_mult_le_left a b 8192; // a * b <= a * 8192 lemma_mult_le_right 8192 a 8192; // a * 8192 <= 8192 * 8192 assert (a * b <= 8192 * 8192); assert_norm (8192 * 8192 = 67108864) #set-options "--z3rlimit 100" let ( *^ ) (x:scale64) (y:scale64_5) : scale128_5 = let (y1,y2,y3,y4,y5) = y in lemma_mul_le_scale64 x y1; lemma_mul_le_scale64 x y2; lemma_mul_le_scale64 x y3; lemma_mul_le_scale64 x y4; lemma_mul_le_scale64 x y5; (x * y1 , x * y2 , x * y3 , x * y4 , x * y5) [@"opaque_to_smt"] let pow51: (pow51: pos { pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51 }) = let pow51: pos = normalize_term (pow2 51) in assert_norm (pow51 > 0); assert_norm (pow51 == pow2 51); assert_norm (pow2 64 == 8192 * pow51); assert_norm (pow2 128 == 67108864 * pow51 * pow51); pow51 inline_for_extraction noextract let max51 = pow51 - 1 inline_for_extraction noextract let mask51 : x:uint64{v x == pow2 51 - 1} = assert_norm (pow2 51 - 1 == 0x7ffffffffffff); u64 0x7ffffffffffff let felem_fits1 (x:uint64) (m:scale64) = uint_v x <= m * max51
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: Lib.IntTypes.uint128 -> m: Hacl.Spec.Curve25519.Field51.Definition.scale128 -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "Lib.IntTypes.uint128", "Hacl.Spec.Curve25519.Field51.Definition.scale128", "Prims.op_LessThanOrEqual", "Lib.IntTypes.uint_v", "Lib.IntTypes.U128", "Lib.IntTypes.SEC", "FStar.Mul.op_Star", "Hacl.Spec.Curve25519.Field51.Definition.max51", "Prims.bool" ]
[]
false
false
false
true
false
let felem_wide_fits1 (x: uint128) (m: scale128) =
uint_v x <= (m * max51) * max51
false
Hacl.Spec.Curve25519.Field51.Definition.fst
Hacl.Spec.Curve25519.Field51.Definition.s64x5
val s64x5 (x: scale64) : scale64_5
val s64x5 (x: scale64) : scale64_5
let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x)
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 47, "end_line": 21, "start_col": 0, "start_line": 21 }
module Hacl.Spec.Curve25519.Field51.Definition open Lib.Sequence open Lib.IntTypes open Spec.Curve25519 #reset-options "--z3rlimit 20" let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64) let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128) let scale64 = s:nat{s <= 8192} let scale128 = s:nat{s <= 67108864} let nat5 = (nat * nat * nat * nat * nat) let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192} let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864}
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst" }
[ { "abbrev": false, "full_module": "Spec.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: Hacl.Spec.Curve25519.Field51.Definition.scale64 -> Hacl.Spec.Curve25519.Field51.Definition.scale64_5
Prims.Tot
[ "total" ]
[]
[ "Hacl.Spec.Curve25519.Field51.Definition.scale64", "FStar.Pervasives.Native.Mktuple5", "Prims.nat", "Hacl.Spec.Curve25519.Field51.Definition.scale64_5" ]
[]
false
false
false
true
false
let s64x5 (x: scale64) : scale64_5 =
(x, x, x, x, x)
false
Hacl.Spec.Curve25519.Field51.Definition.fst
Hacl.Spec.Curve25519.Field51.Definition.lemma_mul_le_scale64
val lemma_mul_le_scale64: a:nat -> b:nat -> Lemma (requires a <= 8192 /\ b <= 8192) (ensures a * b <= 67108864)
val lemma_mul_le_scale64: a:nat -> b:nat -> Lemma (requires a <= 8192 /\ b <= 8192) (ensures a * b <= 67108864)
let lemma_mul_le_scale64 a b = let open FStar.Math.Lemmas in lemma_mult_le_left a b 8192; // a * b <= a * 8192 lemma_mult_le_right 8192 a 8192; // a * 8192 <= 8192 * 8192 assert (a * b <= 8192 * 8192); assert_norm (8192 * 8192 = 67108864)
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 38, "end_line": 63, "start_col": 0, "start_line": 58 }
module Hacl.Spec.Curve25519.Field51.Definition open Lib.Sequence open Lib.IntTypes open Spec.Curve25519 #reset-options "--z3rlimit 20" let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64) let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128) let scale64 = s:nat{s <= 8192} let scale128 = s:nat{s <= 67108864} let nat5 = (nat * nat * nat * nat * nat) let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192} let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864} let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x) let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x) open FStar.Mul let ( <=* ) (x:nat5) (y:nat5) : Type = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 <= y1) /\ (x2 <= y2) /\ (x3 <= y3) /\ (x4 <= y4) /\ (x5 <= y5) let ( +* ) (x:nat5) (y:nat5) : nat5 = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 + y1 , x2 + y2 , x3 + y3 , x4 + y4 , x5 + y5) let ( ** ) (x:nat5) (y:nat5) : nat5 = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 * y1 , x2 * y2 , x3 * y3 , x4 * y4 , x5 * y5) val lemma_mul_le_scale64: a:nat -> b:nat -> Lemma (requires a <= 8192 /\ b <= 8192)
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Prims.nat -> b: Prims.nat -> FStar.Pervasives.Lemma (requires a <= 8192 /\ b <= 8192) (ensures a * b <= 67108864)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.nat", "FStar.Pervasives.assert_norm", "Prims.b2t", "Prims.op_Equality", "Prims.int", "FStar.Mul.op_Star", "Prims.unit", "Prims._assert", "Prims.op_LessThanOrEqual", "FStar.Math.Lemmas.lemma_mult_le_right", "FStar.Math.Lemmas.lemma_mult_le_left" ]
[]
true
false
true
false
false
let lemma_mul_le_scale64 a b =
let open FStar.Math.Lemmas in lemma_mult_le_left a b 8192; lemma_mult_le_right 8192 a 8192; assert (a * b <= 8192 * 8192); assert_norm (8192 * 8192 = 67108864)
false
Test.Vectors.fst
Test.Vectors.hmac_drbg_vectors_tmp
val hmac_drbg_vectors_tmp : Prims.list (((((((Spec.HMAC_DRBG.Test.Vectors.supported_alg * Test.Lowstarize.hex_encoded) * Test.Lowstarize.hex_encoded) * Test.Lowstarize.hex_encoded) * Test.Lowstarize.hex_encoded) * Test.Lowstarize.hex_encoded) * (Test.Lowstarize.hex_encoded * Test.Lowstarize.hex_encoded)) * Test.Lowstarize.hex_encoded)
let hmac_drbg_vectors_tmp = let open Spec.HMAC_DRBG.Test.Vectors in List.Tot.map (fun x -> x.a, h x.entropy_input, h x.nonce, h x.personalization_string, h x.entropy_input_reseed, h x.additional_input_reseed, (h x.additional_input_1, h x.additional_input_2), h x.returned_bits) test_vectors
{ "file_name": "providers/test/Test.Vectors.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 14, "end_line": 204, "start_col": 0, "start_line": 197 }
module Test.Vectors open Test.Lowstarize open EverCrypt.Hash open Spec.Hash.Definitions /// Hash algorithms type hash_alg = EverCrypt.Hash.alg #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" noeq noextract type hash_vector = { (* The input [input] is repeated [repeat] times. *) hash_alg: hash_alg; input: string; output: hex_encoded; repeat: UInt32.t; } noextract let hash_vectors = [{ hash_alg = MD5; input = ""; output = h"d41d8cd98f00b204e9800998ecf8427e"; repeat = 1ul }; { hash_alg = MD5; input = "a"; output = h"0cc175b9c0f1b6a831c399e269772661"; repeat = 1ul }; { hash_alg = MD5; input = "abc"; output = h"900150983cd24fb0d6963f7d28e17f72"; repeat = 1ul }; { hash_alg = MD5; input = "message digest"; output = h"f96b697d7cb7938d525a2f31aaf161d0"; repeat = 1ul }; { hash_alg = MD5; input = "abcdefghijklmnopqrstuvwxyz"; output = h"c3fcd3d76192e4007dfb496cca67e13b"; repeat = 1ul }; { hash_alg = MD5; input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; output = h"d174ab98d277d9f5a5611c2c9f419d9f"; repeat = 1ul }; { hash_alg = MD5; input = "12345678901234567890123456789012345678901234567890123456789012345678901234567890"; output = h"57edf4a22be3c955ac49da2e2107b67a"; repeat = 1ul }; { hash_alg = SHA1; input = "abc"; output = h"a9993e364706816aba3e25717850c26c9cd0d89d"; repeat = 1ul }; { hash_alg = SHA1; input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"; output = h"84983e441c3bd26ebaae4aa1f95129e5e54670f1"; repeat = 1ul }; { hash_alg = SHA1; input = "a"; output = h"34aa973cd4c4daa4f61eeb2bdbad27316534016f"; repeat = 1000000ul }; { hash_alg = SHA1; input = "0123456701234567012345670123456701234567012345670123456701234567"; output = h"dea356a2cddd90c7a7ecedc5ebb563934f460452"; repeat = 10ul }; { hash_alg = SHA2_256; input = "abc"; output = h"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"; repeat = 1ul }; { hash_alg = SHA2_256; input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"; output = h"248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1"; repeat = 1ul }; { hash_alg = SHA2_256; input = "a"; output = h"cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0"; repeat = 1000000ul }; { hash_alg = SHA2_256; input = "0123456701234567012345670123456701234567012345670123456701234567"; output = h"594847328451bdfa85056225462cc1d867d877fb388df0ce35f25ab5562bfbb5"; repeat = 10ul }; { hash_alg = SHA2_256; input = "\x19"; output = h"68aa2e2ee5dff96e3355e6c7ee373e3d6a4e17f75f9518d843709c0c9bc3e3d4"; repeat = 1ul };(* { hash_alg = SHA2_256; // 2018.05.26: Don't know how to encode byte literals in strings; this doesn't work // as in OCaml input = "\xe3\xd7\x25\x70\xdc\xdd\x78\x7c\xe3\x88\x7a\xb2\xcd\x68\x46\x52"; output = h"175ee69b02ba9b58e2b0a5fd13819cea573f3940a94f825128cf4209beabb4e8"; repeat = 1ul }; *){ hash_alg = SHA2_384; input = "abc"; output = h"cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7"; repeat = 1ul }; { hash_alg = SHA2_384; input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"; output = h"09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039"; repeat = 1ul }; { hash_alg = SHA2_384; input = "a"; output = h"9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985"; repeat = 1000000ul }; { hash_alg = SHA2_384; input = "0123456701234567012345670123456701234567012345670123456701234567"; output = h"2fc64a4f500ddb6828f6a3430b8dd72a368eb7f3a8322a70bc84275b9c0b3ab00d27a5cc3c2d224aa6b61a0d79fb4596"; repeat = 10ul }; { hash_alg = SHA2_512; input = "abc"; output = h"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f"; repeat = 1ul }; { hash_alg = SHA2_512; input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"; output = h"8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909"; repeat = 1ul }; { hash_alg = SHA2_512; input = "a"; output = h"e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b"; repeat = 1000000ul }; { hash_alg = SHA2_512; input = "0123456701234567012345670123456701234567012345670123456701234567"; output = h"89d05ba632c699c31231ded4ffc127d5a894dad412c0e024db872d1abd2ba8141a0f85072a9be1e2aa04cf33c765cb510813a39cd5a84c4acaa64d3f3fb7bae9"; repeat = 10ul } ] noextract let hash_vectors_tmp = List.Tot.map (fun h -> h.hash_alg, h.input, h.output, h.repeat ) hash_vectors // 2018.08.06 SZ: I can't verify this in interactive mode but verifies from the command-line %splice[] (lowstarize_toplevel "hash_vectors_tmp" "hash_vectors_low") /// HMAC noeq noextract type hmac_vector = { ha: hash_alg; key: hex_encoded; data: hex_encoded; output: hex_encoded; } // selected test vectors from // https://tools.ietf.org/html/rfc4231#section-4.2 // pls extend me! noextract let hmac_vectors = [{ ha = SHA2_256; key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"; data = h"4869205468657265"; output = h"b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7"; }; { ha = SHA2_384; key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"; data = h"4869205468657265"; output = h"afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6"; }] noextract let hmac_vectors_tmp = List.Tot.map (fun h -> h.ha, h.key, h.data, h.output ) hmac_vectors %splice[] (lowstarize_toplevel "hmac_vectors_tmp" "hmac_vectors_low") /// HMAC_DRBG
{ "checked_file": "/", "dependencies": [ "Test.Lowstarize.fst.checked", "Spec.HMAC_DRBG.Test.Vectors.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "EverCrypt.Hash.fsti.checked" ], "interface_file": false, "source_file": "Test.Vectors.fst" }
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt.Hash", "short_module": null }, { "abbrev": false, "full_module": "Test.Lowstarize", "short_module": null }, { "abbrev": false, "full_module": "Test", "short_module": null }, { "abbrev": false, "full_module": "Test", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Prims.list (((((((Spec.HMAC_DRBG.Test.Vectors.supported_alg * Test.Lowstarize.hex_encoded) * Test.Lowstarize.hex_encoded) * Test.Lowstarize.hex_encoded) * Test.Lowstarize.hex_encoded) * Test.Lowstarize.hex_encoded) * (Test.Lowstarize.hex_encoded * Test.Lowstarize.hex_encoded)) * Test.Lowstarize.hex_encoded)
Prims.Tot
[ "total" ]
[]
[ "FStar.List.Tot.Base.map", "Spec.HMAC_DRBG.Test.Vectors.vec", "FStar.Pervasives.Native.tuple8", "Spec.HMAC_DRBG.Test.Vectors.supported_alg", "Test.Lowstarize.hex_encoded", "FStar.Pervasives.Native.tuple2", "FStar.Pervasives.Native.Mktuple8", "Spec.HMAC_DRBG.Test.Vectors.__proj__Mkvec__item__a", "Test.Lowstarize.h", "Spec.HMAC_DRBG.Test.Vectors.__proj__Mkvec__item__entropy_input", "Spec.HMAC_DRBG.Test.Vectors.__proj__Mkvec__item__nonce", "Spec.HMAC_DRBG.Test.Vectors.__proj__Mkvec__item__personalization_string", "Spec.HMAC_DRBG.Test.Vectors.__proj__Mkvec__item__entropy_input_reseed", "Spec.HMAC_DRBG.Test.Vectors.__proj__Mkvec__item__additional_input_reseed", "FStar.Pervasives.Native.Mktuple2", "Spec.HMAC_DRBG.Test.Vectors.__proj__Mkvec__item__additional_input_1", "Spec.HMAC_DRBG.Test.Vectors.__proj__Mkvec__item__additional_input_2", "Spec.HMAC_DRBG.Test.Vectors.__proj__Mkvec__item__returned_bits", "Spec.HMAC_DRBG.Test.Vectors.test_vectors" ]
[]
false
false
false
true
false
let hmac_drbg_vectors_tmp =
let open Spec.HMAC_DRBG.Test.Vectors in List.Tot.map (fun x -> x.a, h x.entropy_input, h x.nonce, h x.personalization_string, h x.entropy_input_reseed, h x.additional_input_reseed, (h x.additional_input_1, h x.additional_input_2), h x.returned_bits) test_vectors
false
Hacl.Spec.Curve25519.Field51.Definition.fst
Hacl.Spec.Curve25519.Field51.Definition.s128x5
val s128x5 (x: scale128) : scale128_5
val s128x5 (x: scale128) : scale128_5
let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x)
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 50, "end_line": 22, "start_col": 0, "start_line": 22 }
module Hacl.Spec.Curve25519.Field51.Definition open Lib.Sequence open Lib.IntTypes open Spec.Curve25519 #reset-options "--z3rlimit 20" let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64) let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128) let scale64 = s:nat{s <= 8192} let scale128 = s:nat{s <= 67108864} let nat5 = (nat * nat * nat * nat * nat) let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192} let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864}
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst" }
[ { "abbrev": false, "full_module": "Spec.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: Hacl.Spec.Curve25519.Field51.Definition.scale128 -> Hacl.Spec.Curve25519.Field51.Definition.scale128_5
Prims.Tot
[ "total" ]
[]
[ "Hacl.Spec.Curve25519.Field51.Definition.scale128", "FStar.Pervasives.Native.Mktuple5", "Prims.nat", "Hacl.Spec.Curve25519.Field51.Definition.scale128_5" ]
[]
false
false
false
true
false
let s128x5 (x: scale128) : scale128_5 =
(x, x, x, x, x)
false
Hacl.Spec.Curve25519.Field51.Definition.fst
Hacl.Spec.Curve25519.Field51.Definition.pow51
val pow51:(pow51: pos{pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51})
val pow51:(pow51: pos{pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51})
let pow51: (pow51: pos { pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51 }) = let pow51: pos = normalize_term (pow2 51) in assert_norm (pow51 > 0); assert_norm (pow51 == pow2 51); assert_norm (pow2 64 == 8192 * pow51); assert_norm (pow2 128 == 67108864 * pow51 * pow51); pow51
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 7, "end_line": 87, "start_col": 0, "start_line": 81 }
module Hacl.Spec.Curve25519.Field51.Definition open Lib.Sequence open Lib.IntTypes open Spec.Curve25519 #reset-options "--z3rlimit 20" let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64) let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128) let scale64 = s:nat{s <= 8192} let scale128 = s:nat{s <= 67108864} let nat5 = (nat * nat * nat * nat * nat) let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192} let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864} let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x) let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x) open FStar.Mul let ( <=* ) (x:nat5) (y:nat5) : Type = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 <= y1) /\ (x2 <= y2) /\ (x3 <= y3) /\ (x4 <= y4) /\ (x5 <= y5) let ( +* ) (x:nat5) (y:nat5) : nat5 = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 + y1 , x2 + y2 , x3 + y3 , x4 + y4 , x5 + y5) let ( ** ) (x:nat5) (y:nat5) : nat5 = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 * y1 , x2 * y2 , x3 * y3 , x4 * y4 , x5 * y5) val lemma_mul_le_scale64: a:nat -> b:nat -> Lemma (requires a <= 8192 /\ b <= 8192) (ensures a * b <= 67108864) let lemma_mul_le_scale64 a b = let open FStar.Math.Lemmas in lemma_mult_le_left a b 8192; // a * b <= a * 8192 lemma_mult_le_right 8192 a 8192; // a * 8192 <= 8192 * 8192 assert (a * b <= 8192 * 8192); assert_norm (8192 * 8192 = 67108864) #set-options "--z3rlimit 100" let ( *^ ) (x:scale64) (y:scale64_5) : scale128_5 = let (y1,y2,y3,y4,y5) = y in lemma_mul_le_scale64 x y1; lemma_mul_le_scale64 x y2; lemma_mul_le_scale64 x y3; lemma_mul_le_scale64 x y4; lemma_mul_le_scale64 x y5; (x * y1 , x * y2 , x * y3 , x * y4 , x * y5)
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
pow51: Prims.pos { Prims.pow2 64 == 8192 * pow51 /\ Prims.pow2 128 == (67108864 * pow51) * pow51 /\ pow51 == Prims.pow2 51 }
Prims.Tot
[ "total" ]
[]
[ "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.int", "Prims.pow2", "FStar.Mul.op_Star", "Prims.pos", "Prims.b2t", "Prims.op_GreaterThan", "FStar.Pervasives.normalize_term" ]
[]
false
false
false
false
false
let pow51:(pow51: pos{pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51}) =
let pow51:pos = normalize_term (pow2 51) in assert_norm (pow51 > 0); assert_norm (pow51 == pow2 51); assert_norm (pow2 64 == 8192 * pow51); assert_norm (pow2 128 == (67108864 * pow51) * pow51); pow51
false
Hacl.Spec.Curve25519.Field51.Definition.fst
Hacl.Spec.Curve25519.Field51.Definition.mask51
val mask51:x: uint64{v x == pow2 51 - 1}
val mask51:x: uint64{v x == pow2 51 - 1}
let mask51 : x:uint64{v x == pow2 51 - 1} = assert_norm (pow2 51 - 1 == 0x7ffffffffffff); u64 0x7ffffffffffff
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 21, "end_line": 95, "start_col": 0, "start_line": 93 }
module Hacl.Spec.Curve25519.Field51.Definition open Lib.Sequence open Lib.IntTypes open Spec.Curve25519 #reset-options "--z3rlimit 20" let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64) let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128) let scale64 = s:nat{s <= 8192} let scale128 = s:nat{s <= 67108864} let nat5 = (nat * nat * nat * nat * nat) let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192} let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864} let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x) let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x) open FStar.Mul let ( <=* ) (x:nat5) (y:nat5) : Type = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 <= y1) /\ (x2 <= y2) /\ (x3 <= y3) /\ (x4 <= y4) /\ (x5 <= y5) let ( +* ) (x:nat5) (y:nat5) : nat5 = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 + y1 , x2 + y2 , x3 + y3 , x4 + y4 , x5 + y5) let ( ** ) (x:nat5) (y:nat5) : nat5 = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 * y1 , x2 * y2 , x3 * y3 , x4 * y4 , x5 * y5) val lemma_mul_le_scale64: a:nat -> b:nat -> Lemma (requires a <= 8192 /\ b <= 8192) (ensures a * b <= 67108864) let lemma_mul_le_scale64 a b = let open FStar.Math.Lemmas in lemma_mult_le_left a b 8192; // a * b <= a * 8192 lemma_mult_le_right 8192 a 8192; // a * 8192 <= 8192 * 8192 assert (a * b <= 8192 * 8192); assert_norm (8192 * 8192 = 67108864) #set-options "--z3rlimit 100" let ( *^ ) (x:scale64) (y:scale64_5) : scale128_5 = let (y1,y2,y3,y4,y5) = y in lemma_mul_le_scale64 x y1; lemma_mul_le_scale64 x y2; lemma_mul_le_scale64 x y3; lemma_mul_le_scale64 x y4; lemma_mul_le_scale64 x y5; (x * y1 , x * y2 , x * y3 , x * y4 , x * y5) [@"opaque_to_smt"] let pow51: (pow51: pos { pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51 }) = let pow51: pos = normalize_term (pow2 51) in assert_norm (pow51 > 0); assert_norm (pow51 == pow2 51); assert_norm (pow2 64 == 8192 * pow51); assert_norm (pow2 128 == 67108864 * pow51 * pow51); pow51 inline_for_extraction noextract let max51 = pow51 - 1
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: Lib.IntTypes.int_t Lib.IntTypes.U64 Lib.IntTypes.SEC {Lib.IntTypes.v x == Prims.pow2 51 - 1}
Prims.Tot
[ "total" ]
[]
[ "Lib.IntTypes.u64", "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.int", "Prims.op_Subtraction", "Prims.pow2" ]
[]
false
false
false
false
false
let mask51:x: uint64{v x == pow2 51 - 1} =
assert_norm (pow2 51 - 1 == 0x7ffffffffffff); u64 0x7ffffffffffff
false
Hacl.Spec.Curve25519.Field51.Definition.fst
Hacl.Spec.Curve25519.Field51.Definition.feval
val feval (f: felem5) : GTot elem
val feval (f: felem5) : GTot elem
let feval (f:felem5) : GTot elem = (as_nat5 f) % prime
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 54, "end_line": 135, "start_col": 0, "start_line": 135 }
module Hacl.Spec.Curve25519.Field51.Definition open Lib.Sequence open Lib.IntTypes open Spec.Curve25519 #reset-options "--z3rlimit 20" let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64) let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128) let scale64 = s:nat{s <= 8192} let scale128 = s:nat{s <= 67108864} let nat5 = (nat * nat * nat * nat * nat) let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192} let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864} let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x) let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x) open FStar.Mul let ( <=* ) (x:nat5) (y:nat5) : Type = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 <= y1) /\ (x2 <= y2) /\ (x3 <= y3) /\ (x4 <= y4) /\ (x5 <= y5) let ( +* ) (x:nat5) (y:nat5) : nat5 = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 + y1 , x2 + y2 , x3 + y3 , x4 + y4 , x5 + y5) let ( ** ) (x:nat5) (y:nat5) : nat5 = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 * y1 , x2 * y2 , x3 * y3 , x4 * y4 , x5 * y5) val lemma_mul_le_scale64: a:nat -> b:nat -> Lemma (requires a <= 8192 /\ b <= 8192) (ensures a * b <= 67108864) let lemma_mul_le_scale64 a b = let open FStar.Math.Lemmas in lemma_mult_le_left a b 8192; // a * b <= a * 8192 lemma_mult_le_right 8192 a 8192; // a * 8192 <= 8192 * 8192 assert (a * b <= 8192 * 8192); assert_norm (8192 * 8192 = 67108864) #set-options "--z3rlimit 100" let ( *^ ) (x:scale64) (y:scale64_5) : scale128_5 = let (y1,y2,y3,y4,y5) = y in lemma_mul_le_scale64 x y1; lemma_mul_le_scale64 x y2; lemma_mul_le_scale64 x y3; lemma_mul_le_scale64 x y4; lemma_mul_le_scale64 x y5; (x * y1 , x * y2 , x * y3 , x * y4 , x * y5) [@"opaque_to_smt"] let pow51: (pow51: pos { pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51 }) = let pow51: pos = normalize_term (pow2 51) in assert_norm (pow51 > 0); assert_norm (pow51 == pow2 51); assert_norm (pow2 64 == 8192 * pow51); assert_norm (pow2 128 == 67108864 * pow51 * pow51); pow51 inline_for_extraction noextract let max51 = pow51 - 1 inline_for_extraction noextract let mask51 : x:uint64{v x == pow2 51 - 1} = assert_norm (pow2 51 - 1 == 0x7ffffffffffff); u64 0x7ffffffffffff let felem_fits1 (x:uint64) (m:scale64) = uint_v x <= m * max51 let felem_wide_fits1 (x:uint128) (m:scale128) = uint_v x <= m * max51 * max51 let felem_fits5 (f:felem5) (m:scale64_5) = let (x1,x2,x3,x4,x5) = f in let (m1,m2,m3,m4,m5) = m in felem_fits1 x1 m1 /\ felem_fits1 x2 m2 /\ felem_fits1 x3 m3 /\ felem_fits1 x4 m4 /\ felem_fits1 x5 m5 let felem_wide_fits5 (f:felem_wide5) (m:scale128_5) = let (x1,x2,x3,x4,x5) = f in let (m1,m2,m3,m4,m5) = m in felem_wide_fits1 x1 m1 /\ felem_wide_fits1 x2 m2 /\ felem_wide_fits1 x3 m3 /\ felem_wide_fits1 x4 m4 /\ felem_wide_fits1 x5 m5 noextract val as_nat5: f:felem5 -> GTot nat let as_nat5 f = let (s0, s1, s2, s3, s4) = f in uint_v s0 + (uint_v s1 * pow51) + (uint_v s2 * pow51 * pow51) + (uint_v s3 * pow51 * pow51 * pow51) + (uint_v s4 * pow51 * pow51 * pow51 * pow51) noextract val wide_as_nat5: f:felem_wide5 -> GTot nat let wide_as_nat5 f = let (s0, s1, s2, s3, s4) = f in uint_v s0 + (uint_v s1 * pow51) + (uint_v s2 * pow51 * pow51) + (uint_v s3 * pow51 * pow51 * pow51) + (uint_v s4 * pow51 * pow51 * pow51 * pow51)
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
f: Hacl.Spec.Curve25519.Field51.Definition.felem5 -> Prims.GTot Spec.Curve25519.elem
Prims.GTot
[ "sometrivial" ]
[]
[ "Hacl.Spec.Curve25519.Field51.Definition.felem5", "Prims.op_Modulus", "Hacl.Spec.Curve25519.Field51.Definition.as_nat5", "Spec.Curve25519.prime", "Spec.Curve25519.elem" ]
[]
false
false
false
false
false
let feval (f: felem5) : GTot elem =
(as_nat5 f) % prime
false
Hacl.Spec.Curve25519.Field51.Definition.fst
Hacl.Spec.Curve25519.Field51.Definition.felem_wide_fits5
val felem_wide_fits5 : f: Hacl.Spec.Curve25519.Field51.Definition.felem_wide5 -> m: Hacl.Spec.Curve25519.Field51.Definition.scale128_5 -> Prims.logical
let felem_wide_fits5 (f:felem_wide5) (m:scale128_5) = let (x1,x2,x3,x4,x5) = f in let (m1,m2,m3,m4,m5) = m in felem_wide_fits1 x1 m1 /\ felem_wide_fits1 x2 m2 /\ felem_wide_fits1 x3 m3 /\ felem_wide_fits1 x4 m4 /\ felem_wide_fits1 x5 m5
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 24, "end_line": 119, "start_col": 0, "start_line": 112 }
module Hacl.Spec.Curve25519.Field51.Definition open Lib.Sequence open Lib.IntTypes open Spec.Curve25519 #reset-options "--z3rlimit 20" let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64) let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128) let scale64 = s:nat{s <= 8192} let scale128 = s:nat{s <= 67108864} let nat5 = (nat * nat * nat * nat * nat) let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192} let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864} let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x) let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x) open FStar.Mul let ( <=* ) (x:nat5) (y:nat5) : Type = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 <= y1) /\ (x2 <= y2) /\ (x3 <= y3) /\ (x4 <= y4) /\ (x5 <= y5) let ( +* ) (x:nat5) (y:nat5) : nat5 = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 + y1 , x2 + y2 , x3 + y3 , x4 + y4 , x5 + y5) let ( ** ) (x:nat5) (y:nat5) : nat5 = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 * y1 , x2 * y2 , x3 * y3 , x4 * y4 , x5 * y5) val lemma_mul_le_scale64: a:nat -> b:nat -> Lemma (requires a <= 8192 /\ b <= 8192) (ensures a * b <= 67108864) let lemma_mul_le_scale64 a b = let open FStar.Math.Lemmas in lemma_mult_le_left a b 8192; // a * b <= a * 8192 lemma_mult_le_right 8192 a 8192; // a * 8192 <= 8192 * 8192 assert (a * b <= 8192 * 8192); assert_norm (8192 * 8192 = 67108864) #set-options "--z3rlimit 100" let ( *^ ) (x:scale64) (y:scale64_5) : scale128_5 = let (y1,y2,y3,y4,y5) = y in lemma_mul_le_scale64 x y1; lemma_mul_le_scale64 x y2; lemma_mul_le_scale64 x y3; lemma_mul_le_scale64 x y4; lemma_mul_le_scale64 x y5; (x * y1 , x * y2 , x * y3 , x * y4 , x * y5) [@"opaque_to_smt"] let pow51: (pow51: pos { pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51 }) = let pow51: pos = normalize_term (pow2 51) in assert_norm (pow51 > 0); assert_norm (pow51 == pow2 51); assert_norm (pow2 64 == 8192 * pow51); assert_norm (pow2 128 == 67108864 * pow51 * pow51); pow51 inline_for_extraction noextract let max51 = pow51 - 1 inline_for_extraction noextract let mask51 : x:uint64{v x == pow2 51 - 1} = assert_norm (pow2 51 - 1 == 0x7ffffffffffff); u64 0x7ffffffffffff let felem_fits1 (x:uint64) (m:scale64) = uint_v x <= m * max51 let felem_wide_fits1 (x:uint128) (m:scale128) = uint_v x <= m * max51 * max51 let felem_fits5 (f:felem5) (m:scale64_5) = let (x1,x2,x3,x4,x5) = f in let (m1,m2,m3,m4,m5) = m in felem_fits1 x1 m1 /\ felem_fits1 x2 m2 /\ felem_fits1 x3 m3 /\ felem_fits1 x4 m4 /\ felem_fits1 x5 m5
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
f: Hacl.Spec.Curve25519.Field51.Definition.felem_wide5 -> m: Hacl.Spec.Curve25519.Field51.Definition.scale128_5 -> Prims.logical
Prims.Tot
[ "total" ]
[]
[ "Hacl.Spec.Curve25519.Field51.Definition.felem_wide5", "Hacl.Spec.Curve25519.Field51.Definition.scale128_5", "Lib.IntTypes.uint128", "Prims.nat", "Prims.l_and", "Prims.b2t", "Hacl.Spec.Curve25519.Field51.Definition.felem_wide_fits1", "Prims.logical" ]
[]
false
false
false
true
true
let felem_wide_fits5 (f: felem_wide5) (m: scale128_5) =
let x1, x2, x3, x4, x5 = f in let m1, m2, m3, m4, m5 = m in felem_wide_fits1 x1 m1 /\ felem_wide_fits1 x2 m2 /\ felem_wide_fits1 x3 m3 /\ felem_wide_fits1 x4 m4 /\ felem_wide_fits1 x5 m5
false
Hacl.Spec.Curve25519.Field51.Definition.fst
Hacl.Spec.Curve25519.Field51.Definition.felem_fits5
val felem_fits5 : f: Hacl.Spec.Curve25519.Field51.Definition.felem5 -> m: Hacl.Spec.Curve25519.Field51.Definition.scale64_5 -> Prims.logical
let felem_fits5 (f:felem5) (m:scale64_5) = let (x1,x2,x3,x4,x5) = f in let (m1,m2,m3,m4,m5) = m in felem_fits1 x1 m1 /\ felem_fits1 x2 m2 /\ felem_fits1 x3 m3 /\ felem_fits1 x4 m4 /\ felem_fits1 x5 m5
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 19, "end_line": 110, "start_col": 0, "start_line": 103 }
module Hacl.Spec.Curve25519.Field51.Definition open Lib.Sequence open Lib.IntTypes open Spec.Curve25519 #reset-options "--z3rlimit 20" let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64) let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128) let scale64 = s:nat{s <= 8192} let scale128 = s:nat{s <= 67108864} let nat5 = (nat * nat * nat * nat * nat) let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192} let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864} let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x) let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x) open FStar.Mul let ( <=* ) (x:nat5) (y:nat5) : Type = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 <= y1) /\ (x2 <= y2) /\ (x3 <= y3) /\ (x4 <= y4) /\ (x5 <= y5) let ( +* ) (x:nat5) (y:nat5) : nat5 = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 + y1 , x2 + y2 , x3 + y3 , x4 + y4 , x5 + y5) let ( ** ) (x:nat5) (y:nat5) : nat5 = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 * y1 , x2 * y2 , x3 * y3 , x4 * y4 , x5 * y5) val lemma_mul_le_scale64: a:nat -> b:nat -> Lemma (requires a <= 8192 /\ b <= 8192) (ensures a * b <= 67108864) let lemma_mul_le_scale64 a b = let open FStar.Math.Lemmas in lemma_mult_le_left a b 8192; // a * b <= a * 8192 lemma_mult_le_right 8192 a 8192; // a * 8192 <= 8192 * 8192 assert (a * b <= 8192 * 8192); assert_norm (8192 * 8192 = 67108864) #set-options "--z3rlimit 100" let ( *^ ) (x:scale64) (y:scale64_5) : scale128_5 = let (y1,y2,y3,y4,y5) = y in lemma_mul_le_scale64 x y1; lemma_mul_le_scale64 x y2; lemma_mul_le_scale64 x y3; lemma_mul_le_scale64 x y4; lemma_mul_le_scale64 x y5; (x * y1 , x * y2 , x * y3 , x * y4 , x * y5) [@"opaque_to_smt"] let pow51: (pow51: pos { pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51 }) = let pow51: pos = normalize_term (pow2 51) in assert_norm (pow51 > 0); assert_norm (pow51 == pow2 51); assert_norm (pow2 64 == 8192 * pow51); assert_norm (pow2 128 == 67108864 * pow51 * pow51); pow51 inline_for_extraction noextract let max51 = pow51 - 1 inline_for_extraction noextract let mask51 : x:uint64{v x == pow2 51 - 1} = assert_norm (pow2 51 - 1 == 0x7ffffffffffff); u64 0x7ffffffffffff let felem_fits1 (x:uint64) (m:scale64) = uint_v x <= m * max51 let felem_wide_fits1 (x:uint128) (m:scale128) = uint_v x <= m * max51 * max51
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
f: Hacl.Spec.Curve25519.Field51.Definition.felem5 -> m: Hacl.Spec.Curve25519.Field51.Definition.scale64_5 -> Prims.logical
Prims.Tot
[ "total" ]
[]
[ "Hacl.Spec.Curve25519.Field51.Definition.felem5", "Hacl.Spec.Curve25519.Field51.Definition.scale64_5", "Lib.IntTypes.uint64", "Prims.nat", "Prims.l_and", "Prims.b2t", "Hacl.Spec.Curve25519.Field51.Definition.felem_fits1", "Prims.logical" ]
[]
false
false
false
true
true
let felem_fits5 (f: felem5) (m: scale64_5) =
let x1, x2, x3, x4, x5 = f in let m1, m2, m3, m4, m5 = m in felem_fits1 x1 m1 /\ felem_fits1 x2 m2 /\ felem_fits1 x3 m3 /\ felem_fits1 x4 m4 /\ felem_fits1 x5 m5
false
Hacl.Spec.Curve25519.Field51.Definition.fst
Hacl.Spec.Curve25519.Field51.Definition.wide_as_nat5
val wide_as_nat5: f:felem_wide5 -> GTot nat
val wide_as_nat5: f:felem_wide5 -> GTot nat
let wide_as_nat5 f = let (s0, s1, s2, s3, s4) = f in uint_v s0 + (uint_v s1 * pow51) + (uint_v s2 * pow51 * pow51) + (uint_v s3 * pow51 * pow51 * pow51) + (uint_v s4 * pow51 * pow51 * pow51 * pow51)
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 85, "end_line": 133, "start_col": 0, "start_line": 130 }
module Hacl.Spec.Curve25519.Field51.Definition open Lib.Sequence open Lib.IntTypes open Spec.Curve25519 #reset-options "--z3rlimit 20" let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64) let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128) let scale64 = s:nat{s <= 8192} let scale128 = s:nat{s <= 67108864} let nat5 = (nat * nat * nat * nat * nat) let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192} let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864} let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x) let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x) open FStar.Mul let ( <=* ) (x:nat5) (y:nat5) : Type = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 <= y1) /\ (x2 <= y2) /\ (x3 <= y3) /\ (x4 <= y4) /\ (x5 <= y5) let ( +* ) (x:nat5) (y:nat5) : nat5 = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 + y1 , x2 + y2 , x3 + y3 , x4 + y4 , x5 + y5) let ( ** ) (x:nat5) (y:nat5) : nat5 = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 * y1 , x2 * y2 , x3 * y3 , x4 * y4 , x5 * y5) val lemma_mul_le_scale64: a:nat -> b:nat -> Lemma (requires a <= 8192 /\ b <= 8192) (ensures a * b <= 67108864) let lemma_mul_le_scale64 a b = let open FStar.Math.Lemmas in lemma_mult_le_left a b 8192; // a * b <= a * 8192 lemma_mult_le_right 8192 a 8192; // a * 8192 <= 8192 * 8192 assert (a * b <= 8192 * 8192); assert_norm (8192 * 8192 = 67108864) #set-options "--z3rlimit 100" let ( *^ ) (x:scale64) (y:scale64_5) : scale128_5 = let (y1,y2,y3,y4,y5) = y in lemma_mul_le_scale64 x y1; lemma_mul_le_scale64 x y2; lemma_mul_le_scale64 x y3; lemma_mul_le_scale64 x y4; lemma_mul_le_scale64 x y5; (x * y1 , x * y2 , x * y3 , x * y4 , x * y5) [@"opaque_to_smt"] let pow51: (pow51: pos { pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51 }) = let pow51: pos = normalize_term (pow2 51) in assert_norm (pow51 > 0); assert_norm (pow51 == pow2 51); assert_norm (pow2 64 == 8192 * pow51); assert_norm (pow2 128 == 67108864 * pow51 * pow51); pow51 inline_for_extraction noextract let max51 = pow51 - 1 inline_for_extraction noextract let mask51 : x:uint64{v x == pow2 51 - 1} = assert_norm (pow2 51 - 1 == 0x7ffffffffffff); u64 0x7ffffffffffff let felem_fits1 (x:uint64) (m:scale64) = uint_v x <= m * max51 let felem_wide_fits1 (x:uint128) (m:scale128) = uint_v x <= m * max51 * max51 let felem_fits5 (f:felem5) (m:scale64_5) = let (x1,x2,x3,x4,x5) = f in let (m1,m2,m3,m4,m5) = m in felem_fits1 x1 m1 /\ felem_fits1 x2 m2 /\ felem_fits1 x3 m3 /\ felem_fits1 x4 m4 /\ felem_fits1 x5 m5 let felem_wide_fits5 (f:felem_wide5) (m:scale128_5) = let (x1,x2,x3,x4,x5) = f in let (m1,m2,m3,m4,m5) = m in felem_wide_fits1 x1 m1 /\ felem_wide_fits1 x2 m2 /\ felem_wide_fits1 x3 m3 /\ felem_wide_fits1 x4 m4 /\ felem_wide_fits1 x5 m5 noextract val as_nat5: f:felem5 -> GTot nat let as_nat5 f = let (s0, s1, s2, s3, s4) = f in uint_v s0 + (uint_v s1 * pow51) + (uint_v s2 * pow51 * pow51) + (uint_v s3 * pow51 * pow51 * pow51) + (uint_v s4 * pow51 * pow51 * pow51 * pow51) noextract
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
f: Hacl.Spec.Curve25519.Field51.Definition.felem_wide5 -> Prims.GTot Prims.nat
Prims.GTot
[ "sometrivial" ]
[]
[ "Hacl.Spec.Curve25519.Field51.Definition.felem_wide5", "Lib.IntTypes.uint128", "Prims.op_Addition", "Lib.IntTypes.uint_v", "Lib.IntTypes.U128", "Lib.IntTypes.SEC", "FStar.Mul.op_Star", "Hacl.Spec.Curve25519.Field51.Definition.pow51", "Prims.nat" ]
[]
false
false
false
false
false
let wide_as_nat5 f =
let s0, s1, s2, s3, s4 = f in uint_v s0 + (uint_v s1 * pow51) + ((uint_v s2 * pow51) * pow51) + (((uint_v s3 * pow51) * pow51) * pow51) + ((((uint_v s4 * pow51) * pow51) * pow51) * pow51)
false
Hacl.Spec.Curve25519.Field51.Definition.fst
Hacl.Spec.Curve25519.Field51.Definition.feval_wide
val feval_wide (f: felem_wide5) : GTot elem
val feval_wide (f: felem_wide5) : GTot elem
let feval_wide (f:felem_wide5) : GTot elem = (wide_as_nat5 f) % prime
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 69, "end_line": 136, "start_col": 0, "start_line": 136 }
module Hacl.Spec.Curve25519.Field51.Definition open Lib.Sequence open Lib.IntTypes open Spec.Curve25519 #reset-options "--z3rlimit 20" let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64) let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128) let scale64 = s:nat{s <= 8192} let scale128 = s:nat{s <= 67108864} let nat5 = (nat * nat * nat * nat * nat) let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192} let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864} let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x) let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x) open FStar.Mul let ( <=* ) (x:nat5) (y:nat5) : Type = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 <= y1) /\ (x2 <= y2) /\ (x3 <= y3) /\ (x4 <= y4) /\ (x5 <= y5) let ( +* ) (x:nat5) (y:nat5) : nat5 = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 + y1 , x2 + y2 , x3 + y3 , x4 + y4 , x5 + y5) let ( ** ) (x:nat5) (y:nat5) : nat5 = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 * y1 , x2 * y2 , x3 * y3 , x4 * y4 , x5 * y5) val lemma_mul_le_scale64: a:nat -> b:nat -> Lemma (requires a <= 8192 /\ b <= 8192) (ensures a * b <= 67108864) let lemma_mul_le_scale64 a b = let open FStar.Math.Lemmas in lemma_mult_le_left a b 8192; // a * b <= a * 8192 lemma_mult_le_right 8192 a 8192; // a * 8192 <= 8192 * 8192 assert (a * b <= 8192 * 8192); assert_norm (8192 * 8192 = 67108864) #set-options "--z3rlimit 100" let ( *^ ) (x:scale64) (y:scale64_5) : scale128_5 = let (y1,y2,y3,y4,y5) = y in lemma_mul_le_scale64 x y1; lemma_mul_le_scale64 x y2; lemma_mul_le_scale64 x y3; lemma_mul_le_scale64 x y4; lemma_mul_le_scale64 x y5; (x * y1 , x * y2 , x * y3 , x * y4 , x * y5) [@"opaque_to_smt"] let pow51: (pow51: pos { pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51 }) = let pow51: pos = normalize_term (pow2 51) in assert_norm (pow51 > 0); assert_norm (pow51 == pow2 51); assert_norm (pow2 64 == 8192 * pow51); assert_norm (pow2 128 == 67108864 * pow51 * pow51); pow51 inline_for_extraction noextract let max51 = pow51 - 1 inline_for_extraction noextract let mask51 : x:uint64{v x == pow2 51 - 1} = assert_norm (pow2 51 - 1 == 0x7ffffffffffff); u64 0x7ffffffffffff let felem_fits1 (x:uint64) (m:scale64) = uint_v x <= m * max51 let felem_wide_fits1 (x:uint128) (m:scale128) = uint_v x <= m * max51 * max51 let felem_fits5 (f:felem5) (m:scale64_5) = let (x1,x2,x3,x4,x5) = f in let (m1,m2,m3,m4,m5) = m in felem_fits1 x1 m1 /\ felem_fits1 x2 m2 /\ felem_fits1 x3 m3 /\ felem_fits1 x4 m4 /\ felem_fits1 x5 m5 let felem_wide_fits5 (f:felem_wide5) (m:scale128_5) = let (x1,x2,x3,x4,x5) = f in let (m1,m2,m3,m4,m5) = m in felem_wide_fits1 x1 m1 /\ felem_wide_fits1 x2 m2 /\ felem_wide_fits1 x3 m3 /\ felem_wide_fits1 x4 m4 /\ felem_wide_fits1 x5 m5 noextract val as_nat5: f:felem5 -> GTot nat let as_nat5 f = let (s0, s1, s2, s3, s4) = f in uint_v s0 + (uint_v s1 * pow51) + (uint_v s2 * pow51 * pow51) + (uint_v s3 * pow51 * pow51 * pow51) + (uint_v s4 * pow51 * pow51 * pow51 * pow51) noextract val wide_as_nat5: f:felem_wide5 -> GTot nat let wide_as_nat5 f = let (s0, s1, s2, s3, s4) = f in uint_v s0 + (uint_v s1 * pow51) + (uint_v s2 * pow51 * pow51) + (uint_v s3 * pow51 * pow51 * pow51) + (uint_v s4 * pow51 * pow51 * pow51 * pow51)
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
f: Hacl.Spec.Curve25519.Field51.Definition.felem_wide5 -> Prims.GTot Spec.Curve25519.elem
Prims.GTot
[ "sometrivial" ]
[]
[ "Hacl.Spec.Curve25519.Field51.Definition.felem_wide5", "Prims.op_Modulus", "Hacl.Spec.Curve25519.Field51.Definition.wide_as_nat5", "Spec.Curve25519.prime", "Spec.Curve25519.elem" ]
[]
false
false
false
false
false
let feval_wide (f: felem_wide5) : GTot elem =
(wide_as_nat5 f) % prime
false
Hacl.Spec.Curve25519.Field51.Definition.fst
Hacl.Spec.Curve25519.Field51.Definition.as_nat5
val as_nat5: f:felem5 -> GTot nat
val as_nat5: f:felem5 -> GTot nat
let as_nat5 f = let (s0, s1, s2, s3, s4) = f in uint_v s0 + (uint_v s1 * pow51) + (uint_v s2 * pow51 * pow51) + (uint_v s3 * pow51 * pow51 * pow51) + (uint_v s4 * pow51 * pow51 * pow51 * pow51)
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 85, "end_line": 126, "start_col": 0, "start_line": 123 }
module Hacl.Spec.Curve25519.Field51.Definition open Lib.Sequence open Lib.IntTypes open Spec.Curve25519 #reset-options "--z3rlimit 20" let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64) let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128) let scale64 = s:nat{s <= 8192} let scale128 = s:nat{s <= 67108864} let nat5 = (nat * nat * nat * nat * nat) let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192} let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864} let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x) let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x) open FStar.Mul let ( <=* ) (x:nat5) (y:nat5) : Type = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 <= y1) /\ (x2 <= y2) /\ (x3 <= y3) /\ (x4 <= y4) /\ (x5 <= y5) let ( +* ) (x:nat5) (y:nat5) : nat5 = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 + y1 , x2 + y2 , x3 + y3 , x4 + y4 , x5 + y5) let ( ** ) (x:nat5) (y:nat5) : nat5 = let (x1,x2,x3,x4,x5) = x in let (y1,y2,y3,y4,y5) = y in (x1 * y1 , x2 * y2 , x3 * y3 , x4 * y4 , x5 * y5) val lemma_mul_le_scale64: a:nat -> b:nat -> Lemma (requires a <= 8192 /\ b <= 8192) (ensures a * b <= 67108864) let lemma_mul_le_scale64 a b = let open FStar.Math.Lemmas in lemma_mult_le_left a b 8192; // a * b <= a * 8192 lemma_mult_le_right 8192 a 8192; // a * 8192 <= 8192 * 8192 assert (a * b <= 8192 * 8192); assert_norm (8192 * 8192 = 67108864) #set-options "--z3rlimit 100" let ( *^ ) (x:scale64) (y:scale64_5) : scale128_5 = let (y1,y2,y3,y4,y5) = y in lemma_mul_le_scale64 x y1; lemma_mul_le_scale64 x y2; lemma_mul_le_scale64 x y3; lemma_mul_le_scale64 x y4; lemma_mul_le_scale64 x y5; (x * y1 , x * y2 , x * y3 , x * y4 , x * y5) [@"opaque_to_smt"] let pow51: (pow51: pos { pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51 }) = let pow51: pos = normalize_term (pow2 51) in assert_norm (pow51 > 0); assert_norm (pow51 == pow2 51); assert_norm (pow2 64 == 8192 * pow51); assert_norm (pow2 128 == 67108864 * pow51 * pow51); pow51 inline_for_extraction noextract let max51 = pow51 - 1 inline_for_extraction noextract let mask51 : x:uint64{v x == pow2 51 - 1} = assert_norm (pow2 51 - 1 == 0x7ffffffffffff); u64 0x7ffffffffffff let felem_fits1 (x:uint64) (m:scale64) = uint_v x <= m * max51 let felem_wide_fits1 (x:uint128) (m:scale128) = uint_v x <= m * max51 * max51 let felem_fits5 (f:felem5) (m:scale64_5) = let (x1,x2,x3,x4,x5) = f in let (m1,m2,m3,m4,m5) = m in felem_fits1 x1 m1 /\ felem_fits1 x2 m2 /\ felem_fits1 x3 m3 /\ felem_fits1 x4 m4 /\ felem_fits1 x5 m5 let felem_wide_fits5 (f:felem_wide5) (m:scale128_5) = let (x1,x2,x3,x4,x5) = f in let (m1,m2,m3,m4,m5) = m in felem_wide_fits1 x1 m1 /\ felem_wide_fits1 x2 m2 /\ felem_wide_fits1 x3 m3 /\ felem_wide_fits1 x4 m4 /\ felem_wide_fits1 x5 m5 noextract
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field51", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
f: Hacl.Spec.Curve25519.Field51.Definition.felem5 -> Prims.GTot Prims.nat
Prims.GTot
[ "sometrivial" ]
[]
[ "Hacl.Spec.Curve25519.Field51.Definition.felem5", "Lib.IntTypes.uint64", "Prims.op_Addition", "Lib.IntTypes.uint_v", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "FStar.Mul.op_Star", "Hacl.Spec.Curve25519.Field51.Definition.pow51", "Prims.nat" ]
[]
false
false
false
false
false
let as_nat5 f =
let s0, s1, s2, s3, s4 = f in uint_v s0 + (uint_v s1 * pow51) + ((uint_v s2 * pow51) * pow51) + (((uint_v s3 * pow51) * pow51) * pow51) + ((((uint_v s4 * pow51) * pow51) * pow51) * pow51)
false
Hacl.Impl.SHA2.Core.fst
Hacl.Impl.SHA2.Core.block_t
val block_t : a: Spec.Hash.Definitions.sha2_alg -> Type0
let block_t (a:sha2_alg) = lbuffer uint8 (HD.block_len a)
{ "file_name": "code/sha2-mb/Hacl.Impl.SHA2.Core.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 32, "end_line": 36, "start_col": 0, "start_line": 35 }
module Hacl.Impl.SHA2.Core open FStar.Mul open FStar.HyperStack open FStar.HyperStack.All open Lib.IntTypes open Lib.NTuple open Lib.Buffer open Lib.IntVector open Lib.MultiBuffer open Spec.Hash.Definitions //open Hacl.Hash.Definitions // <- defines as_seq which clashes with Lib.Buffer.as_seq open Hacl.Spec.SHA2.Vec module ST = FStar.HyperStack.ST module NTup = Lib.NTuple module SpecVec = Hacl.Spec.SHA2.Vec module VecTranspose = Lib.IntVector.Transpose module LSeq = Lib.Sequence module HD = Hacl.Hash.Definitions (* Force ordering in dependency analysis so that monomorphizations are inserted into the Types module first. *) let _ = Hacl.Impl.SHA2.Types.uint8_8p #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 50" unfold let state_t (a:sha2_alg) (m:m_spec) = lbuffer (element_t a m) 8ul
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NTuple.fsti.checked", "Lib.MultiBuffer.fst.checked", "Lib.IntVector.Transpose.fsti.checked", "Lib.IntVector.Serialize.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.SHA2.Vec.fst.checked", "Hacl.Impl.SHA2.Types.fst.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.UInt32.fsti.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.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA2.Core.fst" }
[ { "abbrev": true, "full_module": "Hacl.Hash.Definitions", "short_module": "HD" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "Lib.IntVector.Transpose", "short_module": "VecTranspose" }, { "abbrev": true, "full_module": "Hacl.Spec.SHA2.Vec", "short_module": "SpecVec" }, { "abbrev": true, "full_module": "Lib.NTuple", "short_module": "NTup" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Spec.SHA2.Vec", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.MultiBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.NTuple", "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.SHA2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Spec.Hash.Definitions.sha2_alg -> Type0
Prims.Tot
[ "total" ]
[]
[ "Spec.Hash.Definitions.sha2_alg", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "Hacl.Hash.Definitions.block_len" ]
[]
false
false
false
true
true
let block_t (a: sha2_alg) =
lbuffer uint8 (HD.block_len a)
false
Hacl.Impl.SHA2.Core.fst
Hacl.Impl.SHA2.Core.state_t
val state_t : a: Spec.Hash.Definitions.sha2_alg -> m: Hacl.Spec.SHA2.Vec.m_spec -> Type0
let state_t (a:sha2_alg) (m:m_spec) = lbuffer (element_t a m) 8ul
{ "file_name": "code/sha2-mb/Hacl.Impl.SHA2.Core.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 29, "end_line": 32, "start_col": 0, "start_line": 31 }
module Hacl.Impl.SHA2.Core open FStar.Mul open FStar.HyperStack open FStar.HyperStack.All open Lib.IntTypes open Lib.NTuple open Lib.Buffer open Lib.IntVector open Lib.MultiBuffer open Spec.Hash.Definitions //open Hacl.Hash.Definitions // <- defines as_seq which clashes with Lib.Buffer.as_seq open Hacl.Spec.SHA2.Vec module ST = FStar.HyperStack.ST module NTup = Lib.NTuple module SpecVec = Hacl.Spec.SHA2.Vec module VecTranspose = Lib.IntVector.Transpose module LSeq = Lib.Sequence module HD = Hacl.Hash.Definitions (* Force ordering in dependency analysis so that monomorphizations are inserted into the Types module first. *) let _ = Hacl.Impl.SHA2.Types.uint8_8p #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 50"
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NTuple.fsti.checked", "Lib.MultiBuffer.fst.checked", "Lib.IntVector.Transpose.fsti.checked", "Lib.IntVector.Serialize.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.SHA2.Vec.fst.checked", "Hacl.Impl.SHA2.Types.fst.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.UInt32.fsti.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.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA2.Core.fst" }
[ { "abbrev": true, "full_module": "Hacl.Hash.Definitions", "short_module": "HD" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "Lib.IntVector.Transpose", "short_module": "VecTranspose" }, { "abbrev": true, "full_module": "Hacl.Spec.SHA2.Vec", "short_module": "SpecVec" }, { "abbrev": true, "full_module": "Lib.NTuple", "short_module": "NTup" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Spec.SHA2.Vec", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.MultiBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.NTuple", "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.SHA2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Spec.Hash.Definitions.sha2_alg -> m: Hacl.Spec.SHA2.Vec.m_spec -> Type0
Prims.Tot
[ "total" ]
[]
[ "Spec.Hash.Definitions.sha2_alg", "Hacl.Spec.SHA2.Vec.m_spec", "Lib.Buffer.lbuffer", "Hacl.Spec.SHA2.Vec.element_t", "FStar.UInt32.__uint_to_t" ]
[]
false
false
false
true
true
let state_t (a: sha2_alg) (m: m_spec) =
lbuffer (element_t a m) 8ul
false
Test.Vectors.fst
Test.Vectors.hash_vectors
val hash_vectors : Prims.list Test.Vectors.hash_vector
let hash_vectors = [{ hash_alg = MD5; input = ""; output = h"d41d8cd98f00b204e9800998ecf8427e"; repeat = 1ul }; { hash_alg = MD5; input = "a"; output = h"0cc175b9c0f1b6a831c399e269772661"; repeat = 1ul }; { hash_alg = MD5; input = "abc"; output = h"900150983cd24fb0d6963f7d28e17f72"; repeat = 1ul }; { hash_alg = MD5; input = "message digest"; output = h"f96b697d7cb7938d525a2f31aaf161d0"; repeat = 1ul }; { hash_alg = MD5; input = "abcdefghijklmnopqrstuvwxyz"; output = h"c3fcd3d76192e4007dfb496cca67e13b"; repeat = 1ul }; { hash_alg = MD5; input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; output = h"d174ab98d277d9f5a5611c2c9f419d9f"; repeat = 1ul }; { hash_alg = MD5; input = "12345678901234567890123456789012345678901234567890123456789012345678901234567890"; output = h"57edf4a22be3c955ac49da2e2107b67a"; repeat = 1ul }; { hash_alg = SHA1; input = "abc"; output = h"a9993e364706816aba3e25717850c26c9cd0d89d"; repeat = 1ul }; { hash_alg = SHA1; input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"; output = h"84983e441c3bd26ebaae4aa1f95129e5e54670f1"; repeat = 1ul }; { hash_alg = SHA1; input = "a"; output = h"34aa973cd4c4daa4f61eeb2bdbad27316534016f"; repeat = 1000000ul }; { hash_alg = SHA1; input = "0123456701234567012345670123456701234567012345670123456701234567"; output = h"dea356a2cddd90c7a7ecedc5ebb563934f460452"; repeat = 10ul }; { hash_alg = SHA2_256; input = "abc"; output = h"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"; repeat = 1ul }; { hash_alg = SHA2_256; input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"; output = h"248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1"; repeat = 1ul }; { hash_alg = SHA2_256; input = "a"; output = h"cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0"; repeat = 1000000ul }; { hash_alg = SHA2_256; input = "0123456701234567012345670123456701234567012345670123456701234567"; output = h"594847328451bdfa85056225462cc1d867d877fb388df0ce35f25ab5562bfbb5"; repeat = 10ul }; { hash_alg = SHA2_256; input = "\x19"; output = h"68aa2e2ee5dff96e3355e6c7ee373e3d6a4e17f75f9518d843709c0c9bc3e3d4"; repeat = 1ul };(* { hash_alg = SHA2_256; // 2018.05.26: Don't know how to encode byte literals in strings; this doesn't work // as in OCaml input = "\xe3\xd7\x25\x70\xdc\xdd\x78\x7c\xe3\x88\x7a\xb2\xcd\x68\x46\x52"; output = h"175ee69b02ba9b58e2b0a5fd13819cea573f3940a94f825128cf4209beabb4e8"; repeat = 1ul }; *){ hash_alg = SHA2_384; input = "abc"; output = h"cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7"; repeat = 1ul }; { hash_alg = SHA2_384; input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"; output = h"09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039"; repeat = 1ul }; { hash_alg = SHA2_384; input = "a"; output = h"9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985"; repeat = 1000000ul }; { hash_alg = SHA2_384; input = "0123456701234567012345670123456701234567012345670123456701234567"; output = h"2fc64a4f500ddb6828f6a3430b8dd72a368eb7f3a8322a70bc84275b9c0b3ab00d27a5cc3c2d224aa6b61a0d79fb4596"; repeat = 10ul }; { hash_alg = SHA2_512; input = "abc"; output = h"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f"; repeat = 1ul }; { hash_alg = SHA2_512; input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"; output = h"8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909"; repeat = 1ul }; { hash_alg = SHA2_512; input = "a"; output = h"e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b"; repeat = 1000000ul }; { hash_alg = SHA2_512; input = "0123456701234567012345670123456701234567012345670123456701234567"; output = h"89d05ba632c699c31231ded4ffc127d5a894dad412c0e024db872d1abd2ba8141a0f85072a9be1e2aa04cf33c765cb510813a39cd5a84c4acaa64d3f3fb7bae9"; repeat = 10ul } ]
{ "file_name": "providers/test/Test.Vectors.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 1, "end_line": 151, "start_col": 0, "start_line": 23 }
module Test.Vectors open Test.Lowstarize open EverCrypt.Hash open Spec.Hash.Definitions /// Hash algorithms type hash_alg = EverCrypt.Hash.alg #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" noeq noextract type hash_vector = { (* The input [input] is repeated [repeat] times. *) hash_alg: hash_alg; input: string; output: hex_encoded; repeat: UInt32.t; }
{ "checked_file": "/", "dependencies": [ "Test.Lowstarize.fst.checked", "Spec.HMAC_DRBG.Test.Vectors.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "EverCrypt.Hash.fsti.checked" ], "interface_file": false, "source_file": "Test.Vectors.fst" }
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt.Hash", "short_module": null }, { "abbrev": false, "full_module": "Test.Lowstarize", "short_module": null }, { "abbrev": false, "full_module": "Test", "short_module": null }, { "abbrev": false, "full_module": "Test", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Prims.list Test.Vectors.hash_vector
Prims.Tot
[ "total" ]
[]
[ "Prims.Cons", "Test.Vectors.hash_vector", "Test.Vectors.Mkhash_vector", "Spec.Hash.Definitions.MD5", "Test.Lowstarize.h", "FStar.UInt32.__uint_to_t", "Spec.Hash.Definitions.SHA1", "Spec.Hash.Definitions.SHA2_256", "Spec.Hash.Definitions.SHA2_384", "Spec.Hash.Definitions.SHA2_512", "Prims.Nil" ]
[]
false
false
false
true
false
let hash_vectors =
[ { hash_alg = MD5; input = ""; output = h "d41d8cd98f00b204e9800998ecf8427e"; repeat = 1ul }; { hash_alg = MD5; input = "a"; output = h "0cc175b9c0f1b6a831c399e269772661"; repeat = 1ul }; { hash_alg = MD5; input = "abc"; output = h "900150983cd24fb0d6963f7d28e17f72"; repeat = 1ul }; { hash_alg = MD5; input = "message digest"; output = h "f96b697d7cb7938d525a2f31aaf161d0"; repeat = 1ul }; { hash_alg = MD5; input = "abcdefghijklmnopqrstuvwxyz"; output = h "c3fcd3d76192e4007dfb496cca67e13b"; repeat = 1ul }; { hash_alg = MD5; input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; output = h "d174ab98d277d9f5a5611c2c9f419d9f"; repeat = 1ul }; { hash_alg = MD5; input = "12345678901234567890123456789012345678901234567890123456789012345678901234567890"; output = h "57edf4a22be3c955ac49da2e2107b67a"; repeat = 1ul }; { hash_alg = SHA1; input = "abc"; output = h "a9993e364706816aba3e25717850c26c9cd0d89d"; repeat = 1ul }; { hash_alg = SHA1; input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"; output = h "84983e441c3bd26ebaae4aa1f95129e5e54670f1"; repeat = 1ul }; { hash_alg = SHA1; input = "a"; output = h "34aa973cd4c4daa4f61eeb2bdbad27316534016f"; repeat = 1000000ul }; { hash_alg = SHA1; input = "0123456701234567012345670123456701234567012345670123456701234567"; output = h "dea356a2cddd90c7a7ecedc5ebb563934f460452"; repeat = 10ul }; { hash_alg = SHA2_256; input = "abc"; output = h "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"; repeat = 1ul }; { hash_alg = SHA2_256; input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"; output = h "248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1"; repeat = 1ul }; { hash_alg = SHA2_256; input = "a"; output = h "cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0"; repeat = 1000000ul }; { hash_alg = SHA2_256; input = "0123456701234567012345670123456701234567012345670123456701234567"; output = h "594847328451bdfa85056225462cc1d867d877fb388df0ce35f25ab5562bfbb5"; repeat = 10ul }; { hash_alg = SHA2_256; input = "\025"; output = h "68aa2e2ee5dff96e3355e6c7ee373e3d6a4e17f75f9518d843709c0c9bc3e3d4"; repeat = 1ul }; { hash_alg = SHA2_384; input = "abc"; output = h "cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7" ; repeat = 1ul }; { hash_alg = SHA2_384; input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"; output = h "09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039" ; repeat = 1ul }; { hash_alg = SHA2_384; input = "a"; output = h "9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985" ; repeat = 1000000ul }; { hash_alg = SHA2_384; input = "0123456701234567012345670123456701234567012345670123456701234567"; output = h "2fc64a4f500ddb6828f6a3430b8dd72a368eb7f3a8322a70bc84275b9c0b3ab00d27a5cc3c2d224aa6b61a0d79fb4596" ; repeat = 10ul }; { hash_alg = SHA2_512; input = "abc"; output = h "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f" ; repeat = 1ul }; { hash_alg = SHA2_512; input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"; output = h "8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909" ; repeat = 1ul }; { hash_alg = SHA2_512; input = "a"; output = h "e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b" ; repeat = 1000000ul }; { hash_alg = SHA2_512; input = "0123456701234567012345670123456701234567012345670123456701234567"; output = h "89d05ba632c699c31231ded4ffc127d5a894dad412c0e024db872d1abd2ba8141a0f85072a9be1e2aa04cf33c765cb510813a39cd5a84c4acaa64d3f3fb7bae9" ; repeat = 10ul } ]
false
Hacl.Impl.SHA2.Core.fst
Hacl.Impl.SHA2.Core.ws_t
val ws_t : a: Spec.Hash.Definitions.sha2_alg -> m: Hacl.Spec.SHA2.Vec.m_spec -> Type0
let ws_t (a:sha2_alg) (m:m_spec) = lbuffer (element_t a m) 16ul
{ "file_name": "code/sha2-mb/Hacl.Impl.SHA2.Core.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 30, "end_line": 40, "start_col": 0, "start_line": 39 }
module Hacl.Impl.SHA2.Core open FStar.Mul open FStar.HyperStack open FStar.HyperStack.All open Lib.IntTypes open Lib.NTuple open Lib.Buffer open Lib.IntVector open Lib.MultiBuffer open Spec.Hash.Definitions //open Hacl.Hash.Definitions // <- defines as_seq which clashes with Lib.Buffer.as_seq open Hacl.Spec.SHA2.Vec module ST = FStar.HyperStack.ST module NTup = Lib.NTuple module SpecVec = Hacl.Spec.SHA2.Vec module VecTranspose = Lib.IntVector.Transpose module LSeq = Lib.Sequence module HD = Hacl.Hash.Definitions (* Force ordering in dependency analysis so that monomorphizations are inserted into the Types module first. *) let _ = Hacl.Impl.SHA2.Types.uint8_8p #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 50" unfold let state_t (a:sha2_alg) (m:m_spec) = lbuffer (element_t a m) 8ul unfold let block_t (a:sha2_alg) = lbuffer uint8 (HD.block_len a)
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NTuple.fsti.checked", "Lib.MultiBuffer.fst.checked", "Lib.IntVector.Transpose.fsti.checked", "Lib.IntVector.Serialize.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.SHA2.Vec.fst.checked", "Hacl.Impl.SHA2.Types.fst.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.UInt32.fsti.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.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA2.Core.fst" }
[ { "abbrev": true, "full_module": "Hacl.Hash.Definitions", "short_module": "HD" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "Lib.IntVector.Transpose", "short_module": "VecTranspose" }, { "abbrev": true, "full_module": "Hacl.Spec.SHA2.Vec", "short_module": "SpecVec" }, { "abbrev": true, "full_module": "Lib.NTuple", "short_module": "NTup" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Spec.SHA2.Vec", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.MultiBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.NTuple", "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.SHA2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Spec.Hash.Definitions.sha2_alg -> m: Hacl.Spec.SHA2.Vec.m_spec -> Type0
Prims.Tot
[ "total" ]
[]
[ "Spec.Hash.Definitions.sha2_alg", "Hacl.Spec.SHA2.Vec.m_spec", "Lib.Buffer.lbuffer", "Hacl.Spec.SHA2.Vec.element_t", "FStar.UInt32.__uint_to_t" ]
[]
false
false
false
true
true
let ws_t (a: sha2_alg) (m: m_spec) =
lbuffer (element_t a m) 16ul
false
Test.Vectors.fst
Test.Vectors.hmac_vectors
val hmac_vectors : Prims.list Test.Vectors.hmac_vector
let hmac_vectors = [{ ha = SHA2_256; key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"; data = h"4869205468657265"; output = h"b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7"; }; { ha = SHA2_384; key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"; data = h"4869205468657265"; output = h"afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6"; }]
{ "file_name": "providers/test/Test.Vectors.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 4, "end_line": 185, "start_col": 0, "start_line": 175 }
module Test.Vectors open Test.Lowstarize open EverCrypt.Hash open Spec.Hash.Definitions /// Hash algorithms type hash_alg = EverCrypt.Hash.alg #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" noeq noextract type hash_vector = { (* The input [input] is repeated [repeat] times. *) hash_alg: hash_alg; input: string; output: hex_encoded; repeat: UInt32.t; } noextract let hash_vectors = [{ hash_alg = MD5; input = ""; output = h"d41d8cd98f00b204e9800998ecf8427e"; repeat = 1ul }; { hash_alg = MD5; input = "a"; output = h"0cc175b9c0f1b6a831c399e269772661"; repeat = 1ul }; { hash_alg = MD5; input = "abc"; output = h"900150983cd24fb0d6963f7d28e17f72"; repeat = 1ul }; { hash_alg = MD5; input = "message digest"; output = h"f96b697d7cb7938d525a2f31aaf161d0"; repeat = 1ul }; { hash_alg = MD5; input = "abcdefghijklmnopqrstuvwxyz"; output = h"c3fcd3d76192e4007dfb496cca67e13b"; repeat = 1ul }; { hash_alg = MD5; input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; output = h"d174ab98d277d9f5a5611c2c9f419d9f"; repeat = 1ul }; { hash_alg = MD5; input = "12345678901234567890123456789012345678901234567890123456789012345678901234567890"; output = h"57edf4a22be3c955ac49da2e2107b67a"; repeat = 1ul }; { hash_alg = SHA1; input = "abc"; output = h"a9993e364706816aba3e25717850c26c9cd0d89d"; repeat = 1ul }; { hash_alg = SHA1; input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"; output = h"84983e441c3bd26ebaae4aa1f95129e5e54670f1"; repeat = 1ul }; { hash_alg = SHA1; input = "a"; output = h"34aa973cd4c4daa4f61eeb2bdbad27316534016f"; repeat = 1000000ul }; { hash_alg = SHA1; input = "0123456701234567012345670123456701234567012345670123456701234567"; output = h"dea356a2cddd90c7a7ecedc5ebb563934f460452"; repeat = 10ul }; { hash_alg = SHA2_256; input = "abc"; output = h"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"; repeat = 1ul }; { hash_alg = SHA2_256; input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"; output = h"248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1"; repeat = 1ul }; { hash_alg = SHA2_256; input = "a"; output = h"cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0"; repeat = 1000000ul }; { hash_alg = SHA2_256; input = "0123456701234567012345670123456701234567012345670123456701234567"; output = h"594847328451bdfa85056225462cc1d867d877fb388df0ce35f25ab5562bfbb5"; repeat = 10ul }; { hash_alg = SHA2_256; input = "\x19"; output = h"68aa2e2ee5dff96e3355e6c7ee373e3d6a4e17f75f9518d843709c0c9bc3e3d4"; repeat = 1ul };(* { hash_alg = SHA2_256; // 2018.05.26: Don't know how to encode byte literals in strings; this doesn't work // as in OCaml input = "\xe3\xd7\x25\x70\xdc\xdd\x78\x7c\xe3\x88\x7a\xb2\xcd\x68\x46\x52"; output = h"175ee69b02ba9b58e2b0a5fd13819cea573f3940a94f825128cf4209beabb4e8"; repeat = 1ul }; *){ hash_alg = SHA2_384; input = "abc"; output = h"cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7"; repeat = 1ul }; { hash_alg = SHA2_384; input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"; output = h"09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039"; repeat = 1ul }; { hash_alg = SHA2_384; input = "a"; output = h"9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985"; repeat = 1000000ul }; { hash_alg = SHA2_384; input = "0123456701234567012345670123456701234567012345670123456701234567"; output = h"2fc64a4f500ddb6828f6a3430b8dd72a368eb7f3a8322a70bc84275b9c0b3ab00d27a5cc3c2d224aa6b61a0d79fb4596"; repeat = 10ul }; { hash_alg = SHA2_512; input = "abc"; output = h"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f"; repeat = 1ul }; { hash_alg = SHA2_512; input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"; output = h"8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909"; repeat = 1ul }; { hash_alg = SHA2_512; input = "a"; output = h"e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b"; repeat = 1000000ul }; { hash_alg = SHA2_512; input = "0123456701234567012345670123456701234567012345670123456701234567"; output = h"89d05ba632c699c31231ded4ffc127d5a894dad412c0e024db872d1abd2ba8141a0f85072a9be1e2aa04cf33c765cb510813a39cd5a84c4acaa64d3f3fb7bae9"; repeat = 10ul } ] noextract let hash_vectors_tmp = List.Tot.map (fun h -> h.hash_alg, h.input, h.output, h.repeat ) hash_vectors // 2018.08.06 SZ: I can't verify this in interactive mode but verifies from the command-line %splice[] (lowstarize_toplevel "hash_vectors_tmp" "hash_vectors_low") /// HMAC noeq noextract type hmac_vector = { ha: hash_alg; key: hex_encoded; data: hex_encoded; output: hex_encoded; } // selected test vectors from // https://tools.ietf.org/html/rfc4231#section-4.2 // pls extend me!
{ "checked_file": "/", "dependencies": [ "Test.Lowstarize.fst.checked", "Spec.HMAC_DRBG.Test.Vectors.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "EverCrypt.Hash.fsti.checked" ], "interface_file": false, "source_file": "Test.Vectors.fst" }
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt.Hash", "short_module": null }, { "abbrev": false, "full_module": "Test.Lowstarize", "short_module": null }, { "abbrev": false, "full_module": "Test", "short_module": null }, { "abbrev": false, "full_module": "Test", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Prims.list Test.Vectors.hmac_vector
Prims.Tot
[ "total" ]
[]
[ "Prims.Cons", "Test.Vectors.hmac_vector", "Test.Vectors.Mkhmac_vector", "Spec.Hash.Definitions.SHA2_256", "Test.Lowstarize.h", "Spec.Hash.Definitions.SHA2_384", "Prims.Nil" ]
[]
false
false
false
true
false
let hmac_vectors =
[ { ha = SHA2_256; key = h "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"; data = h "4869205468657265"; output = h "b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7" }; { ha = SHA2_384; key = h "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"; data = h "4869205468657265"; output = h "afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6" } ]
false
Hacl.Impl.SHA2.Core.fst
Hacl.Impl.SHA2.Core.preserves_sub_disjoint_multi
val preserves_sub_disjoint_multi : b: Lib.Buffer.lbuffer Lib.IntTypes.uint8 len -> r: Lib.MultiBuffer.multibuf lanes len' -> Prims.logical
let preserves_sub_disjoint_multi #lanes #len #len' (b:lbuffer uint8 len) (r:multibuf lanes len') = (forall a l (x:lbuffer a l). disjoint b x ==> disjoint_multi r x)
{ "file_name": "code/sha2-mb/Hacl.Impl.SHA2.Core.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 69, "end_line": 392, "start_col": 0, "start_line": 391 }
module Hacl.Impl.SHA2.Core open FStar.Mul open FStar.HyperStack open FStar.HyperStack.All open Lib.IntTypes open Lib.NTuple open Lib.Buffer open Lib.IntVector open Lib.MultiBuffer open Spec.Hash.Definitions //open Hacl.Hash.Definitions // <- defines as_seq which clashes with Lib.Buffer.as_seq open Hacl.Spec.SHA2.Vec module ST = FStar.HyperStack.ST module NTup = Lib.NTuple module SpecVec = Hacl.Spec.SHA2.Vec module VecTranspose = Lib.IntVector.Transpose module LSeq = Lib.Sequence module HD = Hacl.Hash.Definitions (* Force ordering in dependency analysis so that monomorphizations are inserted into the Types module first. *) let _ = Hacl.Impl.SHA2.Types.uint8_8p #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 50" unfold let state_t (a:sha2_alg) (m:m_spec) = lbuffer (element_t a m) 8ul unfold let block_t (a:sha2_alg) = lbuffer uint8 (HD.block_len a) inline_for_extraction noextract let ws_t (a:sha2_alg) (m:m_spec) = lbuffer (element_t a m) 16ul inline_for_extraction noextract val set_wsi: #a:sha2_alg -> #m:m_spec -> ws:ws_t a m -> i:size_t{v i < 16} -> b:lbuffer uint8 (HD.block_len a) -> bi:size_t{v bi < 16 / (lanes a m)} -> Stack unit (requires fun h -> live h b /\ live h ws /\ disjoint b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == LSeq.upd (as_seq h0 ws) (v i) (SpecVec.load_elementi #a #m (as_seq h0 b) (v bi))) let set_wsi #a #m ws i b bi = [@inline_let] let l = lanes a m in ws.(i) <- vec_load_be (word_t a) l (sub b (bi *! size l *! HD.word_len a) (size l *! HD.word_len a)) noextract let load_blocks_spec1 (#a:sha2_alg) (#m:m_spec{lanes a m == 1}) (b:multiblock_spec a m) : ws_spec a m = let b = b.(|0|) in let ws0 = SpecVec.load_elementi b 0 in let ws1 = SpecVec.load_elementi b 1 in let ws2 = SpecVec.load_elementi b 2 in let ws3 = SpecVec.load_elementi b 3 in let ws4 = SpecVec.load_elementi b 4 in let ws5 = SpecVec.load_elementi b 5 in let ws6 = SpecVec.load_elementi b 6 in let ws7 = SpecVec.load_elementi b 7 in let ws8 = SpecVec.load_elementi b 8 in let ws9 = SpecVec.load_elementi b 9 in let ws10 = SpecVec.load_elementi b 10 in let ws11 = SpecVec.load_elementi b 11 in let ws12 = SpecVec.load_elementi b 12 in let ws13 = SpecVec.load_elementi b 13 in let ws14 = SpecVec.load_elementi b 14 in let ws15 = SpecVec.load_elementi b 15 in LSeq.create16 ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15 noextract let load_blocks_spec1_lemma (#a:sha2_alg) (#m:m_spec{lanes a m == 1}) (b:multiblock_spec a m) : Lemma (SpecVec.load_blocks b == load_blocks_spec1 b) = LSeq.eq_intro (SpecVec.load_blocks b) (load_blocks_spec1 b) #push-options "--z3rlimit 100" inline_for_extraction noextract val load_blocks1: #a:sha2_alg -> #m:m_spec{lanes a m == 1} -> b:multibuf (lanes a m) (HD.block_len a) -> ws:ws_t a m -> Stack unit (requires fun h -> live_multi h b /\ live h ws /\ disjoint_multi b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 b)) let load_blocks1 #a #m ib ws = let h0 = ST.get() in let b = ib.(|0|) in set_wsi ws 0ul b 0ul; set_wsi ws 1ul b 1ul; set_wsi ws 2ul b 2ul; set_wsi ws 3ul b 3ul; set_wsi ws 4ul b 4ul; set_wsi ws 5ul b 5ul; set_wsi ws 6ul b 6ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); set_wsi ws 7ul b 7ul; set_wsi ws 8ul b 8ul; set_wsi ws 9ul b 9ul; set_wsi ws 10ul b 10ul; set_wsi ws 11ul b 11ul; set_wsi ws 12ul b 12ul; set_wsi ws 13ul b 13ul; set_wsi ws 14ul b 14ul; set_wsi ws 15ul b 15ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); LSeq.eq_intro (as_seq h1 ws) (load_blocks_spec1 (as_seq_multi h0 ib)); load_blocks_spec1_lemma #a #m (as_seq_multi h0 ib); assert (as_seq h1 ws == load_blocks_spec1 (as_seq_multi h0 ib)); assert (as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 ib)) #pop-options noextract let load_blocks_spec4 (#a:sha2_alg) (#m:m_spec{lanes a m == 4}) (b:multiblock_spec a m) : ws_spec a m = let b0 = b.(|0|) in let b1 = b.(|1|) in let b2 = b.(|2|) in let b3 = b.(|3|) in let ws0 = SpecVec.load_elementi b0 0 in let ws1 = SpecVec.load_elementi b1 0 in let ws2 = SpecVec.load_elementi b2 0 in let ws3 = SpecVec.load_elementi b3 0 in let ws4 = SpecVec.load_elementi b0 1 in let ws5 = SpecVec.load_elementi b1 1 in let ws6 = SpecVec.load_elementi b2 1 in let ws7 = SpecVec.load_elementi b3 1 in let ws8 = SpecVec.load_elementi b0 2 in let ws9 = SpecVec.load_elementi b1 2 in let ws10 = SpecVec.load_elementi b2 2 in let ws11 = SpecVec.load_elementi b3 2 in let ws12 = SpecVec.load_elementi b0 3 in let ws13 = SpecVec.load_elementi b1 3 in let ws14 = SpecVec.load_elementi b2 3 in let ws15 = SpecVec.load_elementi b3 3 in LSeq.create16 ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15 noextract let load_blocks_spec4_lemma (#a:sha2_alg) (#m:m_spec{lanes a m == 4}) (b:multiblock_spec a m) : Lemma (SpecVec.load_blocks b == load_blocks_spec4 b) = LSeq.eq_intro (SpecVec.load_blocks b) (load_blocks_spec4 b) inline_for_extraction noextract val load_blocks4: #a:sha2_alg -> #m:m_spec{lanes a m == 4} -> b:multibuf (lanes a m) (HD.block_len a) -> ws:ws_t a m -> Stack unit (requires fun h -> live_multi h b /\ live h ws /\ disjoint_multi b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 b)) #push-options "--z3rlimit 150" let load_blocks4 #a #m ib ws = let h0 = ST.get() in let (b0,(b1,(b2,b3))) = NTup.tup4 ib in set_wsi ws 0ul b0 0ul; set_wsi ws 1ul b1 0ul; set_wsi ws 2ul b2 0ul; set_wsi ws 3ul b3 0ul; set_wsi ws 4ul b0 1ul; set_wsi ws 5ul b1 1ul; set_wsi ws 6ul b2 1ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); set_wsi ws 7ul b3 1ul; set_wsi ws 8ul b0 2ul; set_wsi ws 9ul b1 2ul; set_wsi ws 10ul b2 2ul; set_wsi ws 11ul b3 2ul; set_wsi ws 12ul b0 3ul; set_wsi ws 13ul b1 3ul; set_wsi ws 14ul b2 3ul; set_wsi ws 15ul b3 3ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); LSeq.eq_intro (as_seq h1 ws) (load_blocks_spec4 (as_seq_multi h0 ib)); load_blocks_spec4_lemma #a #m (as_seq_multi h0 ib); assert (as_seq h1 ws == load_blocks_spec4 (as_seq_multi h0 ib)); assert (as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 ib)); () #pop-options noextract let load_blocks_spec8 (#a:sha2_alg) (#m:m_spec{lanes a m == 8}) (b:multiblock_spec a m) : ws_spec a m = let b0 = b.(|0|) in let b1 = b.(|1|) in let b2 = b.(|2|) in let b3 = b.(|3|) in let b4 = b.(|4|) in let b5 = b.(|5|) in let b6 = b.(|6|) in let b7 = b.(|7|) in let ws0 = SpecVec.load_elementi b0 0 in let ws1 = SpecVec.load_elementi b1 0 in let ws2 = SpecVec.load_elementi b2 0 in let ws3 = SpecVec.load_elementi b3 0 in let ws4 = SpecVec.load_elementi b4 0 in let ws5 = SpecVec.load_elementi b5 0 in let ws6 = SpecVec.load_elementi b6 0 in let ws7 = SpecVec.load_elementi b7 0 in let ws8 = SpecVec.load_elementi b0 1 in let ws9 = SpecVec.load_elementi b1 1 in let ws10 = SpecVec.load_elementi b2 1 in let ws11 = SpecVec.load_elementi b3 1 in let ws12 = SpecVec.load_elementi b4 1 in let ws13 = SpecVec.load_elementi b5 1 in let ws14 = SpecVec.load_elementi b6 1 in let ws15 = SpecVec.load_elementi b7 1 in LSeq.create16 ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15 noextract let load_blocks_spec8_lemma (#a:sha2_alg) (#m:m_spec{lanes a m == 8}) (b:multiblock_spec a m) : Lemma (SpecVec.load_blocks b == load_blocks_spec8 b) = LSeq.eq_intro (SpecVec.load_blocks b) (load_blocks_spec8 b) inline_for_extraction noextract val load_blocks8: #a:sha2_alg -> #m:m_spec{lanes a m == 8} -> b:multibuf (lanes a m) (HD.block_len a) -> ws:ws_t a m -> Stack unit (requires fun h -> live_multi h b /\ live h ws /\ disjoint_multi b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 b)) #push-options "--z3rlimit 150" let load_blocks8 #a #m ib ws = let h0 = ST.get() in let (b0,(b1,(b2,(b3,(b4,(b5,(b6,b7))))))) = NTup.tup8 ib in set_wsi ws 0ul b0 0ul; set_wsi ws 1ul b1 0ul; set_wsi ws 2ul b2 0ul; set_wsi ws 3ul b3 0ul; set_wsi ws 4ul b4 0ul; set_wsi ws 5ul b5 0ul; set_wsi ws 6ul b6 0ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); set_wsi ws 7ul b7 0ul; set_wsi ws 8ul b0 1ul; set_wsi ws 9ul b1 1ul; set_wsi ws 10ul b2 1ul; set_wsi ws 11ul b3 1ul; set_wsi ws 12ul b4 1ul; set_wsi ws 13ul b5 1ul; set_wsi ws 14ul b6 1ul; set_wsi ws 15ul b7 1ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); LSeq.eq_intro (as_seq h1 ws) (load_blocks_spec8 (as_seq_multi h0 ib)); load_blocks_spec8_lemma #a #m (as_seq_multi h0 ib); assert (as_seq h1 ws == load_blocks_spec8 (as_seq_multi h0 ib)); assert (as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 ib)); () #pop-options inline_for_extraction noextract val load_blocks: #a:sha2_alg -> #m:m_spec{is_supported a m} -> b:multibuf (lanes a m) (HD.block_len a) -> ws:ws_t a m -> Stack unit (requires fun h -> live_multi h b /\ live h ws /\ disjoint_multi b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 b)) let load_blocks #a #m b ws = match lanes a m with | 1 -> load_blocks1 b ws | 4 -> load_blocks4 b ws | 8 -> load_blocks8 b ws inline_for_extraction noextract val transpose_ws4: #a:sha2_alg -> #m:m_spec{lanes a m == 4} -> ws:ws_t a m -> Stack unit (requires fun h -> live h ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.transpose_ws (as_seq h0 ws)) let transpose_ws4 #a #m ws = let (ws0,ws1,ws2,ws3) = VecTranspose.transpose4x4 (ws.(0ul),ws.(1ul),ws.(2ul),ws.(3ul)) in let (ws4,ws5,ws6,ws7) = VecTranspose.transpose4x4 (ws.(4ul),ws.(5ul),ws.(6ul),ws.(7ul)) in let (ws8,ws9,ws10,ws11) = VecTranspose.transpose4x4 (ws.(8ul),ws.(9ul),ws.(10ul),ws.(11ul)) in let (ws12,ws13,ws14,ws15) = VecTranspose.transpose4x4 (ws.(12ul),ws.(13ul),ws.(14ul),ws.(15ul)) in create16 ws ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15 inline_for_extraction noextract val transpose_ws8: #a:sha2_alg -> #m:m_spec{lanes a m == 8} -> ws:ws_t a m -> Stack unit (requires fun h -> live h ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.transpose_ws (as_seq h0 ws)) let transpose_ws8 #a #m ws = let (ws0,ws1,ws2,ws3,ws4,ws5,ws6,ws7) = VecTranspose.transpose8x8 (ws.(0ul),ws.(1ul),ws.(2ul),ws.(3ul),ws.(4ul),ws.(5ul),ws.(6ul),ws.(7ul)) in let (ws8,ws9,ws10,ws11,ws12,ws13,ws14,ws15) = VecTranspose.transpose8x8 (ws.(8ul),ws.(9ul),ws.(10ul),ws.(11ul),ws.(12ul),ws.(13ul),ws.(14ul),ws.(15ul)) in create16 ws ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15 inline_for_extraction noextract val transpose_ws: #a:sha2_alg -> #m:m_spec{is_supported a m} -> ws:ws_t a m -> Stack unit (requires fun h -> live h ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.transpose_ws (as_seq h0 ws)) let transpose_ws #a #m ws = match lanes a m with | 1 -> () | 4 -> transpose_ws4 ws | 8 -> transpose_ws8 ws inline_for_extraction noextract val load_ws: #a:sha2_alg -> #m:m_spec{is_supported a m} -> b:multibuf (lanes a m) (HD.block_len a) -> ws:ws_t a m -> Stack unit (requires fun h -> live_multi h b /\ live h ws /\ disjoint_multi b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.load_ws #a #m (as_seq_multi h0 b)) let load_ws #a #m b ws = load_blocks b ws; transpose_ws ws inline_for_extraction noextract let padded_blocks (a:sha2_alg) (len:size_t{v len <= block_length a}) : n:size_t{v n == SpecVec.padded_blocks a (v len)} = if (len +! len_len a +! 1ul <=. HD.block_len a) then 1ul else 2ul inline_for_extraction noextract val load_last_blocks: #a:sha2_alg -> totlen_buf:lbuffer uint8 (len_len a) -> len:size_t{v len <= block_length a} -> b:lbuffer uint8 len -> fin:size_t{v fin == block_length a \/ v fin == 2 * block_length a} -> last:lbuffer uint8 (2ul *! HD.block_len a) -> Stack (lbuffer uint8 (HD.block_len a) & lbuffer uint8 (HD.block_len a)) (requires fun h -> live h totlen_buf /\ live h b /\ live h last /\ disjoint b last /\ disjoint last totlen_buf /\ as_seq h last == LSeq.create (2 * block_length a) (u8 0)) (ensures (fun h0 (l0,l1) h1 -> modifies (loc last) h0 h1 /\ live h1 l0 /\ live h1 l1 /\ (forall a l (r:lbuffer a l). disjoint last r ==> (disjoint l0 r /\ disjoint l1 r)) /\ (as_seq h1 l0, as_seq h1 l1) == SpecVec.load_last_blocks #a (as_seq h0 totlen_buf) (v fin) (v len) (as_seq h0 b))) #push-options "--z3rlimit 200" let load_last_blocks #a totlen_buf len b fin last = let h0 = ST.get() in update_sub last 0ul len b; last.(len) <- u8 0x80; update_sub last (fin -. len_len a) (len_len a) totlen_buf; let last0 : lbuffer uint8 (HD.block_len a) = sub last 0ul (HD.block_len a) in let last1 : lbuffer uint8 (HD.block_len a) = sub last (HD.block_len a) (HD.block_len a) in let h1 = ST.get() in assert (modifies (loc last) h0 h1); (last0,last1) #pop-options
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NTuple.fsti.checked", "Lib.MultiBuffer.fst.checked", "Lib.IntVector.Transpose.fsti.checked", "Lib.IntVector.Serialize.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.SHA2.Vec.fst.checked", "Hacl.Impl.SHA2.Types.fst.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.UInt32.fsti.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.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA2.Core.fst" }
[ { "abbrev": true, "full_module": "Hacl.Hash.Definitions", "short_module": "HD" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "Lib.IntVector.Transpose", "short_module": "VecTranspose" }, { "abbrev": true, "full_module": "Hacl.Spec.SHA2.Vec", "short_module": "SpecVec" }, { "abbrev": true, "full_module": "Lib.NTuple", "short_module": "NTup" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Spec.SHA2.Vec", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.MultiBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.NTuple", "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.SHA2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
b: Lib.Buffer.lbuffer Lib.IntTypes.uint8 len -> r: Lib.MultiBuffer.multibuf lanes len' -> Prims.logical
Prims.Tot
[ "total" ]
[]
[ "Lib.NTuple.flen", "Lib.IntTypes.size_t", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "Lib.MultiBuffer.multibuf", "Prims.l_Forall", "Prims.l_imp", "Lib.Buffer.disjoint", "Lib.Buffer.MUT", "Lib.MultiBuffer.disjoint_multi", "Prims.logical" ]
[]
false
false
false
false
true
let preserves_sub_disjoint_multi #lanes #len #len' (b: lbuffer uint8 len) (r: multibuf lanes len') =
(forall a l (x: lbuffer a l). disjoint b x ==> disjoint_multi r x)
false
Hacl.Impl.SHA2.Core.fst
Hacl.Impl.SHA2.Core.load_blocks_spec1
val load_blocks_spec1 (#a: sha2_alg) (#m: m_spec{lanes a m == 1}) (b: multiblock_spec a m) : ws_spec a m
val load_blocks_spec1 (#a: sha2_alg) (#m: m_spec{lanes a m == 1}) (b: multiblock_spec a m) : ws_spec a m
let load_blocks_spec1 (#a:sha2_alg) (#m:m_spec{lanes a m == 1}) (b:multiblock_spec a m) : ws_spec a m = let b = b.(|0|) in let ws0 = SpecVec.load_elementi b 0 in let ws1 = SpecVec.load_elementi b 1 in let ws2 = SpecVec.load_elementi b 2 in let ws3 = SpecVec.load_elementi b 3 in let ws4 = SpecVec.load_elementi b 4 in let ws5 = SpecVec.load_elementi b 5 in let ws6 = SpecVec.load_elementi b 6 in let ws7 = SpecVec.load_elementi b 7 in let ws8 = SpecVec.load_elementi b 8 in let ws9 = SpecVec.load_elementi b 9 in let ws10 = SpecVec.load_elementi b 10 in let ws11 = SpecVec.load_elementi b 11 in let ws12 = SpecVec.load_elementi b 12 in let ws13 = SpecVec.load_elementi b 13 in let ws14 = SpecVec.load_elementi b 14 in let ws15 = SpecVec.load_elementi b 15 in LSeq.create16 ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15
{ "file_name": "code/sha2-mb/Hacl.Impl.SHA2.Core.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 48, "end_line": 80, "start_col": 0, "start_line": 61 }
module Hacl.Impl.SHA2.Core open FStar.Mul open FStar.HyperStack open FStar.HyperStack.All open Lib.IntTypes open Lib.NTuple open Lib.Buffer open Lib.IntVector open Lib.MultiBuffer open Spec.Hash.Definitions //open Hacl.Hash.Definitions // <- defines as_seq which clashes with Lib.Buffer.as_seq open Hacl.Spec.SHA2.Vec module ST = FStar.HyperStack.ST module NTup = Lib.NTuple module SpecVec = Hacl.Spec.SHA2.Vec module VecTranspose = Lib.IntVector.Transpose module LSeq = Lib.Sequence module HD = Hacl.Hash.Definitions (* Force ordering in dependency analysis so that monomorphizations are inserted into the Types module first. *) let _ = Hacl.Impl.SHA2.Types.uint8_8p #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 50" unfold let state_t (a:sha2_alg) (m:m_spec) = lbuffer (element_t a m) 8ul unfold let block_t (a:sha2_alg) = lbuffer uint8 (HD.block_len a) inline_for_extraction noextract let ws_t (a:sha2_alg) (m:m_spec) = lbuffer (element_t a m) 16ul inline_for_extraction noextract val set_wsi: #a:sha2_alg -> #m:m_spec -> ws:ws_t a m -> i:size_t{v i < 16} -> b:lbuffer uint8 (HD.block_len a) -> bi:size_t{v bi < 16 / (lanes a m)} -> Stack unit (requires fun h -> live h b /\ live h ws /\ disjoint b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == LSeq.upd (as_seq h0 ws) (v i) (SpecVec.load_elementi #a #m (as_seq h0 b) (v bi))) let set_wsi #a #m ws i b bi = [@inline_let] let l = lanes a m in ws.(i) <- vec_load_be (word_t a) l (sub b (bi *! size l *! HD.word_len a) (size l *! HD.word_len a))
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NTuple.fsti.checked", "Lib.MultiBuffer.fst.checked", "Lib.IntVector.Transpose.fsti.checked", "Lib.IntVector.Serialize.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.SHA2.Vec.fst.checked", "Hacl.Impl.SHA2.Types.fst.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.UInt32.fsti.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.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA2.Core.fst" }
[ { "abbrev": true, "full_module": "Hacl.Hash.Definitions", "short_module": "HD" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "Lib.IntVector.Transpose", "short_module": "VecTranspose" }, { "abbrev": true, "full_module": "Hacl.Spec.SHA2.Vec", "short_module": "SpecVec" }, { "abbrev": true, "full_module": "Lib.NTuple", "short_module": "NTup" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Spec.SHA2.Vec", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.MultiBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.NTuple", "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.SHA2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
b: Hacl.Spec.SHA2.Vec.multiblock_spec a m -> Hacl.Spec.SHA2.Vec.ws_spec a m
Prims.Tot
[ "total" ]
[]
[ "Spec.Hash.Definitions.sha2_alg", "Hacl.Spec.SHA2.Vec.m_spec", "Prims.eq2", "Prims.int", "Hacl.Spec.SHA2.Vec.lanes", "Hacl.Spec.SHA2.Vec.multiblock_spec", "Lib.Sequence.create16", "Hacl.Spec.SHA2.Vec.element_t", "Hacl.Spec.SHA2.Vec.load_elementi", "FStar.Seq.Properties.lseq", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Hash.Definitions.block_length", "Lib.MultiBuffer.op_Lens_Access", "Lib.IntTypes.uint8", "Hacl.Spec.SHA2.Vec.ws_spec" ]
[]
false
false
false
false
false
let load_blocks_spec1 (#a: sha2_alg) (#m: m_spec{lanes a m == 1}) (b: multiblock_spec a m) : ws_spec a m =
let b = b.(| 0 |) in let ws0 = SpecVec.load_elementi b 0 in let ws1 = SpecVec.load_elementi b 1 in let ws2 = SpecVec.load_elementi b 2 in let ws3 = SpecVec.load_elementi b 3 in let ws4 = SpecVec.load_elementi b 4 in let ws5 = SpecVec.load_elementi b 5 in let ws6 = SpecVec.load_elementi b 6 in let ws7 = SpecVec.load_elementi b 7 in let ws8 = SpecVec.load_elementi b 8 in let ws9 = SpecVec.load_elementi b 9 in let ws10 = SpecVec.load_elementi b 10 in let ws11 = SpecVec.load_elementi b 11 in let ws12 = SpecVec.load_elementi b 12 in let ws13 = SpecVec.load_elementi b 13 in let ws14 = SpecVec.load_elementi b 14 in let ws15 = SpecVec.load_elementi b 15 in LSeq.create16 ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15
false
FStar.Tactics.Visit.fst
FStar.Tactics.Visit.on_sort_binder
val on_sort_binder (f: (term -> Tac term)) (b: binder) : Tac binder
val on_sort_binder (f: (term -> Tac term)) (b: binder) : Tac binder
let on_sort_binder (f : term -> Tac term) (b:binder) : Tac binder = let bview = inspect_binder b in let bview = { bview with sort = f bview.sort } in pack_binder bview
{ "file_name": "ulib/FStar.Tactics.Visit.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 19, "end_line": 27, "start_col": 0, "start_line": 24 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.Visit (* Visit a term and transform it step by step. *) open FStar.Reflection.V2 open FStar.Tactics.Effect open FStar.Tactics.Util
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.Tactics.Visit.fst" }
[ { "abbrev": false, "full_module": "FStar.Tactics.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.Effect", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
f: (_: FStar.Stubs.Reflection.Types.term -> FStar.Tactics.Effect.Tac FStar.Stubs.Reflection.Types.term) -> b: FStar.Stubs.Reflection.Types.binder -> FStar.Tactics.Effect.Tac FStar.Stubs.Reflection.Types.binder
FStar.Tactics.Effect.Tac
[]
[]
[ "FStar.Stubs.Reflection.Types.term", "FStar.Stubs.Reflection.Types.binder", "FStar.Stubs.Reflection.V2.Builtins.pack_binder", "FStar.Stubs.Reflection.V2.Data.binder_view", "FStar.Stubs.Reflection.V2.Data.Mkbinder_view", "FStar.Stubs.Reflection.V2.Data.__proj__Mkbinder_view__item__qual", "FStar.Stubs.Reflection.V2.Data.__proj__Mkbinder_view__item__attrs", "FStar.Stubs.Reflection.V2.Data.__proj__Mkbinder_view__item__ppname", "FStar.Stubs.Reflection.Types.typ", "FStar.Stubs.Reflection.V2.Data.__proj__Mkbinder_view__item__sort", "Prims.precedes", "FStar.Stubs.Reflection.V2.Builtins.inspect_binder" ]
[]
false
true
false
false
false
let on_sort_binder (f: (term -> Tac term)) (b: binder) : Tac binder =
let bview = inspect_binder b in let bview = { bview with sort = f bview.sort } in pack_binder bview
false
Hacl.Impl.SHA2.Core.fst
Hacl.Impl.SHA2.Core.load_blocks_spec4
val load_blocks_spec4 (#a: sha2_alg) (#m: m_spec{lanes a m == 4}) (b: multiblock_spec a m) : ws_spec a m
val load_blocks_spec4 (#a: sha2_alg) (#m: m_spec{lanes a m == 4}) (b: multiblock_spec a m) : ws_spec a m
let load_blocks_spec4 (#a:sha2_alg) (#m:m_spec{lanes a m == 4}) (b:multiblock_spec a m) : ws_spec a m = let b0 = b.(|0|) in let b1 = b.(|1|) in let b2 = b.(|2|) in let b3 = b.(|3|) in let ws0 = SpecVec.load_elementi b0 0 in let ws1 = SpecVec.load_elementi b1 0 in let ws2 = SpecVec.load_elementi b2 0 in let ws3 = SpecVec.load_elementi b3 0 in let ws4 = SpecVec.load_elementi b0 1 in let ws5 = SpecVec.load_elementi b1 1 in let ws6 = SpecVec.load_elementi b2 1 in let ws7 = SpecVec.load_elementi b3 1 in let ws8 = SpecVec.load_elementi b0 2 in let ws9 = SpecVec.load_elementi b1 2 in let ws10 = SpecVec.load_elementi b2 2 in let ws11 = SpecVec.load_elementi b3 2 in let ws12 = SpecVec.load_elementi b0 3 in let ws13 = SpecVec.load_elementi b1 3 in let ws14 = SpecVec.load_elementi b2 3 in let ws15 = SpecVec.load_elementi b3 3 in LSeq.create16 ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15
{ "file_name": "code/sha2-mb/Hacl.Impl.SHA2.Core.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 48, "end_line": 152, "start_col": 0, "start_line": 130 }
module Hacl.Impl.SHA2.Core open FStar.Mul open FStar.HyperStack open FStar.HyperStack.All open Lib.IntTypes open Lib.NTuple open Lib.Buffer open Lib.IntVector open Lib.MultiBuffer open Spec.Hash.Definitions //open Hacl.Hash.Definitions // <- defines as_seq which clashes with Lib.Buffer.as_seq open Hacl.Spec.SHA2.Vec module ST = FStar.HyperStack.ST module NTup = Lib.NTuple module SpecVec = Hacl.Spec.SHA2.Vec module VecTranspose = Lib.IntVector.Transpose module LSeq = Lib.Sequence module HD = Hacl.Hash.Definitions (* Force ordering in dependency analysis so that monomorphizations are inserted into the Types module first. *) let _ = Hacl.Impl.SHA2.Types.uint8_8p #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 50" unfold let state_t (a:sha2_alg) (m:m_spec) = lbuffer (element_t a m) 8ul unfold let block_t (a:sha2_alg) = lbuffer uint8 (HD.block_len a) inline_for_extraction noextract let ws_t (a:sha2_alg) (m:m_spec) = lbuffer (element_t a m) 16ul inline_for_extraction noextract val set_wsi: #a:sha2_alg -> #m:m_spec -> ws:ws_t a m -> i:size_t{v i < 16} -> b:lbuffer uint8 (HD.block_len a) -> bi:size_t{v bi < 16 / (lanes a m)} -> Stack unit (requires fun h -> live h b /\ live h ws /\ disjoint b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == LSeq.upd (as_seq h0 ws) (v i) (SpecVec.load_elementi #a #m (as_seq h0 b) (v bi))) let set_wsi #a #m ws i b bi = [@inline_let] let l = lanes a m in ws.(i) <- vec_load_be (word_t a) l (sub b (bi *! size l *! HD.word_len a) (size l *! HD.word_len a)) noextract let load_blocks_spec1 (#a:sha2_alg) (#m:m_spec{lanes a m == 1}) (b:multiblock_spec a m) : ws_spec a m = let b = b.(|0|) in let ws0 = SpecVec.load_elementi b 0 in let ws1 = SpecVec.load_elementi b 1 in let ws2 = SpecVec.load_elementi b 2 in let ws3 = SpecVec.load_elementi b 3 in let ws4 = SpecVec.load_elementi b 4 in let ws5 = SpecVec.load_elementi b 5 in let ws6 = SpecVec.load_elementi b 6 in let ws7 = SpecVec.load_elementi b 7 in let ws8 = SpecVec.load_elementi b 8 in let ws9 = SpecVec.load_elementi b 9 in let ws10 = SpecVec.load_elementi b 10 in let ws11 = SpecVec.load_elementi b 11 in let ws12 = SpecVec.load_elementi b 12 in let ws13 = SpecVec.load_elementi b 13 in let ws14 = SpecVec.load_elementi b 14 in let ws15 = SpecVec.load_elementi b 15 in LSeq.create16 ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15 noextract let load_blocks_spec1_lemma (#a:sha2_alg) (#m:m_spec{lanes a m == 1}) (b:multiblock_spec a m) : Lemma (SpecVec.load_blocks b == load_blocks_spec1 b) = LSeq.eq_intro (SpecVec.load_blocks b) (load_blocks_spec1 b) #push-options "--z3rlimit 100" inline_for_extraction noextract val load_blocks1: #a:sha2_alg -> #m:m_spec{lanes a m == 1} -> b:multibuf (lanes a m) (HD.block_len a) -> ws:ws_t a m -> Stack unit (requires fun h -> live_multi h b /\ live h ws /\ disjoint_multi b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 b)) let load_blocks1 #a #m ib ws = let h0 = ST.get() in let b = ib.(|0|) in set_wsi ws 0ul b 0ul; set_wsi ws 1ul b 1ul; set_wsi ws 2ul b 2ul; set_wsi ws 3ul b 3ul; set_wsi ws 4ul b 4ul; set_wsi ws 5ul b 5ul; set_wsi ws 6ul b 6ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); set_wsi ws 7ul b 7ul; set_wsi ws 8ul b 8ul; set_wsi ws 9ul b 9ul; set_wsi ws 10ul b 10ul; set_wsi ws 11ul b 11ul; set_wsi ws 12ul b 12ul; set_wsi ws 13ul b 13ul; set_wsi ws 14ul b 14ul; set_wsi ws 15ul b 15ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); LSeq.eq_intro (as_seq h1 ws) (load_blocks_spec1 (as_seq_multi h0 ib)); load_blocks_spec1_lemma #a #m (as_seq_multi h0 ib); assert (as_seq h1 ws == load_blocks_spec1 (as_seq_multi h0 ib)); assert (as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 ib)) #pop-options
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NTuple.fsti.checked", "Lib.MultiBuffer.fst.checked", "Lib.IntVector.Transpose.fsti.checked", "Lib.IntVector.Serialize.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.SHA2.Vec.fst.checked", "Hacl.Impl.SHA2.Types.fst.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.UInt32.fsti.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.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA2.Core.fst" }
[ { "abbrev": true, "full_module": "Hacl.Hash.Definitions", "short_module": "HD" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "Lib.IntVector.Transpose", "short_module": "VecTranspose" }, { "abbrev": true, "full_module": "Hacl.Spec.SHA2.Vec", "short_module": "SpecVec" }, { "abbrev": true, "full_module": "Lib.NTuple", "short_module": "NTup" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Spec.SHA2.Vec", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.MultiBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.NTuple", "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.SHA2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
b: Hacl.Spec.SHA2.Vec.multiblock_spec a m -> Hacl.Spec.SHA2.Vec.ws_spec a m
Prims.Tot
[ "total" ]
[]
[ "Spec.Hash.Definitions.sha2_alg", "Hacl.Spec.SHA2.Vec.m_spec", "Prims.eq2", "Prims.int", "Hacl.Spec.SHA2.Vec.lanes", "Hacl.Spec.SHA2.Vec.multiblock_spec", "Lib.Sequence.create16", "Hacl.Spec.SHA2.Vec.element_t", "Hacl.Spec.SHA2.Vec.load_elementi", "FStar.Seq.Properties.lseq", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Hash.Definitions.block_length", "Lib.MultiBuffer.op_Lens_Access", "Lib.IntTypes.uint8", "Hacl.Spec.SHA2.Vec.ws_spec" ]
[]
false
false
false
false
false
let load_blocks_spec4 (#a: sha2_alg) (#m: m_spec{lanes a m == 4}) (b: multiblock_spec a m) : ws_spec a m =
let b0 = b.(| 0 |) in let b1 = b.(| 1 |) in let b2 = b.(| 2 |) in let b3 = b.(| 3 |) in let ws0 = SpecVec.load_elementi b0 0 in let ws1 = SpecVec.load_elementi b1 0 in let ws2 = SpecVec.load_elementi b2 0 in let ws3 = SpecVec.load_elementi b3 0 in let ws4 = SpecVec.load_elementi b0 1 in let ws5 = SpecVec.load_elementi b1 1 in let ws6 = SpecVec.load_elementi b2 1 in let ws7 = SpecVec.load_elementi b3 1 in let ws8 = SpecVec.load_elementi b0 2 in let ws9 = SpecVec.load_elementi b1 2 in let ws10 = SpecVec.load_elementi b2 2 in let ws11 = SpecVec.load_elementi b3 2 in let ws12 = SpecVec.load_elementi b0 3 in let ws13 = SpecVec.load_elementi b1 3 in let ws14 = SpecVec.load_elementi b2 3 in let ws15 = SpecVec.load_elementi b3 3 in LSeq.create16 ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15
false
Hacl.Impl.SHA2.Core.fst
Hacl.Impl.SHA2.Core.load_blocks_spec1_lemma
val load_blocks_spec1_lemma (#a: sha2_alg) (#m: m_spec{lanes a m == 1}) (b: multiblock_spec a m) : Lemma (SpecVec.load_blocks b == load_blocks_spec1 b)
val load_blocks_spec1_lemma (#a: sha2_alg) (#m: m_spec{lanes a m == 1}) (b: multiblock_spec a m) : Lemma (SpecVec.load_blocks b == load_blocks_spec1 b)
let load_blocks_spec1_lemma (#a:sha2_alg) (#m:m_spec{lanes a m == 1}) (b:multiblock_spec a m) : Lemma (SpecVec.load_blocks b == load_blocks_spec1 b) = LSeq.eq_intro (SpecVec.load_blocks b) (load_blocks_spec1 b)
{ "file_name": "code/sha2-mb/Hacl.Impl.SHA2.Core.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 61, "end_line": 86, "start_col": 0, "start_line": 83 }
module Hacl.Impl.SHA2.Core open FStar.Mul open FStar.HyperStack open FStar.HyperStack.All open Lib.IntTypes open Lib.NTuple open Lib.Buffer open Lib.IntVector open Lib.MultiBuffer open Spec.Hash.Definitions //open Hacl.Hash.Definitions // <- defines as_seq which clashes with Lib.Buffer.as_seq open Hacl.Spec.SHA2.Vec module ST = FStar.HyperStack.ST module NTup = Lib.NTuple module SpecVec = Hacl.Spec.SHA2.Vec module VecTranspose = Lib.IntVector.Transpose module LSeq = Lib.Sequence module HD = Hacl.Hash.Definitions (* Force ordering in dependency analysis so that monomorphizations are inserted into the Types module first. *) let _ = Hacl.Impl.SHA2.Types.uint8_8p #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 50" unfold let state_t (a:sha2_alg) (m:m_spec) = lbuffer (element_t a m) 8ul unfold let block_t (a:sha2_alg) = lbuffer uint8 (HD.block_len a) inline_for_extraction noextract let ws_t (a:sha2_alg) (m:m_spec) = lbuffer (element_t a m) 16ul inline_for_extraction noextract val set_wsi: #a:sha2_alg -> #m:m_spec -> ws:ws_t a m -> i:size_t{v i < 16} -> b:lbuffer uint8 (HD.block_len a) -> bi:size_t{v bi < 16 / (lanes a m)} -> Stack unit (requires fun h -> live h b /\ live h ws /\ disjoint b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == LSeq.upd (as_seq h0 ws) (v i) (SpecVec.load_elementi #a #m (as_seq h0 b) (v bi))) let set_wsi #a #m ws i b bi = [@inline_let] let l = lanes a m in ws.(i) <- vec_load_be (word_t a) l (sub b (bi *! size l *! HD.word_len a) (size l *! HD.word_len a)) noextract let load_blocks_spec1 (#a:sha2_alg) (#m:m_spec{lanes a m == 1}) (b:multiblock_spec a m) : ws_spec a m = let b = b.(|0|) in let ws0 = SpecVec.load_elementi b 0 in let ws1 = SpecVec.load_elementi b 1 in let ws2 = SpecVec.load_elementi b 2 in let ws3 = SpecVec.load_elementi b 3 in let ws4 = SpecVec.load_elementi b 4 in let ws5 = SpecVec.load_elementi b 5 in let ws6 = SpecVec.load_elementi b 6 in let ws7 = SpecVec.load_elementi b 7 in let ws8 = SpecVec.load_elementi b 8 in let ws9 = SpecVec.load_elementi b 9 in let ws10 = SpecVec.load_elementi b 10 in let ws11 = SpecVec.load_elementi b 11 in let ws12 = SpecVec.load_elementi b 12 in let ws13 = SpecVec.load_elementi b 13 in let ws14 = SpecVec.load_elementi b 14 in let ws15 = SpecVec.load_elementi b 15 in LSeq.create16 ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NTuple.fsti.checked", "Lib.MultiBuffer.fst.checked", "Lib.IntVector.Transpose.fsti.checked", "Lib.IntVector.Serialize.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.SHA2.Vec.fst.checked", "Hacl.Impl.SHA2.Types.fst.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.UInt32.fsti.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.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA2.Core.fst" }
[ { "abbrev": true, "full_module": "Hacl.Hash.Definitions", "short_module": "HD" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "Lib.IntVector.Transpose", "short_module": "VecTranspose" }, { "abbrev": true, "full_module": "Hacl.Spec.SHA2.Vec", "short_module": "SpecVec" }, { "abbrev": true, "full_module": "Lib.NTuple", "short_module": "NTup" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Spec.SHA2.Vec", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.MultiBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.NTuple", "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.SHA2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
b: Hacl.Spec.SHA2.Vec.multiblock_spec a m -> FStar.Pervasives.Lemma (ensures Hacl.Spec.SHA2.Vec.load_blocks b == Hacl.Impl.SHA2.Core.load_blocks_spec1 b)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Spec.Hash.Definitions.sha2_alg", "Hacl.Spec.SHA2.Vec.m_spec", "Prims.eq2", "Prims.int", "Hacl.Spec.SHA2.Vec.lanes", "Hacl.Spec.SHA2.Vec.multiblock_spec", "Lib.Sequence.eq_intro", "Hacl.Spec.SHA2.Vec.element_t", "Hacl.Spec.SHA2.Vec.load_blocks", "Hacl.Impl.SHA2.Core.load_blocks_spec1", "Prims.unit", "Prims.l_True", "Prims.squash", "Hacl.Spec.SHA2.Vec.ws_spec", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let load_blocks_spec1_lemma (#a: sha2_alg) (#m: m_spec{lanes a m == 1}) (b: multiblock_spec a m) : Lemma (SpecVec.load_blocks b == load_blocks_spec1 b) =
LSeq.eq_intro (SpecVec.load_blocks b) (load_blocks_spec1 b)
false
FStar.FunctionalExtensionality.fst
FStar.FunctionalExtensionality.on_domain
val on_domain (a: Type) (#b: (a -> Type)) ([@@@strictly_positive] f: arrow a b) : Tot (arrow a b)
val on_domain (a: Type) (#b: (a -> Type)) ([@@@strictly_positive] f: arrow a b) : Tot (arrow a b)
let on_domain (a:Type) (#b:a -> Type) ([@@@strictly_positive] f:arrow a b) = fun (x:a) -> f x
{ "file_name": "ulib/FStar.FunctionalExtensionality.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 20, "end_line": 21, "start_col": 0, "start_line": 20 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.FunctionalExtensionality
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "FStar.Stubs.Tactics.Types.fsti.checked", "FStar.Stubs.Reflection.Types.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "FStar.FunctionalExtensionality.fst" }
[ { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> f: FStar.FunctionalExtensionality.arrow a b -> FStar.FunctionalExtensionality.arrow a b
Prims.Tot
[ "total" ]
[]
[ "FStar.FunctionalExtensionality.arrow" ]
[]
false
false
false
false
false
let on_domain (a: Type) (#b: (a -> Type)) ([@@@ strictly_positive]f: arrow a b) =
fun (x: a) -> f x
false
Hacl.Impl.SHA2.Core.fst
Hacl.Impl.SHA2.Core.set_wsi
val set_wsi: #a:sha2_alg -> #m:m_spec -> ws:ws_t a m -> i:size_t{v i < 16} -> b:lbuffer uint8 (HD.block_len a) -> bi:size_t{v bi < 16 / (lanes a m)} -> Stack unit (requires fun h -> live h b /\ live h ws /\ disjoint b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == LSeq.upd (as_seq h0 ws) (v i) (SpecVec.load_elementi #a #m (as_seq h0 b) (v bi)))
val set_wsi: #a:sha2_alg -> #m:m_spec -> ws:ws_t a m -> i:size_t{v i < 16} -> b:lbuffer uint8 (HD.block_len a) -> bi:size_t{v bi < 16 / (lanes a m)} -> Stack unit (requires fun h -> live h b /\ live h ws /\ disjoint b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == LSeq.upd (as_seq h0 ws) (v i) (SpecVec.load_elementi #a #m (as_seq h0 b) (v bi)))
let set_wsi #a #m ws i b bi = [@inline_let] let l = lanes a m in ws.(i) <- vec_load_be (word_t a) l (sub b (bi *! size l *! HD.word_len a) (size l *! HD.word_len a))
{ "file_name": "code/sha2-mb/Hacl.Impl.SHA2.Core.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 102, "end_line": 57, "start_col": 0, "start_line": 54 }
module Hacl.Impl.SHA2.Core open FStar.Mul open FStar.HyperStack open FStar.HyperStack.All open Lib.IntTypes open Lib.NTuple open Lib.Buffer open Lib.IntVector open Lib.MultiBuffer open Spec.Hash.Definitions //open Hacl.Hash.Definitions // <- defines as_seq which clashes with Lib.Buffer.as_seq open Hacl.Spec.SHA2.Vec module ST = FStar.HyperStack.ST module NTup = Lib.NTuple module SpecVec = Hacl.Spec.SHA2.Vec module VecTranspose = Lib.IntVector.Transpose module LSeq = Lib.Sequence module HD = Hacl.Hash.Definitions (* Force ordering in dependency analysis so that monomorphizations are inserted into the Types module first. *) let _ = Hacl.Impl.SHA2.Types.uint8_8p #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 50" unfold let state_t (a:sha2_alg) (m:m_spec) = lbuffer (element_t a m) 8ul unfold let block_t (a:sha2_alg) = lbuffer uint8 (HD.block_len a) inline_for_extraction noextract let ws_t (a:sha2_alg) (m:m_spec) = lbuffer (element_t a m) 16ul inline_for_extraction noextract val set_wsi: #a:sha2_alg -> #m:m_spec -> ws:ws_t a m -> i:size_t{v i < 16} -> b:lbuffer uint8 (HD.block_len a) -> bi:size_t{v bi < 16 / (lanes a m)} -> Stack unit (requires fun h -> live h b /\ live h ws /\ disjoint b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == LSeq.upd (as_seq h0 ws) (v i) (SpecVec.load_elementi #a #m (as_seq h0 b) (v bi)))
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NTuple.fsti.checked", "Lib.MultiBuffer.fst.checked", "Lib.IntVector.Transpose.fsti.checked", "Lib.IntVector.Serialize.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.SHA2.Vec.fst.checked", "Hacl.Impl.SHA2.Types.fst.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.UInt32.fsti.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.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA2.Core.fst" }
[ { "abbrev": true, "full_module": "Hacl.Hash.Definitions", "short_module": "HD" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "Lib.IntVector.Transpose", "short_module": "VecTranspose" }, { "abbrev": true, "full_module": "Hacl.Spec.SHA2.Vec", "short_module": "SpecVec" }, { "abbrev": true, "full_module": "Lib.NTuple", "short_module": "NTup" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Spec.SHA2.Vec", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.MultiBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.NTuple", "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.SHA2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
ws: Hacl.Impl.SHA2.Core.ws_t a m -> i: Lib.IntTypes.size_t{Lib.IntTypes.v i < 16} -> b: Lib.Buffer.lbuffer Lib.IntTypes.uint8 (Hacl.Hash.Definitions.block_len a) -> bi: Lib.IntTypes.size_t{Lib.IntTypes.v bi < 16 / Hacl.Spec.SHA2.Vec.lanes a m} -> FStar.HyperStack.ST.Stack Prims.unit
FStar.HyperStack.ST.Stack
[]
[]
[ "Spec.Hash.Definitions.sha2_alg", "Hacl.Spec.SHA2.Vec.m_spec", "Hacl.Impl.SHA2.Core.ws_t", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_LessThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "Hacl.Hash.Definitions.block_len", "Prims.op_Division", "Hacl.Spec.SHA2.Vec.lanes", "Lib.Buffer.op_Array_Assignment", "Hacl.Spec.SHA2.Vec.element_t", "FStar.UInt32.__uint_to_t", "Prims.unit", "Lib.IntVector.vec_load_be", "Spec.Hash.Definitions.word_t", "Lib.IntVector.vec_t", "Lib.Buffer.lbuffer_t", "Lib.Buffer.MUT", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Lib.IntTypes.mul", "Lib.IntTypes.mk_int", "Lib.IntTypes.numbytes", "Lib.Buffer.sub", "Lib.IntTypes.op_Star_Bang", "Lib.IntTypes.size", "Hacl.Hash.Definitions.word_len", "Hacl.Spec.SHA2.Vec.lanes_t" ]
[]
false
true
false
false
false
let set_wsi #a #m ws i b bi =
[@@ inline_let ]let l = lanes a m in ws.(i) <- vec_load_be (word_t a) l (sub b (bi *! size l *! HD.word_len a) (size l *! HD.word_len a))
false
Hacl.Impl.SHA2.Core.fst
Hacl.Impl.SHA2.Core.load_blocks_spec8
val load_blocks_spec8 (#a: sha2_alg) (#m: m_spec{lanes a m == 8}) (b: multiblock_spec a m) : ws_spec a m
val load_blocks_spec8 (#a: sha2_alg) (#m: m_spec{lanes a m == 8}) (b: multiblock_spec a m) : ws_spec a m
let load_blocks_spec8 (#a:sha2_alg) (#m:m_spec{lanes a m == 8}) (b:multiblock_spec a m) : ws_spec a m = let b0 = b.(|0|) in let b1 = b.(|1|) in let b2 = b.(|2|) in let b3 = b.(|3|) in let b4 = b.(|4|) in let b5 = b.(|5|) in let b6 = b.(|6|) in let b7 = b.(|7|) in let ws0 = SpecVec.load_elementi b0 0 in let ws1 = SpecVec.load_elementi b1 0 in let ws2 = SpecVec.load_elementi b2 0 in let ws3 = SpecVec.load_elementi b3 0 in let ws4 = SpecVec.load_elementi b4 0 in let ws5 = SpecVec.load_elementi b5 0 in let ws6 = SpecVec.load_elementi b6 0 in let ws7 = SpecVec.load_elementi b7 0 in let ws8 = SpecVec.load_elementi b0 1 in let ws9 = SpecVec.load_elementi b1 1 in let ws10 = SpecVec.load_elementi b2 1 in let ws11 = SpecVec.load_elementi b3 1 in let ws12 = SpecVec.load_elementi b4 1 in let ws13 = SpecVec.load_elementi b5 1 in let ws14 = SpecVec.load_elementi b6 1 in let ws15 = SpecVec.load_elementi b7 1 in LSeq.create16 ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15
{ "file_name": "code/sha2-mb/Hacl.Impl.SHA2.Core.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 48, "end_line": 230, "start_col": 0, "start_line": 204 }
module Hacl.Impl.SHA2.Core open FStar.Mul open FStar.HyperStack open FStar.HyperStack.All open Lib.IntTypes open Lib.NTuple open Lib.Buffer open Lib.IntVector open Lib.MultiBuffer open Spec.Hash.Definitions //open Hacl.Hash.Definitions // <- defines as_seq which clashes with Lib.Buffer.as_seq open Hacl.Spec.SHA2.Vec module ST = FStar.HyperStack.ST module NTup = Lib.NTuple module SpecVec = Hacl.Spec.SHA2.Vec module VecTranspose = Lib.IntVector.Transpose module LSeq = Lib.Sequence module HD = Hacl.Hash.Definitions (* Force ordering in dependency analysis so that monomorphizations are inserted into the Types module first. *) let _ = Hacl.Impl.SHA2.Types.uint8_8p #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 50" unfold let state_t (a:sha2_alg) (m:m_spec) = lbuffer (element_t a m) 8ul unfold let block_t (a:sha2_alg) = lbuffer uint8 (HD.block_len a) inline_for_extraction noextract let ws_t (a:sha2_alg) (m:m_spec) = lbuffer (element_t a m) 16ul inline_for_extraction noextract val set_wsi: #a:sha2_alg -> #m:m_spec -> ws:ws_t a m -> i:size_t{v i < 16} -> b:lbuffer uint8 (HD.block_len a) -> bi:size_t{v bi < 16 / (lanes a m)} -> Stack unit (requires fun h -> live h b /\ live h ws /\ disjoint b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == LSeq.upd (as_seq h0 ws) (v i) (SpecVec.load_elementi #a #m (as_seq h0 b) (v bi))) let set_wsi #a #m ws i b bi = [@inline_let] let l = lanes a m in ws.(i) <- vec_load_be (word_t a) l (sub b (bi *! size l *! HD.word_len a) (size l *! HD.word_len a)) noextract let load_blocks_spec1 (#a:sha2_alg) (#m:m_spec{lanes a m == 1}) (b:multiblock_spec a m) : ws_spec a m = let b = b.(|0|) in let ws0 = SpecVec.load_elementi b 0 in let ws1 = SpecVec.load_elementi b 1 in let ws2 = SpecVec.load_elementi b 2 in let ws3 = SpecVec.load_elementi b 3 in let ws4 = SpecVec.load_elementi b 4 in let ws5 = SpecVec.load_elementi b 5 in let ws6 = SpecVec.load_elementi b 6 in let ws7 = SpecVec.load_elementi b 7 in let ws8 = SpecVec.load_elementi b 8 in let ws9 = SpecVec.load_elementi b 9 in let ws10 = SpecVec.load_elementi b 10 in let ws11 = SpecVec.load_elementi b 11 in let ws12 = SpecVec.load_elementi b 12 in let ws13 = SpecVec.load_elementi b 13 in let ws14 = SpecVec.load_elementi b 14 in let ws15 = SpecVec.load_elementi b 15 in LSeq.create16 ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15 noextract let load_blocks_spec1_lemma (#a:sha2_alg) (#m:m_spec{lanes a m == 1}) (b:multiblock_spec a m) : Lemma (SpecVec.load_blocks b == load_blocks_spec1 b) = LSeq.eq_intro (SpecVec.load_blocks b) (load_blocks_spec1 b) #push-options "--z3rlimit 100" inline_for_extraction noextract val load_blocks1: #a:sha2_alg -> #m:m_spec{lanes a m == 1} -> b:multibuf (lanes a m) (HD.block_len a) -> ws:ws_t a m -> Stack unit (requires fun h -> live_multi h b /\ live h ws /\ disjoint_multi b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 b)) let load_blocks1 #a #m ib ws = let h0 = ST.get() in let b = ib.(|0|) in set_wsi ws 0ul b 0ul; set_wsi ws 1ul b 1ul; set_wsi ws 2ul b 2ul; set_wsi ws 3ul b 3ul; set_wsi ws 4ul b 4ul; set_wsi ws 5ul b 5ul; set_wsi ws 6ul b 6ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); set_wsi ws 7ul b 7ul; set_wsi ws 8ul b 8ul; set_wsi ws 9ul b 9ul; set_wsi ws 10ul b 10ul; set_wsi ws 11ul b 11ul; set_wsi ws 12ul b 12ul; set_wsi ws 13ul b 13ul; set_wsi ws 14ul b 14ul; set_wsi ws 15ul b 15ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); LSeq.eq_intro (as_seq h1 ws) (load_blocks_spec1 (as_seq_multi h0 ib)); load_blocks_spec1_lemma #a #m (as_seq_multi h0 ib); assert (as_seq h1 ws == load_blocks_spec1 (as_seq_multi h0 ib)); assert (as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 ib)) #pop-options noextract let load_blocks_spec4 (#a:sha2_alg) (#m:m_spec{lanes a m == 4}) (b:multiblock_spec a m) : ws_spec a m = let b0 = b.(|0|) in let b1 = b.(|1|) in let b2 = b.(|2|) in let b3 = b.(|3|) in let ws0 = SpecVec.load_elementi b0 0 in let ws1 = SpecVec.load_elementi b1 0 in let ws2 = SpecVec.load_elementi b2 0 in let ws3 = SpecVec.load_elementi b3 0 in let ws4 = SpecVec.load_elementi b0 1 in let ws5 = SpecVec.load_elementi b1 1 in let ws6 = SpecVec.load_elementi b2 1 in let ws7 = SpecVec.load_elementi b3 1 in let ws8 = SpecVec.load_elementi b0 2 in let ws9 = SpecVec.load_elementi b1 2 in let ws10 = SpecVec.load_elementi b2 2 in let ws11 = SpecVec.load_elementi b3 2 in let ws12 = SpecVec.load_elementi b0 3 in let ws13 = SpecVec.load_elementi b1 3 in let ws14 = SpecVec.load_elementi b2 3 in let ws15 = SpecVec.load_elementi b3 3 in LSeq.create16 ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15 noextract let load_blocks_spec4_lemma (#a:sha2_alg) (#m:m_spec{lanes a m == 4}) (b:multiblock_spec a m) : Lemma (SpecVec.load_blocks b == load_blocks_spec4 b) = LSeq.eq_intro (SpecVec.load_blocks b) (load_blocks_spec4 b) inline_for_extraction noextract val load_blocks4: #a:sha2_alg -> #m:m_spec{lanes a m == 4} -> b:multibuf (lanes a m) (HD.block_len a) -> ws:ws_t a m -> Stack unit (requires fun h -> live_multi h b /\ live h ws /\ disjoint_multi b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 b)) #push-options "--z3rlimit 150" let load_blocks4 #a #m ib ws = let h0 = ST.get() in let (b0,(b1,(b2,b3))) = NTup.tup4 ib in set_wsi ws 0ul b0 0ul; set_wsi ws 1ul b1 0ul; set_wsi ws 2ul b2 0ul; set_wsi ws 3ul b3 0ul; set_wsi ws 4ul b0 1ul; set_wsi ws 5ul b1 1ul; set_wsi ws 6ul b2 1ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); set_wsi ws 7ul b3 1ul; set_wsi ws 8ul b0 2ul; set_wsi ws 9ul b1 2ul; set_wsi ws 10ul b2 2ul; set_wsi ws 11ul b3 2ul; set_wsi ws 12ul b0 3ul; set_wsi ws 13ul b1 3ul; set_wsi ws 14ul b2 3ul; set_wsi ws 15ul b3 3ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); LSeq.eq_intro (as_seq h1 ws) (load_blocks_spec4 (as_seq_multi h0 ib)); load_blocks_spec4_lemma #a #m (as_seq_multi h0 ib); assert (as_seq h1 ws == load_blocks_spec4 (as_seq_multi h0 ib)); assert (as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 ib)); () #pop-options
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NTuple.fsti.checked", "Lib.MultiBuffer.fst.checked", "Lib.IntVector.Transpose.fsti.checked", "Lib.IntVector.Serialize.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.SHA2.Vec.fst.checked", "Hacl.Impl.SHA2.Types.fst.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.UInt32.fsti.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.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA2.Core.fst" }
[ { "abbrev": true, "full_module": "Hacl.Hash.Definitions", "short_module": "HD" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "Lib.IntVector.Transpose", "short_module": "VecTranspose" }, { "abbrev": true, "full_module": "Hacl.Spec.SHA2.Vec", "short_module": "SpecVec" }, { "abbrev": true, "full_module": "Lib.NTuple", "short_module": "NTup" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Spec.SHA2.Vec", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.MultiBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.NTuple", "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.SHA2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
b: Hacl.Spec.SHA2.Vec.multiblock_spec a m -> Hacl.Spec.SHA2.Vec.ws_spec a m
Prims.Tot
[ "total" ]
[]
[ "Spec.Hash.Definitions.sha2_alg", "Hacl.Spec.SHA2.Vec.m_spec", "Prims.eq2", "Prims.int", "Hacl.Spec.SHA2.Vec.lanes", "Hacl.Spec.SHA2.Vec.multiblock_spec", "Lib.Sequence.create16", "Hacl.Spec.SHA2.Vec.element_t", "Hacl.Spec.SHA2.Vec.load_elementi", "FStar.Seq.Properties.lseq", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Hash.Definitions.block_length", "Lib.MultiBuffer.op_Lens_Access", "Lib.IntTypes.uint8", "Hacl.Spec.SHA2.Vec.ws_spec" ]
[]
false
false
false
false
false
let load_blocks_spec8 (#a: sha2_alg) (#m: m_spec{lanes a m == 8}) (b: multiblock_spec a m) : ws_spec a m =
let b0 = b.(| 0 |) in let b1 = b.(| 1 |) in let b2 = b.(| 2 |) in let b3 = b.(| 3 |) in let b4 = b.(| 4 |) in let b5 = b.(| 5 |) in let b6 = b.(| 6 |) in let b7 = b.(| 7 |) in let ws0 = SpecVec.load_elementi b0 0 in let ws1 = SpecVec.load_elementi b1 0 in let ws2 = SpecVec.load_elementi b2 0 in let ws3 = SpecVec.load_elementi b3 0 in let ws4 = SpecVec.load_elementi b4 0 in let ws5 = SpecVec.load_elementi b5 0 in let ws6 = SpecVec.load_elementi b6 0 in let ws7 = SpecVec.load_elementi b7 0 in let ws8 = SpecVec.load_elementi b0 1 in let ws9 = SpecVec.load_elementi b1 1 in let ws10 = SpecVec.load_elementi b2 1 in let ws11 = SpecVec.load_elementi b3 1 in let ws12 = SpecVec.load_elementi b4 1 in let ws13 = SpecVec.load_elementi b5 1 in let ws14 = SpecVec.load_elementi b6 1 in let ws15 = SpecVec.load_elementi b7 1 in LSeq.create16 ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15
false
Hacl.Impl.SHA2.Core.fst
Hacl.Impl.SHA2.Core.preserves_disjoint_multi
val preserves_disjoint_multi : b: Lib.MultiBuffer.multibuf lanes len -> r: Lib.MultiBuffer.multibuf lanes len' -> Prims.logical
let preserves_disjoint_multi #lanes #len #len' (b:multibuf lanes len) (r:multibuf lanes len') = (forall a l (x:lbuffer a l). disjoint_multi b x ==> disjoint_multi r x)
{ "file_name": "code/sha2-mb/Hacl.Impl.SHA2.Core.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 75, "end_line": 781, "start_col": 0, "start_line": 780 }
module Hacl.Impl.SHA2.Core open FStar.Mul open FStar.HyperStack open FStar.HyperStack.All open Lib.IntTypes open Lib.NTuple open Lib.Buffer open Lib.IntVector open Lib.MultiBuffer open Spec.Hash.Definitions //open Hacl.Hash.Definitions // <- defines as_seq which clashes with Lib.Buffer.as_seq open Hacl.Spec.SHA2.Vec module ST = FStar.HyperStack.ST module NTup = Lib.NTuple module SpecVec = Hacl.Spec.SHA2.Vec module VecTranspose = Lib.IntVector.Transpose module LSeq = Lib.Sequence module HD = Hacl.Hash.Definitions (* Force ordering in dependency analysis so that monomorphizations are inserted into the Types module first. *) let _ = Hacl.Impl.SHA2.Types.uint8_8p #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 50" unfold let state_t (a:sha2_alg) (m:m_spec) = lbuffer (element_t a m) 8ul unfold let block_t (a:sha2_alg) = lbuffer uint8 (HD.block_len a) inline_for_extraction noextract let ws_t (a:sha2_alg) (m:m_spec) = lbuffer (element_t a m) 16ul inline_for_extraction noextract val set_wsi: #a:sha2_alg -> #m:m_spec -> ws:ws_t a m -> i:size_t{v i < 16} -> b:lbuffer uint8 (HD.block_len a) -> bi:size_t{v bi < 16 / (lanes a m)} -> Stack unit (requires fun h -> live h b /\ live h ws /\ disjoint b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == LSeq.upd (as_seq h0 ws) (v i) (SpecVec.load_elementi #a #m (as_seq h0 b) (v bi))) let set_wsi #a #m ws i b bi = [@inline_let] let l = lanes a m in ws.(i) <- vec_load_be (word_t a) l (sub b (bi *! size l *! HD.word_len a) (size l *! HD.word_len a)) noextract let load_blocks_spec1 (#a:sha2_alg) (#m:m_spec{lanes a m == 1}) (b:multiblock_spec a m) : ws_spec a m = let b = b.(|0|) in let ws0 = SpecVec.load_elementi b 0 in let ws1 = SpecVec.load_elementi b 1 in let ws2 = SpecVec.load_elementi b 2 in let ws3 = SpecVec.load_elementi b 3 in let ws4 = SpecVec.load_elementi b 4 in let ws5 = SpecVec.load_elementi b 5 in let ws6 = SpecVec.load_elementi b 6 in let ws7 = SpecVec.load_elementi b 7 in let ws8 = SpecVec.load_elementi b 8 in let ws9 = SpecVec.load_elementi b 9 in let ws10 = SpecVec.load_elementi b 10 in let ws11 = SpecVec.load_elementi b 11 in let ws12 = SpecVec.load_elementi b 12 in let ws13 = SpecVec.load_elementi b 13 in let ws14 = SpecVec.load_elementi b 14 in let ws15 = SpecVec.load_elementi b 15 in LSeq.create16 ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15 noextract let load_blocks_spec1_lemma (#a:sha2_alg) (#m:m_spec{lanes a m == 1}) (b:multiblock_spec a m) : Lemma (SpecVec.load_blocks b == load_blocks_spec1 b) = LSeq.eq_intro (SpecVec.load_blocks b) (load_blocks_spec1 b) #push-options "--z3rlimit 100" inline_for_extraction noextract val load_blocks1: #a:sha2_alg -> #m:m_spec{lanes a m == 1} -> b:multibuf (lanes a m) (HD.block_len a) -> ws:ws_t a m -> Stack unit (requires fun h -> live_multi h b /\ live h ws /\ disjoint_multi b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 b)) let load_blocks1 #a #m ib ws = let h0 = ST.get() in let b = ib.(|0|) in set_wsi ws 0ul b 0ul; set_wsi ws 1ul b 1ul; set_wsi ws 2ul b 2ul; set_wsi ws 3ul b 3ul; set_wsi ws 4ul b 4ul; set_wsi ws 5ul b 5ul; set_wsi ws 6ul b 6ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); set_wsi ws 7ul b 7ul; set_wsi ws 8ul b 8ul; set_wsi ws 9ul b 9ul; set_wsi ws 10ul b 10ul; set_wsi ws 11ul b 11ul; set_wsi ws 12ul b 12ul; set_wsi ws 13ul b 13ul; set_wsi ws 14ul b 14ul; set_wsi ws 15ul b 15ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); LSeq.eq_intro (as_seq h1 ws) (load_blocks_spec1 (as_seq_multi h0 ib)); load_blocks_spec1_lemma #a #m (as_seq_multi h0 ib); assert (as_seq h1 ws == load_blocks_spec1 (as_seq_multi h0 ib)); assert (as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 ib)) #pop-options noextract let load_blocks_spec4 (#a:sha2_alg) (#m:m_spec{lanes a m == 4}) (b:multiblock_spec a m) : ws_spec a m = let b0 = b.(|0|) in let b1 = b.(|1|) in let b2 = b.(|2|) in let b3 = b.(|3|) in let ws0 = SpecVec.load_elementi b0 0 in let ws1 = SpecVec.load_elementi b1 0 in let ws2 = SpecVec.load_elementi b2 0 in let ws3 = SpecVec.load_elementi b3 0 in let ws4 = SpecVec.load_elementi b0 1 in let ws5 = SpecVec.load_elementi b1 1 in let ws6 = SpecVec.load_elementi b2 1 in let ws7 = SpecVec.load_elementi b3 1 in let ws8 = SpecVec.load_elementi b0 2 in let ws9 = SpecVec.load_elementi b1 2 in let ws10 = SpecVec.load_elementi b2 2 in let ws11 = SpecVec.load_elementi b3 2 in let ws12 = SpecVec.load_elementi b0 3 in let ws13 = SpecVec.load_elementi b1 3 in let ws14 = SpecVec.load_elementi b2 3 in let ws15 = SpecVec.load_elementi b3 3 in LSeq.create16 ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15 noextract let load_blocks_spec4_lemma (#a:sha2_alg) (#m:m_spec{lanes a m == 4}) (b:multiblock_spec a m) : Lemma (SpecVec.load_blocks b == load_blocks_spec4 b) = LSeq.eq_intro (SpecVec.load_blocks b) (load_blocks_spec4 b) inline_for_extraction noextract val load_blocks4: #a:sha2_alg -> #m:m_spec{lanes a m == 4} -> b:multibuf (lanes a m) (HD.block_len a) -> ws:ws_t a m -> Stack unit (requires fun h -> live_multi h b /\ live h ws /\ disjoint_multi b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 b)) #push-options "--z3rlimit 150" let load_blocks4 #a #m ib ws = let h0 = ST.get() in let (b0,(b1,(b2,b3))) = NTup.tup4 ib in set_wsi ws 0ul b0 0ul; set_wsi ws 1ul b1 0ul; set_wsi ws 2ul b2 0ul; set_wsi ws 3ul b3 0ul; set_wsi ws 4ul b0 1ul; set_wsi ws 5ul b1 1ul; set_wsi ws 6ul b2 1ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); set_wsi ws 7ul b3 1ul; set_wsi ws 8ul b0 2ul; set_wsi ws 9ul b1 2ul; set_wsi ws 10ul b2 2ul; set_wsi ws 11ul b3 2ul; set_wsi ws 12ul b0 3ul; set_wsi ws 13ul b1 3ul; set_wsi ws 14ul b2 3ul; set_wsi ws 15ul b3 3ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); LSeq.eq_intro (as_seq h1 ws) (load_blocks_spec4 (as_seq_multi h0 ib)); load_blocks_spec4_lemma #a #m (as_seq_multi h0 ib); assert (as_seq h1 ws == load_blocks_spec4 (as_seq_multi h0 ib)); assert (as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 ib)); () #pop-options noextract let load_blocks_spec8 (#a:sha2_alg) (#m:m_spec{lanes a m == 8}) (b:multiblock_spec a m) : ws_spec a m = let b0 = b.(|0|) in let b1 = b.(|1|) in let b2 = b.(|2|) in let b3 = b.(|3|) in let b4 = b.(|4|) in let b5 = b.(|5|) in let b6 = b.(|6|) in let b7 = b.(|7|) in let ws0 = SpecVec.load_elementi b0 0 in let ws1 = SpecVec.load_elementi b1 0 in let ws2 = SpecVec.load_elementi b2 0 in let ws3 = SpecVec.load_elementi b3 0 in let ws4 = SpecVec.load_elementi b4 0 in let ws5 = SpecVec.load_elementi b5 0 in let ws6 = SpecVec.load_elementi b6 0 in let ws7 = SpecVec.load_elementi b7 0 in let ws8 = SpecVec.load_elementi b0 1 in let ws9 = SpecVec.load_elementi b1 1 in let ws10 = SpecVec.load_elementi b2 1 in let ws11 = SpecVec.load_elementi b3 1 in let ws12 = SpecVec.load_elementi b4 1 in let ws13 = SpecVec.load_elementi b5 1 in let ws14 = SpecVec.load_elementi b6 1 in let ws15 = SpecVec.load_elementi b7 1 in LSeq.create16 ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15 noextract let load_blocks_spec8_lemma (#a:sha2_alg) (#m:m_spec{lanes a m == 8}) (b:multiblock_spec a m) : Lemma (SpecVec.load_blocks b == load_blocks_spec8 b) = LSeq.eq_intro (SpecVec.load_blocks b) (load_blocks_spec8 b) inline_for_extraction noextract val load_blocks8: #a:sha2_alg -> #m:m_spec{lanes a m == 8} -> b:multibuf (lanes a m) (HD.block_len a) -> ws:ws_t a m -> Stack unit (requires fun h -> live_multi h b /\ live h ws /\ disjoint_multi b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 b)) #push-options "--z3rlimit 150" let load_blocks8 #a #m ib ws = let h0 = ST.get() in let (b0,(b1,(b2,(b3,(b4,(b5,(b6,b7))))))) = NTup.tup8 ib in set_wsi ws 0ul b0 0ul; set_wsi ws 1ul b1 0ul; set_wsi ws 2ul b2 0ul; set_wsi ws 3ul b3 0ul; set_wsi ws 4ul b4 0ul; set_wsi ws 5ul b5 0ul; set_wsi ws 6ul b6 0ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); set_wsi ws 7ul b7 0ul; set_wsi ws 8ul b0 1ul; set_wsi ws 9ul b1 1ul; set_wsi ws 10ul b2 1ul; set_wsi ws 11ul b3 1ul; set_wsi ws 12ul b4 1ul; set_wsi ws 13ul b5 1ul; set_wsi ws 14ul b6 1ul; set_wsi ws 15ul b7 1ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); LSeq.eq_intro (as_seq h1 ws) (load_blocks_spec8 (as_seq_multi h0 ib)); load_blocks_spec8_lemma #a #m (as_seq_multi h0 ib); assert (as_seq h1 ws == load_blocks_spec8 (as_seq_multi h0 ib)); assert (as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 ib)); () #pop-options inline_for_extraction noextract val load_blocks: #a:sha2_alg -> #m:m_spec{is_supported a m} -> b:multibuf (lanes a m) (HD.block_len a) -> ws:ws_t a m -> Stack unit (requires fun h -> live_multi h b /\ live h ws /\ disjoint_multi b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 b)) let load_blocks #a #m b ws = match lanes a m with | 1 -> load_blocks1 b ws | 4 -> load_blocks4 b ws | 8 -> load_blocks8 b ws inline_for_extraction noextract val transpose_ws4: #a:sha2_alg -> #m:m_spec{lanes a m == 4} -> ws:ws_t a m -> Stack unit (requires fun h -> live h ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.transpose_ws (as_seq h0 ws)) let transpose_ws4 #a #m ws = let (ws0,ws1,ws2,ws3) = VecTranspose.transpose4x4 (ws.(0ul),ws.(1ul),ws.(2ul),ws.(3ul)) in let (ws4,ws5,ws6,ws7) = VecTranspose.transpose4x4 (ws.(4ul),ws.(5ul),ws.(6ul),ws.(7ul)) in let (ws8,ws9,ws10,ws11) = VecTranspose.transpose4x4 (ws.(8ul),ws.(9ul),ws.(10ul),ws.(11ul)) in let (ws12,ws13,ws14,ws15) = VecTranspose.transpose4x4 (ws.(12ul),ws.(13ul),ws.(14ul),ws.(15ul)) in create16 ws ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15 inline_for_extraction noextract val transpose_ws8: #a:sha2_alg -> #m:m_spec{lanes a m == 8} -> ws:ws_t a m -> Stack unit (requires fun h -> live h ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.transpose_ws (as_seq h0 ws)) let transpose_ws8 #a #m ws = let (ws0,ws1,ws2,ws3,ws4,ws5,ws6,ws7) = VecTranspose.transpose8x8 (ws.(0ul),ws.(1ul),ws.(2ul),ws.(3ul),ws.(4ul),ws.(5ul),ws.(6ul),ws.(7ul)) in let (ws8,ws9,ws10,ws11,ws12,ws13,ws14,ws15) = VecTranspose.transpose8x8 (ws.(8ul),ws.(9ul),ws.(10ul),ws.(11ul),ws.(12ul),ws.(13ul),ws.(14ul),ws.(15ul)) in create16 ws ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15 inline_for_extraction noextract val transpose_ws: #a:sha2_alg -> #m:m_spec{is_supported a m} -> ws:ws_t a m -> Stack unit (requires fun h -> live h ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.transpose_ws (as_seq h0 ws)) let transpose_ws #a #m ws = match lanes a m with | 1 -> () | 4 -> transpose_ws4 ws | 8 -> transpose_ws8 ws inline_for_extraction noextract val load_ws: #a:sha2_alg -> #m:m_spec{is_supported a m} -> b:multibuf (lanes a m) (HD.block_len a) -> ws:ws_t a m -> Stack unit (requires fun h -> live_multi h b /\ live h ws /\ disjoint_multi b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.load_ws #a #m (as_seq_multi h0 b)) let load_ws #a #m b ws = load_blocks b ws; transpose_ws ws inline_for_extraction noextract let padded_blocks (a:sha2_alg) (len:size_t{v len <= block_length a}) : n:size_t{v n == SpecVec.padded_blocks a (v len)} = if (len +! len_len a +! 1ul <=. HD.block_len a) then 1ul else 2ul inline_for_extraction noextract val load_last_blocks: #a:sha2_alg -> totlen_buf:lbuffer uint8 (len_len a) -> len:size_t{v len <= block_length a} -> b:lbuffer uint8 len -> fin:size_t{v fin == block_length a \/ v fin == 2 * block_length a} -> last:lbuffer uint8 (2ul *! HD.block_len a) -> Stack (lbuffer uint8 (HD.block_len a) & lbuffer uint8 (HD.block_len a)) (requires fun h -> live h totlen_buf /\ live h b /\ live h last /\ disjoint b last /\ disjoint last totlen_buf /\ as_seq h last == LSeq.create (2 * block_length a) (u8 0)) (ensures (fun h0 (l0,l1) h1 -> modifies (loc last) h0 h1 /\ live h1 l0 /\ live h1 l1 /\ (forall a l (r:lbuffer a l). disjoint last r ==> (disjoint l0 r /\ disjoint l1 r)) /\ (as_seq h1 l0, as_seq h1 l1) == SpecVec.load_last_blocks #a (as_seq h0 totlen_buf) (v fin) (v len) (as_seq h0 b))) #push-options "--z3rlimit 200" let load_last_blocks #a totlen_buf len b fin last = let h0 = ST.get() in update_sub last 0ul len b; last.(len) <- u8 0x80; update_sub last (fin -. len_len a) (len_len a) totlen_buf; let last0 : lbuffer uint8 (HD.block_len a) = sub last 0ul (HD.block_len a) in let last1 : lbuffer uint8 (HD.block_len a) = sub last (HD.block_len a) (HD.block_len a) in let h1 = ST.get() in assert (modifies (loc last) h0 h1); (last0,last1) #pop-options noextract let preserves_sub_disjoint_multi #lanes #len #len' (b:lbuffer uint8 len) (r:multibuf lanes len') = (forall a l (x:lbuffer a l). disjoint b x ==> disjoint_multi r x) inline_for_extraction noextract let load_last_t (a:sha2_alg) (m:m_spec{is_supported a m}) = totlen_buf:lbuffer uint8 (len_len a) -> len:size_t{v len <= block_length a} -> b:multibuf (lanes a m) len -> fin:size_t{v fin == block_length a \/ v fin == 2 * block_length a} -> last:lbuffer uint8 (size (lanes a m) *! 2ul *! HD.block_len a) -> Stack (multibuf (lanes a m) (HD.block_len a) & multibuf (lanes a m) (HD.block_len a)) (requires fun h -> live h totlen_buf /\ live_multi h b /\ live h last /\ disjoint_multi b last /\ disjoint last totlen_buf /\ as_seq h last == LSeq.create (lanes a m * 2 * block_length a) (u8 0)) (ensures fun h0 (l0,l1) h1 -> modifies (loc last) h0 h1 /\ live_multi h1 l0 /\ live_multi h1 l1 /\ preserves_sub_disjoint_multi last l0 /\ preserves_sub_disjoint_multi last l1 /\ (as_seq_multi h1 l0, as_seq_multi h1 l1) == SpecVec.load_last #a #m (as_seq h0 totlen_buf) (v fin) (v len) (as_seq_multi h0 b)) inline_for_extraction noextract val load_last1: #a:sha2_alg -> #m:m_spec{lanes a m = 1} -> load_last_t a m #push-options "--z3rlimit 250" let load_last1 #a #m totlen_buf len b fin last = let h0 = ST.get() in let b0 = b.(|0|) in let (l0,l1) = load_last_blocks #a totlen_buf len b0 fin last in let lb0 : multibuf (lanes a m) (HD.block_len a) = ntup1 l0 in let lb1 : multibuf (lanes a m) (HD.block_len a) = ntup1 l1 in let h1 = ST.get() in assert (modifies (loc last) h0 h1); NTup.eq_intro (as_seq_multi h0 b) (ntup1 (as_seq h0 b0)); NTup.eq_intro (as_seq_multi h1 lb0) (ntup1 (as_seq h1 l0)); NTup.eq_intro (as_seq_multi h1 lb1) (ntup1 (as_seq h1 l1)); assert ((as_seq_multi h1 lb0, as_seq_multi h1 lb1) == SpecVec.load_last1 #a #m (as_seq h0 totlen_buf) (v fin) (v len) (as_seq_multi h0 b)); reveal_opaque (`%SpecVec.load_last) (SpecVec.load_last #a #m); (lb0,lb1) #pop-options inline_for_extraction noextract val load_last4: #a:sha2_alg -> #m:m_spec{lanes a m = 4} -> load_last_t a m #push-options "--z3rlimit 350" let load_last4 #a #m totlen_buf len b fin last = let h0 = ST.get() in let (b0,(b1,(b2,b3))) = NTup.tup4 b in let last0 = sub last 0ul (2ul *! HD.block_len a) in let last1 = sub last (2ul *! HD.block_len a) (2ul *! HD.block_len a) in let last2 = sub last (4ul *! HD.block_len a) (2ul *! HD.block_len a) in let last3 = sub last (6ul *! HD.block_len a) (2ul *! HD.block_len a) in let h1 = ST.get() in assert (disjoint last0 last1); LSeq.eq_intro (as_seq h1 last0) (LSeq.create (2 * block_length a) (u8 0)); LSeq.eq_intro (as_seq h1 last1) (LSeq.create (2 * block_length a) (u8 0)); LSeq.eq_intro (as_seq h1 last2) (LSeq.create (2 * block_length a) (u8 0)); LSeq.eq_intro (as_seq h1 last3) (LSeq.create (2 * block_length a) (u8 0)); let (l00,l01) = load_last_blocks #a totlen_buf len b0 fin last0 in let (l10,l11) = load_last_blocks #a totlen_buf len b1 fin last1 in let (l20,l21) = load_last_blocks #a totlen_buf len b2 fin last2 in let (l30,l31) = load_last_blocks #a totlen_buf len b3 fin last3 in let mb0:multibuf (lanes a m) (HD.block_len a) = ntup4 (l00, (l10, (l20, l30))) in let mb1:multibuf (lanes a m) (HD.block_len a) = ntup4 (l01, (l11, (l21, l31))) in let h1 = ST.get() in assert ((as_seq h1 l00, as_seq h1 l01) == SpecVec.load_last_blocks #a (as_seq h0 totlen_buf) (v fin) (v len) (as_seq h0 b0)); assert ((as_seq h1 l10, as_seq h1 l11) == SpecVec.load_last_blocks #a (as_seq h0 totlen_buf) (v fin) (v len) (as_seq h0 b1)); assert ((as_seq h1 l20, as_seq h1 l21) == SpecVec.load_last_blocks #a (as_seq h0 totlen_buf) (v fin) (v len) (as_seq h0 b2)); assert ((as_seq h1 l30, as_seq h1 l31) == SpecVec.load_last_blocks #a (as_seq h0 totlen_buf) (v fin) (v len) (as_seq h0 b3)); NTup.eq_intro (as_seq_multi h1 mb0) (ntup4 (as_seq h1 l00, (as_seq h1 l10, (as_seq h1 l20, (as_seq h1 l30))))); NTup.eq_intro (as_seq_multi h1 mb1) (ntup4 (as_seq h1 l01, (as_seq h1 l11, (as_seq h1 l21, (as_seq h1 l31))))); assert (modifies (loc last0 |+| loc last1 |+| loc last2 |+| loc last3) h0 h1); assert (modifies (loc last) h0 h1); assert (live_multi h1 mb0); assert (live_multi h1 mb1); reveal_opaque (`%SpecVec.load_last) (SpecVec.load_last #a #m); (mb0, mb1) #pop-options inline_for_extraction noextract val load_last8: #a:sha2_alg -> #m:m_spec{lanes a m = 8} -> load_last_t a m #push-options "--z3rlimit 600" let load_last8 #a #m totlen_buf len b fin last = let h0 = ST.get() in let (b0,(b1,(b2,(b3,(b4,(b5,(b6,b7))))))) = NTup.tup8 b in let last0 = sub last 0ul (2ul *! HD.block_len a) in let last1 = sub last (2ul *! HD.block_len a) (2ul *! HD.block_len a) in let last2 = sub last (4ul *! HD.block_len a) (2ul *! HD.block_len a) in let last3 = sub last (6ul *! HD.block_len a) (2ul *! HD.block_len a) in let last4 = sub last (8ul *! HD.block_len a) (2ul *! HD.block_len a) in let last5 = sub last (10ul *! HD.block_len a) (2ul *! HD.block_len a) in let last6 = sub last (12ul *! HD.block_len a) (2ul *! HD.block_len a) in let last7 = sub last (14ul *! HD.block_len a) (2ul *! HD.block_len a) in assert (internally_disjoint8 last0 last1 last2 last3 last4 last5 last6 last7); let h1 = ST.get() in assert (h0 == h1); LSeq.eq_intro (as_seq h1 last0) (LSeq.create (2 * block_length a) (u8 0)); LSeq.eq_intro (as_seq h1 last1) (LSeq.create (2 * block_length a) (u8 0)); LSeq.eq_intro (as_seq h1 last2) (LSeq.create (2 * block_length a) (u8 0)); LSeq.eq_intro (as_seq h1 last3) (LSeq.create (2 * block_length a) (u8 0)); LSeq.eq_intro (as_seq h1 last4) (LSeq.create (2 * block_length a) (u8 0)); LSeq.eq_intro (as_seq h1 last5) (LSeq.create (2 * block_length a) (u8 0)); LSeq.eq_intro (as_seq h1 last6) (LSeq.create (2 * block_length a) (u8 0)); LSeq.eq_intro (as_seq h1 last7) (LSeq.create (2 * block_length a) (u8 0)); let (l00,l01) = load_last_blocks #a totlen_buf len b0 fin last0 in let (l10,l11) = load_last_blocks #a totlen_buf len b1 fin last1 in let h2 = ST.get() in assert (modifies (loc last0 |+| loc last1) h0 h2); let (l20,l21) = load_last_blocks #a totlen_buf len b2 fin last2 in let (l30,l31) = load_last_blocks #a totlen_buf len b3 fin last3 in let h2 = ST.get() in assert (modifies (loc last0 |+| loc last1 |+| loc last2 |+| loc last3) h0 h2); let (l40,l41) = load_last_blocks #a totlen_buf len b4 fin last4 in let (l50,l51) = load_last_blocks #a totlen_buf len b5 fin last5 in let h2 = ST.get() in assert (modifies (loc last0 |+| loc last1 |+| loc last2 |+| loc last3 |+| loc last4 |+| loc last5) h0 h2); let (l60,l61) = load_last_blocks #a totlen_buf len b6 fin last6 in let (l70,l71) = load_last_blocks #a totlen_buf len b7 fin last7 in let h3 = ST.get() in assert (modifies (loc last0 |+| loc last1 |+| loc last2 |+| loc last3 |+| loc last4 |+| loc last5 |+| loc last6 |+| loc last7) h0 h3); assert (modifies (loc last) h0 h3); let mb0:multibuf (lanes a m) (HD.block_len a) = ntup8 (l00, (l10, (l20, (l30, (l40, (l50, (l60, l70))))))) in let mb1:multibuf (lanes a m) (HD.block_len a) = ntup8 (l01, (l11, (l21, (l31, (l41, (l51, (l61, l71))))))) in ntup8_lemma #_ #8 (l00, (l10, (l20, (l30, (l40, (l50, (l60, l70))))))); ntup8_lemma #_ #8 (l01, (l11, (l21, (l31, (l41, (l51, (l61, l71))))))); assert (live_multi h3 mb0); assert (live_multi h3 mb1); NTup.eq_intro (as_seq_multi h3 mb0) (ntup8 (as_seq h3 l00, (as_seq h3 l10, (as_seq h3 l20, (as_seq h3 l30, (as_seq h3 l40, (as_seq h3 l50, (as_seq h3 l60, (as_seq h3 l70))))))))); NTup.eq_intro (as_seq_multi h3 mb1) (ntup8 (as_seq h3 l01, (as_seq h3 l11, (as_seq h3 l21, (as_seq h3 l31, (as_seq h3 l41, (as_seq h3 l51, (as_seq h3 l61, (as_seq h3 l71))))))))); assert ((as_seq_multi h3 mb0, as_seq_multi h3 mb1) == SpecVec.load_last8 #a #m (as_seq h0 totlen_buf) (v fin) (v len) (as_seq_multi h0 b)); reveal_opaque (`%SpecVec.load_last) (SpecVec.load_last #a #m); (mb0, mb1) #pop-options inline_for_extraction noextract val load_last: #a:sha2_alg -> #m:m_spec{is_supported a m} -> load_last_t a m let load_last #a #m totlen_buf len b fin last = match lanes a m with | 1 -> load_last1 #a #m totlen_buf len b fin last | 4 -> load_last4 #a #m totlen_buf len b fin last | 8 -> load_last8 #a #m totlen_buf len b fin last inline_for_extraction noextract val transpose_state4: #a:sha2_alg -> #m:m_spec{lanes a m == 4} -> st:state_t a m -> Stack unit (requires fun h -> live h st) (ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\ as_seq h1 st == SpecVec.transpose_state4 (as_seq h0 st)) let transpose_state4 #a #m st = let (st0',st1',st2',st3') = VecTranspose.transpose4x4 (st.(0ul),st.(1ul),st.(2ul),st.(3ul)) in let (st4',st5',st6',st7') = VecTranspose.transpose4x4 (st.(4ul),st.(5ul),st.(6ul),st.(7ul)) in create8 st st0' st4' st1' st5' st2' st6' st3' st7' inline_for_extraction noextract val transpose_state8: #a:sha2_alg -> #m:m_spec{lanes a m == 8} -> st:state_t a m -> Stack unit (requires fun h -> live h st) (ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\ as_seq h1 st == SpecVec.transpose_state8 (as_seq h0 st)) let transpose_state8 #a #m st = let (st0',st1',st2',st3',st4',st5',st6',st7') = VecTranspose.transpose8x8 (st.(0ul),st.(1ul),st.(2ul),st.(3ul),st.(4ul),st.(5ul),st.(6ul),st.(7ul)) in create8 st st0' st1' st2' st3' st4' st5' st6' st7' inline_for_extraction noextract val transpose_state: #a:sha2_alg -> #m:m_spec{is_supported a m} -> st:state_t a m -> Stack unit (requires fun h -> live h st) (ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\ as_seq h1 st == SpecVec.transpose_state (as_seq h0 st)) let transpose_state #a #m st = match lanes a m with | 1 -> () | 4 -> transpose_state4 st | 8 -> transpose_state8 st inline_for_extraction noextract val store_state: #a:sha2_alg -> #m:m_spec{is_supported a m} -> st:state_t a m -> hbuf:lbuffer uint8 (size (lanes a m) *! 8ul *! HD.word_len a) -> Stack unit (requires fun h -> live h hbuf /\ live h st /\ disjoint hbuf st /\ as_seq h hbuf == LSeq.create (lanes a m * 8 * word_length a) (u8 0)) (ensures fun h0 _ h1 -> modifies (loc st |+| loc hbuf) h0 h1 /\ as_seq h1 hbuf == SpecVec.store_state #a #m (as_seq h0 st)) let store_state #a #m st hbuf = transpose_state st; Lib.IntVector.Serialize.vecs_store_be hbuf st noextract let emit1_spec (#a:sha2_alg) (#m:m_spec{lanes a m == 1}) (hseq:LSeq.lseq uint8 (lanes a m * 8 * word_length a)) : multiseq (lanes a m) (hash_length a) = let hsub = LSeq.sub hseq 0 (hash_length a) in ntup1 hsub noextract let emit1_lemma (#a:sha2_alg) (#m:m_spec{lanes a m == 1}) (hseq:LSeq.lseq uint8 (lanes a m * 8 * word_length a)) : Lemma (emit1_spec #a #m hseq == SpecVec.emit #a #m hseq) = Lib.NTuple.eq_intro (emit1_spec #a #m hseq) (SpecVec.emit #a #m hseq) inline_for_extraction noextract val emit1: #a:sha2_alg -> #m:m_spec{lanes a m = 1} -> hbuf:lbuffer uint8 (8ul *! HD.word_len a) -> result:multibuf (lanes a m) (HD.hash_len a) -> Stack unit (requires fun h -> live_multi h result /\ live h hbuf /\ internally_disjoint result /\ disjoint_multi result hbuf) (ensures fun h0 _ h1 -> modifies_multi result h0 h1 /\ as_seq_multi h1 result == SpecVec.emit #a #m (as_seq h0 hbuf)) let emit1 #a #m hbuf result = let h0 = ST.get() in copy result.(|0|) (sub hbuf 0ul (HD.hash_len a)); let h1 = ST.get() in Lib.NTuple.eq_intro (as_seq_multi h1 result) (emit1_spec #a #m (as_seq h0 hbuf)); emit1_lemma #a #m (as_seq h0 hbuf); assert (modifies_multi result h0 h1) noextract let emit4_spec (#a:sha2_alg) (#m:m_spec{lanes a m == 4}) (hseq:LSeq.lseq uint8 (lanes a m * 8 * word_length a)) : multiseq (lanes a m) (hash_length a) = let open Lib.Sequence in let h0 = sub hseq 0 (hash_length a) in let h1 = sub hseq (8 * word_length a) (hash_length a) in let h2 = sub hseq (16 * word_length a) (hash_length a) in let h3 = sub hseq (24 * word_length a) (hash_length a) in let hsub : multiseq 4 (hash_length a) = ntup4 (h0,(h1,(h2,h3))) in hsub noextract let emit4_lemma (#a:sha2_alg) (#m:m_spec{lanes a m == 4}) (hseq:LSeq.lseq uint8 (lanes a m * 8 * word_length a)) : Lemma (emit4_spec #a #m hseq == SpecVec.emit #a #m hseq) = Lib.NTuple.eq_intro (emit4_spec #a #m hseq) (SpecVec.emit #a #m hseq) inline_for_extraction noextract val emit4: #a:sha2_alg -> #m:m_spec{lanes a m = 4} -> hbuf: lbuffer uint8 (size (lanes a m) *! 8ul *! HD.word_len a) -> result:multibuf (lanes a m) (HD.hash_len a) -> Stack unit (requires fun h -> live_multi h result /\ live h hbuf /\ internally_disjoint result /\ disjoint_multi result hbuf) (ensures fun h0 _ h1 -> modifies_multi result h0 h1 /\ as_seq_multi h1 result == SpecVec.emit #a #m (as_seq h0 hbuf)) #push-options "--z3rlimit 200" let emit4 #a #m hbuf result = let h0 = ST.get() in let (b0,(b1,(b2,b3))) = NTup.tup4 result in assert (disjoint b0 b1); assert (disjoint b0 b2); assert (disjoint b0 b3); assert (disjoint b1 b2); assert (disjoint b1 b3); assert (disjoint b2 b3); copy b0 (sub hbuf 0ul (HD.hash_len a)); copy b1 (sub hbuf (8ul *! HD.word_len a) (HD.hash_len a)); copy b2 (sub hbuf (16ul *! HD.word_len a) (HD.hash_len a)); copy b3 (sub hbuf (24ul *! HD.word_len a) (HD.hash_len a)); let h1 = ST.get() in assert (as_seq h1 b0 == LSeq.sub (as_seq h0 hbuf) 0 (hash_length a)); assert (as_seq h1 b1 == LSeq.sub (as_seq h0 hbuf) (8 * word_length a) (hash_length a)); assert (as_seq h1 b2 == LSeq.sub (as_seq h0 hbuf) (16 * word_length a) (hash_length a)); assert (as_seq h1 b3 == LSeq.sub (as_seq h0 hbuf) (24 * word_length a) (hash_length a)); NTup.eq_intro (as_seq_multi h1 result) (NTup.ntup4 (as_seq h1 b0, (as_seq h1 b1, (as_seq h1 b2, as_seq h1 b3)))); assert (modifies (loc b0 |+| loc b1 |+| loc b2 |+| loc b3) h0 h1); assert (as_seq_multi h1 result == emit4_spec #a #m (as_seq h0 hbuf)); emit4_lemma #a #m (as_seq h0 hbuf); loc_multi4 result; assert (modifies_multi result h0 h1); () #pop-options noextract let emit8_spec (#a:sha2_alg) (#m:m_spec{lanes a m == 8}) (hseq:LSeq.lseq uint8 (lanes a m * 8 * word_length a)) : multiseq (lanes a m) (hash_length a) = let open Lib.Sequence in let h0 = sub hseq 0 (hash_length a) in let h1 = sub hseq (8 * word_length a) (hash_length a) in let h2 = sub hseq (16 * word_length a) (hash_length a) in let h3 = sub hseq (24 * word_length a) (hash_length a) in let h4 = sub hseq (32 * word_length a) (hash_length a) in let h5 = sub hseq (40 * word_length a) (hash_length a) in let h6 = sub hseq (48 * word_length a) (hash_length a) in let h7 = sub hseq (56 * word_length a) (hash_length a) in let hsub : multiseq 8 (hash_length a) = ntup8 (h0,(h1,(h2,(h3,(h4,(h5,(h6,h7))))))) in hsub noextract let emit8_lemma (#a:sha2_alg) (#m:m_spec{lanes a m == 8}) (hseq:LSeq.lseq uint8 (lanes a m * 8 * word_length a)) : Lemma (emit8_spec #a #m hseq == SpecVec.emit #a #m hseq) = Lib.NTuple.eq_intro (emit8_spec #a #m hseq) (SpecVec.emit #a #m hseq) inline_for_extraction noextract val emit8: #a:sha2_alg -> #m:m_spec{lanes a m = 8} -> hbuf: lbuffer uint8 (size (lanes a m) *! 8ul *! HD.word_len a) -> result:multibuf (lanes a m) (HD.hash_len a) -> Stack unit (requires fun h -> live_multi h result /\ live h hbuf /\ internally_disjoint result /\ disjoint_multi result hbuf) (ensures fun h0 _ h1 -> modifies_multi result h0 h1 /\ as_seq_multi h1 result == SpecVec.emit #a #m (as_seq h0 hbuf)) #push-options "--z3rlimit 700" let emit8 #a #m hbuf result = let h0 = ST.get() in let (b0,(b1,(b2,(b3,(b4,(b5,(b6,b7))))))) = NTup.tup8 result in assert (internally_disjoint8 b0 b1 b2 b3 b4 b5 b6 b7); copy b0 (sub hbuf 0ul (HD.hash_len a)); copy b1 (sub hbuf (8ul *! HD.word_len a) (HD.hash_len a)); copy b2 (sub hbuf (16ul *! HD.word_len a) (HD.hash_len a)); copy b3 (sub hbuf (24ul *! HD.word_len a) (HD.hash_len a)); let h1 = ST.get() in assert (modifies (loc b0 |+| loc b1 |+| loc b2 |+| loc b3) h0 h1); copy b4 (sub hbuf (32ul *! HD.word_len a) (HD.hash_len a)); copy b5 (sub hbuf (40ul *! HD.word_len a) (HD.hash_len a)); copy b6 (sub hbuf (48ul *! HD.word_len a) (HD.hash_len a)); copy b7 (sub hbuf (56ul *! HD.word_len a) (HD.hash_len a)); let h1 = ST.get() in assert (as_seq h1 b0 == LSeq.sub (as_seq h0 hbuf) 0 (hash_length a)); assert (as_seq h1 b1 == LSeq.sub (as_seq h0 hbuf) (8 * word_length a) (hash_length a)); assert (as_seq h1 b2 == LSeq.sub (as_seq h0 hbuf) (16 * word_length a) (hash_length a)); assert (as_seq h1 b3 == LSeq.sub (as_seq h0 hbuf) (24 * word_length a) (hash_length a)); assert (as_seq h1 b4 == LSeq.sub (as_seq h0 hbuf) (32 * word_length a) (hash_length a)); assert (as_seq h1 b5 == LSeq.sub (as_seq h0 hbuf) (40 * word_length a) (hash_length a)); assert (as_seq h1 b6 == LSeq.sub (as_seq h0 hbuf) (48 * word_length a) (hash_length a)); assert (as_seq h1 b7 == LSeq.sub (as_seq h0 hbuf) (56 * word_length a) (hash_length a)); NTup.eq_intro (as_seq_multi h1 result) (NTup.ntup8 (as_seq h1 b0, (as_seq h1 b1, (as_seq h1 b2, (as_seq h1 b3, (as_seq h1 b4, (as_seq h1 b5, (as_seq h1 b6, as_seq h1 b7)))))))); assert (modifies (loc b0 |+| loc b1 |+| loc b2 |+| loc b3 |+| loc b4 |+| loc b5 |+| loc b6 |+| loc b7) h0 h1); assert (as_seq_multi h1 result == emit8_spec #a #m (as_seq h0 hbuf)); emit8_lemma #a #m (as_seq h0 hbuf); loc_multi8 result; assert (modifies_multi result h0 h1); () #pop-options inline_for_extraction noextract val emit: #a:sha2_alg -> #m:m_spec{is_supported a m} -> hbuf: lbuffer uint8 (size (lanes a m) *! 8ul *! HD.word_len a) -> result:multibuf (lanes a m) (HD.hash_len a) -> Stack unit (requires fun h -> live_multi h result /\ live h hbuf /\ internally_disjoint result /\ disjoint_multi result hbuf) (ensures fun h0 _ h1 -> modifies_multi result h0 h1 /\ as_seq_multi h1 result == SpecVec.emit #a #m (as_seq h0 hbuf)) let emit #a #m hbuf result = match lanes a m with | 1 -> emit1 #a #m hbuf result | 4 -> emit4 #a #m hbuf result | 8 -> emit8 #a #m hbuf result
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NTuple.fsti.checked", "Lib.MultiBuffer.fst.checked", "Lib.IntVector.Transpose.fsti.checked", "Lib.IntVector.Serialize.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.SHA2.Vec.fst.checked", "Hacl.Impl.SHA2.Types.fst.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.UInt32.fsti.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.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA2.Core.fst" }
[ { "abbrev": true, "full_module": "Hacl.Hash.Definitions", "short_module": "HD" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "Lib.IntVector.Transpose", "short_module": "VecTranspose" }, { "abbrev": true, "full_module": "Hacl.Spec.SHA2.Vec", "short_module": "SpecVec" }, { "abbrev": true, "full_module": "Lib.NTuple", "short_module": "NTup" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Spec.SHA2.Vec", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.MultiBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.NTuple", "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.SHA2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
b: Lib.MultiBuffer.multibuf lanes len -> r: Lib.MultiBuffer.multibuf lanes len' -> Prims.logical
Prims.Tot
[ "total" ]
[]
[ "Lib.NTuple.flen", "Lib.IntTypes.size_t", "Lib.MultiBuffer.multibuf", "Prims.l_Forall", "Lib.Buffer.lbuffer", "Prims.l_imp", "Lib.MultiBuffer.disjoint_multi", "Prims.logical" ]
[]
false
false
false
false
true
let preserves_disjoint_multi #lanes #len #len' (b: multibuf lanes len) (r: multibuf lanes len') =
(forall a l (x: lbuffer a l). disjoint_multi b x ==> disjoint_multi r x)
false
FStar.Tactics.Visit.fst
FStar.Tactics.Visit.on_sort_simple_binder
val on_sort_simple_binder (f: (term -> Tac term)) (b: simple_binder) : Tac simple_binder
val on_sort_simple_binder (f: (term -> Tac term)) (b: simple_binder) : Tac simple_binder
let on_sort_simple_binder (f : term -> Tac term) (b:simple_binder) : Tac simple_binder = let bview = inspect_binder b in let bview = { bview with sort = f bview.sort } in inspect_pack_binder bview; pack_binder bview
{ "file_name": "ulib/FStar.Tactics.Visit.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 19, "end_line": 34, "start_col": 0, "start_line": 30 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Tactics.Visit (* Visit a term and transform it step by step. *) open FStar.Reflection.V2 open FStar.Tactics.Effect open FStar.Tactics.Util let on_sort_binder (f : term -> Tac term) (b:binder) : Tac binder = let bview = inspect_binder b in let bview = { bview with sort = f bview.sort } in pack_binder bview
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Tactics.Util.fst.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.Tactics.Visit.fst" }
[ { "abbrev": false, "full_module": "FStar.Tactics.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics.Effect", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "FStar.Tactics", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
f: (_: FStar.Stubs.Reflection.Types.term -> FStar.Tactics.Effect.Tac FStar.Stubs.Reflection.Types.term) -> b: FStar.Stubs.Reflection.V2.Data.simple_binder -> FStar.Tactics.Effect.Tac FStar.Stubs.Reflection.V2.Data.simple_binder
FStar.Tactics.Effect.Tac
[]
[]
[ "FStar.Stubs.Reflection.Types.term", "FStar.Stubs.Reflection.V2.Data.simple_binder", "FStar.Stubs.Reflection.V2.Builtins.pack_binder", "Prims.unit", "FStar.Stubs.Reflection.V2.Builtins.inspect_pack_binder", "FStar.Stubs.Reflection.V2.Data.binder_view", "FStar.Stubs.Reflection.V2.Data.Mkbinder_view", "FStar.Stubs.Reflection.V2.Data.__proj__Mkbinder_view__item__qual", "FStar.Stubs.Reflection.V2.Data.__proj__Mkbinder_view__item__attrs", "FStar.Stubs.Reflection.V2.Data.__proj__Mkbinder_view__item__ppname", "FStar.Stubs.Reflection.Types.typ", "FStar.Stubs.Reflection.V2.Data.__proj__Mkbinder_view__item__sort", "Prims.precedes", "FStar.Stubs.Reflection.Types.binder", "FStar.Stubs.Reflection.V2.Builtins.inspect_binder" ]
[]
false
true
false
false
false
let on_sort_simple_binder (f: (term -> Tac term)) (b: simple_binder) : Tac simple_binder =
let bview = inspect_binder b in let bview = { bview with sort = f bview.sort } in inspect_pack_binder bview; pack_binder bview
false
Hacl.Impl.SHA2.Core.fst
Hacl.Impl.SHA2.Core.transpose_ws
val transpose_ws: #a:sha2_alg -> #m:m_spec{is_supported a m} -> ws:ws_t a m -> Stack unit (requires fun h -> live h ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.transpose_ws (as_seq h0 ws))
val transpose_ws: #a:sha2_alg -> #m:m_spec{is_supported a m} -> ws:ws_t a m -> Stack unit (requires fun h -> live h ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.transpose_ws (as_seq h0 ws))
let transpose_ws #a #m ws = match lanes a m with | 1 -> () | 4 -> transpose_ws4 ws | 8 -> transpose_ws8 ws
{ "file_name": "code/sha2-mb/Hacl.Impl.SHA2.Core.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 25, "end_line": 336, "start_col": 0, "start_line": 332 }
module Hacl.Impl.SHA2.Core open FStar.Mul open FStar.HyperStack open FStar.HyperStack.All open Lib.IntTypes open Lib.NTuple open Lib.Buffer open Lib.IntVector open Lib.MultiBuffer open Spec.Hash.Definitions //open Hacl.Hash.Definitions // <- defines as_seq which clashes with Lib.Buffer.as_seq open Hacl.Spec.SHA2.Vec module ST = FStar.HyperStack.ST module NTup = Lib.NTuple module SpecVec = Hacl.Spec.SHA2.Vec module VecTranspose = Lib.IntVector.Transpose module LSeq = Lib.Sequence module HD = Hacl.Hash.Definitions (* Force ordering in dependency analysis so that monomorphizations are inserted into the Types module first. *) let _ = Hacl.Impl.SHA2.Types.uint8_8p #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 50" unfold let state_t (a:sha2_alg) (m:m_spec) = lbuffer (element_t a m) 8ul unfold let block_t (a:sha2_alg) = lbuffer uint8 (HD.block_len a) inline_for_extraction noextract let ws_t (a:sha2_alg) (m:m_spec) = lbuffer (element_t a m) 16ul inline_for_extraction noextract val set_wsi: #a:sha2_alg -> #m:m_spec -> ws:ws_t a m -> i:size_t{v i < 16} -> b:lbuffer uint8 (HD.block_len a) -> bi:size_t{v bi < 16 / (lanes a m)} -> Stack unit (requires fun h -> live h b /\ live h ws /\ disjoint b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == LSeq.upd (as_seq h0 ws) (v i) (SpecVec.load_elementi #a #m (as_seq h0 b) (v bi))) let set_wsi #a #m ws i b bi = [@inline_let] let l = lanes a m in ws.(i) <- vec_load_be (word_t a) l (sub b (bi *! size l *! HD.word_len a) (size l *! HD.word_len a)) noextract let load_blocks_spec1 (#a:sha2_alg) (#m:m_spec{lanes a m == 1}) (b:multiblock_spec a m) : ws_spec a m = let b = b.(|0|) in let ws0 = SpecVec.load_elementi b 0 in let ws1 = SpecVec.load_elementi b 1 in let ws2 = SpecVec.load_elementi b 2 in let ws3 = SpecVec.load_elementi b 3 in let ws4 = SpecVec.load_elementi b 4 in let ws5 = SpecVec.load_elementi b 5 in let ws6 = SpecVec.load_elementi b 6 in let ws7 = SpecVec.load_elementi b 7 in let ws8 = SpecVec.load_elementi b 8 in let ws9 = SpecVec.load_elementi b 9 in let ws10 = SpecVec.load_elementi b 10 in let ws11 = SpecVec.load_elementi b 11 in let ws12 = SpecVec.load_elementi b 12 in let ws13 = SpecVec.load_elementi b 13 in let ws14 = SpecVec.load_elementi b 14 in let ws15 = SpecVec.load_elementi b 15 in LSeq.create16 ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15 noextract let load_blocks_spec1_lemma (#a:sha2_alg) (#m:m_spec{lanes a m == 1}) (b:multiblock_spec a m) : Lemma (SpecVec.load_blocks b == load_blocks_spec1 b) = LSeq.eq_intro (SpecVec.load_blocks b) (load_blocks_spec1 b) #push-options "--z3rlimit 100" inline_for_extraction noextract val load_blocks1: #a:sha2_alg -> #m:m_spec{lanes a m == 1} -> b:multibuf (lanes a m) (HD.block_len a) -> ws:ws_t a m -> Stack unit (requires fun h -> live_multi h b /\ live h ws /\ disjoint_multi b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 b)) let load_blocks1 #a #m ib ws = let h0 = ST.get() in let b = ib.(|0|) in set_wsi ws 0ul b 0ul; set_wsi ws 1ul b 1ul; set_wsi ws 2ul b 2ul; set_wsi ws 3ul b 3ul; set_wsi ws 4ul b 4ul; set_wsi ws 5ul b 5ul; set_wsi ws 6ul b 6ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); set_wsi ws 7ul b 7ul; set_wsi ws 8ul b 8ul; set_wsi ws 9ul b 9ul; set_wsi ws 10ul b 10ul; set_wsi ws 11ul b 11ul; set_wsi ws 12ul b 12ul; set_wsi ws 13ul b 13ul; set_wsi ws 14ul b 14ul; set_wsi ws 15ul b 15ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); LSeq.eq_intro (as_seq h1 ws) (load_blocks_spec1 (as_seq_multi h0 ib)); load_blocks_spec1_lemma #a #m (as_seq_multi h0 ib); assert (as_seq h1 ws == load_blocks_spec1 (as_seq_multi h0 ib)); assert (as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 ib)) #pop-options noextract let load_blocks_spec4 (#a:sha2_alg) (#m:m_spec{lanes a m == 4}) (b:multiblock_spec a m) : ws_spec a m = let b0 = b.(|0|) in let b1 = b.(|1|) in let b2 = b.(|2|) in let b3 = b.(|3|) in let ws0 = SpecVec.load_elementi b0 0 in let ws1 = SpecVec.load_elementi b1 0 in let ws2 = SpecVec.load_elementi b2 0 in let ws3 = SpecVec.load_elementi b3 0 in let ws4 = SpecVec.load_elementi b0 1 in let ws5 = SpecVec.load_elementi b1 1 in let ws6 = SpecVec.load_elementi b2 1 in let ws7 = SpecVec.load_elementi b3 1 in let ws8 = SpecVec.load_elementi b0 2 in let ws9 = SpecVec.load_elementi b1 2 in let ws10 = SpecVec.load_elementi b2 2 in let ws11 = SpecVec.load_elementi b3 2 in let ws12 = SpecVec.load_elementi b0 3 in let ws13 = SpecVec.load_elementi b1 3 in let ws14 = SpecVec.load_elementi b2 3 in let ws15 = SpecVec.load_elementi b3 3 in LSeq.create16 ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15 noextract let load_blocks_spec4_lemma (#a:sha2_alg) (#m:m_spec{lanes a m == 4}) (b:multiblock_spec a m) : Lemma (SpecVec.load_blocks b == load_blocks_spec4 b) = LSeq.eq_intro (SpecVec.load_blocks b) (load_blocks_spec4 b) inline_for_extraction noextract val load_blocks4: #a:sha2_alg -> #m:m_spec{lanes a m == 4} -> b:multibuf (lanes a m) (HD.block_len a) -> ws:ws_t a m -> Stack unit (requires fun h -> live_multi h b /\ live h ws /\ disjoint_multi b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 b)) #push-options "--z3rlimit 150" let load_blocks4 #a #m ib ws = let h0 = ST.get() in let (b0,(b1,(b2,b3))) = NTup.tup4 ib in set_wsi ws 0ul b0 0ul; set_wsi ws 1ul b1 0ul; set_wsi ws 2ul b2 0ul; set_wsi ws 3ul b3 0ul; set_wsi ws 4ul b0 1ul; set_wsi ws 5ul b1 1ul; set_wsi ws 6ul b2 1ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); set_wsi ws 7ul b3 1ul; set_wsi ws 8ul b0 2ul; set_wsi ws 9ul b1 2ul; set_wsi ws 10ul b2 2ul; set_wsi ws 11ul b3 2ul; set_wsi ws 12ul b0 3ul; set_wsi ws 13ul b1 3ul; set_wsi ws 14ul b2 3ul; set_wsi ws 15ul b3 3ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); LSeq.eq_intro (as_seq h1 ws) (load_blocks_spec4 (as_seq_multi h0 ib)); load_blocks_spec4_lemma #a #m (as_seq_multi h0 ib); assert (as_seq h1 ws == load_blocks_spec4 (as_seq_multi h0 ib)); assert (as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 ib)); () #pop-options noextract let load_blocks_spec8 (#a:sha2_alg) (#m:m_spec{lanes a m == 8}) (b:multiblock_spec a m) : ws_spec a m = let b0 = b.(|0|) in let b1 = b.(|1|) in let b2 = b.(|2|) in let b3 = b.(|3|) in let b4 = b.(|4|) in let b5 = b.(|5|) in let b6 = b.(|6|) in let b7 = b.(|7|) in let ws0 = SpecVec.load_elementi b0 0 in let ws1 = SpecVec.load_elementi b1 0 in let ws2 = SpecVec.load_elementi b2 0 in let ws3 = SpecVec.load_elementi b3 0 in let ws4 = SpecVec.load_elementi b4 0 in let ws5 = SpecVec.load_elementi b5 0 in let ws6 = SpecVec.load_elementi b6 0 in let ws7 = SpecVec.load_elementi b7 0 in let ws8 = SpecVec.load_elementi b0 1 in let ws9 = SpecVec.load_elementi b1 1 in let ws10 = SpecVec.load_elementi b2 1 in let ws11 = SpecVec.load_elementi b3 1 in let ws12 = SpecVec.load_elementi b4 1 in let ws13 = SpecVec.load_elementi b5 1 in let ws14 = SpecVec.load_elementi b6 1 in let ws15 = SpecVec.load_elementi b7 1 in LSeq.create16 ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15 noextract let load_blocks_spec8_lemma (#a:sha2_alg) (#m:m_spec{lanes a m == 8}) (b:multiblock_spec a m) : Lemma (SpecVec.load_blocks b == load_blocks_spec8 b) = LSeq.eq_intro (SpecVec.load_blocks b) (load_blocks_spec8 b) inline_for_extraction noextract val load_blocks8: #a:sha2_alg -> #m:m_spec{lanes a m == 8} -> b:multibuf (lanes a m) (HD.block_len a) -> ws:ws_t a m -> Stack unit (requires fun h -> live_multi h b /\ live h ws /\ disjoint_multi b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 b)) #push-options "--z3rlimit 150" let load_blocks8 #a #m ib ws = let h0 = ST.get() in let (b0,(b1,(b2,(b3,(b4,(b5,(b6,b7))))))) = NTup.tup8 ib in set_wsi ws 0ul b0 0ul; set_wsi ws 1ul b1 0ul; set_wsi ws 2ul b2 0ul; set_wsi ws 3ul b3 0ul; set_wsi ws 4ul b4 0ul; set_wsi ws 5ul b5 0ul; set_wsi ws 6ul b6 0ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); set_wsi ws 7ul b7 0ul; set_wsi ws 8ul b0 1ul; set_wsi ws 9ul b1 1ul; set_wsi ws 10ul b2 1ul; set_wsi ws 11ul b3 1ul; set_wsi ws 12ul b4 1ul; set_wsi ws 13ul b5 1ul; set_wsi ws 14ul b6 1ul; set_wsi ws 15ul b7 1ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); LSeq.eq_intro (as_seq h1 ws) (load_blocks_spec8 (as_seq_multi h0 ib)); load_blocks_spec8_lemma #a #m (as_seq_multi h0 ib); assert (as_seq h1 ws == load_blocks_spec8 (as_seq_multi h0 ib)); assert (as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 ib)); () #pop-options inline_for_extraction noextract val load_blocks: #a:sha2_alg -> #m:m_spec{is_supported a m} -> b:multibuf (lanes a m) (HD.block_len a) -> ws:ws_t a m -> Stack unit (requires fun h -> live_multi h b /\ live h ws /\ disjoint_multi b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 b)) let load_blocks #a #m b ws = match lanes a m with | 1 -> load_blocks1 b ws | 4 -> load_blocks4 b ws | 8 -> load_blocks8 b ws inline_for_extraction noextract val transpose_ws4: #a:sha2_alg -> #m:m_spec{lanes a m == 4} -> ws:ws_t a m -> Stack unit (requires fun h -> live h ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.transpose_ws (as_seq h0 ws)) let transpose_ws4 #a #m ws = let (ws0,ws1,ws2,ws3) = VecTranspose.transpose4x4 (ws.(0ul),ws.(1ul),ws.(2ul),ws.(3ul)) in let (ws4,ws5,ws6,ws7) = VecTranspose.transpose4x4 (ws.(4ul),ws.(5ul),ws.(6ul),ws.(7ul)) in let (ws8,ws9,ws10,ws11) = VecTranspose.transpose4x4 (ws.(8ul),ws.(9ul),ws.(10ul),ws.(11ul)) in let (ws12,ws13,ws14,ws15) = VecTranspose.transpose4x4 (ws.(12ul),ws.(13ul),ws.(14ul),ws.(15ul)) in create16 ws ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15 inline_for_extraction noextract val transpose_ws8: #a:sha2_alg -> #m:m_spec{lanes a m == 8} -> ws:ws_t a m -> Stack unit (requires fun h -> live h ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.transpose_ws (as_seq h0 ws)) let transpose_ws8 #a #m ws = let (ws0,ws1,ws2,ws3,ws4,ws5,ws6,ws7) = VecTranspose.transpose8x8 (ws.(0ul),ws.(1ul),ws.(2ul),ws.(3ul),ws.(4ul),ws.(5ul),ws.(6ul),ws.(7ul)) in let (ws8,ws9,ws10,ws11,ws12,ws13,ws14,ws15) = VecTranspose.transpose8x8 (ws.(8ul),ws.(9ul),ws.(10ul),ws.(11ul),ws.(12ul),ws.(13ul),ws.(14ul),ws.(15ul)) in create16 ws ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15 inline_for_extraction noextract val transpose_ws: #a:sha2_alg -> #m:m_spec{is_supported a m} -> ws:ws_t a m -> Stack unit (requires fun h -> live h ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.transpose_ws (as_seq h0 ws))
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NTuple.fsti.checked", "Lib.MultiBuffer.fst.checked", "Lib.IntVector.Transpose.fsti.checked", "Lib.IntVector.Serialize.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.SHA2.Vec.fst.checked", "Hacl.Impl.SHA2.Types.fst.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.UInt32.fsti.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.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA2.Core.fst" }
[ { "abbrev": true, "full_module": "Hacl.Hash.Definitions", "short_module": "HD" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "Lib.IntVector.Transpose", "short_module": "VecTranspose" }, { "abbrev": true, "full_module": "Hacl.Spec.SHA2.Vec", "short_module": "SpecVec" }, { "abbrev": true, "full_module": "Lib.NTuple", "short_module": "NTup" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Spec.SHA2.Vec", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.MultiBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.NTuple", "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.SHA2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
ws: Hacl.Impl.SHA2.Core.ws_t a m -> FStar.HyperStack.ST.Stack Prims.unit
FStar.HyperStack.ST.Stack
[]
[]
[ "Spec.Hash.Definitions.sha2_alg", "Hacl.Spec.SHA2.Vec.m_spec", "Hacl.Spec.SHA2.Vec.is_supported", "Hacl.Impl.SHA2.Core.ws_t", "Hacl.Spec.SHA2.Vec.lanes", "Prims.unit", "Hacl.Impl.SHA2.Core.transpose_ws4", "Hacl.Impl.SHA2.Core.transpose_ws8" ]
[]
false
true
false
false
false
let transpose_ws #a #m ws =
match lanes a m with | 1 -> () | 4 -> transpose_ws4 ws | 8 -> transpose_ws8 ws
false
Hacl.Impl.SHA2.Core.fst
Hacl.Impl.SHA2.Core.load_blocks_spec8_lemma
val load_blocks_spec8_lemma (#a: sha2_alg) (#m: m_spec{lanes a m == 8}) (b: multiblock_spec a m) : Lemma (SpecVec.load_blocks b == load_blocks_spec8 b)
val load_blocks_spec8_lemma (#a: sha2_alg) (#m: m_spec{lanes a m == 8}) (b: multiblock_spec a m) : Lemma (SpecVec.load_blocks b == load_blocks_spec8 b)
let load_blocks_spec8_lemma (#a:sha2_alg) (#m:m_spec{lanes a m == 8}) (b:multiblock_spec a m) : Lemma (SpecVec.load_blocks b == load_blocks_spec8 b) = LSeq.eq_intro (SpecVec.load_blocks b) (load_blocks_spec8 b)
{ "file_name": "code/sha2-mb/Hacl.Impl.SHA2.Core.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 61, "end_line": 237, "start_col": 0, "start_line": 234 }
module Hacl.Impl.SHA2.Core open FStar.Mul open FStar.HyperStack open FStar.HyperStack.All open Lib.IntTypes open Lib.NTuple open Lib.Buffer open Lib.IntVector open Lib.MultiBuffer open Spec.Hash.Definitions //open Hacl.Hash.Definitions // <- defines as_seq which clashes with Lib.Buffer.as_seq open Hacl.Spec.SHA2.Vec module ST = FStar.HyperStack.ST module NTup = Lib.NTuple module SpecVec = Hacl.Spec.SHA2.Vec module VecTranspose = Lib.IntVector.Transpose module LSeq = Lib.Sequence module HD = Hacl.Hash.Definitions (* Force ordering in dependency analysis so that monomorphizations are inserted into the Types module first. *) let _ = Hacl.Impl.SHA2.Types.uint8_8p #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 50" unfold let state_t (a:sha2_alg) (m:m_spec) = lbuffer (element_t a m) 8ul unfold let block_t (a:sha2_alg) = lbuffer uint8 (HD.block_len a) inline_for_extraction noextract let ws_t (a:sha2_alg) (m:m_spec) = lbuffer (element_t a m) 16ul inline_for_extraction noextract val set_wsi: #a:sha2_alg -> #m:m_spec -> ws:ws_t a m -> i:size_t{v i < 16} -> b:lbuffer uint8 (HD.block_len a) -> bi:size_t{v bi < 16 / (lanes a m)} -> Stack unit (requires fun h -> live h b /\ live h ws /\ disjoint b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == LSeq.upd (as_seq h0 ws) (v i) (SpecVec.load_elementi #a #m (as_seq h0 b) (v bi))) let set_wsi #a #m ws i b bi = [@inline_let] let l = lanes a m in ws.(i) <- vec_load_be (word_t a) l (sub b (bi *! size l *! HD.word_len a) (size l *! HD.word_len a)) noextract let load_blocks_spec1 (#a:sha2_alg) (#m:m_spec{lanes a m == 1}) (b:multiblock_spec a m) : ws_spec a m = let b = b.(|0|) in let ws0 = SpecVec.load_elementi b 0 in let ws1 = SpecVec.load_elementi b 1 in let ws2 = SpecVec.load_elementi b 2 in let ws3 = SpecVec.load_elementi b 3 in let ws4 = SpecVec.load_elementi b 4 in let ws5 = SpecVec.load_elementi b 5 in let ws6 = SpecVec.load_elementi b 6 in let ws7 = SpecVec.load_elementi b 7 in let ws8 = SpecVec.load_elementi b 8 in let ws9 = SpecVec.load_elementi b 9 in let ws10 = SpecVec.load_elementi b 10 in let ws11 = SpecVec.load_elementi b 11 in let ws12 = SpecVec.load_elementi b 12 in let ws13 = SpecVec.load_elementi b 13 in let ws14 = SpecVec.load_elementi b 14 in let ws15 = SpecVec.load_elementi b 15 in LSeq.create16 ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15 noextract let load_blocks_spec1_lemma (#a:sha2_alg) (#m:m_spec{lanes a m == 1}) (b:multiblock_spec a m) : Lemma (SpecVec.load_blocks b == load_blocks_spec1 b) = LSeq.eq_intro (SpecVec.load_blocks b) (load_blocks_spec1 b) #push-options "--z3rlimit 100" inline_for_extraction noextract val load_blocks1: #a:sha2_alg -> #m:m_spec{lanes a m == 1} -> b:multibuf (lanes a m) (HD.block_len a) -> ws:ws_t a m -> Stack unit (requires fun h -> live_multi h b /\ live h ws /\ disjoint_multi b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 b)) let load_blocks1 #a #m ib ws = let h0 = ST.get() in let b = ib.(|0|) in set_wsi ws 0ul b 0ul; set_wsi ws 1ul b 1ul; set_wsi ws 2ul b 2ul; set_wsi ws 3ul b 3ul; set_wsi ws 4ul b 4ul; set_wsi ws 5ul b 5ul; set_wsi ws 6ul b 6ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); set_wsi ws 7ul b 7ul; set_wsi ws 8ul b 8ul; set_wsi ws 9ul b 9ul; set_wsi ws 10ul b 10ul; set_wsi ws 11ul b 11ul; set_wsi ws 12ul b 12ul; set_wsi ws 13ul b 13ul; set_wsi ws 14ul b 14ul; set_wsi ws 15ul b 15ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); LSeq.eq_intro (as_seq h1 ws) (load_blocks_spec1 (as_seq_multi h0 ib)); load_blocks_spec1_lemma #a #m (as_seq_multi h0 ib); assert (as_seq h1 ws == load_blocks_spec1 (as_seq_multi h0 ib)); assert (as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 ib)) #pop-options noextract let load_blocks_spec4 (#a:sha2_alg) (#m:m_spec{lanes a m == 4}) (b:multiblock_spec a m) : ws_spec a m = let b0 = b.(|0|) in let b1 = b.(|1|) in let b2 = b.(|2|) in let b3 = b.(|3|) in let ws0 = SpecVec.load_elementi b0 0 in let ws1 = SpecVec.load_elementi b1 0 in let ws2 = SpecVec.load_elementi b2 0 in let ws3 = SpecVec.load_elementi b3 0 in let ws4 = SpecVec.load_elementi b0 1 in let ws5 = SpecVec.load_elementi b1 1 in let ws6 = SpecVec.load_elementi b2 1 in let ws7 = SpecVec.load_elementi b3 1 in let ws8 = SpecVec.load_elementi b0 2 in let ws9 = SpecVec.load_elementi b1 2 in let ws10 = SpecVec.load_elementi b2 2 in let ws11 = SpecVec.load_elementi b3 2 in let ws12 = SpecVec.load_elementi b0 3 in let ws13 = SpecVec.load_elementi b1 3 in let ws14 = SpecVec.load_elementi b2 3 in let ws15 = SpecVec.load_elementi b3 3 in LSeq.create16 ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15 noextract let load_blocks_spec4_lemma (#a:sha2_alg) (#m:m_spec{lanes a m == 4}) (b:multiblock_spec a m) : Lemma (SpecVec.load_blocks b == load_blocks_spec4 b) = LSeq.eq_intro (SpecVec.load_blocks b) (load_blocks_spec4 b) inline_for_extraction noextract val load_blocks4: #a:sha2_alg -> #m:m_spec{lanes a m == 4} -> b:multibuf (lanes a m) (HD.block_len a) -> ws:ws_t a m -> Stack unit (requires fun h -> live_multi h b /\ live h ws /\ disjoint_multi b ws) (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\ as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 b)) #push-options "--z3rlimit 150" let load_blocks4 #a #m ib ws = let h0 = ST.get() in let (b0,(b1,(b2,b3))) = NTup.tup4 ib in set_wsi ws 0ul b0 0ul; set_wsi ws 1ul b1 0ul; set_wsi ws 2ul b2 0ul; set_wsi ws 3ul b3 0ul; set_wsi ws 4ul b0 1ul; set_wsi ws 5ul b1 1ul; set_wsi ws 6ul b2 1ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); set_wsi ws 7ul b3 1ul; set_wsi ws 8ul b0 2ul; set_wsi ws 9ul b1 2ul; set_wsi ws 10ul b2 2ul; set_wsi ws 11ul b3 2ul; set_wsi ws 12ul b0 3ul; set_wsi ws 13ul b1 3ul; set_wsi ws 14ul b2 3ul; set_wsi ws 15ul b3 3ul; let h1 = ST.get() in assert (modifies (loc ws) h0 h1); LSeq.eq_intro (as_seq h1 ws) (load_blocks_spec4 (as_seq_multi h0 ib)); load_blocks_spec4_lemma #a #m (as_seq_multi h0 ib); assert (as_seq h1 ws == load_blocks_spec4 (as_seq_multi h0 ib)); assert (as_seq h1 ws == SpecVec.load_blocks (as_seq_multi h0 ib)); () #pop-options noextract let load_blocks_spec8 (#a:sha2_alg) (#m:m_spec{lanes a m == 8}) (b:multiblock_spec a m) : ws_spec a m = let b0 = b.(|0|) in let b1 = b.(|1|) in let b2 = b.(|2|) in let b3 = b.(|3|) in let b4 = b.(|4|) in let b5 = b.(|5|) in let b6 = b.(|6|) in let b7 = b.(|7|) in let ws0 = SpecVec.load_elementi b0 0 in let ws1 = SpecVec.load_elementi b1 0 in let ws2 = SpecVec.load_elementi b2 0 in let ws3 = SpecVec.load_elementi b3 0 in let ws4 = SpecVec.load_elementi b4 0 in let ws5 = SpecVec.load_elementi b5 0 in let ws6 = SpecVec.load_elementi b6 0 in let ws7 = SpecVec.load_elementi b7 0 in let ws8 = SpecVec.load_elementi b0 1 in let ws9 = SpecVec.load_elementi b1 1 in let ws10 = SpecVec.load_elementi b2 1 in let ws11 = SpecVec.load_elementi b3 1 in let ws12 = SpecVec.load_elementi b4 1 in let ws13 = SpecVec.load_elementi b5 1 in let ws14 = SpecVec.load_elementi b6 1 in let ws15 = SpecVec.load_elementi b7 1 in LSeq.create16 ws0 ws1 ws2 ws3 ws4 ws5 ws6 ws7 ws8 ws9 ws10 ws11 ws12 ws13 ws14 ws15
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NTuple.fsti.checked", "Lib.MultiBuffer.fst.checked", "Lib.IntVector.Transpose.fsti.checked", "Lib.IntVector.Serialize.fsti.checked", "Lib.IntVector.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.SHA2.Vec.fst.checked", "Hacl.Impl.SHA2.Types.fst.checked", "Hacl.Hash.Definitions.fst.checked", "FStar.UInt32.fsti.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.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA2.Core.fst" }
[ { "abbrev": true, "full_module": "Hacl.Hash.Definitions", "short_module": "HD" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "Lib.IntVector.Transpose", "short_module": "VecTranspose" }, { "abbrev": true, "full_module": "Hacl.Spec.SHA2.Vec", "short_module": "SpecVec" }, { "abbrev": true, "full_module": "Lib.NTuple", "short_module": "NTup" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Spec.SHA2.Vec", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.MultiBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntVector", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.NTuple", "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": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.SHA2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
b: Hacl.Spec.SHA2.Vec.multiblock_spec a m -> FStar.Pervasives.Lemma (ensures Hacl.Spec.SHA2.Vec.load_blocks b == Hacl.Impl.SHA2.Core.load_blocks_spec8 b)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Spec.Hash.Definitions.sha2_alg", "Hacl.Spec.SHA2.Vec.m_spec", "Prims.eq2", "Prims.int", "Hacl.Spec.SHA2.Vec.lanes", "Hacl.Spec.SHA2.Vec.multiblock_spec", "Lib.Sequence.eq_intro", "Hacl.Spec.SHA2.Vec.element_t", "Hacl.Spec.SHA2.Vec.load_blocks", "Hacl.Impl.SHA2.Core.load_blocks_spec8", "Prims.unit", "Prims.l_True", "Prims.squash", "Hacl.Spec.SHA2.Vec.ws_spec", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let load_blocks_spec8_lemma (#a: sha2_alg) (#m: m_spec{lanes a m == 8}) (b: multiblock_spec a m) : Lemma (SpecVec.load_blocks b == load_blocks_spec8 b) =
LSeq.eq_intro (SpecVec.load_blocks b) (load_blocks_spec8 b)
false