effect
stringclasses
48 values
original_source_type
stringlengths
0
23k
opens_and_abbrevs
listlengths
2
92
isa_cross_project_example
bool
1 class
source_definition
stringlengths
9
57.9k
partial_definition
stringlengths
7
23.3k
is_div
bool
2 classes
is_type
null
is_proof
bool
2 classes
completed_definiton
stringlengths
1
250k
dependencies
dict
effect_flags
sequencelengths
0
2
ideal_premises
sequencelengths
0
236
mutual_with
sequencelengths
0
11
file_context
stringlengths
0
407k
interleaved
bool
1 class
is_simply_typed
bool
2 classes
file_name
stringlengths
5
48
vconfig
dict
is_simple_lemma
null
source_type
stringlengths
10
23k
proof_features
sequencelengths
0
1
name
stringlengths
8
95
source
dict
verbose_type
stringlengths
1
7.42k
source_range
dict
Prims.Tot
val ws_next (a: sha2_alg) (ws: k_w a) : k_w a
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let ws_next (a:sha2_alg) (ws:k_w a) : k_w a = Lib.LoopCombinators.repeati 16 (ws_next_inner a) ws
val ws_next (a: sha2_alg) (ws: k_w a) : k_w a let ws_next (a: sha2_alg) (ws: k_w a) : k_w a =
false
null
false
Lib.LoopCombinators.repeati 16 (ws_next_inner a) ws
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Hacl.Spec.SHA2.k_w", "Lib.LoopCombinators.repeati", "Hacl.Spec.SHA2.ws_next_inner" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC (* Definition of the SHA2 word functions *) inline_for_extraction val _Ch: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Ch a x y z = (x &. y) ^. (~.x &. z) inline_for_extraction val _Maj: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Maj a x y z = (x &. y) ^. ((x &. z) ^. (y &. z)) inline_for_extraction val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma0 a x = (x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2) inline_for_extraction val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma1 a x = (x >>>. (op0 a).c3) ^. (x >>>. (op0 a).c4) ^. (x >>>. (op0 a).c5) inline_for_extraction val _sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma0 a x = (x >>>. (op0 a).e0) ^. (x >>>. (op0 a).e1) ^. (x >>. (op0 a).e2) inline_for_extraction val _sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma1 a x = (x >>>. (op0 a).e3) ^. (x >>>. (op0 a).e4) ^. (x >>. (op0 a).e5) let h0: a:sha2_alg -> Tot (words_state a) = function | SHA2_224 -> C.h224 | SHA2_256 -> C.h256 | SHA2_384 -> C.h384 | SHA2_512 -> C.h512 let k0: a:sha2_alg -> Tot (m:S.seq (word a) {S.length m = size_k_w a}) = function | SHA2_224 -> C.k224_256 | SHA2_256 -> C.k224_256 | SHA2_384 -> C.k384_512 | SHA2_512 -> C.k384_512 unfold let (.[]) = S.index (* Core shuffling function *) let shuffle_core_pre (a:sha2_alg) (k_t: word a) (ws_t: word a) (hash:words_state a) : Tot (words_state a) = (**) assert(7 <= S.length hash); let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in (**) assert(S.length (k0 a) = size_k_w a); let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. k_t +. ws_t in let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert_norm (List.Tot.length l = 8); S.seq_of_list l (* Scheduling function *) let ws_next_inner (a:sha2_alg) (i:nat{i < 16}) (ws:k_w a) : k_w a = let t16 = ws.[i] in let t15 = ws.[(i+1) % 16] in let t7 = ws.[(i+9) % 16] in let t2 = ws.[(i+14) % 16] in let s1 = _sigma1 a t2 in let s0 = _sigma0 a t15 in Seq.upd ws i (s1 +. t7 +. s0 +. t16)
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val ws_next (a: sha2_alg) (ws: k_w a) : k_w a
[]
Hacl.Spec.SHA2.ws_next
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> ws: Hacl.Spec.SHA2.k_w a -> Hacl.Spec.SHA2.k_w a
{ "end_col": 53, "end_line": 193, "start_col": 2, "start_line": 193 }
Prims.Tot
val shuffle_inner_loop: a:sha2_alg -> i:nat{i < num_rounds16 a} -> ws_st:tuple2 (k_w a) (words_state a) -> k_w a & words_state a
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let shuffle_inner_loop a i (ws, st) = let st' = Lib.LoopCombinators.repeati 16 (shuffle_inner a ws i) st in let ws' = if i < num_rounds16 a - 1 then ws_next a ws else ws in (ws', st')
val shuffle_inner_loop: a:sha2_alg -> i:nat{i < num_rounds16 a} -> ws_st:tuple2 (k_w a) (words_state a) -> k_w a & words_state a let shuffle_inner_loop a i (ws, st) =
false
null
false
let st' = Lib.LoopCombinators.repeati 16 (shuffle_inner a ws i) st in let ws' = if i < num_rounds16 a - 1 then ws_next a ws else ws in (ws', st')
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Prims.nat", "Prims.b2t", "Prims.op_LessThan", "Hacl.Spec.SHA2.num_rounds16", "FStar.Pervasives.Native.tuple2", "Hacl.Spec.SHA2.k_w", "Spec.Hash.Definitions.words_state", "FStar.Pervasives.Native.Mktuple2", "Prims.op_Subtraction", "Hacl.Spec.SHA2.ws_next", "Prims.bool", "Lib.LoopCombinators.repeati", "Hacl.Spec.SHA2.shuffle_inner" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC (* Definition of the SHA2 word functions *) inline_for_extraction val _Ch: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Ch a x y z = (x &. y) ^. (~.x &. z) inline_for_extraction val _Maj: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Maj a x y z = (x &. y) ^. ((x &. z) ^. (y &. z)) inline_for_extraction val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma0 a x = (x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2) inline_for_extraction val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma1 a x = (x >>>. (op0 a).c3) ^. (x >>>. (op0 a).c4) ^. (x >>>. (op0 a).c5) inline_for_extraction val _sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma0 a x = (x >>>. (op0 a).e0) ^. (x >>>. (op0 a).e1) ^. (x >>. (op0 a).e2) inline_for_extraction val _sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma1 a x = (x >>>. (op0 a).e3) ^. (x >>>. (op0 a).e4) ^. (x >>. (op0 a).e5) let h0: a:sha2_alg -> Tot (words_state a) = function | SHA2_224 -> C.h224 | SHA2_256 -> C.h256 | SHA2_384 -> C.h384 | SHA2_512 -> C.h512 let k0: a:sha2_alg -> Tot (m:S.seq (word a) {S.length m = size_k_w a}) = function | SHA2_224 -> C.k224_256 | SHA2_256 -> C.k224_256 | SHA2_384 -> C.k384_512 | SHA2_512 -> C.k384_512 unfold let (.[]) = S.index (* Core shuffling function *) let shuffle_core_pre (a:sha2_alg) (k_t: word a) (ws_t: word a) (hash:words_state a) : Tot (words_state a) = (**) assert(7 <= S.length hash); let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in (**) assert(S.length (k0 a) = size_k_w a); let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. k_t +. ws_t in let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert_norm (List.Tot.length l = 8); S.seq_of_list l (* Scheduling function *) let ws_next_inner (a:sha2_alg) (i:nat{i < 16}) (ws:k_w a) : k_w a = let t16 = ws.[i] in let t15 = ws.[(i+1) % 16] in let t7 = ws.[(i+9) % 16] in let t2 = ws.[(i+14) % 16] in let s1 = _sigma1 a t2 in let s0 = _sigma0 a t15 in Seq.upd ws i (s1 +. t7 +. s0 +. t16) let ws_next (a:sha2_alg) (ws:k_w a) : k_w a = Lib.LoopCombinators.repeati 16 (ws_next_inner a) ws val shuffle_inner: a:sha2_alg -> ws:k_w a -> i:nat{i < num_rounds16 a} -> j:nat{j < 16} -> hash:words_state a -> words_state a let shuffle_inner a ws i j hash = let k_t = Seq.index (k0 a) (16 * i + j) in let ws_t = ws.[j] in shuffle_core_pre a k_t ws_t hash val shuffle_inner_loop: a:sha2_alg -> i:nat{i < num_rounds16 a} -> ws_st:tuple2 (k_w a) (words_state a) -> k_w a & words_state a
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val shuffle_inner_loop: a:sha2_alg -> i:nat{i < num_rounds16 a} -> ws_st:tuple2 (k_w a) (words_state a) -> k_w a & words_state a
[]
Hacl.Spec.SHA2.shuffle_inner_loop
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> i: Prims.nat{i < Hacl.Spec.SHA2.num_rounds16 a} -> ws_st: (Hacl.Spec.SHA2.k_w a * Spec.Hash.Definitions.words_state a) -> Hacl.Spec.SHA2.k_w a * Spec.Hash.Definitions.words_state a
{ "end_col": 12, "end_line": 219, "start_col": 37, "start_line": 216 }
Prims.Tot
val mk_len_t (a: sha2_alg) (len: len_lt_max_a_t a) : len_t a
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len)
val mk_len_t (a: sha2_alg) (len: len_lt_max_a_t a) : len_t a let mk_len_t (a: sha2_alg) (len: len_lt_max_a_t a) : len_t a =
false
null
false
match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len)
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Hacl.Spec.SHA2.len_lt_max_a_t", "Lib.IntTypes.uint", "Lib.IntTypes.U64", "Lib.IntTypes.PUB", "Prims.unit", "FStar.Math.Lemmas.pow2_lt_compat", "Lib.IntTypes.U128", "Spec.Hash.Definitions.len_t" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a}
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val mk_len_t (a: sha2_alg) (len: len_lt_max_a_t a) : len_t a
[]
Hacl.Spec.SHA2.mk_len_t
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> len: Hacl.Spec.SHA2.len_lt_max_a_t a -> Spec.Hash.Definitions.len_t a
{ "end_col": 61, "end_line": 20, "start_col": 2, "start_line": 16 }
Prims.Tot
val shuffle (a: sha2_alg) (ws: k_w a) (hash: words_state a) : Tot (words_state a)
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let shuffle (a:sha2_alg) (ws:k_w a) (hash:words_state a) : Tot (words_state a) = let (ws, st) = Lib.LoopCombinators.repeati (num_rounds16 a) (shuffle_inner_loop a) (ws, hash) in st
val shuffle (a: sha2_alg) (ws: k_w a) (hash: words_state a) : Tot (words_state a) let shuffle (a: sha2_alg) (ws: k_w a) (hash: words_state a) : Tot (words_state a) =
false
null
false
let ws, st = Lib.LoopCombinators.repeati (num_rounds16 a) (shuffle_inner_loop a) (ws, hash) in st
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Hacl.Spec.SHA2.k_w", "Spec.Hash.Definitions.words_state", "FStar.Pervasives.Native.tuple2", "Lib.LoopCombinators.repeati", "Hacl.Spec.SHA2.num_rounds16", "Hacl.Spec.SHA2.shuffle_inner_loop", "FStar.Pervasives.Native.Mktuple2" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC (* Definition of the SHA2 word functions *) inline_for_extraction val _Ch: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Ch a x y z = (x &. y) ^. (~.x &. z) inline_for_extraction val _Maj: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Maj a x y z = (x &. y) ^. ((x &. z) ^. (y &. z)) inline_for_extraction val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma0 a x = (x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2) inline_for_extraction val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma1 a x = (x >>>. (op0 a).c3) ^. (x >>>. (op0 a).c4) ^. (x >>>. (op0 a).c5) inline_for_extraction val _sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma0 a x = (x >>>. (op0 a).e0) ^. (x >>>. (op0 a).e1) ^. (x >>. (op0 a).e2) inline_for_extraction val _sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma1 a x = (x >>>. (op0 a).e3) ^. (x >>>. (op0 a).e4) ^. (x >>. (op0 a).e5) let h0: a:sha2_alg -> Tot (words_state a) = function | SHA2_224 -> C.h224 | SHA2_256 -> C.h256 | SHA2_384 -> C.h384 | SHA2_512 -> C.h512 let k0: a:sha2_alg -> Tot (m:S.seq (word a) {S.length m = size_k_w a}) = function | SHA2_224 -> C.k224_256 | SHA2_256 -> C.k224_256 | SHA2_384 -> C.k384_512 | SHA2_512 -> C.k384_512 unfold let (.[]) = S.index (* Core shuffling function *) let shuffle_core_pre (a:sha2_alg) (k_t: word a) (ws_t: word a) (hash:words_state a) : Tot (words_state a) = (**) assert(7 <= S.length hash); let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in (**) assert(S.length (k0 a) = size_k_w a); let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. k_t +. ws_t in let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert_norm (List.Tot.length l = 8); S.seq_of_list l (* Scheduling function *) let ws_next_inner (a:sha2_alg) (i:nat{i < 16}) (ws:k_w a) : k_w a = let t16 = ws.[i] in let t15 = ws.[(i+1) % 16] in let t7 = ws.[(i+9) % 16] in let t2 = ws.[(i+14) % 16] in let s1 = _sigma1 a t2 in let s0 = _sigma0 a t15 in Seq.upd ws i (s1 +. t7 +. s0 +. t16) let ws_next (a:sha2_alg) (ws:k_w a) : k_w a = Lib.LoopCombinators.repeati 16 (ws_next_inner a) ws val shuffle_inner: a:sha2_alg -> ws:k_w a -> i:nat{i < num_rounds16 a} -> j:nat{j < 16} -> hash:words_state a -> words_state a let shuffle_inner a ws i j hash = let k_t = Seq.index (k0 a) (16 * i + j) in let ws_t = ws.[j] in shuffle_core_pre a k_t ws_t hash val shuffle_inner_loop: a:sha2_alg -> i:nat{i < num_rounds16 a} -> ws_st:tuple2 (k_w a) (words_state a) -> k_w a & words_state a let shuffle_inner_loop a i (ws, st) = let st' = Lib.LoopCombinators.repeati 16 (shuffle_inner a ws i) st in let ws' = if i < num_rounds16 a - 1 then ws_next a ws else ws in (ws', st') (* Full shuffling function *)
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val shuffle (a: sha2_alg) (ws: k_w a) (hash: words_state a) : Tot (words_state a)
[]
Hacl.Spec.SHA2.shuffle
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> ws: Hacl.Spec.SHA2.k_w a -> hash: Spec.Hash.Definitions.words_state a -> Spec.Hash.Definitions.words_state a
{ "end_col": 4, "end_line": 225, "start_col": 80, "start_line": 223 }
Prims.Tot
val word_n: sha2_alg -> Tot nat
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64
val word_n: sha2_alg -> Tot nat let word_n: sha2_alg -> Tot nat =
false
null
false
function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Prims.nat" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80
false
true
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val word_n: sha2_alg -> Tot nat
[]
Hacl.Spec.SHA2.word_n
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
_: Spec.Hash.Definitions.sha2_alg -> Prims.nat
{ "end_col": 29, "end_line": 34, "start_col": 34, "start_line": 32 }
Prims.Tot
val to_word (a: sha2_alg) (n: nat{n < pow2 (word_n a)}) : word a
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n
val to_word (a: sha2_alg) (n: nat{n < pow2 (word_n a)}) : word a let to_word (a: sha2_alg) (n: nat{n < pow2 (word_n a)}) : word a =
false
null
false
match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Prims.nat", "Prims.b2t", "Prims.op_LessThan", "Prims.pow2", "Hacl.Spec.SHA2.word_n", "Lib.IntTypes.u32", "Lib.IntTypes.u64", "Spec.Hash.Definitions.word" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val to_word (a: sha2_alg) (n: nat{n < pow2 (word_n a)}) : word a
[]
Hacl.Spec.SHA2.to_word
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> n: Prims.nat{n < Prims.pow2 (Hacl.Spec.SHA2.word_n a)} -> Spec.Hash.Definitions.word a
{ "end_col": 32, "end_line": 40, "start_col": 2, "start_line": 38 }
Prims.Tot
val op0 (a: sha2_alg) : Tot ops
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512
val op0 (a: sha2_alg) : Tot ops let op0: a: sha2_alg -> Tot ops =
false
null
false
function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Hacl.Spec.SHA2.op224_256", "Hacl.Spec.SHA2.op384_512", "Hacl.Spec.SHA2.ops" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul }
false
true
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val op0 (a: sha2_alg) : Tot ops
[]
Hacl.Spec.SHA2.op0
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> Hacl.Spec.SHA2.ops
{ "end_col": 25, "end_line": 81, "start_col": 33, "start_line": 77 }
Prims.Tot
val num_rounds16 (a: sha2_alg) : n: pos{16 * n == size_k_w a}
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5
val num_rounds16 (a: sha2_alg) : n: pos{16 * n == size_k_w a} let num_rounds16 (a: sha2_alg) : n: pos{16 * n == size_k_w a} =
false
null
false
match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Prims.pos", "Prims.eq2", "Prims.int", "FStar.Mul.op_Star", "Hacl.Spec.SHA2.size_k_w" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val num_rounds16 (a: sha2_alg) : n: pos{16 * n == size_k_w a}
[]
Hacl.Spec.SHA2.num_rounds16
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> n: Prims.pos{16 * n == Hacl.Spec.SHA2.size_k_w a}
{ "end_col": 28, "end_line": 46, "start_col": 2, "start_line": 44 }
Prims.Tot
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let k_w (a: sha2_alg) = lseq (word a) (block_word_length a)
let k_w (a: sha2_alg) =
false
null
false
lseq (word a) (block_word_length a)
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Lib.Sequence.lseq", "Spec.Hash.Definitions.word", "Spec.Hash.Definitions.block_word_length" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5
false
true
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val k_w : a: Spec.Hash.Definitions.sha2_alg -> Type0
[]
Hacl.Spec.SHA2.k_w
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> Type0
{ "end_col": 61, "end_line": 48, "start_col": 26, "start_line": 48 }
Prims.Tot
val op_Tilde_Dot: #a: sha2_alg -> word a -> word a
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC
val op_Tilde_Dot: #a: sha2_alg -> word a -> word a let op_Tilde_Dot (#a: sha2_alg) : word a -> word a =
false
null
false
match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Lib.IntTypes.op_Tilde_Dot", "Lib.IntTypes.U32", "Lib.IntTypes.SEC", "Lib.IntTypes.U64", "Spec.Hash.Definitions.word" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val op_Tilde_Dot: #a: sha2_alg -> word a -> word a
[]
Hacl.Spec.SHA2.op_Tilde_Dot
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
_: Spec.Hash.Definitions.word a -> Spec.Hash.Definitions.word a
{ "end_col": 43, "end_line": 106, "start_col": 2, "start_line": 104 }
Prims.Tot
val op_Hat_Dot: #a: sha2_alg -> word a -> word a -> word a
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC
val op_Hat_Dot: #a: sha2_alg -> word a -> word a -> word a let op_Hat_Dot (#a: sha2_alg) : word a -> word a -> word a =
false
null
false
match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Lib.IntTypes.op_Hat_Dot", "Lib.IntTypes.U32", "Lib.IntTypes.SEC", "Lib.IntTypes.U64", "Spec.Hash.Definitions.word" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val op_Hat_Dot: #a: sha2_alg -> word a -> word a -> word a
[]
Hacl.Spec.SHA2.op_Hat_Dot
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
_: Spec.Hash.Definitions.word a -> _: Spec.Hash.Definitions.word a -> Spec.Hash.Definitions.word a
{ "end_col": 43, "end_line": 93, "start_col": 2, "start_line": 91 }
Prims.Tot
val padded_blocks (a: sha2_alg) (len: nat{len <= block_length a}) : n: nat{n <= 2}
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let padded_blocks (a:sha2_alg) (len:nat{len <= block_length a}) : n:nat{n <= 2} = if (len + len_length a + 1 <= block_length a) then 1 else 2
val padded_blocks (a: sha2_alg) (len: nat{len <= block_length a}) : n: nat{n <= 2} let padded_blocks (a: sha2_alg) (len: nat{len <= block_length a}) : n: nat{n <= 2} =
false
null
false
if (len + len_length a + 1 <= block_length a) then 1 else 2
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Prims.nat", "Prims.b2t", "Prims.op_LessThanOrEqual", "Spec.Hash.Definitions.block_length", "Prims.op_Addition", "Spec.Hash.Definitions.len_length", "Prims.bool" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC (* Definition of the SHA2 word functions *) inline_for_extraction val _Ch: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Ch a x y z = (x &. y) ^. (~.x &. z) inline_for_extraction val _Maj: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Maj a x y z = (x &. y) ^. ((x &. z) ^. (y &. z)) inline_for_extraction val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma0 a x = (x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2) inline_for_extraction val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma1 a x = (x >>>. (op0 a).c3) ^. (x >>>. (op0 a).c4) ^. (x >>>. (op0 a).c5) inline_for_extraction val _sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma0 a x = (x >>>. (op0 a).e0) ^. (x >>>. (op0 a).e1) ^. (x >>. (op0 a).e2) inline_for_extraction val _sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma1 a x = (x >>>. (op0 a).e3) ^. (x >>>. (op0 a).e4) ^. (x >>. (op0 a).e5) let h0: a:sha2_alg -> Tot (words_state a) = function | SHA2_224 -> C.h224 | SHA2_256 -> C.h256 | SHA2_384 -> C.h384 | SHA2_512 -> C.h512 let k0: a:sha2_alg -> Tot (m:S.seq (word a) {S.length m = size_k_w a}) = function | SHA2_224 -> C.k224_256 | SHA2_256 -> C.k224_256 | SHA2_384 -> C.k384_512 | SHA2_512 -> C.k384_512 unfold let (.[]) = S.index (* Core shuffling function *) let shuffle_core_pre (a:sha2_alg) (k_t: word a) (ws_t: word a) (hash:words_state a) : Tot (words_state a) = (**) assert(7 <= S.length hash); let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in (**) assert(S.length (k0 a) = size_k_w a); let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. k_t +. ws_t in let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert_norm (List.Tot.length l = 8); S.seq_of_list l (* Scheduling function *) let ws_next_inner (a:sha2_alg) (i:nat{i < 16}) (ws:k_w a) : k_w a = let t16 = ws.[i] in let t15 = ws.[(i+1) % 16] in let t7 = ws.[(i+9) % 16] in let t2 = ws.[(i+14) % 16] in let s1 = _sigma1 a t2 in let s0 = _sigma0 a t15 in Seq.upd ws i (s1 +. t7 +. s0 +. t16) let ws_next (a:sha2_alg) (ws:k_w a) : k_w a = Lib.LoopCombinators.repeati 16 (ws_next_inner a) ws val shuffle_inner: a:sha2_alg -> ws:k_w a -> i:nat{i < num_rounds16 a} -> j:nat{j < 16} -> hash:words_state a -> words_state a let shuffle_inner a ws i j hash = let k_t = Seq.index (k0 a) (16 * i + j) in let ws_t = ws.[j] in shuffle_core_pre a k_t ws_t hash val shuffle_inner_loop: a:sha2_alg -> i:nat{i < num_rounds16 a} -> ws_st:tuple2 (k_w a) (words_state a) -> k_w a & words_state a let shuffle_inner_loop a i (ws, st) = let st' = Lib.LoopCombinators.repeati 16 (shuffle_inner a ws i) st in let ws' = if i < num_rounds16 a - 1 then ws_next a ws else ws in (ws', st') (* Full shuffling function *) let shuffle (a:sha2_alg) (ws:k_w a) (hash:words_state a) : Tot (words_state a) = let (ws, st) = Lib.LoopCombinators.repeati (num_rounds16 a) (shuffle_inner_loop a) (ws, hash) in st let init (a:sha2_alg) : words_state a = h0 a let update (a:sha2_alg) (block:block_t a) (hash:words_state a): Tot (words_state a) = let block_w = Lib.ByteSequence.uints_from_bytes_be #(word_t a) #SEC #(block_word_length a) block in let hash_1 = shuffle a block_w hash in map2 #_ #_ #_ #8 ( +. ) hash_1 hash
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val padded_blocks (a: sha2_alg) (len: nat{len <= block_length a}) : n: nat{n <= 2}
[]
Hacl.Spec.SHA2.padded_blocks
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> len: Prims.nat{len <= Spec.Hash.Definitions.block_length a} -> n: Prims.nat{n <= 2}
{ "end_col": 61, "end_line": 237, "start_col": 2, "start_line": 237 }
Prims.Tot
val size_k_w: sha2_alg -> Tot nat
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80
val size_k_w: sha2_alg -> Tot nat let size_k_w: sha2_alg -> Tot nat =
false
null
false
function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Prims.nat" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *)
false
true
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val size_k_w: sha2_alg -> Tot nat
[]
Hacl.Spec.SHA2.size_k_w
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
_: Spec.Hash.Definitions.sha2_alg -> Prims.nat
{ "end_col": 29, "end_line": 29, "start_col": 36, "start_line": 27 }
Prims.Tot
val op_Amp_Dot: #a: sha2_alg -> word a -> word a -> word a
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC
val op_Amp_Dot: #a: sha2_alg -> word a -> word a -> word a let op_Amp_Dot (#a: sha2_alg) : word a -> word a -> word a =
false
null
false
match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Lib.IntTypes.op_Amp_Dot", "Lib.IntTypes.U32", "Lib.IntTypes.SEC", "Lib.IntTypes.U64", "Spec.Hash.Definitions.word" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val op_Amp_Dot: #a: sha2_alg -> word a -> word a -> word a
[]
Hacl.Spec.SHA2.op_Amp_Dot
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
_: Spec.Hash.Definitions.word a -> _: Spec.Hash.Definitions.word a -> Spec.Hash.Definitions.word a
{ "end_col": 43, "end_line": 100, "start_col": 2, "start_line": 98 }
Prims.Tot
val op_Plus_Dot: #a: sha2_alg -> word a -> word a -> word a
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC
val op_Plus_Dot: #a: sha2_alg -> word a -> word a -> word a let op_Plus_Dot (#a: sha2_alg) : word a -> word a -> word a =
false
null
false
match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Lib.IntTypes.op_Plus_Dot", "Lib.IntTypes.U32", "Lib.IntTypes.SEC", "Lib.IntTypes.U64", "Spec.Hash.Definitions.word" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val op_Plus_Dot: #a: sha2_alg -> word a -> word a -> word a
[]
Hacl.Spec.SHA2.op_Plus_Dot
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
_: Spec.Hash.Definitions.word a -> _: Spec.Hash.Definitions.word a -> Spec.Hash.Definitions.word a
{ "end_col": 43, "end_line": 87, "start_col": 2, "start_line": 85 }
Prims.Tot
val ws_next_inner (a: sha2_alg) (i: nat{i < 16}) (ws: k_w a) : k_w a
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let ws_next_inner (a:sha2_alg) (i:nat{i < 16}) (ws:k_w a) : k_w a = let t16 = ws.[i] in let t15 = ws.[(i+1) % 16] in let t7 = ws.[(i+9) % 16] in let t2 = ws.[(i+14) % 16] in let s1 = _sigma1 a t2 in let s0 = _sigma0 a t15 in Seq.upd ws i (s1 +. t7 +. s0 +. t16)
val ws_next_inner (a: sha2_alg) (i: nat{i < 16}) (ws: k_w a) : k_w a let ws_next_inner (a: sha2_alg) (i: nat{i < 16}) (ws: k_w a) : k_w a =
false
null
false
let t16 = ws.[ i ] in let t15 = ws.[ (i + 1) % 16 ] in let t7 = ws.[ (i + 9) % 16 ] in let t2 = ws.[ (i + 14) % 16 ] in let s1 = _sigma1 a t2 in let s0 = _sigma0 a t15 in Seq.upd ws i (s1 +. t7 +. s0 +. t16)
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Prims.nat", "Prims.b2t", "Prims.op_LessThan", "Hacl.Spec.SHA2.k_w", "FStar.Seq.Base.upd", "Spec.Hash.Definitions.word", "Hacl.Spec.SHA2.op_Plus_Dot", "Hacl.Spec.SHA2._sigma0", "Hacl.Spec.SHA2._sigma1", "Hacl.Spec.SHA2.op_String_Access", "Prims.op_Modulus", "Prims.op_Addition" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC (* Definition of the SHA2 word functions *) inline_for_extraction val _Ch: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Ch a x y z = (x &. y) ^. (~.x &. z) inline_for_extraction val _Maj: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Maj a x y z = (x &. y) ^. ((x &. z) ^. (y &. z)) inline_for_extraction val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma0 a x = (x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2) inline_for_extraction val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma1 a x = (x >>>. (op0 a).c3) ^. (x >>>. (op0 a).c4) ^. (x >>>. (op0 a).c5) inline_for_extraction val _sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma0 a x = (x >>>. (op0 a).e0) ^. (x >>>. (op0 a).e1) ^. (x >>. (op0 a).e2) inline_for_extraction val _sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma1 a x = (x >>>. (op0 a).e3) ^. (x >>>. (op0 a).e4) ^. (x >>. (op0 a).e5) let h0: a:sha2_alg -> Tot (words_state a) = function | SHA2_224 -> C.h224 | SHA2_256 -> C.h256 | SHA2_384 -> C.h384 | SHA2_512 -> C.h512 let k0: a:sha2_alg -> Tot (m:S.seq (word a) {S.length m = size_k_w a}) = function | SHA2_224 -> C.k224_256 | SHA2_256 -> C.k224_256 | SHA2_384 -> C.k384_512 | SHA2_512 -> C.k384_512 unfold let (.[]) = S.index (* Core shuffling function *) let shuffle_core_pre (a:sha2_alg) (k_t: word a) (ws_t: word a) (hash:words_state a) : Tot (words_state a) = (**) assert(7 <= S.length hash); let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in (**) assert(S.length (k0 a) = size_k_w a); let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. k_t +. ws_t in let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert_norm (List.Tot.length l = 8); S.seq_of_list l (* Scheduling function *)
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val ws_next_inner (a: sha2_alg) (i: nat{i < 16}) (ws: k_w a) : k_w a
[]
Hacl.Spec.SHA2.ws_next_inner
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> i: Prims.nat{i < 16} -> ws: Hacl.Spec.SHA2.k_w a -> Hacl.Spec.SHA2.k_w a
{ "end_col": 38, "end_line": 190, "start_col": 67, "start_line": 183 }
Prims.Tot
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let block_t (a: sha2_alg) = lseq uint8 (block_length a)
let block_t (a: sha2_alg) =
false
null
false
lseq uint8 (block_length a)
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Lib.Sequence.lseq", "Lib.IntTypes.uint8", "Spec.Hash.Definitions.block_length" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5
false
true
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val block_t : a: Spec.Hash.Definitions.sha2_alg -> Type0
[]
Hacl.Spec.SHA2.block_t
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> Type0
{ "end_col": 55, "end_line": 49, "start_col": 28, "start_line": 49 }
Prims.Tot
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let sha224 (len:len_lt_max_a_t SHA2_224) (b:seq uint8{length b = len}) = hash #SHA2_224 len b
let sha224 (len: len_lt_max_a_t SHA2_224) (b: seq uint8 {length b = len}) =
false
null
false
hash #SHA2_224 len b
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Hacl.Spec.SHA2.len_lt_max_a_t", "Spec.Hash.Definitions.SHA2_224", "Lib.Sequence.seq", "Lib.IntTypes.uint8", "Prims.b2t", "Prims.op_Equality", "Prims.nat", "Lib.Sequence.length", "Hacl.Spec.SHA2.hash", "Lib.Sequence.lseq", "Spec.Hash.Definitions.hash_length" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC (* Definition of the SHA2 word functions *) inline_for_extraction val _Ch: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Ch a x y z = (x &. y) ^. (~.x &. z) inline_for_extraction val _Maj: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Maj a x y z = (x &. y) ^. ((x &. z) ^. (y &. z)) inline_for_extraction val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma0 a x = (x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2) inline_for_extraction val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma1 a x = (x >>>. (op0 a).c3) ^. (x >>>. (op0 a).c4) ^. (x >>>. (op0 a).c5) inline_for_extraction val _sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma0 a x = (x >>>. (op0 a).e0) ^. (x >>>. (op0 a).e1) ^. (x >>. (op0 a).e2) inline_for_extraction val _sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma1 a x = (x >>>. (op0 a).e3) ^. (x >>>. (op0 a).e4) ^. (x >>. (op0 a).e5) let h0: a:sha2_alg -> Tot (words_state a) = function | SHA2_224 -> C.h224 | SHA2_256 -> C.h256 | SHA2_384 -> C.h384 | SHA2_512 -> C.h512 let k0: a:sha2_alg -> Tot (m:S.seq (word a) {S.length m = size_k_w a}) = function | SHA2_224 -> C.k224_256 | SHA2_256 -> C.k224_256 | SHA2_384 -> C.k384_512 | SHA2_512 -> C.k384_512 unfold let (.[]) = S.index (* Core shuffling function *) let shuffle_core_pre (a:sha2_alg) (k_t: word a) (ws_t: word a) (hash:words_state a) : Tot (words_state a) = (**) assert(7 <= S.length hash); let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in (**) assert(S.length (k0 a) = size_k_w a); let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. k_t +. ws_t in let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert_norm (List.Tot.length l = 8); S.seq_of_list l (* Scheduling function *) let ws_next_inner (a:sha2_alg) (i:nat{i < 16}) (ws:k_w a) : k_w a = let t16 = ws.[i] in let t15 = ws.[(i+1) % 16] in let t7 = ws.[(i+9) % 16] in let t2 = ws.[(i+14) % 16] in let s1 = _sigma1 a t2 in let s0 = _sigma0 a t15 in Seq.upd ws i (s1 +. t7 +. s0 +. t16) let ws_next (a:sha2_alg) (ws:k_w a) : k_w a = Lib.LoopCombinators.repeati 16 (ws_next_inner a) ws val shuffle_inner: a:sha2_alg -> ws:k_w a -> i:nat{i < num_rounds16 a} -> j:nat{j < 16} -> hash:words_state a -> words_state a let shuffle_inner a ws i j hash = let k_t = Seq.index (k0 a) (16 * i + j) in let ws_t = ws.[j] in shuffle_core_pre a k_t ws_t hash val shuffle_inner_loop: a:sha2_alg -> i:nat{i < num_rounds16 a} -> ws_st:tuple2 (k_w a) (words_state a) -> k_w a & words_state a let shuffle_inner_loop a i (ws, st) = let st' = Lib.LoopCombinators.repeati 16 (shuffle_inner a ws i) st in let ws' = if i < num_rounds16 a - 1 then ws_next a ws else ws in (ws', st') (* Full shuffling function *) let shuffle (a:sha2_alg) (ws:k_w a) (hash:words_state a) : Tot (words_state a) = let (ws, st) = Lib.LoopCombinators.repeati (num_rounds16 a) (shuffle_inner_loop a) (ws, hash) in st let init (a:sha2_alg) : words_state a = h0 a let update (a:sha2_alg) (block:block_t a) (hash:words_state a): Tot (words_state a) = let block_w = Lib.ByteSequence.uints_from_bytes_be #(word_t a) #SEC #(block_word_length a) block in let hash_1 = shuffle a block_w hash in map2 #_ #_ #_ #8 ( +. ) hash_1 hash let padded_blocks (a:sha2_alg) (len:nat{len <= block_length a}) : n:nat{n <= 2} = if (len + len_length a + 1 <= block_length a) then 1 else 2 let load_last (a:sha2_alg) (totlen_seq:lseq uint8 (len_length a)) (fin:nat{fin == block_length a \/ fin == 2 * block_length a}) (len:nat{len <= block_length a}) (b:bytes{S.length b = len}) : (block_t a & block_t a) = let last = create (2 * block_length a) (u8 0) in let last = update_sub last 0 len b in let last = last.[len] <- u8 0x80 in let last = update_sub last (fin - len_length a) (len_length a) totlen_seq in let b0 = sub last 0 (block_length a) in let b1 = sub last (block_length a) (block_length a) in (b0, b1) let update_last (a:sha2_alg) (totlen:len_t a) (len:nat{len <= block_length a}) (b:bytes{S.length b = len}) (hash:words_state a) : Tot (words_state a) = let blocks = padded_blocks a len in let fin = blocks * block_length a in let total_len_bits = secret (shift_left #(len_int_type a) totlen 3ul) in let totlen_seq = Lib.ByteSequence.uint_to_bytes_be #(len_int_type a) total_len_bits in let (b0, b1) = load_last a totlen_seq fin len b in let hash = update a b0 hash in if blocks > 1 then update a b1 hash else hash let store_state (a:sha2_alg) (hashw:words_state a) : Tot (lseq uint8 (8 * word_length a)) = Lib.ByteSequence.uints_to_bytes_be #(word_t a) #SEC #8 hashw let emit (a:sha2_alg) (h:lseq uint8 (8 * word_length a)) : Tot (lseq uint8 (hash_length a)) = sub h 0 (hash_length a) let finish (a:sha2_alg) (st:words_state a) : Tot (lseq uint8 (hash_length a)) = let hseq = store_state a st in emit a hseq let update_block (a:sha2_alg) (len:len_lt_max_a_t a) (b:seq uint8{length b = len}) (i:nat{i < len / block_length a}) (st:words_state a) : words_state a = let mb = Seq.slice b (i * block_length a) (i * block_length a + block_length a) in update a mb st let update_nblocks (a:sha2_alg) (len:len_lt_max_a_t a) (b:seq uint8{length b = len}) (st:words_state a) : words_state a = let blocks = len / block_length a in Lib.LoopCombinators.repeati blocks (update_block a len b) st let hash (#a:sha2_alg) (len:len_lt_max_a_t a) (b:seq uint8{length b = len}) = let len' : len_t a = mk_len_t a len in let st = init a in let st = update_nblocks a len b st in let rem = len % block_length a in let mb = Seq.slice b (len - rem) len in let st = update_last a len' rem mb st in finish a st
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val sha224 : len: Hacl.Spec.SHA2.len_lt_max_a_t Spec.Hash.Definitions.SHA2_224 -> b: Lib.Sequence.seq Lib.IntTypes.uint8 {Lib.Sequence.length b = len} -> Lib.Sequence.lseq Lib.IntTypes.uint8 (Spec.Hash.Definitions.hash_length Spec.Hash.Definitions.SHA2_224)
[]
Hacl.Spec.SHA2.sha224
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
len: Hacl.Spec.SHA2.len_lt_max_a_t Spec.Hash.Definitions.SHA2_224 -> b: Lib.Sequence.seq Lib.IntTypes.uint8 {Lib.Sequence.length b = len} -> Lib.Sequence.lseq Lib.IntTypes.uint8 (Spec.Hash.Definitions.hash_length Spec.Hash.Definitions.SHA2_224)
{ "end_col": 22, "end_line": 301, "start_col": 2, "start_line": 301 }
Prims.Tot
val op_Greater_Greater_Dot: #a: sha2_alg -> word a -> shiftval (word_t a) -> word a
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC
val op_Greater_Greater_Dot: #a: sha2_alg -> word a -> shiftval (word_t a) -> word a let op_Greater_Greater_Dot (#a: sha2_alg) : word a -> shiftval (word_t a) -> word a =
false
null
false
match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Lib.IntTypes.op_Greater_Greater_Dot", "Lib.IntTypes.U32", "Lib.IntTypes.SEC", "Lib.IntTypes.U64", "Spec.Hash.Definitions.word", "Lib.IntTypes.shiftval", "Spec.Hash.Definitions.word_t" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val op_Greater_Greater_Dot: #a: sha2_alg -> word a -> shiftval (word_t a) -> word a
[]
Hacl.Spec.SHA2.op_Greater_Greater_Dot
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
_: Spec.Hash.Definitions.word a -> _: Lib.IntTypes.shiftval (Spec.Hash.Definitions.word_t a) -> Spec.Hash.Definitions.word a
{ "end_col": 44, "end_line": 118, "start_col": 2, "start_line": 116 }
Prims.Tot
val update (a: sha2_alg) (block: block_t a) (hash: words_state a) : Tot (words_state a)
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let update (a:sha2_alg) (block:block_t a) (hash:words_state a): Tot (words_state a) = let block_w = Lib.ByteSequence.uints_from_bytes_be #(word_t a) #SEC #(block_word_length a) block in let hash_1 = shuffle a block_w hash in map2 #_ #_ #_ #8 ( +. ) hash_1 hash
val update (a: sha2_alg) (block: block_t a) (hash: words_state a) : Tot (words_state a) let update (a: sha2_alg) (block: block_t a) (hash: words_state a) : Tot (words_state a) =
false
null
false
let block_w = Lib.ByteSequence.uints_from_bytes_be #(word_t a) #SEC #(block_word_length a) block in let hash_1 = shuffle a block_w hash in map2 #_ #_ #_ #8 ( +. ) hash_1 hash
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Hacl.Spec.SHA2.block_t", "Spec.Hash.Definitions.words_state", "Lib.Sequence.map2", "Spec.Hash.Definitions.word", "Hacl.Spec.SHA2.op_Plus_Dot", "Hacl.Spec.SHA2.shuffle", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Spec.Hash.Definitions.word_t", "Lib.IntTypes.SEC", "Spec.Hash.Definitions.block_word_length", "Lib.ByteSequence.uints_from_bytes_be" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC (* Definition of the SHA2 word functions *) inline_for_extraction val _Ch: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Ch a x y z = (x &. y) ^. (~.x &. z) inline_for_extraction val _Maj: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Maj a x y z = (x &. y) ^. ((x &. z) ^. (y &. z)) inline_for_extraction val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma0 a x = (x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2) inline_for_extraction val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma1 a x = (x >>>. (op0 a).c3) ^. (x >>>. (op0 a).c4) ^. (x >>>. (op0 a).c5) inline_for_extraction val _sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma0 a x = (x >>>. (op0 a).e0) ^. (x >>>. (op0 a).e1) ^. (x >>. (op0 a).e2) inline_for_extraction val _sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma1 a x = (x >>>. (op0 a).e3) ^. (x >>>. (op0 a).e4) ^. (x >>. (op0 a).e5) let h0: a:sha2_alg -> Tot (words_state a) = function | SHA2_224 -> C.h224 | SHA2_256 -> C.h256 | SHA2_384 -> C.h384 | SHA2_512 -> C.h512 let k0: a:sha2_alg -> Tot (m:S.seq (word a) {S.length m = size_k_w a}) = function | SHA2_224 -> C.k224_256 | SHA2_256 -> C.k224_256 | SHA2_384 -> C.k384_512 | SHA2_512 -> C.k384_512 unfold let (.[]) = S.index (* Core shuffling function *) let shuffle_core_pre (a:sha2_alg) (k_t: word a) (ws_t: word a) (hash:words_state a) : Tot (words_state a) = (**) assert(7 <= S.length hash); let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in (**) assert(S.length (k0 a) = size_k_w a); let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. k_t +. ws_t in let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert_norm (List.Tot.length l = 8); S.seq_of_list l (* Scheduling function *) let ws_next_inner (a:sha2_alg) (i:nat{i < 16}) (ws:k_w a) : k_w a = let t16 = ws.[i] in let t15 = ws.[(i+1) % 16] in let t7 = ws.[(i+9) % 16] in let t2 = ws.[(i+14) % 16] in let s1 = _sigma1 a t2 in let s0 = _sigma0 a t15 in Seq.upd ws i (s1 +. t7 +. s0 +. t16) let ws_next (a:sha2_alg) (ws:k_w a) : k_w a = Lib.LoopCombinators.repeati 16 (ws_next_inner a) ws val shuffle_inner: a:sha2_alg -> ws:k_w a -> i:nat{i < num_rounds16 a} -> j:nat{j < 16} -> hash:words_state a -> words_state a let shuffle_inner a ws i j hash = let k_t = Seq.index (k0 a) (16 * i + j) in let ws_t = ws.[j] in shuffle_core_pre a k_t ws_t hash val shuffle_inner_loop: a:sha2_alg -> i:nat{i < num_rounds16 a} -> ws_st:tuple2 (k_w a) (words_state a) -> k_w a & words_state a let shuffle_inner_loop a i (ws, st) = let st' = Lib.LoopCombinators.repeati 16 (shuffle_inner a ws i) st in let ws' = if i < num_rounds16 a - 1 then ws_next a ws else ws in (ws', st') (* Full shuffling function *) let shuffle (a:sha2_alg) (ws:k_w a) (hash:words_state a) : Tot (words_state a) = let (ws, st) = Lib.LoopCombinators.repeati (num_rounds16 a) (shuffle_inner_loop a) (ws, hash) in st let init (a:sha2_alg) : words_state a = h0 a
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val update (a: sha2_alg) (block: block_t a) (hash: words_state a) : Tot (words_state a)
[]
Hacl.Spec.SHA2.update
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> block: Hacl.Spec.SHA2.block_t a -> hash: Spec.Hash.Definitions.words_state a -> Spec.Hash.Definitions.words_state a
{ "end_col": 37, "end_line": 233, "start_col": 85, "start_line": 230 }
Prims.Tot
val op_Greater_Greater_Greater_Dot: #a: sha2_alg -> word a -> rotval (word_t a) -> word a
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC
val op_Greater_Greater_Greater_Dot: #a: sha2_alg -> word a -> rotval (word_t a) -> word a let op_Greater_Greater_Greater_Dot (#a: sha2_alg) : word a -> rotval (word_t a) -> word a =
false
null
false
match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Lib.IntTypes.op_Greater_Greater_Greater_Dot", "Lib.IntTypes.U32", "Lib.IntTypes.SEC", "Lib.IntTypes.U64", "Spec.Hash.Definitions.word", "Lib.IntTypes.rotval", "Spec.Hash.Definitions.word_t" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val op_Greater_Greater_Greater_Dot: #a: sha2_alg -> word a -> rotval (word_t a) -> word a
[]
Hacl.Spec.SHA2.op_Greater_Greater_Greater_Dot
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
_: Spec.Hash.Definitions.word a -> _: Lib.IntTypes.rotval (Spec.Hash.Definitions.word_t a) -> Spec.Hash.Definitions.word a
{ "end_col": 45, "end_line": 112, "start_col": 2, "start_line": 110 }
Prims.Tot
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let sha384 (len:len_lt_max_a_t SHA2_384) (b:seq uint8{length b = len}) = hash #SHA2_384 len b
let sha384 (len: len_lt_max_a_t SHA2_384) (b: seq uint8 {length b = len}) =
false
null
false
hash #SHA2_384 len b
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Hacl.Spec.SHA2.len_lt_max_a_t", "Spec.Hash.Definitions.SHA2_384", "Lib.Sequence.seq", "Lib.IntTypes.uint8", "Prims.b2t", "Prims.op_Equality", "Prims.nat", "Lib.Sequence.length", "Hacl.Spec.SHA2.hash", "Lib.Sequence.lseq", "Spec.Hash.Definitions.hash_length" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC (* Definition of the SHA2 word functions *) inline_for_extraction val _Ch: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Ch a x y z = (x &. y) ^. (~.x &. z) inline_for_extraction val _Maj: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Maj a x y z = (x &. y) ^. ((x &. z) ^. (y &. z)) inline_for_extraction val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma0 a x = (x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2) inline_for_extraction val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma1 a x = (x >>>. (op0 a).c3) ^. (x >>>. (op0 a).c4) ^. (x >>>. (op0 a).c5) inline_for_extraction val _sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma0 a x = (x >>>. (op0 a).e0) ^. (x >>>. (op0 a).e1) ^. (x >>. (op0 a).e2) inline_for_extraction val _sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma1 a x = (x >>>. (op0 a).e3) ^. (x >>>. (op0 a).e4) ^. (x >>. (op0 a).e5) let h0: a:sha2_alg -> Tot (words_state a) = function | SHA2_224 -> C.h224 | SHA2_256 -> C.h256 | SHA2_384 -> C.h384 | SHA2_512 -> C.h512 let k0: a:sha2_alg -> Tot (m:S.seq (word a) {S.length m = size_k_w a}) = function | SHA2_224 -> C.k224_256 | SHA2_256 -> C.k224_256 | SHA2_384 -> C.k384_512 | SHA2_512 -> C.k384_512 unfold let (.[]) = S.index (* Core shuffling function *) let shuffle_core_pre (a:sha2_alg) (k_t: word a) (ws_t: word a) (hash:words_state a) : Tot (words_state a) = (**) assert(7 <= S.length hash); let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in (**) assert(S.length (k0 a) = size_k_w a); let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. k_t +. ws_t in let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert_norm (List.Tot.length l = 8); S.seq_of_list l (* Scheduling function *) let ws_next_inner (a:sha2_alg) (i:nat{i < 16}) (ws:k_w a) : k_w a = let t16 = ws.[i] in let t15 = ws.[(i+1) % 16] in let t7 = ws.[(i+9) % 16] in let t2 = ws.[(i+14) % 16] in let s1 = _sigma1 a t2 in let s0 = _sigma0 a t15 in Seq.upd ws i (s1 +. t7 +. s0 +. t16) let ws_next (a:sha2_alg) (ws:k_w a) : k_w a = Lib.LoopCombinators.repeati 16 (ws_next_inner a) ws val shuffle_inner: a:sha2_alg -> ws:k_w a -> i:nat{i < num_rounds16 a} -> j:nat{j < 16} -> hash:words_state a -> words_state a let shuffle_inner a ws i j hash = let k_t = Seq.index (k0 a) (16 * i + j) in let ws_t = ws.[j] in shuffle_core_pre a k_t ws_t hash val shuffle_inner_loop: a:sha2_alg -> i:nat{i < num_rounds16 a} -> ws_st:tuple2 (k_w a) (words_state a) -> k_w a & words_state a let shuffle_inner_loop a i (ws, st) = let st' = Lib.LoopCombinators.repeati 16 (shuffle_inner a ws i) st in let ws' = if i < num_rounds16 a - 1 then ws_next a ws else ws in (ws', st') (* Full shuffling function *) let shuffle (a:sha2_alg) (ws:k_w a) (hash:words_state a) : Tot (words_state a) = let (ws, st) = Lib.LoopCombinators.repeati (num_rounds16 a) (shuffle_inner_loop a) (ws, hash) in st let init (a:sha2_alg) : words_state a = h0 a let update (a:sha2_alg) (block:block_t a) (hash:words_state a): Tot (words_state a) = let block_w = Lib.ByteSequence.uints_from_bytes_be #(word_t a) #SEC #(block_word_length a) block in let hash_1 = shuffle a block_w hash in map2 #_ #_ #_ #8 ( +. ) hash_1 hash let padded_blocks (a:sha2_alg) (len:nat{len <= block_length a}) : n:nat{n <= 2} = if (len + len_length a + 1 <= block_length a) then 1 else 2 let load_last (a:sha2_alg) (totlen_seq:lseq uint8 (len_length a)) (fin:nat{fin == block_length a \/ fin == 2 * block_length a}) (len:nat{len <= block_length a}) (b:bytes{S.length b = len}) : (block_t a & block_t a) = let last = create (2 * block_length a) (u8 0) in let last = update_sub last 0 len b in let last = last.[len] <- u8 0x80 in let last = update_sub last (fin - len_length a) (len_length a) totlen_seq in let b0 = sub last 0 (block_length a) in let b1 = sub last (block_length a) (block_length a) in (b0, b1) let update_last (a:sha2_alg) (totlen:len_t a) (len:nat{len <= block_length a}) (b:bytes{S.length b = len}) (hash:words_state a) : Tot (words_state a) = let blocks = padded_blocks a len in let fin = blocks * block_length a in let total_len_bits = secret (shift_left #(len_int_type a) totlen 3ul) in let totlen_seq = Lib.ByteSequence.uint_to_bytes_be #(len_int_type a) total_len_bits in let (b0, b1) = load_last a totlen_seq fin len b in let hash = update a b0 hash in if blocks > 1 then update a b1 hash else hash let store_state (a:sha2_alg) (hashw:words_state a) : Tot (lseq uint8 (8 * word_length a)) = Lib.ByteSequence.uints_to_bytes_be #(word_t a) #SEC #8 hashw let emit (a:sha2_alg) (h:lseq uint8 (8 * word_length a)) : Tot (lseq uint8 (hash_length a)) = sub h 0 (hash_length a) let finish (a:sha2_alg) (st:words_state a) : Tot (lseq uint8 (hash_length a)) = let hseq = store_state a st in emit a hseq let update_block (a:sha2_alg) (len:len_lt_max_a_t a) (b:seq uint8{length b = len}) (i:nat{i < len / block_length a}) (st:words_state a) : words_state a = let mb = Seq.slice b (i * block_length a) (i * block_length a + block_length a) in update a mb st let update_nblocks (a:sha2_alg) (len:len_lt_max_a_t a) (b:seq uint8{length b = len}) (st:words_state a) : words_state a = let blocks = len / block_length a in Lib.LoopCombinators.repeati blocks (update_block a len b) st let hash (#a:sha2_alg) (len:len_lt_max_a_t a) (b:seq uint8{length b = len}) = let len' : len_t a = mk_len_t a len in let st = init a in let st = update_nblocks a len b st in let rem = len % block_length a in let mb = Seq.slice b (len - rem) len in let st = update_last a len' rem mb st in finish a st let sha224 (len:len_lt_max_a_t SHA2_224) (b:seq uint8{length b = len}) = hash #SHA2_224 len b let sha256 (len:len_lt_max_a_t SHA2_256) (b:seq uint8{length b = len}) = hash #SHA2_256 len b
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val sha384 : len: Hacl.Spec.SHA2.len_lt_max_a_t Spec.Hash.Definitions.SHA2_384 -> b: Lib.Sequence.seq Lib.IntTypes.uint8 {Lib.Sequence.length b = len} -> Lib.Sequence.lseq Lib.IntTypes.uint8 (Spec.Hash.Definitions.hash_length Spec.Hash.Definitions.SHA2_384)
[]
Hacl.Spec.SHA2.sha384
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
len: Hacl.Spec.SHA2.len_lt_max_a_t Spec.Hash.Definitions.SHA2_384 -> b: Lib.Sequence.seq Lib.IntTypes.uint8 {Lib.Sequence.length b = len} -> Lib.Sequence.lseq Lib.IntTypes.uint8 (Spec.Hash.Definitions.hash_length Spec.Hash.Definitions.SHA2_384)
{ "end_col": 22, "end_line": 307, "start_col": 2, "start_line": 307 }
Prims.Tot
val shuffle_inner: a:sha2_alg -> ws:k_w a -> i:nat{i < num_rounds16 a} -> j:nat{j < 16} -> hash:words_state a -> words_state a
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let shuffle_inner a ws i j hash = let k_t = Seq.index (k0 a) (16 * i + j) in let ws_t = ws.[j] in shuffle_core_pre a k_t ws_t hash
val shuffle_inner: a:sha2_alg -> ws:k_w a -> i:nat{i < num_rounds16 a} -> j:nat{j < 16} -> hash:words_state a -> words_state a let shuffle_inner a ws i j hash =
false
null
false
let k_t = Seq.index (k0 a) (16 * i + j) in let ws_t = ws.[ j ] in shuffle_core_pre a k_t ws_t hash
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Hacl.Spec.SHA2.k_w", "Prims.nat", "Prims.b2t", "Prims.op_LessThan", "Hacl.Spec.SHA2.num_rounds16", "Spec.Hash.Definitions.words_state", "Hacl.Spec.SHA2.shuffle_core_pre", "Spec.Hash.Definitions.word", "Hacl.Spec.SHA2.op_String_Access", "FStar.Seq.Base.index", "Hacl.Spec.SHA2.k0", "Prims.op_Addition", "FStar.Mul.op_Star" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC (* Definition of the SHA2 word functions *) inline_for_extraction val _Ch: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Ch a x y z = (x &. y) ^. (~.x &. z) inline_for_extraction val _Maj: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Maj a x y z = (x &. y) ^. ((x &. z) ^. (y &. z)) inline_for_extraction val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma0 a x = (x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2) inline_for_extraction val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma1 a x = (x >>>. (op0 a).c3) ^. (x >>>. (op0 a).c4) ^. (x >>>. (op0 a).c5) inline_for_extraction val _sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma0 a x = (x >>>. (op0 a).e0) ^. (x >>>. (op0 a).e1) ^. (x >>. (op0 a).e2) inline_for_extraction val _sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma1 a x = (x >>>. (op0 a).e3) ^. (x >>>. (op0 a).e4) ^. (x >>. (op0 a).e5) let h0: a:sha2_alg -> Tot (words_state a) = function | SHA2_224 -> C.h224 | SHA2_256 -> C.h256 | SHA2_384 -> C.h384 | SHA2_512 -> C.h512 let k0: a:sha2_alg -> Tot (m:S.seq (word a) {S.length m = size_k_w a}) = function | SHA2_224 -> C.k224_256 | SHA2_256 -> C.k224_256 | SHA2_384 -> C.k384_512 | SHA2_512 -> C.k384_512 unfold let (.[]) = S.index (* Core shuffling function *) let shuffle_core_pre (a:sha2_alg) (k_t: word a) (ws_t: word a) (hash:words_state a) : Tot (words_state a) = (**) assert(7 <= S.length hash); let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in (**) assert(S.length (k0 a) = size_k_w a); let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. k_t +. ws_t in let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert_norm (List.Tot.length l = 8); S.seq_of_list l (* Scheduling function *) let ws_next_inner (a:sha2_alg) (i:nat{i < 16}) (ws:k_w a) : k_w a = let t16 = ws.[i] in let t15 = ws.[(i+1) % 16] in let t7 = ws.[(i+9) % 16] in let t2 = ws.[(i+14) % 16] in let s1 = _sigma1 a t2 in let s0 = _sigma0 a t15 in Seq.upd ws i (s1 +. t7 +. s0 +. t16) let ws_next (a:sha2_alg) (ws:k_w a) : k_w a = Lib.LoopCombinators.repeati 16 (ws_next_inner a) ws val shuffle_inner: a:sha2_alg -> ws:k_w a -> i:nat{i < num_rounds16 a} -> j:nat{j < 16} -> hash:words_state a -> words_state a
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val shuffle_inner: a:sha2_alg -> ws:k_w a -> i:nat{i < num_rounds16 a} -> j:nat{j < 16} -> hash:words_state a -> words_state a
[]
Hacl.Spec.SHA2.shuffle_inner
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> ws: Hacl.Spec.SHA2.k_w a -> i: Prims.nat{i < Hacl.Spec.SHA2.num_rounds16 a} -> j: Prims.nat{j < 16} -> hash: Spec.Hash.Definitions.words_state a -> Spec.Hash.Definitions.words_state a
{ "end_col": 34, "end_line": 207, "start_col": 33, "start_line": 204 }
Prims.Tot
val h0 (a: sha2_alg) : Tot (words_state a)
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let h0: a:sha2_alg -> Tot (words_state a) = function | SHA2_224 -> C.h224 | SHA2_256 -> C.h256 | SHA2_384 -> C.h384 | SHA2_512 -> C.h512
val h0 (a: sha2_alg) : Tot (words_state a) let h0: a: sha2_alg -> Tot (words_state a) =
false
null
false
function | SHA2_224 -> C.h224 | SHA2_256 -> C.h256 | SHA2_384 -> C.h384 | SHA2_512 -> C.h512
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Spec.SHA2.Constants.h224", "Spec.SHA2.Constants.h256", "Spec.SHA2.Constants.h384", "Spec.SHA2.Constants.h512", "Spec.Hash.Definitions.words_state" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC (* Definition of the SHA2 word functions *) inline_for_extraction val _Ch: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Ch a x y z = (x &. y) ^. (~.x &. z) inline_for_extraction val _Maj: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Maj a x y z = (x &. y) ^. ((x &. z) ^. (y &. z)) inline_for_extraction val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma0 a x = (x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2) inline_for_extraction val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma1 a x = (x >>>. (op0 a).c3) ^. (x >>>. (op0 a).c4) ^. (x >>>. (op0 a).c5) inline_for_extraction val _sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma0 a x = (x >>>. (op0 a).e0) ^. (x >>>. (op0 a).e1) ^. (x >>. (op0 a).e2) inline_for_extraction val _sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma1 a x = (x >>>. (op0 a).e3) ^. (x >>>. (op0 a).e4) ^. (x >>. (op0 a).e5)
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val h0 (a: sha2_alg) : Tot (words_state a)
[]
Hacl.Spec.SHA2.h0
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> Spec.Hash.Definitions.words_state a
{ "end_col": 22, "end_line": 149, "start_col": 44, "start_line": 145 }
Prims.Tot
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let sha256 (len:len_lt_max_a_t SHA2_256) (b:seq uint8{length b = len}) = hash #SHA2_256 len b
let sha256 (len: len_lt_max_a_t SHA2_256) (b: seq uint8 {length b = len}) =
false
null
false
hash #SHA2_256 len b
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Hacl.Spec.SHA2.len_lt_max_a_t", "Spec.Hash.Definitions.SHA2_256", "Lib.Sequence.seq", "Lib.IntTypes.uint8", "Prims.b2t", "Prims.op_Equality", "Prims.nat", "Lib.Sequence.length", "Hacl.Spec.SHA2.hash", "Lib.Sequence.lseq", "Spec.Hash.Definitions.hash_length" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC (* Definition of the SHA2 word functions *) inline_for_extraction val _Ch: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Ch a x y z = (x &. y) ^. (~.x &. z) inline_for_extraction val _Maj: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Maj a x y z = (x &. y) ^. ((x &. z) ^. (y &. z)) inline_for_extraction val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma0 a x = (x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2) inline_for_extraction val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma1 a x = (x >>>. (op0 a).c3) ^. (x >>>. (op0 a).c4) ^. (x >>>. (op0 a).c5) inline_for_extraction val _sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma0 a x = (x >>>. (op0 a).e0) ^. (x >>>. (op0 a).e1) ^. (x >>. (op0 a).e2) inline_for_extraction val _sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma1 a x = (x >>>. (op0 a).e3) ^. (x >>>. (op0 a).e4) ^. (x >>. (op0 a).e5) let h0: a:sha2_alg -> Tot (words_state a) = function | SHA2_224 -> C.h224 | SHA2_256 -> C.h256 | SHA2_384 -> C.h384 | SHA2_512 -> C.h512 let k0: a:sha2_alg -> Tot (m:S.seq (word a) {S.length m = size_k_w a}) = function | SHA2_224 -> C.k224_256 | SHA2_256 -> C.k224_256 | SHA2_384 -> C.k384_512 | SHA2_512 -> C.k384_512 unfold let (.[]) = S.index (* Core shuffling function *) let shuffle_core_pre (a:sha2_alg) (k_t: word a) (ws_t: word a) (hash:words_state a) : Tot (words_state a) = (**) assert(7 <= S.length hash); let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in (**) assert(S.length (k0 a) = size_k_w a); let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. k_t +. ws_t in let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert_norm (List.Tot.length l = 8); S.seq_of_list l (* Scheduling function *) let ws_next_inner (a:sha2_alg) (i:nat{i < 16}) (ws:k_w a) : k_w a = let t16 = ws.[i] in let t15 = ws.[(i+1) % 16] in let t7 = ws.[(i+9) % 16] in let t2 = ws.[(i+14) % 16] in let s1 = _sigma1 a t2 in let s0 = _sigma0 a t15 in Seq.upd ws i (s1 +. t7 +. s0 +. t16) let ws_next (a:sha2_alg) (ws:k_w a) : k_w a = Lib.LoopCombinators.repeati 16 (ws_next_inner a) ws val shuffle_inner: a:sha2_alg -> ws:k_w a -> i:nat{i < num_rounds16 a} -> j:nat{j < 16} -> hash:words_state a -> words_state a let shuffle_inner a ws i j hash = let k_t = Seq.index (k0 a) (16 * i + j) in let ws_t = ws.[j] in shuffle_core_pre a k_t ws_t hash val shuffle_inner_loop: a:sha2_alg -> i:nat{i < num_rounds16 a} -> ws_st:tuple2 (k_w a) (words_state a) -> k_w a & words_state a let shuffle_inner_loop a i (ws, st) = let st' = Lib.LoopCombinators.repeati 16 (shuffle_inner a ws i) st in let ws' = if i < num_rounds16 a - 1 then ws_next a ws else ws in (ws', st') (* Full shuffling function *) let shuffle (a:sha2_alg) (ws:k_w a) (hash:words_state a) : Tot (words_state a) = let (ws, st) = Lib.LoopCombinators.repeati (num_rounds16 a) (shuffle_inner_loop a) (ws, hash) in st let init (a:sha2_alg) : words_state a = h0 a let update (a:sha2_alg) (block:block_t a) (hash:words_state a): Tot (words_state a) = let block_w = Lib.ByteSequence.uints_from_bytes_be #(word_t a) #SEC #(block_word_length a) block in let hash_1 = shuffle a block_w hash in map2 #_ #_ #_ #8 ( +. ) hash_1 hash let padded_blocks (a:sha2_alg) (len:nat{len <= block_length a}) : n:nat{n <= 2} = if (len + len_length a + 1 <= block_length a) then 1 else 2 let load_last (a:sha2_alg) (totlen_seq:lseq uint8 (len_length a)) (fin:nat{fin == block_length a \/ fin == 2 * block_length a}) (len:nat{len <= block_length a}) (b:bytes{S.length b = len}) : (block_t a & block_t a) = let last = create (2 * block_length a) (u8 0) in let last = update_sub last 0 len b in let last = last.[len] <- u8 0x80 in let last = update_sub last (fin - len_length a) (len_length a) totlen_seq in let b0 = sub last 0 (block_length a) in let b1 = sub last (block_length a) (block_length a) in (b0, b1) let update_last (a:sha2_alg) (totlen:len_t a) (len:nat{len <= block_length a}) (b:bytes{S.length b = len}) (hash:words_state a) : Tot (words_state a) = let blocks = padded_blocks a len in let fin = blocks * block_length a in let total_len_bits = secret (shift_left #(len_int_type a) totlen 3ul) in let totlen_seq = Lib.ByteSequence.uint_to_bytes_be #(len_int_type a) total_len_bits in let (b0, b1) = load_last a totlen_seq fin len b in let hash = update a b0 hash in if blocks > 1 then update a b1 hash else hash let store_state (a:sha2_alg) (hashw:words_state a) : Tot (lseq uint8 (8 * word_length a)) = Lib.ByteSequence.uints_to_bytes_be #(word_t a) #SEC #8 hashw let emit (a:sha2_alg) (h:lseq uint8 (8 * word_length a)) : Tot (lseq uint8 (hash_length a)) = sub h 0 (hash_length a) let finish (a:sha2_alg) (st:words_state a) : Tot (lseq uint8 (hash_length a)) = let hseq = store_state a st in emit a hseq let update_block (a:sha2_alg) (len:len_lt_max_a_t a) (b:seq uint8{length b = len}) (i:nat{i < len / block_length a}) (st:words_state a) : words_state a = let mb = Seq.slice b (i * block_length a) (i * block_length a + block_length a) in update a mb st let update_nblocks (a:sha2_alg) (len:len_lt_max_a_t a) (b:seq uint8{length b = len}) (st:words_state a) : words_state a = let blocks = len / block_length a in Lib.LoopCombinators.repeati blocks (update_block a len b) st let hash (#a:sha2_alg) (len:len_lt_max_a_t a) (b:seq uint8{length b = len}) = let len' : len_t a = mk_len_t a len in let st = init a in let st = update_nblocks a len b st in let rem = len % block_length a in let mb = Seq.slice b (len - rem) len in let st = update_last a len' rem mb st in finish a st let sha224 (len:len_lt_max_a_t SHA2_224) (b:seq uint8{length b = len}) = hash #SHA2_224 len b
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val sha256 : len: Hacl.Spec.SHA2.len_lt_max_a_t Spec.Hash.Definitions.SHA2_256 -> b: Lib.Sequence.seq Lib.IntTypes.uint8 {Lib.Sequence.length b = len} -> Lib.Sequence.lseq Lib.IntTypes.uint8 (Spec.Hash.Definitions.hash_length Spec.Hash.Definitions.SHA2_256)
[]
Hacl.Spec.SHA2.sha256
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
len: Hacl.Spec.SHA2.len_lt_max_a_t Spec.Hash.Definitions.SHA2_256 -> b: Lib.Sequence.seq Lib.IntTypes.uint8 {Lib.Sequence.length b = len} -> Lib.Sequence.lseq Lib.IntTypes.uint8 (Spec.Hash.Definitions.hash_length Spec.Hash.Definitions.SHA2_256)
{ "end_col": 22, "end_line": 304, "start_col": 2, "start_line": 304 }
Prims.Tot
val _sigma0: a:sha2_alg -> x:(word a) -> Tot (word a)
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let _sigma0 a x = (x >>>. (op0 a).e0) ^. (x >>>. (op0 a).e1) ^. (x >>. (op0 a).e2)
val _sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma0 a x =
false
null
false
(x >>>. (op0 a).e0) ^. (x >>>. (op0 a).e1) ^. (x >>. (op0 a).e2)
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Spec.Hash.Definitions.word", "Hacl.Spec.SHA2.op_Hat_Dot", "Hacl.Spec.SHA2.op_Greater_Greater_Greater_Dot", "Hacl.Spec.SHA2.__proj__Mkops__item__e0", "Hacl.Spec.SHA2.op0", "Hacl.Spec.SHA2.__proj__Mkops__item__e1", "Hacl.Spec.SHA2.op_Greater_Greater_Dot", "Hacl.Spec.SHA2.__proj__Mkops__item__e2" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC (* Definition of the SHA2 word functions *) inline_for_extraction val _Ch: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Ch a x y z = (x &. y) ^. (~.x &. z) inline_for_extraction val _Maj: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Maj a x y z = (x &. y) ^. ((x &. z) ^. (y &. z)) inline_for_extraction val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma0 a x = (x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2) inline_for_extraction val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma1 a x = (x >>>. (op0 a).c3) ^. (x >>>. (op0 a).c4) ^. (x >>>. (op0 a).c5) inline_for_extraction
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val _sigma0: a:sha2_alg -> x:(word a) -> Tot (word a)
[]
Hacl.Spec.SHA2._sigma0
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> x: Spec.Hash.Definitions.word a -> Spec.Hash.Definitions.word a
{ "end_col": 82, "end_line": 139, "start_col": 18, "start_line": 139 }
Prims.Tot
val k0 (a: sha2_alg) : Tot (m: S.seq (word a) {S.length m = size_k_w a})
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let k0: a:sha2_alg -> Tot (m:S.seq (word a) {S.length m = size_k_w a}) = function | SHA2_224 -> C.k224_256 | SHA2_256 -> C.k224_256 | SHA2_384 -> C.k384_512 | SHA2_512 -> C.k384_512
val k0 (a: sha2_alg) : Tot (m: S.seq (word a) {S.length m = size_k_w a}) let k0: a: sha2_alg -> Tot (m: S.seq (word a) {S.length m = size_k_w a}) =
false
null
false
function | SHA2_224 -> C.k224_256 | SHA2_256 -> C.k224_256 | SHA2_384 -> C.k384_512 | SHA2_512 -> C.k384_512
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Spec.SHA2.Constants.k224_256", "Spec.SHA2.Constants.k384_512", "FStar.Seq.Base.seq", "Spec.Hash.Definitions.word", "Prims.b2t", "Prims.op_Equality", "Prims.nat", "FStar.Seq.Base.length", "Hacl.Spec.SHA2.size_k_w" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC (* Definition of the SHA2 word functions *) inline_for_extraction val _Ch: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Ch a x y z = (x &. y) ^. (~.x &. z) inline_for_extraction val _Maj: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Maj a x y z = (x &. y) ^. ((x &. z) ^. (y &. z)) inline_for_extraction val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma0 a x = (x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2) inline_for_extraction val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma1 a x = (x >>>. (op0 a).c3) ^. (x >>>. (op0 a).c4) ^. (x >>>. (op0 a).c5) inline_for_extraction val _sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma0 a x = (x >>>. (op0 a).e0) ^. (x >>>. (op0 a).e1) ^. (x >>. (op0 a).e2) inline_for_extraction val _sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma1 a x = (x >>>. (op0 a).e3) ^. (x >>>. (op0 a).e4) ^. (x >>. (op0 a).e5) let h0: a:sha2_alg -> Tot (words_state a) = function | SHA2_224 -> C.h224 | SHA2_256 -> C.h256 | SHA2_384 -> C.h384 | SHA2_512 -> C.h512
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val k0 (a: sha2_alg) : Tot (m: S.seq (word a) {S.length m = size_k_w a})
[]
Hacl.Spec.SHA2.k0
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> m: FStar.Seq.Base.seq (Spec.Hash.Definitions.word a) {FStar.Seq.Base.length m = Hacl.Spec.SHA2.size_k_w a}
{ "end_col": 26, "end_line": 155, "start_col": 73, "start_line": 151 }
Prims.Tot
val finish (a: sha2_alg) (st: words_state a) : Tot (lseq uint8 (hash_length a))
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let finish (a:sha2_alg) (st:words_state a) : Tot (lseq uint8 (hash_length a)) = let hseq = store_state a st in emit a hseq
val finish (a: sha2_alg) (st: words_state a) : Tot (lseq uint8 (hash_length a)) let finish (a: sha2_alg) (st: words_state a) : Tot (lseq uint8 (hash_length a)) =
false
null
false
let hseq = store_state a st in emit a hseq
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Spec.Hash.Definitions.words_state", "Hacl.Spec.SHA2.emit", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Prims.op_Multiply", "Spec.Hash.Definitions.word_length", "Hacl.Spec.SHA2.store_state", "Lib.IntTypes.uint8", "Spec.Hash.Definitions.hash_length" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC (* Definition of the SHA2 word functions *) inline_for_extraction val _Ch: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Ch a x y z = (x &. y) ^. (~.x &. z) inline_for_extraction val _Maj: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Maj a x y z = (x &. y) ^. ((x &. z) ^. (y &. z)) inline_for_extraction val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma0 a x = (x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2) inline_for_extraction val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma1 a x = (x >>>. (op0 a).c3) ^. (x >>>. (op0 a).c4) ^. (x >>>. (op0 a).c5) inline_for_extraction val _sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma0 a x = (x >>>. (op0 a).e0) ^. (x >>>. (op0 a).e1) ^. (x >>. (op0 a).e2) inline_for_extraction val _sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma1 a x = (x >>>. (op0 a).e3) ^. (x >>>. (op0 a).e4) ^. (x >>. (op0 a).e5) let h0: a:sha2_alg -> Tot (words_state a) = function | SHA2_224 -> C.h224 | SHA2_256 -> C.h256 | SHA2_384 -> C.h384 | SHA2_512 -> C.h512 let k0: a:sha2_alg -> Tot (m:S.seq (word a) {S.length m = size_k_w a}) = function | SHA2_224 -> C.k224_256 | SHA2_256 -> C.k224_256 | SHA2_384 -> C.k384_512 | SHA2_512 -> C.k384_512 unfold let (.[]) = S.index (* Core shuffling function *) let shuffle_core_pre (a:sha2_alg) (k_t: word a) (ws_t: word a) (hash:words_state a) : Tot (words_state a) = (**) assert(7 <= S.length hash); let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in (**) assert(S.length (k0 a) = size_k_w a); let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. k_t +. ws_t in let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert_norm (List.Tot.length l = 8); S.seq_of_list l (* Scheduling function *) let ws_next_inner (a:sha2_alg) (i:nat{i < 16}) (ws:k_w a) : k_w a = let t16 = ws.[i] in let t15 = ws.[(i+1) % 16] in let t7 = ws.[(i+9) % 16] in let t2 = ws.[(i+14) % 16] in let s1 = _sigma1 a t2 in let s0 = _sigma0 a t15 in Seq.upd ws i (s1 +. t7 +. s0 +. t16) let ws_next (a:sha2_alg) (ws:k_w a) : k_w a = Lib.LoopCombinators.repeati 16 (ws_next_inner a) ws val shuffle_inner: a:sha2_alg -> ws:k_w a -> i:nat{i < num_rounds16 a} -> j:nat{j < 16} -> hash:words_state a -> words_state a let shuffle_inner a ws i j hash = let k_t = Seq.index (k0 a) (16 * i + j) in let ws_t = ws.[j] in shuffle_core_pre a k_t ws_t hash val shuffle_inner_loop: a:sha2_alg -> i:nat{i < num_rounds16 a} -> ws_st:tuple2 (k_w a) (words_state a) -> k_w a & words_state a let shuffle_inner_loop a i (ws, st) = let st' = Lib.LoopCombinators.repeati 16 (shuffle_inner a ws i) st in let ws' = if i < num_rounds16 a - 1 then ws_next a ws else ws in (ws', st') (* Full shuffling function *) let shuffle (a:sha2_alg) (ws:k_w a) (hash:words_state a) : Tot (words_state a) = let (ws, st) = Lib.LoopCombinators.repeati (num_rounds16 a) (shuffle_inner_loop a) (ws, hash) in st let init (a:sha2_alg) : words_state a = h0 a let update (a:sha2_alg) (block:block_t a) (hash:words_state a): Tot (words_state a) = let block_w = Lib.ByteSequence.uints_from_bytes_be #(word_t a) #SEC #(block_word_length a) block in let hash_1 = shuffle a block_w hash in map2 #_ #_ #_ #8 ( +. ) hash_1 hash let padded_blocks (a:sha2_alg) (len:nat{len <= block_length a}) : n:nat{n <= 2} = if (len + len_length a + 1 <= block_length a) then 1 else 2 let load_last (a:sha2_alg) (totlen_seq:lseq uint8 (len_length a)) (fin:nat{fin == block_length a \/ fin == 2 * block_length a}) (len:nat{len <= block_length a}) (b:bytes{S.length b = len}) : (block_t a & block_t a) = let last = create (2 * block_length a) (u8 0) in let last = update_sub last 0 len b in let last = last.[len] <- u8 0x80 in let last = update_sub last (fin - len_length a) (len_length a) totlen_seq in let b0 = sub last 0 (block_length a) in let b1 = sub last (block_length a) (block_length a) in (b0, b1) let update_last (a:sha2_alg) (totlen:len_t a) (len:nat{len <= block_length a}) (b:bytes{S.length b = len}) (hash:words_state a) : Tot (words_state a) = let blocks = padded_blocks a len in let fin = blocks * block_length a in let total_len_bits = secret (shift_left #(len_int_type a) totlen 3ul) in let totlen_seq = Lib.ByteSequence.uint_to_bytes_be #(len_int_type a) total_len_bits in let (b0, b1) = load_last a totlen_seq fin len b in let hash = update a b0 hash in if blocks > 1 then update a b1 hash else hash let store_state (a:sha2_alg) (hashw:words_state a) : Tot (lseq uint8 (8 * word_length a)) = Lib.ByteSequence.uints_to_bytes_be #(word_t a) #SEC #8 hashw let emit (a:sha2_alg) (h:lseq uint8 (8 * word_length a)) : Tot (lseq uint8 (hash_length a)) = sub h 0 (hash_length a)
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val finish (a: sha2_alg) (st: words_state a) : Tot (lseq uint8 (hash_length a))
[]
Hacl.Spec.SHA2.finish
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> st: Spec.Hash.Definitions.words_state a -> Lib.Sequence.lseq Lib.IntTypes.uint8 (Spec.Hash.Definitions.hash_length a)
{ "end_col": 13, "end_line": 276, "start_col": 79, "start_line": 274 }
Prims.Tot
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let hash (#a:sha2_alg) (len:len_lt_max_a_t a) (b:seq uint8{length b = len}) = let len' : len_t a = mk_len_t a len in let st = init a in let st = update_nblocks a len b st in let rem = len % block_length a in let mb = Seq.slice b (len - rem) len in let st = update_last a len' rem mb st in finish a st
let hash (#a: sha2_alg) (len: len_lt_max_a_t a) (b: seq uint8 {length b = len}) =
false
null
false
let len':len_t a = mk_len_t a len in let st = init a in let st = update_nblocks a len b st in let rem = len % block_length a in let mb = Seq.slice b (len - rem) len in let st = update_last a len' rem mb st in finish a st
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Hacl.Spec.SHA2.len_lt_max_a_t", "Lib.Sequence.seq", "Lib.IntTypes.uint8", "Prims.b2t", "Prims.op_Equality", "Prims.nat", "Lib.Sequence.length", "Hacl.Spec.SHA2.finish", "Spec.Hash.Definitions.words_state", "Hacl.Spec.SHA2.update_last", "FStar.Seq.Base.seq", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "FStar.Seq.Base.slice", "Prims.op_Subtraction", "Prims.int", "Prims.op_Modulus", "Spec.Hash.Definitions.block_length", "Hacl.Spec.SHA2.update_nblocks", "Hacl.Spec.SHA2.init", "Spec.Hash.Definitions.len_t", "Hacl.Spec.SHA2.mk_len_t", "Lib.Sequence.lseq", "Spec.Hash.Definitions.hash_length" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC (* Definition of the SHA2 word functions *) inline_for_extraction val _Ch: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Ch a x y z = (x &. y) ^. (~.x &. z) inline_for_extraction val _Maj: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Maj a x y z = (x &. y) ^. ((x &. z) ^. (y &. z)) inline_for_extraction val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma0 a x = (x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2) inline_for_extraction val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma1 a x = (x >>>. (op0 a).c3) ^. (x >>>. (op0 a).c4) ^. (x >>>. (op0 a).c5) inline_for_extraction val _sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma0 a x = (x >>>. (op0 a).e0) ^. (x >>>. (op0 a).e1) ^. (x >>. (op0 a).e2) inline_for_extraction val _sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma1 a x = (x >>>. (op0 a).e3) ^. (x >>>. (op0 a).e4) ^. (x >>. (op0 a).e5) let h0: a:sha2_alg -> Tot (words_state a) = function | SHA2_224 -> C.h224 | SHA2_256 -> C.h256 | SHA2_384 -> C.h384 | SHA2_512 -> C.h512 let k0: a:sha2_alg -> Tot (m:S.seq (word a) {S.length m = size_k_w a}) = function | SHA2_224 -> C.k224_256 | SHA2_256 -> C.k224_256 | SHA2_384 -> C.k384_512 | SHA2_512 -> C.k384_512 unfold let (.[]) = S.index (* Core shuffling function *) let shuffle_core_pre (a:sha2_alg) (k_t: word a) (ws_t: word a) (hash:words_state a) : Tot (words_state a) = (**) assert(7 <= S.length hash); let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in (**) assert(S.length (k0 a) = size_k_w a); let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. k_t +. ws_t in let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert_norm (List.Tot.length l = 8); S.seq_of_list l (* Scheduling function *) let ws_next_inner (a:sha2_alg) (i:nat{i < 16}) (ws:k_w a) : k_w a = let t16 = ws.[i] in let t15 = ws.[(i+1) % 16] in let t7 = ws.[(i+9) % 16] in let t2 = ws.[(i+14) % 16] in let s1 = _sigma1 a t2 in let s0 = _sigma0 a t15 in Seq.upd ws i (s1 +. t7 +. s0 +. t16) let ws_next (a:sha2_alg) (ws:k_w a) : k_w a = Lib.LoopCombinators.repeati 16 (ws_next_inner a) ws val shuffle_inner: a:sha2_alg -> ws:k_w a -> i:nat{i < num_rounds16 a} -> j:nat{j < 16} -> hash:words_state a -> words_state a let shuffle_inner a ws i j hash = let k_t = Seq.index (k0 a) (16 * i + j) in let ws_t = ws.[j] in shuffle_core_pre a k_t ws_t hash val shuffle_inner_loop: a:sha2_alg -> i:nat{i < num_rounds16 a} -> ws_st:tuple2 (k_w a) (words_state a) -> k_w a & words_state a let shuffle_inner_loop a i (ws, st) = let st' = Lib.LoopCombinators.repeati 16 (shuffle_inner a ws i) st in let ws' = if i < num_rounds16 a - 1 then ws_next a ws else ws in (ws', st') (* Full shuffling function *) let shuffle (a:sha2_alg) (ws:k_w a) (hash:words_state a) : Tot (words_state a) = let (ws, st) = Lib.LoopCombinators.repeati (num_rounds16 a) (shuffle_inner_loop a) (ws, hash) in st let init (a:sha2_alg) : words_state a = h0 a let update (a:sha2_alg) (block:block_t a) (hash:words_state a): Tot (words_state a) = let block_w = Lib.ByteSequence.uints_from_bytes_be #(word_t a) #SEC #(block_word_length a) block in let hash_1 = shuffle a block_w hash in map2 #_ #_ #_ #8 ( +. ) hash_1 hash let padded_blocks (a:sha2_alg) (len:nat{len <= block_length a}) : n:nat{n <= 2} = if (len + len_length a + 1 <= block_length a) then 1 else 2 let load_last (a:sha2_alg) (totlen_seq:lseq uint8 (len_length a)) (fin:nat{fin == block_length a \/ fin == 2 * block_length a}) (len:nat{len <= block_length a}) (b:bytes{S.length b = len}) : (block_t a & block_t a) = let last = create (2 * block_length a) (u8 0) in let last = update_sub last 0 len b in let last = last.[len] <- u8 0x80 in let last = update_sub last (fin - len_length a) (len_length a) totlen_seq in let b0 = sub last 0 (block_length a) in let b1 = sub last (block_length a) (block_length a) in (b0, b1) let update_last (a:sha2_alg) (totlen:len_t a) (len:nat{len <= block_length a}) (b:bytes{S.length b = len}) (hash:words_state a) : Tot (words_state a) = let blocks = padded_blocks a len in let fin = blocks * block_length a in let total_len_bits = secret (shift_left #(len_int_type a) totlen 3ul) in let totlen_seq = Lib.ByteSequence.uint_to_bytes_be #(len_int_type a) total_len_bits in let (b0, b1) = load_last a totlen_seq fin len b in let hash = update a b0 hash in if blocks > 1 then update a b1 hash else hash let store_state (a:sha2_alg) (hashw:words_state a) : Tot (lseq uint8 (8 * word_length a)) = Lib.ByteSequence.uints_to_bytes_be #(word_t a) #SEC #8 hashw let emit (a:sha2_alg) (h:lseq uint8 (8 * word_length a)) : Tot (lseq uint8 (hash_length a)) = sub h 0 (hash_length a) let finish (a:sha2_alg) (st:words_state a) : Tot (lseq uint8 (hash_length a)) = let hseq = store_state a st in emit a hseq let update_block (a:sha2_alg) (len:len_lt_max_a_t a) (b:seq uint8{length b = len}) (i:nat{i < len / block_length a}) (st:words_state a) : words_state a = let mb = Seq.slice b (i * block_length a) (i * block_length a + block_length a) in update a mb st let update_nblocks (a:sha2_alg) (len:len_lt_max_a_t a) (b:seq uint8{length b = len}) (st:words_state a) : words_state a = let blocks = len / block_length a in Lib.LoopCombinators.repeati blocks (update_block a len b) st
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val hash : len: Hacl.Spec.SHA2.len_lt_max_a_t a -> b: Lib.Sequence.seq Lib.IntTypes.uint8 {Lib.Sequence.length b = len} -> Lib.Sequence.lseq Lib.IntTypes.uint8 (Spec.Hash.Definitions.hash_length a)
[]
Hacl.Spec.SHA2.hash
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
len: Hacl.Spec.SHA2.len_lt_max_a_t a -> b: Lib.Sequence.seq Lib.IntTypes.uint8 {Lib.Sequence.length b = len} -> Lib.Sequence.lseq Lib.IntTypes.uint8 (Spec.Hash.Definitions.hash_length a)
{ "end_col": 13, "end_line": 298, "start_col": 77, "start_line": 291 }
Prims.Tot
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let sha512 (len:len_lt_max_a_t SHA2_512) (b:seq uint8{length b = len}) = hash #SHA2_512 len b
let sha512 (len: len_lt_max_a_t SHA2_512) (b: seq uint8 {length b = len}) =
false
null
false
hash #SHA2_512 len b
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Hacl.Spec.SHA2.len_lt_max_a_t", "Spec.Hash.Definitions.SHA2_512", "Lib.Sequence.seq", "Lib.IntTypes.uint8", "Prims.b2t", "Prims.op_Equality", "Prims.nat", "Lib.Sequence.length", "Hacl.Spec.SHA2.hash", "Lib.Sequence.lseq", "Spec.Hash.Definitions.hash_length" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC (* Definition of the SHA2 word functions *) inline_for_extraction val _Ch: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Ch a x y z = (x &. y) ^. (~.x &. z) inline_for_extraction val _Maj: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Maj a x y z = (x &. y) ^. ((x &. z) ^. (y &. z)) inline_for_extraction val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma0 a x = (x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2) inline_for_extraction val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma1 a x = (x >>>. (op0 a).c3) ^. (x >>>. (op0 a).c4) ^. (x >>>. (op0 a).c5) inline_for_extraction val _sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma0 a x = (x >>>. (op0 a).e0) ^. (x >>>. (op0 a).e1) ^. (x >>. (op0 a).e2) inline_for_extraction val _sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma1 a x = (x >>>. (op0 a).e3) ^. (x >>>. (op0 a).e4) ^. (x >>. (op0 a).e5) let h0: a:sha2_alg -> Tot (words_state a) = function | SHA2_224 -> C.h224 | SHA2_256 -> C.h256 | SHA2_384 -> C.h384 | SHA2_512 -> C.h512 let k0: a:sha2_alg -> Tot (m:S.seq (word a) {S.length m = size_k_w a}) = function | SHA2_224 -> C.k224_256 | SHA2_256 -> C.k224_256 | SHA2_384 -> C.k384_512 | SHA2_512 -> C.k384_512 unfold let (.[]) = S.index (* Core shuffling function *) let shuffle_core_pre (a:sha2_alg) (k_t: word a) (ws_t: word a) (hash:words_state a) : Tot (words_state a) = (**) assert(7 <= S.length hash); let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in (**) assert(S.length (k0 a) = size_k_w a); let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. k_t +. ws_t in let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert_norm (List.Tot.length l = 8); S.seq_of_list l (* Scheduling function *) let ws_next_inner (a:sha2_alg) (i:nat{i < 16}) (ws:k_w a) : k_w a = let t16 = ws.[i] in let t15 = ws.[(i+1) % 16] in let t7 = ws.[(i+9) % 16] in let t2 = ws.[(i+14) % 16] in let s1 = _sigma1 a t2 in let s0 = _sigma0 a t15 in Seq.upd ws i (s1 +. t7 +. s0 +. t16) let ws_next (a:sha2_alg) (ws:k_w a) : k_w a = Lib.LoopCombinators.repeati 16 (ws_next_inner a) ws val shuffle_inner: a:sha2_alg -> ws:k_w a -> i:nat{i < num_rounds16 a} -> j:nat{j < 16} -> hash:words_state a -> words_state a let shuffle_inner a ws i j hash = let k_t = Seq.index (k0 a) (16 * i + j) in let ws_t = ws.[j] in shuffle_core_pre a k_t ws_t hash val shuffle_inner_loop: a:sha2_alg -> i:nat{i < num_rounds16 a} -> ws_st:tuple2 (k_w a) (words_state a) -> k_w a & words_state a let shuffle_inner_loop a i (ws, st) = let st' = Lib.LoopCombinators.repeati 16 (shuffle_inner a ws i) st in let ws' = if i < num_rounds16 a - 1 then ws_next a ws else ws in (ws', st') (* Full shuffling function *) let shuffle (a:sha2_alg) (ws:k_w a) (hash:words_state a) : Tot (words_state a) = let (ws, st) = Lib.LoopCombinators.repeati (num_rounds16 a) (shuffle_inner_loop a) (ws, hash) in st let init (a:sha2_alg) : words_state a = h0 a let update (a:sha2_alg) (block:block_t a) (hash:words_state a): Tot (words_state a) = let block_w = Lib.ByteSequence.uints_from_bytes_be #(word_t a) #SEC #(block_word_length a) block in let hash_1 = shuffle a block_w hash in map2 #_ #_ #_ #8 ( +. ) hash_1 hash let padded_blocks (a:sha2_alg) (len:nat{len <= block_length a}) : n:nat{n <= 2} = if (len + len_length a + 1 <= block_length a) then 1 else 2 let load_last (a:sha2_alg) (totlen_seq:lseq uint8 (len_length a)) (fin:nat{fin == block_length a \/ fin == 2 * block_length a}) (len:nat{len <= block_length a}) (b:bytes{S.length b = len}) : (block_t a & block_t a) = let last = create (2 * block_length a) (u8 0) in let last = update_sub last 0 len b in let last = last.[len] <- u8 0x80 in let last = update_sub last (fin - len_length a) (len_length a) totlen_seq in let b0 = sub last 0 (block_length a) in let b1 = sub last (block_length a) (block_length a) in (b0, b1) let update_last (a:sha2_alg) (totlen:len_t a) (len:nat{len <= block_length a}) (b:bytes{S.length b = len}) (hash:words_state a) : Tot (words_state a) = let blocks = padded_blocks a len in let fin = blocks * block_length a in let total_len_bits = secret (shift_left #(len_int_type a) totlen 3ul) in let totlen_seq = Lib.ByteSequence.uint_to_bytes_be #(len_int_type a) total_len_bits in let (b0, b1) = load_last a totlen_seq fin len b in let hash = update a b0 hash in if blocks > 1 then update a b1 hash else hash let store_state (a:sha2_alg) (hashw:words_state a) : Tot (lseq uint8 (8 * word_length a)) = Lib.ByteSequence.uints_to_bytes_be #(word_t a) #SEC #8 hashw let emit (a:sha2_alg) (h:lseq uint8 (8 * word_length a)) : Tot (lseq uint8 (hash_length a)) = sub h 0 (hash_length a) let finish (a:sha2_alg) (st:words_state a) : Tot (lseq uint8 (hash_length a)) = let hseq = store_state a st in emit a hseq let update_block (a:sha2_alg) (len:len_lt_max_a_t a) (b:seq uint8{length b = len}) (i:nat{i < len / block_length a}) (st:words_state a) : words_state a = let mb = Seq.slice b (i * block_length a) (i * block_length a + block_length a) in update a mb st let update_nblocks (a:sha2_alg) (len:len_lt_max_a_t a) (b:seq uint8{length b = len}) (st:words_state a) : words_state a = let blocks = len / block_length a in Lib.LoopCombinators.repeati blocks (update_block a len b) st let hash (#a:sha2_alg) (len:len_lt_max_a_t a) (b:seq uint8{length b = len}) = let len' : len_t a = mk_len_t a len in let st = init a in let st = update_nblocks a len b st in let rem = len % block_length a in let mb = Seq.slice b (len - rem) len in let st = update_last a len' rem mb st in finish a st let sha224 (len:len_lt_max_a_t SHA2_224) (b:seq uint8{length b = len}) = hash #SHA2_224 len b let sha256 (len:len_lt_max_a_t SHA2_256) (b:seq uint8{length b = len}) = hash #SHA2_256 len b let sha384 (len:len_lt_max_a_t SHA2_384) (b:seq uint8{length b = len}) = hash #SHA2_384 len b
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val sha512 : len: Hacl.Spec.SHA2.len_lt_max_a_t Spec.Hash.Definitions.SHA2_512 -> b: Lib.Sequence.seq Lib.IntTypes.uint8 {Lib.Sequence.length b = len} -> Lib.Sequence.lseq Lib.IntTypes.uint8 (Spec.Hash.Definitions.hash_length Spec.Hash.Definitions.SHA2_512)
[]
Hacl.Spec.SHA2.sha512
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
len: Hacl.Spec.SHA2.len_lt_max_a_t Spec.Hash.Definitions.SHA2_512 -> b: Lib.Sequence.seq Lib.IntTypes.uint8 {Lib.Sequence.length b = len} -> Lib.Sequence.lseq Lib.IntTypes.uint8 (Spec.Hash.Definitions.hash_length Spec.Hash.Definitions.SHA2_512)
{ "end_col": 22, "end_line": 310, "start_col": 2, "start_line": 310 }
Prims.Tot
val shuffle_core_pre (a: sha2_alg) (k_t ws_t: word a) (hash: words_state a) : Tot (words_state a)
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let shuffle_core_pre (a:sha2_alg) (k_t: word a) (ws_t: word a) (hash:words_state a) : Tot (words_state a) = (**) assert(7 <= S.length hash); let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in (**) assert(S.length (k0 a) = size_k_w a); let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. k_t +. ws_t in let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert_norm (List.Tot.length l = 8); S.seq_of_list l
val shuffle_core_pre (a: sha2_alg) (k_t ws_t: word a) (hash: words_state a) : Tot (words_state a) let shuffle_core_pre (a: sha2_alg) (k_t ws_t: word a) (hash: words_state a) : Tot (words_state a) =
false
null
false
assert (7 <= S.length hash); let a0 = hash.[ 0 ] in let b0 = hash.[ 1 ] in let c0 = hash.[ 2 ] in let d0 = hash.[ 3 ] in let e0 = hash.[ 4 ] in let f0 = hash.[ 5 ] in let g0 = hash.[ 6 ] in let h0 = hash.[ 7 ] in assert (S.length (k0 a) = size_k_w a); let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. k_t +. ws_t in let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in let l = [t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0] in assert_norm (List.Tot.length l = 8); S.seq_of_list l
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Spec.Hash.Definitions.word", "Spec.Hash.Definitions.words_state", "FStar.Seq.Properties.seq_of_list", "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.b2t", "Prims.op_Equality", "Prims.int", "FStar.List.Tot.Base.length", "Prims.list", "Prims.Cons", "Hacl.Spec.SHA2.op_Plus_Dot", "Prims.Nil", "Hacl.Spec.SHA2._Sigma0", "Hacl.Spec.SHA2._Maj", "Hacl.Spec.SHA2._Sigma1", "Hacl.Spec.SHA2._Ch", "Prims._assert", "Prims.nat", "FStar.Seq.Base.length", "Hacl.Spec.SHA2.k0", "Hacl.Spec.SHA2.size_k_w", "Hacl.Spec.SHA2.op_String_Access", "Prims.op_LessThanOrEqual" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC (* Definition of the SHA2 word functions *) inline_for_extraction val _Ch: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Ch a x y z = (x &. y) ^. (~.x &. z) inline_for_extraction val _Maj: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Maj a x y z = (x &. y) ^. ((x &. z) ^. (y &. z)) inline_for_extraction val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma0 a x = (x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2) inline_for_extraction val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma1 a x = (x >>>. (op0 a).c3) ^. (x >>>. (op0 a).c4) ^. (x >>>. (op0 a).c5) inline_for_extraction val _sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma0 a x = (x >>>. (op0 a).e0) ^. (x >>>. (op0 a).e1) ^. (x >>. (op0 a).e2) inline_for_extraction val _sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma1 a x = (x >>>. (op0 a).e3) ^. (x >>>. (op0 a).e4) ^. (x >>. (op0 a).e5) let h0: a:sha2_alg -> Tot (words_state a) = function | SHA2_224 -> C.h224 | SHA2_256 -> C.h256 | SHA2_384 -> C.h384 | SHA2_512 -> C.h512 let k0: a:sha2_alg -> Tot (m:S.seq (word a) {S.length m = size_k_w a}) = function | SHA2_224 -> C.k224_256 | SHA2_256 -> C.k224_256 | SHA2_384 -> C.k384_512 | SHA2_512 -> C.k384_512 unfold let (.[]) = S.index (* Core shuffling function *)
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val shuffle_core_pre (a: sha2_alg) (k_t ws_t: word a) (hash: words_state a) : Tot (words_state a)
[]
Hacl.Spec.SHA2.shuffle_core_pre
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> k_t: Spec.Hash.Definitions.word a -> ws_t: Spec.Hash.Definitions.word a -> hash: Spec.Hash.Definitions.words_state a -> Spec.Hash.Definitions.words_state a
{ "end_col": 17, "end_line": 179, "start_col": 7, "start_line": 163 }
Prims.Tot
val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a)
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let _Sigma1 a x = (x >>>. (op0 a).c3) ^. (x >>>. (op0 a).c4) ^. (x >>>. (op0 a).c5)
val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma1 a x =
false
null
false
(x >>>. (op0 a).c3) ^. (x >>>. (op0 a).c4) ^. (x >>>. (op0 a).c5)
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Spec.Hash.Definitions.word", "Hacl.Spec.SHA2.op_Hat_Dot", "Hacl.Spec.SHA2.op_Greater_Greater_Greater_Dot", "Hacl.Spec.SHA2.__proj__Mkops__item__c3", "Hacl.Spec.SHA2.op0", "Hacl.Spec.SHA2.__proj__Mkops__item__c4", "Hacl.Spec.SHA2.__proj__Mkops__item__c5" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC (* Definition of the SHA2 word functions *) inline_for_extraction val _Ch: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Ch a x y z = (x &. y) ^. (~.x &. z) inline_for_extraction val _Maj: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Maj a x y z = (x &. y) ^. ((x &. z) ^. (y &. z)) inline_for_extraction val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma0 a x = (x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2) inline_for_extraction
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a)
[]
Hacl.Spec.SHA2._Sigma1
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> x: Spec.Hash.Definitions.word a -> Spec.Hash.Definitions.word a
{ "end_col": 83, "end_line": 135, "start_col": 18, "start_line": 135 }
Prims.Tot
val _sigma1: a:sha2_alg -> x:(word a) -> Tot (word a)
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let _sigma1 a x = (x >>>. (op0 a).e3) ^. (x >>>. (op0 a).e4) ^. (x >>. (op0 a).e5)
val _sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma1 a x =
false
null
false
(x >>>. (op0 a).e3) ^. (x >>>. (op0 a).e4) ^. (x >>. (op0 a).e5)
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Spec.Hash.Definitions.word", "Hacl.Spec.SHA2.op_Hat_Dot", "Hacl.Spec.SHA2.op_Greater_Greater_Greater_Dot", "Hacl.Spec.SHA2.__proj__Mkops__item__e3", "Hacl.Spec.SHA2.op0", "Hacl.Spec.SHA2.__proj__Mkops__item__e4", "Hacl.Spec.SHA2.op_Greater_Greater_Dot", "Hacl.Spec.SHA2.__proj__Mkops__item__e5" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC (* Definition of the SHA2 word functions *) inline_for_extraction val _Ch: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Ch a x y z = (x &. y) ^. (~.x &. z) inline_for_extraction val _Maj: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Maj a x y z = (x &. y) ^. ((x &. z) ^. (y &. z)) inline_for_extraction val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma0 a x = (x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2) inline_for_extraction val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma1 a x = (x >>>. (op0 a).c3) ^. (x >>>. (op0 a).c4) ^. (x >>>. (op0 a).c5) inline_for_extraction val _sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma0 a x = (x >>>. (op0 a).e0) ^. (x >>>. (op0 a).e1) ^. (x >>. (op0 a).e2) inline_for_extraction
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val _sigma1: a:sha2_alg -> x:(word a) -> Tot (word a)
[]
Hacl.Spec.SHA2._sigma1
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> x: Spec.Hash.Definitions.word a -> Spec.Hash.Definitions.word a
{ "end_col": 82, "end_line": 143, "start_col": 18, "start_line": 143 }
Prims.Tot
val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a)
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let _Sigma0 a x = (x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2)
val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma0 a x =
false
null
false
(x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2)
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Spec.Hash.Definitions.word", "Hacl.Spec.SHA2.op_Hat_Dot", "Hacl.Spec.SHA2.op_Greater_Greater_Greater_Dot", "Hacl.Spec.SHA2.__proj__Mkops__item__c0", "Hacl.Spec.SHA2.op0", "Hacl.Spec.SHA2.__proj__Mkops__item__c1", "Hacl.Spec.SHA2.__proj__Mkops__item__c2" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC (* Definition of the SHA2 word functions *) inline_for_extraction val _Ch: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Ch a x y z = (x &. y) ^. (~.x &. z) inline_for_extraction val _Maj: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Maj a x y z = (x &. y) ^. ((x &. z) ^. (y &. z)) inline_for_extraction
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a)
[]
Hacl.Spec.SHA2._Sigma0
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> x: Spec.Hash.Definitions.word a -> Spec.Hash.Definitions.word a
{ "end_col": 83, "end_line": 131, "start_col": 18, "start_line": 131 }
Prims.Tot
val update_nblocks (a: sha2_alg) (len: len_lt_max_a_t a) (b: seq uint8 {length b = len}) (st: words_state a) : words_state a
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let update_nblocks (a:sha2_alg) (len:len_lt_max_a_t a) (b:seq uint8{length b = len}) (st:words_state a) : words_state a = let blocks = len / block_length a in Lib.LoopCombinators.repeati blocks (update_block a len b) st
val update_nblocks (a: sha2_alg) (len: len_lt_max_a_t a) (b: seq uint8 {length b = len}) (st: words_state a) : words_state a let update_nblocks (a: sha2_alg) (len: len_lt_max_a_t a) (b: seq uint8 {length b = len}) (st: words_state a) : words_state a =
false
null
false
let blocks = len / block_length a in Lib.LoopCombinators.repeati blocks (update_block a len b) st
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Hacl.Spec.SHA2.len_lt_max_a_t", "Lib.Sequence.seq", "Lib.IntTypes.uint8", "Prims.b2t", "Prims.op_Equality", "Prims.nat", "Lib.Sequence.length", "Spec.Hash.Definitions.words_state", "Lib.LoopCombinators.repeati", "Hacl.Spec.SHA2.update_block", "Prims.int", "Prims.op_Division", "Spec.Hash.Definitions.block_length" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC (* Definition of the SHA2 word functions *) inline_for_extraction val _Ch: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Ch a x y z = (x &. y) ^. (~.x &. z) inline_for_extraction val _Maj: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Maj a x y z = (x &. y) ^. ((x &. z) ^. (y &. z)) inline_for_extraction val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma0 a x = (x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2) inline_for_extraction val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma1 a x = (x >>>. (op0 a).c3) ^. (x >>>. (op0 a).c4) ^. (x >>>. (op0 a).c5) inline_for_extraction val _sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma0 a x = (x >>>. (op0 a).e0) ^. (x >>>. (op0 a).e1) ^. (x >>. (op0 a).e2) inline_for_extraction val _sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma1 a x = (x >>>. (op0 a).e3) ^. (x >>>. (op0 a).e4) ^. (x >>. (op0 a).e5) let h0: a:sha2_alg -> Tot (words_state a) = function | SHA2_224 -> C.h224 | SHA2_256 -> C.h256 | SHA2_384 -> C.h384 | SHA2_512 -> C.h512 let k0: a:sha2_alg -> Tot (m:S.seq (word a) {S.length m = size_k_w a}) = function | SHA2_224 -> C.k224_256 | SHA2_256 -> C.k224_256 | SHA2_384 -> C.k384_512 | SHA2_512 -> C.k384_512 unfold let (.[]) = S.index (* Core shuffling function *) let shuffle_core_pre (a:sha2_alg) (k_t: word a) (ws_t: word a) (hash:words_state a) : Tot (words_state a) = (**) assert(7 <= S.length hash); let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in (**) assert(S.length (k0 a) = size_k_w a); let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. k_t +. ws_t in let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert_norm (List.Tot.length l = 8); S.seq_of_list l (* Scheduling function *) let ws_next_inner (a:sha2_alg) (i:nat{i < 16}) (ws:k_w a) : k_w a = let t16 = ws.[i] in let t15 = ws.[(i+1) % 16] in let t7 = ws.[(i+9) % 16] in let t2 = ws.[(i+14) % 16] in let s1 = _sigma1 a t2 in let s0 = _sigma0 a t15 in Seq.upd ws i (s1 +. t7 +. s0 +. t16) let ws_next (a:sha2_alg) (ws:k_w a) : k_w a = Lib.LoopCombinators.repeati 16 (ws_next_inner a) ws val shuffle_inner: a:sha2_alg -> ws:k_w a -> i:nat{i < num_rounds16 a} -> j:nat{j < 16} -> hash:words_state a -> words_state a let shuffle_inner a ws i j hash = let k_t = Seq.index (k0 a) (16 * i + j) in let ws_t = ws.[j] in shuffle_core_pre a k_t ws_t hash val shuffle_inner_loop: a:sha2_alg -> i:nat{i < num_rounds16 a} -> ws_st:tuple2 (k_w a) (words_state a) -> k_w a & words_state a let shuffle_inner_loop a i (ws, st) = let st' = Lib.LoopCombinators.repeati 16 (shuffle_inner a ws i) st in let ws' = if i < num_rounds16 a - 1 then ws_next a ws else ws in (ws', st') (* Full shuffling function *) let shuffle (a:sha2_alg) (ws:k_w a) (hash:words_state a) : Tot (words_state a) = let (ws, st) = Lib.LoopCombinators.repeati (num_rounds16 a) (shuffle_inner_loop a) (ws, hash) in st let init (a:sha2_alg) : words_state a = h0 a let update (a:sha2_alg) (block:block_t a) (hash:words_state a): Tot (words_state a) = let block_w = Lib.ByteSequence.uints_from_bytes_be #(word_t a) #SEC #(block_word_length a) block in let hash_1 = shuffle a block_w hash in map2 #_ #_ #_ #8 ( +. ) hash_1 hash let padded_blocks (a:sha2_alg) (len:nat{len <= block_length a}) : n:nat{n <= 2} = if (len + len_length a + 1 <= block_length a) then 1 else 2 let load_last (a:sha2_alg) (totlen_seq:lseq uint8 (len_length a)) (fin:nat{fin == block_length a \/ fin == 2 * block_length a}) (len:nat{len <= block_length a}) (b:bytes{S.length b = len}) : (block_t a & block_t a) = let last = create (2 * block_length a) (u8 0) in let last = update_sub last 0 len b in let last = last.[len] <- u8 0x80 in let last = update_sub last (fin - len_length a) (len_length a) totlen_seq in let b0 = sub last 0 (block_length a) in let b1 = sub last (block_length a) (block_length a) in (b0, b1) let update_last (a:sha2_alg) (totlen:len_t a) (len:nat{len <= block_length a}) (b:bytes{S.length b = len}) (hash:words_state a) : Tot (words_state a) = let blocks = padded_blocks a len in let fin = blocks * block_length a in let total_len_bits = secret (shift_left #(len_int_type a) totlen 3ul) in let totlen_seq = Lib.ByteSequence.uint_to_bytes_be #(len_int_type a) total_len_bits in let (b0, b1) = load_last a totlen_seq fin len b in let hash = update a b0 hash in if blocks > 1 then update a b1 hash else hash let store_state (a:sha2_alg) (hashw:words_state a) : Tot (lseq uint8 (8 * word_length a)) = Lib.ByteSequence.uints_to_bytes_be #(word_t a) #SEC #8 hashw let emit (a:sha2_alg) (h:lseq uint8 (8 * word_length a)) : Tot (lseq uint8 (hash_length a)) = sub h 0 (hash_length a) let finish (a:sha2_alg) (st:words_state a) : Tot (lseq uint8 (hash_length a)) = let hseq = store_state a st in emit a hseq let update_block (a:sha2_alg) (len:len_lt_max_a_t a) (b:seq uint8{length b = len}) (i:nat{i < len / block_length a}) (st:words_state a) : words_state a = let mb = Seq.slice b (i * block_length a) (i * block_length a + block_length a) in update a mb st
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val update_nblocks (a: sha2_alg) (len: len_lt_max_a_t a) (b: seq uint8 {length b = len}) (st: words_state a) : words_state a
[]
Hacl.Spec.SHA2.update_nblocks
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> len: Hacl.Spec.SHA2.len_lt_max_a_t a -> b: Lib.Sequence.seq Lib.IntTypes.uint8 {Lib.Sequence.length b = len} -> st: Spec.Hash.Definitions.words_state a -> Spec.Hash.Definitions.words_state a
{ "end_col": 62, "end_line": 288, "start_col": 121, "start_line": 286 }
Prims.Tot
val store_state (a: sha2_alg) (hashw: words_state a) : Tot (lseq uint8 (8 * word_length a))
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let store_state (a:sha2_alg) (hashw:words_state a) : Tot (lseq uint8 (8 * word_length a)) = Lib.ByteSequence.uints_to_bytes_be #(word_t a) #SEC #8 hashw
val store_state (a: sha2_alg) (hashw: words_state a) : Tot (lseq uint8 (8 * word_length a)) let store_state (a: sha2_alg) (hashw: words_state a) : Tot (lseq uint8 (8 * word_length a)) =
false
null
false
Lib.ByteSequence.uints_to_bytes_be #(word_t a) #SEC #8 hashw
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Spec.Hash.Definitions.words_state", "Lib.ByteSequence.uints_to_bytes_be", "Spec.Hash.Definitions.word_t", "Lib.IntTypes.SEC", "Lib.Sequence.lseq", "Lib.IntTypes.uint8", "FStar.Mul.op_Star", "Spec.Hash.Definitions.word_length" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC (* Definition of the SHA2 word functions *) inline_for_extraction val _Ch: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Ch a x y z = (x &. y) ^. (~.x &. z) inline_for_extraction val _Maj: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Maj a x y z = (x &. y) ^. ((x &. z) ^. (y &. z)) inline_for_extraction val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma0 a x = (x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2) inline_for_extraction val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma1 a x = (x >>>. (op0 a).c3) ^. (x >>>. (op0 a).c4) ^. (x >>>. (op0 a).c5) inline_for_extraction val _sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma0 a x = (x >>>. (op0 a).e0) ^. (x >>>. (op0 a).e1) ^. (x >>. (op0 a).e2) inline_for_extraction val _sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma1 a x = (x >>>. (op0 a).e3) ^. (x >>>. (op0 a).e4) ^. (x >>. (op0 a).e5) let h0: a:sha2_alg -> Tot (words_state a) = function | SHA2_224 -> C.h224 | SHA2_256 -> C.h256 | SHA2_384 -> C.h384 | SHA2_512 -> C.h512 let k0: a:sha2_alg -> Tot (m:S.seq (word a) {S.length m = size_k_w a}) = function | SHA2_224 -> C.k224_256 | SHA2_256 -> C.k224_256 | SHA2_384 -> C.k384_512 | SHA2_512 -> C.k384_512 unfold let (.[]) = S.index (* Core shuffling function *) let shuffle_core_pre (a:sha2_alg) (k_t: word a) (ws_t: word a) (hash:words_state a) : Tot (words_state a) = (**) assert(7 <= S.length hash); let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in (**) assert(S.length (k0 a) = size_k_w a); let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. k_t +. ws_t in let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert_norm (List.Tot.length l = 8); S.seq_of_list l (* Scheduling function *) let ws_next_inner (a:sha2_alg) (i:nat{i < 16}) (ws:k_w a) : k_w a = let t16 = ws.[i] in let t15 = ws.[(i+1) % 16] in let t7 = ws.[(i+9) % 16] in let t2 = ws.[(i+14) % 16] in let s1 = _sigma1 a t2 in let s0 = _sigma0 a t15 in Seq.upd ws i (s1 +. t7 +. s0 +. t16) let ws_next (a:sha2_alg) (ws:k_w a) : k_w a = Lib.LoopCombinators.repeati 16 (ws_next_inner a) ws val shuffle_inner: a:sha2_alg -> ws:k_w a -> i:nat{i < num_rounds16 a} -> j:nat{j < 16} -> hash:words_state a -> words_state a let shuffle_inner a ws i j hash = let k_t = Seq.index (k0 a) (16 * i + j) in let ws_t = ws.[j] in shuffle_core_pre a k_t ws_t hash val shuffle_inner_loop: a:sha2_alg -> i:nat{i < num_rounds16 a} -> ws_st:tuple2 (k_w a) (words_state a) -> k_w a & words_state a let shuffle_inner_loop a i (ws, st) = let st' = Lib.LoopCombinators.repeati 16 (shuffle_inner a ws i) st in let ws' = if i < num_rounds16 a - 1 then ws_next a ws else ws in (ws', st') (* Full shuffling function *) let shuffle (a:sha2_alg) (ws:k_w a) (hash:words_state a) : Tot (words_state a) = let (ws, st) = Lib.LoopCombinators.repeati (num_rounds16 a) (shuffle_inner_loop a) (ws, hash) in st let init (a:sha2_alg) : words_state a = h0 a let update (a:sha2_alg) (block:block_t a) (hash:words_state a): Tot (words_state a) = let block_w = Lib.ByteSequence.uints_from_bytes_be #(word_t a) #SEC #(block_word_length a) block in let hash_1 = shuffle a block_w hash in map2 #_ #_ #_ #8 ( +. ) hash_1 hash let padded_blocks (a:sha2_alg) (len:nat{len <= block_length a}) : n:nat{n <= 2} = if (len + len_length a + 1 <= block_length a) then 1 else 2 let load_last (a:sha2_alg) (totlen_seq:lseq uint8 (len_length a)) (fin:nat{fin == block_length a \/ fin == 2 * block_length a}) (len:nat{len <= block_length a}) (b:bytes{S.length b = len}) : (block_t a & block_t a) = let last = create (2 * block_length a) (u8 0) in let last = update_sub last 0 len b in let last = last.[len] <- u8 0x80 in let last = update_sub last (fin - len_length a) (len_length a) totlen_seq in let b0 = sub last 0 (block_length a) in let b1 = sub last (block_length a) (block_length a) in (b0, b1) let update_last (a:sha2_alg) (totlen:len_t a) (len:nat{len <= block_length a}) (b:bytes{S.length b = len}) (hash:words_state a) : Tot (words_state a) = let blocks = padded_blocks a len in let fin = blocks * block_length a in let total_len_bits = secret (shift_left #(len_int_type a) totlen 3ul) in let totlen_seq = Lib.ByteSequence.uint_to_bytes_be #(len_int_type a) total_len_bits in let (b0, b1) = load_last a totlen_seq fin len b in let hash = update a b0 hash in if blocks > 1 then update a b1 hash else hash
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val store_state (a: sha2_alg) (hashw: words_state a) : Tot (lseq uint8 (8 * word_length a))
[]
Hacl.Spec.SHA2.store_state
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> hashw: Spec.Hash.Definitions.words_state a -> Lib.Sequence.lseq Lib.IntTypes.uint8 (8 * Spec.Hash.Definitions.word_length a)
{ "end_col": 62, "end_line": 267, "start_col": 2, "start_line": 267 }
Prims.Tot
val update_last (a: sha2_alg) (totlen: len_t a) (len: nat{len <= block_length a}) (b: bytes{S.length b = len}) (hash: words_state a) : Tot (words_state a)
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let update_last (a:sha2_alg) (totlen:len_t a) (len:nat{len <= block_length a}) (b:bytes{S.length b = len}) (hash:words_state a) : Tot (words_state a) = let blocks = padded_blocks a len in let fin = blocks * block_length a in let total_len_bits = secret (shift_left #(len_int_type a) totlen 3ul) in let totlen_seq = Lib.ByteSequence.uint_to_bytes_be #(len_int_type a) total_len_bits in let (b0, b1) = load_last a totlen_seq fin len b in let hash = update a b0 hash in if blocks > 1 then update a b1 hash else hash
val update_last (a: sha2_alg) (totlen: len_t a) (len: nat{len <= block_length a}) (b: bytes{S.length b = len}) (hash: words_state a) : Tot (words_state a) let update_last (a: sha2_alg) (totlen: len_t a) (len: nat{len <= block_length a}) (b: bytes{S.length b = len}) (hash: words_state a) : Tot (words_state a) =
false
null
false
let blocks = padded_blocks a len in let fin = blocks * block_length a in let total_len_bits = secret (shift_left #(len_int_type a) totlen 3ul) in let totlen_seq = Lib.ByteSequence.uint_to_bytes_be #(len_int_type a) total_len_bits in let b0, b1 = load_last a totlen_seq fin len b in let hash = update a b0 hash in if blocks > 1 then update a b1 hash else hash
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Spec.Hash.Definitions.len_t", "Prims.nat", "Prims.b2t", "Prims.op_LessThanOrEqual", "Spec.Hash.Definitions.block_length", "Spec.Hash.Definitions.bytes", "Prims.op_Equality", "FStar.Seq.Base.length", "Lib.IntTypes.uint8", "Spec.Hash.Definitions.words_state", "Hacl.Spec.SHA2.block_t", "Prims.op_GreaterThan", "Hacl.Spec.SHA2.update", "Prims.bool", "FStar.Pervasives.Native.tuple2", "Hacl.Spec.SHA2.load_last", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Lib.IntTypes.numbytes", "Spec.Hash.Definitions.len_int_type", "Lib.ByteSequence.uint_to_bytes_be", "Prims.eq2", "Prims.int", "Lib.IntTypes.range", "Lib.IntTypes.v", "Lib.IntTypes.PUB", "Lib.IntTypes.shift_left", "FStar.UInt32.uint_to_t", "FStar.UInt32.t", "Lib.IntTypes.secret", "FStar.UInt32.__uint_to_t", "FStar.Mul.op_Star", "Hacl.Spec.SHA2.padded_blocks" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC (* Definition of the SHA2 word functions *) inline_for_extraction val _Ch: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Ch a x y z = (x &. y) ^. (~.x &. z) inline_for_extraction val _Maj: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Maj a x y z = (x &. y) ^. ((x &. z) ^. (y &. z)) inline_for_extraction val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma0 a x = (x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2) inline_for_extraction val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma1 a x = (x >>>. (op0 a).c3) ^. (x >>>. (op0 a).c4) ^. (x >>>. (op0 a).c5) inline_for_extraction val _sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma0 a x = (x >>>. (op0 a).e0) ^. (x >>>. (op0 a).e1) ^. (x >>. (op0 a).e2) inline_for_extraction val _sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma1 a x = (x >>>. (op0 a).e3) ^. (x >>>. (op0 a).e4) ^. (x >>. (op0 a).e5) let h0: a:sha2_alg -> Tot (words_state a) = function | SHA2_224 -> C.h224 | SHA2_256 -> C.h256 | SHA2_384 -> C.h384 | SHA2_512 -> C.h512 let k0: a:sha2_alg -> Tot (m:S.seq (word a) {S.length m = size_k_w a}) = function | SHA2_224 -> C.k224_256 | SHA2_256 -> C.k224_256 | SHA2_384 -> C.k384_512 | SHA2_512 -> C.k384_512 unfold let (.[]) = S.index (* Core shuffling function *) let shuffle_core_pre (a:sha2_alg) (k_t: word a) (ws_t: word a) (hash:words_state a) : Tot (words_state a) = (**) assert(7 <= S.length hash); let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in (**) assert(S.length (k0 a) = size_k_w a); let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. k_t +. ws_t in let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert_norm (List.Tot.length l = 8); S.seq_of_list l (* Scheduling function *) let ws_next_inner (a:sha2_alg) (i:nat{i < 16}) (ws:k_w a) : k_w a = let t16 = ws.[i] in let t15 = ws.[(i+1) % 16] in let t7 = ws.[(i+9) % 16] in let t2 = ws.[(i+14) % 16] in let s1 = _sigma1 a t2 in let s0 = _sigma0 a t15 in Seq.upd ws i (s1 +. t7 +. s0 +. t16) let ws_next (a:sha2_alg) (ws:k_w a) : k_w a = Lib.LoopCombinators.repeati 16 (ws_next_inner a) ws val shuffle_inner: a:sha2_alg -> ws:k_w a -> i:nat{i < num_rounds16 a} -> j:nat{j < 16} -> hash:words_state a -> words_state a let shuffle_inner a ws i j hash = let k_t = Seq.index (k0 a) (16 * i + j) in let ws_t = ws.[j] in shuffle_core_pre a k_t ws_t hash val shuffle_inner_loop: a:sha2_alg -> i:nat{i < num_rounds16 a} -> ws_st:tuple2 (k_w a) (words_state a) -> k_w a & words_state a let shuffle_inner_loop a i (ws, st) = let st' = Lib.LoopCombinators.repeati 16 (shuffle_inner a ws i) st in let ws' = if i < num_rounds16 a - 1 then ws_next a ws else ws in (ws', st') (* Full shuffling function *) let shuffle (a:sha2_alg) (ws:k_w a) (hash:words_state a) : Tot (words_state a) = let (ws, st) = Lib.LoopCombinators.repeati (num_rounds16 a) (shuffle_inner_loop a) (ws, hash) in st let init (a:sha2_alg) : words_state a = h0 a let update (a:sha2_alg) (block:block_t a) (hash:words_state a): Tot (words_state a) = let block_w = Lib.ByteSequence.uints_from_bytes_be #(word_t a) #SEC #(block_word_length a) block in let hash_1 = shuffle a block_w hash in map2 #_ #_ #_ #8 ( +. ) hash_1 hash let padded_blocks (a:sha2_alg) (len:nat{len <= block_length a}) : n:nat{n <= 2} = if (len + len_length a + 1 <= block_length a) then 1 else 2 let load_last (a:sha2_alg) (totlen_seq:lseq uint8 (len_length a)) (fin:nat{fin == block_length a \/ fin == 2 * block_length a}) (len:nat{len <= block_length a}) (b:bytes{S.length b = len}) : (block_t a & block_t a) = let last = create (2 * block_length a) (u8 0) in let last = update_sub last 0 len b in let last = last.[len] <- u8 0x80 in let last = update_sub last (fin - len_length a) (len_length a) totlen_seq in let b0 = sub last 0 (block_length a) in let b1 = sub last (block_length a) (block_length a) in (b0, b1) let update_last (a:sha2_alg) (totlen:len_t a)
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val update_last (a: sha2_alg) (totlen: len_t a) (len: nat{len <= block_length a}) (b: bytes{S.length b = len}) (hash: words_state a) : Tot (words_state a)
[]
Hacl.Spec.SHA2.update_last
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> totlen: Spec.Hash.Definitions.len_t a -> len: Prims.nat{len <= Spec.Hash.Definitions.block_length a} -> b: Spec.Hash.Definitions.bytes{FStar.Seq.Base.length b = len} -> hash: Spec.Hash.Definitions.words_state a -> Spec.Hash.Definitions.words_state a
{ "end_col": 47, "end_line": 263, "start_col": 74, "start_line": 256 }
Prims.Tot
val update_block (a: sha2_alg) (len: len_lt_max_a_t a) (b: seq uint8 {length b = len}) (i: nat{i < len / block_length a}) (st: words_state a) : words_state a
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let update_block (a:sha2_alg) (len:len_lt_max_a_t a) (b:seq uint8{length b = len}) (i:nat{i < len / block_length a}) (st:words_state a) : words_state a = let mb = Seq.slice b (i * block_length a) (i * block_length a + block_length a) in update a mb st
val update_block (a: sha2_alg) (len: len_lt_max_a_t a) (b: seq uint8 {length b = len}) (i: nat{i < len / block_length a}) (st: words_state a) : words_state a let update_block (a: sha2_alg) (len: len_lt_max_a_t a) (b: seq uint8 {length b = len}) (i: nat{i < len / block_length a}) (st: words_state a) : words_state a =
false
null
false
let mb = Seq.slice b (i * block_length a) (i * block_length a + block_length a) in update a mb st
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Hacl.Spec.SHA2.len_lt_max_a_t", "Lib.Sequence.seq", "Lib.IntTypes.uint8", "Prims.b2t", "Prims.op_Equality", "Prims.nat", "Lib.Sequence.length", "Prims.op_LessThan", "Prims.op_Division", "Spec.Hash.Definitions.block_length", "Spec.Hash.Definitions.words_state", "Hacl.Spec.SHA2.update", "FStar.Seq.Base.seq", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "FStar.Seq.Base.slice", "FStar.Mul.op_Star", "Prims.op_Addition" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC (* Definition of the SHA2 word functions *) inline_for_extraction val _Ch: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Ch a x y z = (x &. y) ^. (~.x &. z) inline_for_extraction val _Maj: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Maj a x y z = (x &. y) ^. ((x &. z) ^. (y &. z)) inline_for_extraction val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma0 a x = (x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2) inline_for_extraction val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma1 a x = (x >>>. (op0 a).c3) ^. (x >>>. (op0 a).c4) ^. (x >>>. (op0 a).c5) inline_for_extraction val _sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma0 a x = (x >>>. (op0 a).e0) ^. (x >>>. (op0 a).e1) ^. (x >>. (op0 a).e2) inline_for_extraction val _sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma1 a x = (x >>>. (op0 a).e3) ^. (x >>>. (op0 a).e4) ^. (x >>. (op0 a).e5) let h0: a:sha2_alg -> Tot (words_state a) = function | SHA2_224 -> C.h224 | SHA2_256 -> C.h256 | SHA2_384 -> C.h384 | SHA2_512 -> C.h512 let k0: a:sha2_alg -> Tot (m:S.seq (word a) {S.length m = size_k_w a}) = function | SHA2_224 -> C.k224_256 | SHA2_256 -> C.k224_256 | SHA2_384 -> C.k384_512 | SHA2_512 -> C.k384_512 unfold let (.[]) = S.index (* Core shuffling function *) let shuffle_core_pre (a:sha2_alg) (k_t: word a) (ws_t: word a) (hash:words_state a) : Tot (words_state a) = (**) assert(7 <= S.length hash); let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in (**) assert(S.length (k0 a) = size_k_w a); let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. k_t +. ws_t in let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert_norm (List.Tot.length l = 8); S.seq_of_list l (* Scheduling function *) let ws_next_inner (a:sha2_alg) (i:nat{i < 16}) (ws:k_w a) : k_w a = let t16 = ws.[i] in let t15 = ws.[(i+1) % 16] in let t7 = ws.[(i+9) % 16] in let t2 = ws.[(i+14) % 16] in let s1 = _sigma1 a t2 in let s0 = _sigma0 a t15 in Seq.upd ws i (s1 +. t7 +. s0 +. t16) let ws_next (a:sha2_alg) (ws:k_w a) : k_w a = Lib.LoopCombinators.repeati 16 (ws_next_inner a) ws val shuffle_inner: a:sha2_alg -> ws:k_w a -> i:nat{i < num_rounds16 a} -> j:nat{j < 16} -> hash:words_state a -> words_state a let shuffle_inner a ws i j hash = let k_t = Seq.index (k0 a) (16 * i + j) in let ws_t = ws.[j] in shuffle_core_pre a k_t ws_t hash val shuffle_inner_loop: a:sha2_alg -> i:nat{i < num_rounds16 a} -> ws_st:tuple2 (k_w a) (words_state a) -> k_w a & words_state a let shuffle_inner_loop a i (ws, st) = let st' = Lib.LoopCombinators.repeati 16 (shuffle_inner a ws i) st in let ws' = if i < num_rounds16 a - 1 then ws_next a ws else ws in (ws', st') (* Full shuffling function *) let shuffle (a:sha2_alg) (ws:k_w a) (hash:words_state a) : Tot (words_state a) = let (ws, st) = Lib.LoopCombinators.repeati (num_rounds16 a) (shuffle_inner_loop a) (ws, hash) in st let init (a:sha2_alg) : words_state a = h0 a let update (a:sha2_alg) (block:block_t a) (hash:words_state a): Tot (words_state a) = let block_w = Lib.ByteSequence.uints_from_bytes_be #(word_t a) #SEC #(block_word_length a) block in let hash_1 = shuffle a block_w hash in map2 #_ #_ #_ #8 ( +. ) hash_1 hash let padded_blocks (a:sha2_alg) (len:nat{len <= block_length a}) : n:nat{n <= 2} = if (len + len_length a + 1 <= block_length a) then 1 else 2 let load_last (a:sha2_alg) (totlen_seq:lseq uint8 (len_length a)) (fin:nat{fin == block_length a \/ fin == 2 * block_length a}) (len:nat{len <= block_length a}) (b:bytes{S.length b = len}) : (block_t a & block_t a) = let last = create (2 * block_length a) (u8 0) in let last = update_sub last 0 len b in let last = last.[len] <- u8 0x80 in let last = update_sub last (fin - len_length a) (len_length a) totlen_seq in let b0 = sub last 0 (block_length a) in let b1 = sub last (block_length a) (block_length a) in (b0, b1) let update_last (a:sha2_alg) (totlen:len_t a) (len:nat{len <= block_length a}) (b:bytes{S.length b = len}) (hash:words_state a) : Tot (words_state a) = let blocks = padded_blocks a len in let fin = blocks * block_length a in let total_len_bits = secret (shift_left #(len_int_type a) totlen 3ul) in let totlen_seq = Lib.ByteSequence.uint_to_bytes_be #(len_int_type a) total_len_bits in let (b0, b1) = load_last a totlen_seq fin len b in let hash = update a b0 hash in if blocks > 1 then update a b1 hash else hash let store_state (a:sha2_alg) (hashw:words_state a) : Tot (lseq uint8 (8 * word_length a)) = Lib.ByteSequence.uints_to_bytes_be #(word_t a) #SEC #8 hashw let emit (a:sha2_alg) (h:lseq uint8 (8 * word_length a)) : Tot (lseq uint8 (hash_length a)) = sub h 0 (hash_length a) let finish (a:sha2_alg) (st:words_state a) : Tot (lseq uint8 (hash_length a)) = let hseq = store_state a st in emit a hseq let update_block (a:sha2_alg) (len:len_lt_max_a_t a) (b:seq uint8{length b = len})
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val update_block (a: sha2_alg) (len: len_lt_max_a_t a) (b: seq uint8 {length b = len}) (i: nat{i < len / block_length a}) (st: words_state a) : words_state a
[]
Hacl.Spec.SHA2.update_block
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> len: Hacl.Spec.SHA2.len_lt_max_a_t a -> b: Lib.Sequence.seq Lib.IntTypes.uint8 {Lib.Sequence.length b = len} -> i: Prims.nat{i < len / Spec.Hash.Definitions.block_length a} -> st: Spec.Hash.Definitions.words_state a -> Spec.Hash.Definitions.words_state a
{ "end_col": 16, "end_line": 283, "start_col": 2, "start_line": 281 }
Prims.Tot
val emit (a: sha2_alg) (h: lseq uint8 (8 * word_length a)) : Tot (lseq uint8 (hash_length a))
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let emit (a:sha2_alg) (h:lseq uint8 (8 * word_length a)) : Tot (lseq uint8 (hash_length a)) = sub h 0 (hash_length a)
val emit (a: sha2_alg) (h: lseq uint8 (8 * word_length a)) : Tot (lseq uint8 (hash_length a)) let emit (a: sha2_alg) (h: lseq uint8 (8 * word_length a)) : Tot (lseq uint8 (hash_length a)) =
false
null
false
sub h 0 (hash_length a)
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Lib.Sequence.lseq", "Lib.IntTypes.uint8", "FStar.Mul.op_Star", "Spec.Hash.Definitions.word_length", "Lib.Sequence.sub", "Spec.Hash.Definitions.hash_length" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC (* Definition of the SHA2 word functions *) inline_for_extraction val _Ch: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Ch a x y z = (x &. y) ^. (~.x &. z) inline_for_extraction val _Maj: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Maj a x y z = (x &. y) ^. ((x &. z) ^. (y &. z)) inline_for_extraction val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma0 a x = (x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2) inline_for_extraction val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma1 a x = (x >>>. (op0 a).c3) ^. (x >>>. (op0 a).c4) ^. (x >>>. (op0 a).c5) inline_for_extraction val _sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma0 a x = (x >>>. (op0 a).e0) ^. (x >>>. (op0 a).e1) ^. (x >>. (op0 a).e2) inline_for_extraction val _sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma1 a x = (x >>>. (op0 a).e3) ^. (x >>>. (op0 a).e4) ^. (x >>. (op0 a).e5) let h0: a:sha2_alg -> Tot (words_state a) = function | SHA2_224 -> C.h224 | SHA2_256 -> C.h256 | SHA2_384 -> C.h384 | SHA2_512 -> C.h512 let k0: a:sha2_alg -> Tot (m:S.seq (word a) {S.length m = size_k_w a}) = function | SHA2_224 -> C.k224_256 | SHA2_256 -> C.k224_256 | SHA2_384 -> C.k384_512 | SHA2_512 -> C.k384_512 unfold let (.[]) = S.index (* Core shuffling function *) let shuffle_core_pre (a:sha2_alg) (k_t: word a) (ws_t: word a) (hash:words_state a) : Tot (words_state a) = (**) assert(7 <= S.length hash); let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in (**) assert(S.length (k0 a) = size_k_w a); let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. k_t +. ws_t in let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert_norm (List.Tot.length l = 8); S.seq_of_list l (* Scheduling function *) let ws_next_inner (a:sha2_alg) (i:nat{i < 16}) (ws:k_w a) : k_w a = let t16 = ws.[i] in let t15 = ws.[(i+1) % 16] in let t7 = ws.[(i+9) % 16] in let t2 = ws.[(i+14) % 16] in let s1 = _sigma1 a t2 in let s0 = _sigma0 a t15 in Seq.upd ws i (s1 +. t7 +. s0 +. t16) let ws_next (a:sha2_alg) (ws:k_w a) : k_w a = Lib.LoopCombinators.repeati 16 (ws_next_inner a) ws val shuffle_inner: a:sha2_alg -> ws:k_w a -> i:nat{i < num_rounds16 a} -> j:nat{j < 16} -> hash:words_state a -> words_state a let shuffle_inner a ws i j hash = let k_t = Seq.index (k0 a) (16 * i + j) in let ws_t = ws.[j] in shuffle_core_pre a k_t ws_t hash val shuffle_inner_loop: a:sha2_alg -> i:nat{i < num_rounds16 a} -> ws_st:tuple2 (k_w a) (words_state a) -> k_w a & words_state a let shuffle_inner_loop a i (ws, st) = let st' = Lib.LoopCombinators.repeati 16 (shuffle_inner a ws i) st in let ws' = if i < num_rounds16 a - 1 then ws_next a ws else ws in (ws', st') (* Full shuffling function *) let shuffle (a:sha2_alg) (ws:k_w a) (hash:words_state a) : Tot (words_state a) = let (ws, st) = Lib.LoopCombinators.repeati (num_rounds16 a) (shuffle_inner_loop a) (ws, hash) in st let init (a:sha2_alg) : words_state a = h0 a let update (a:sha2_alg) (block:block_t a) (hash:words_state a): Tot (words_state a) = let block_w = Lib.ByteSequence.uints_from_bytes_be #(word_t a) #SEC #(block_word_length a) block in let hash_1 = shuffle a block_w hash in map2 #_ #_ #_ #8 ( +. ) hash_1 hash let padded_blocks (a:sha2_alg) (len:nat{len <= block_length a}) : n:nat{n <= 2} = if (len + len_length a + 1 <= block_length a) then 1 else 2 let load_last (a:sha2_alg) (totlen_seq:lseq uint8 (len_length a)) (fin:nat{fin == block_length a \/ fin == 2 * block_length a}) (len:nat{len <= block_length a}) (b:bytes{S.length b = len}) : (block_t a & block_t a) = let last = create (2 * block_length a) (u8 0) in let last = update_sub last 0 len b in let last = last.[len] <- u8 0x80 in let last = update_sub last (fin - len_length a) (len_length a) totlen_seq in let b0 = sub last 0 (block_length a) in let b1 = sub last (block_length a) (block_length a) in (b0, b1) let update_last (a:sha2_alg) (totlen:len_t a) (len:nat{len <= block_length a}) (b:bytes{S.length b = len}) (hash:words_state a) : Tot (words_state a) = let blocks = padded_blocks a len in let fin = blocks * block_length a in let total_len_bits = secret (shift_left #(len_int_type a) totlen 3ul) in let totlen_seq = Lib.ByteSequence.uint_to_bytes_be #(len_int_type a) total_len_bits in let (b0, b1) = load_last a totlen_seq fin len b in let hash = update a b0 hash in if blocks > 1 then update a b1 hash else hash let store_state (a:sha2_alg) (hashw:words_state a) : Tot (lseq uint8 (8 * word_length a)) = Lib.ByteSequence.uints_to_bytes_be #(word_t a) #SEC #8 hashw
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val emit (a: sha2_alg) (h: lseq uint8 (8 * word_length a)) : Tot (lseq uint8 (hash_length a))
[]
Hacl.Spec.SHA2.emit
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> h: Lib.Sequence.lseq Lib.IntTypes.uint8 (8 * Spec.Hash.Definitions.word_length a) -> Lib.Sequence.lseq Lib.IntTypes.uint8 (Spec.Hash.Definitions.hash_length a)
{ "end_col": 25, "end_line": 271, "start_col": 2, "start_line": 271 }
Prims.Tot
val load_last (a: sha2_alg) (totlen_seq: lseq uint8 (len_length a)) (fin: nat{fin == block_length a \/ fin == 2 * block_length a}) (len: nat{len <= block_length a}) (b: bytes{S.length b = len}) : (block_t a & block_t a)
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Spec.SHA2.Constants", "short_module": "C" }, { "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 } ]
false
let load_last (a:sha2_alg) (totlen_seq:lseq uint8 (len_length a)) (fin:nat{fin == block_length a \/ fin == 2 * block_length a}) (len:nat{len <= block_length a}) (b:bytes{S.length b = len}) : (block_t a & block_t a) = let last = create (2 * block_length a) (u8 0) in let last = update_sub last 0 len b in let last = last.[len] <- u8 0x80 in let last = update_sub last (fin - len_length a) (len_length a) totlen_seq in let b0 = sub last 0 (block_length a) in let b1 = sub last (block_length a) (block_length a) in (b0, b1)
val load_last (a: sha2_alg) (totlen_seq: lseq uint8 (len_length a)) (fin: nat{fin == block_length a \/ fin == 2 * block_length a}) (len: nat{len <= block_length a}) (b: bytes{S.length b = len}) : (block_t a & block_t a) let load_last (a: sha2_alg) (totlen_seq: lseq uint8 (len_length a)) (fin: nat{fin == block_length a \/ fin == 2 * block_length a}) (len: nat{len <= block_length a}) (b: bytes{S.length b = len}) : (block_t a & block_t a) =
false
null
false
let last = create (2 * block_length a) (u8 0) in let last = update_sub last 0 len b in let last = last.[ len ] <- u8 0x80 in let last = update_sub last (fin - len_length a) (len_length a) totlen_seq in let b0 = sub last 0 (block_length a) in let b1 = sub last (block_length a) (block_length a) in (b0, b1)
{ "checked_file": "Hacl.Spec.SHA2.fst.checked", "dependencies": [ "Spec.SHA2.Constants.fst.checked", "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.SHA2.fst" }
[ "total" ]
[ "Spec.Hash.Definitions.sha2_alg", "Lib.Sequence.lseq", "Lib.IntTypes.uint8", "Spec.Hash.Definitions.len_length", "Prims.nat", "Prims.l_or", "Prims.eq2", "Prims.int", "Prims.b2t", "Prims.op_GreaterThanOrEqual", "Prims.op_disEquality", "Spec.Hash.Definitions.block_length", "FStar.Mul.op_Star", "Prims.op_LessThanOrEqual", "Spec.Hash.Definitions.bytes", "Prims.op_Equality", "FStar.Seq.Base.length", "FStar.Pervasives.Native.Mktuple2", "Hacl.Spec.SHA2.block_t", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Prims.l_and", "FStar.Seq.Base.seq", "Lib.Sequence.to_seq", "FStar.Seq.Base.slice", "Prims.op_Multiply", "Prims.op_Addition", "Prims.l_Forall", "Prims.op_LessThan", "FStar.Seq.Base.index", "Lib.Sequence.index", "Lib.Sequence.sub", "Prims.op_Subtraction", "Lib.Sequence.update_sub", "FStar.Seq.Base.upd", "Lib.IntTypes.mk_int", "Prims.pow2", "Prims.l_imp", "Lib.Sequence.op_String_Assignment", "Lib.IntTypes.u8", "FStar.Seq.Base.create", "Lib.Sequence.create", "FStar.Pervasives.Native.tuple2" ]
[]
module Hacl.Spec.SHA2 open FStar.Mul open Lib.IntTypes open Lib.Sequence module C = Spec.SHA2.Constants module S = FStar.Seq open Spec.Hash.Definitions #set-options "--z3rlimit 20 --fuel 0 --ifuel 0" let len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a} let mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a = match a with | SHA2_224 | SHA2_256 -> (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len) | SHA2_384 | SHA2_512 -> (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len) (* The core compression, padding and extraction functions for all SHA2 * algorithms. *) (* Define the length of the constants. Also the number of scheduling rounds. *) inline_for_extraction let size_k_w: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 64 | SHA2_384 | SHA2_512 -> 80 inline_for_extraction let word_n: sha2_alg -> Tot nat = function | SHA2_224 | SHA2_256 -> 32 | SHA2_384 | SHA2_512 -> 64 inline_for_extraction let to_word (a:sha2_alg) (n:nat{n < pow2 (word_n a)}) : word a = match a with | SHA2_224 | SHA2_256 -> u32 n | SHA2_384 | SHA2_512 -> u64 n inline_for_extraction let num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} = match a with | SHA2_224 | SHA2_256 -> 4 | SHA2_384 | SHA2_512 -> 5 let k_w (a: sha2_alg) = lseq (word a) (block_word_length a) let block_t (a: sha2_alg) = lseq uint8 (block_length a) inline_for_extraction noextract type ops = { c0: size_t; c1: size_t; c2: size_t; c3: size_t; c4: size_t; c5: size_t; e0: size_t; e1: size_t; e2: size_t; e3: size_t; e4: size_t; e5: size_t; } (* Definition of constants used in word functions *) inline_for_extraction noextract let op224_256: ops = { c0 = 2ul; c1 = 13ul; c2 = 22ul; c3 = 6ul; c4 = 11ul; c5 = 25ul; e0 = 7ul; e1 = 18ul; e2 = 3ul; e3 = 17ul; e4 = 19ul; e5 = 10ul } inline_for_extraction noextract let op384_512: ops = { c0 = 28ul; c1 = 34ul; c2 = 39ul; c3 = 14ul; c4 = 18ul; c5 = 41ul; e0 = 1ul ; e1 = 8ul; e2 = 7ul; e3 = 19ul; e4 = 61ul; e5 = 6ul } inline_for_extraction let op0: a:sha2_alg -> Tot ops = function | SHA2_224 -> op224_256 | SHA2_256 -> op224_256 | SHA2_384 -> op384_512 | SHA2_512 -> op384_512 inline_for_extraction let ( +. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( +. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( +. ) #U64 #SEC inline_for_extraction let ( ^. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ^. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ^. ) #U64 #SEC inline_for_extraction let ( &. ) (#a:sha2_alg): word a -> word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( &. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( &. ) #U64 #SEC inline_for_extraction let ( ~. ) (#a:sha2_alg): word a -> word a = match a with | SHA2_224 | SHA2_256 -> ( ~. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( ~. ) #U64 #SEC inline_for_extraction let ( >>>. ) (#a:sha2_alg): word a -> rotval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>>. ) #U64 #SEC inline_for_extraction let ( >>. ) (#a:sha2_alg): word a -> shiftval (word_t a) -> word a = match a with | SHA2_224 | SHA2_256 -> ( >>. ) #U32 #SEC | SHA2_384 | SHA2_512 -> ( >>. ) #U64 #SEC (* Definition of the SHA2 word functions *) inline_for_extraction val _Ch: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Ch a x y z = (x &. y) ^. (~.x &. z) inline_for_extraction val _Maj: a:sha2_alg -> x:(word a) -> y:(word a) -> z:(word a) -> Tot (word a) let _Maj a x y z = (x &. y) ^. ((x &. z) ^. (y &. z)) inline_for_extraction val _Sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma0 a x = (x >>>. (op0 a).c0) ^. (x >>>. (op0 a).c1) ^. (x >>>. (op0 a).c2) inline_for_extraction val _Sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _Sigma1 a x = (x >>>. (op0 a).c3) ^. (x >>>. (op0 a).c4) ^. (x >>>. (op0 a).c5) inline_for_extraction val _sigma0: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma0 a x = (x >>>. (op0 a).e0) ^. (x >>>. (op0 a).e1) ^. (x >>. (op0 a).e2) inline_for_extraction val _sigma1: a:sha2_alg -> x:(word a) -> Tot (word a) let _sigma1 a x = (x >>>. (op0 a).e3) ^. (x >>>. (op0 a).e4) ^. (x >>. (op0 a).e5) let h0: a:sha2_alg -> Tot (words_state a) = function | SHA2_224 -> C.h224 | SHA2_256 -> C.h256 | SHA2_384 -> C.h384 | SHA2_512 -> C.h512 let k0: a:sha2_alg -> Tot (m:S.seq (word a) {S.length m = size_k_w a}) = function | SHA2_224 -> C.k224_256 | SHA2_256 -> C.k224_256 | SHA2_384 -> C.k384_512 | SHA2_512 -> C.k384_512 unfold let (.[]) = S.index (* Core shuffling function *) let shuffle_core_pre (a:sha2_alg) (k_t: word a) (ws_t: word a) (hash:words_state a) : Tot (words_state a) = (**) assert(7 <= S.length hash); let a0 = hash.[0] in let b0 = hash.[1] in let c0 = hash.[2] in let d0 = hash.[3] in let e0 = hash.[4] in let f0 = hash.[5] in let g0 = hash.[6] in let h0 = hash.[7] in (**) assert(S.length (k0 a) = size_k_w a); let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. k_t +. ws_t in let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert_norm (List.Tot.length l = 8); S.seq_of_list l (* Scheduling function *) let ws_next_inner (a:sha2_alg) (i:nat{i < 16}) (ws:k_w a) : k_w a = let t16 = ws.[i] in let t15 = ws.[(i+1) % 16] in let t7 = ws.[(i+9) % 16] in let t2 = ws.[(i+14) % 16] in let s1 = _sigma1 a t2 in let s0 = _sigma0 a t15 in Seq.upd ws i (s1 +. t7 +. s0 +. t16) let ws_next (a:sha2_alg) (ws:k_w a) : k_w a = Lib.LoopCombinators.repeati 16 (ws_next_inner a) ws val shuffle_inner: a:sha2_alg -> ws:k_w a -> i:nat{i < num_rounds16 a} -> j:nat{j < 16} -> hash:words_state a -> words_state a let shuffle_inner a ws i j hash = let k_t = Seq.index (k0 a) (16 * i + j) in let ws_t = ws.[j] in shuffle_core_pre a k_t ws_t hash val shuffle_inner_loop: a:sha2_alg -> i:nat{i < num_rounds16 a} -> ws_st:tuple2 (k_w a) (words_state a) -> k_w a & words_state a let shuffle_inner_loop a i (ws, st) = let st' = Lib.LoopCombinators.repeati 16 (shuffle_inner a ws i) st in let ws' = if i < num_rounds16 a - 1 then ws_next a ws else ws in (ws', st') (* Full shuffling function *) let shuffle (a:sha2_alg) (ws:k_w a) (hash:words_state a) : Tot (words_state a) = let (ws, st) = Lib.LoopCombinators.repeati (num_rounds16 a) (shuffle_inner_loop a) (ws, hash) in st let init (a:sha2_alg) : words_state a = h0 a let update (a:sha2_alg) (block:block_t a) (hash:words_state a): Tot (words_state a) = let block_w = Lib.ByteSequence.uints_from_bytes_be #(word_t a) #SEC #(block_word_length a) block in let hash_1 = shuffle a block_w hash in map2 #_ #_ #_ #8 ( +. ) hash_1 hash let padded_blocks (a:sha2_alg) (len:nat{len <= block_length a}) : n:nat{n <= 2} = if (len + len_length a + 1 <= block_length a) then 1 else 2 let load_last (a:sha2_alg) (totlen_seq:lseq uint8 (len_length a)) (fin:nat{fin == block_length a \/ fin == 2 * block_length a}) (len:nat{len <= block_length a}) (b:bytes{S.length b = len}) :
false
false
Hacl.Spec.SHA2.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val load_last (a: sha2_alg) (totlen_seq: lseq uint8 (len_length a)) (fin: nat{fin == block_length a \/ fin == 2 * block_length a}) (len: nat{len <= block_length a}) (b: bytes{S.length b = len}) : (block_t a & block_t a)
[]
Hacl.Spec.SHA2.load_last
{ "file_name": "code/sha2-mb/Hacl.Spec.SHA2.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Hash.Definitions.sha2_alg -> totlen_seq: Lib.Sequence.lseq Lib.IntTypes.uint8 (Spec.Hash.Definitions.len_length a) -> fin: Prims.nat { fin == Spec.Hash.Definitions.block_length a \/ fin == 2 * Spec.Hash.Definitions.block_length a } -> len: Prims.nat{len <= Spec.Hash.Definitions.block_length a} -> b: Spec.Hash.Definitions.bytes{FStar.Seq.Base.length b = len} -> Hacl.Spec.SHA2.block_t a * Hacl.Spec.SHA2.block_t a
{ "end_col": 10, "end_line": 251, "start_col": 2, "start_line": 244 }
Prims.Tot
[ { "abbrev": false, "full_module": "FStar.IO", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let print_maddr (m:maddr) (p:printer) = p.maddr (string_of_int m.offset) (print_reg m.address p)
let print_maddr (m: maddr) (p: printer) =
false
null
false
p.maddr (string_of_int m.offset) (print_reg m.address p)
{ "checked_file": "Vale.PPC64LE.Print_s.fst.checked", "dependencies": [ "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IO.fst.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.Print_s.fst" }
[ "total" ]
[ "Vale.PPC64LE.Machine_s.maddr", "Vale.PPC64LE.Print_s.printer", "Vale.PPC64LE.Print_s.__proj__Mkprinter__item__maddr", "Prims.string_of_int", "Vale.PPC64LE.Machine_s.__proj__Mkmaddr__item__offset", "Vale.PPC64LE.Print_s.print_reg", "Vale.PPC64LE.Machine_s.__proj__Mkmaddr__item__address", "Prims.string" ]
[]
module Vale.PPC64LE.Print_s // Trusted code for producing assembly code open Vale.PPC64LE.Machine_s open Vale.PPC64LE.Semantics_s open FStar.IO noeq type printer = { reg_prefix : unit -> string; vec_prefix : unit -> string; vsr_prefix : unit -> string; maddr : string -> string -> string; const : int -> string; align : unit -> string; header : unit -> string; footer : unit -> string; proc_name : string -> string; ret : string -> string; } let print_reg (r:reg) (p:printer) = p.reg_prefix() ^ string_of_int r let print_vec (v:vec) (vsr:bool) (p:printer) = if vsr then p.vsr_prefix() ^ "32+" ^ string_of_int v else p.vec_prefix() ^ string_of_int v
false
true
Vale.PPC64LE.Print_s.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val print_maddr : m: Vale.PPC64LE.Machine_s.maddr -> p: Vale.PPC64LE.Print_s.printer -> Prims.string
[]
Vale.PPC64LE.Print_s.print_maddr
{ "file_name": "vale/specs/hardware/Vale.PPC64LE.Print_s.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
m: Vale.PPC64LE.Machine_s.maddr -> p: Vale.PPC64LE.Print_s.printer -> Prims.string
{ "end_col": 58, "end_line": 30, "start_col": 2, "start_line": 30 }
Prims.Tot
[ { "abbrev": false, "full_module": "FStar.IO", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let print_vec (v:vec) (vsr:bool) (p:printer) = if vsr then p.vsr_prefix() ^ "32+" ^ string_of_int v else p.vec_prefix() ^ string_of_int v
let print_vec (v: vec) (vsr: bool) (p: printer) =
false
null
false
if vsr then p.vsr_prefix () ^ "32+" ^ string_of_int v else p.vec_prefix () ^ string_of_int v
{ "checked_file": "Vale.PPC64LE.Print_s.fst.checked", "dependencies": [ "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IO.fst.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.Print_s.fst" }
[ "total" ]
[ "Vale.PPC64LE.Machine_s.vec", "Prims.bool", "Vale.PPC64LE.Print_s.printer", "Prims.op_Hat", "Vale.PPC64LE.Print_s.__proj__Mkprinter__item__vsr_prefix", "Prims.string_of_int", "Vale.PPC64LE.Print_s.__proj__Mkprinter__item__vec_prefix", "Prims.string" ]
[]
module Vale.PPC64LE.Print_s // Trusted code for producing assembly code open Vale.PPC64LE.Machine_s open Vale.PPC64LE.Semantics_s open FStar.IO noeq type printer = { reg_prefix : unit -> string; vec_prefix : unit -> string; vsr_prefix : unit -> string; maddr : string -> string -> string; const : int -> string; align : unit -> string; header : unit -> string; footer : unit -> string; proc_name : string -> string; ret : string -> string; } let print_reg (r:reg) (p:printer) = p.reg_prefix() ^ string_of_int r
false
true
Vale.PPC64LE.Print_s.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val print_vec : v: Vale.PPC64LE.Machine_s.vec -> vsr: Prims.bool -> p: Vale.PPC64LE.Print_s.printer -> Prims.string
[]
Vale.PPC64LE.Print_s.print_vec
{ "file_name": "vale/specs/hardware/Vale.PPC64LE.Print_s.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
v: Vale.PPC64LE.Machine_s.vec -> vsr: Prims.bool -> p: Vale.PPC64LE.Print_s.printer -> Prims.string
{ "end_col": 39, "end_line": 27, "start_col": 2, "start_line": 26 }
Prims.Tot
[ { "abbrev": false, "full_module": "FStar.IO", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let print_reg (r:reg) (p:printer) = p.reg_prefix() ^ string_of_int r
let print_reg (r: reg) (p: printer) =
false
null
false
p.reg_prefix () ^ string_of_int r
{ "checked_file": "Vale.PPC64LE.Print_s.fst.checked", "dependencies": [ "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IO.fst.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.Print_s.fst" }
[ "total" ]
[ "Vale.PPC64LE.Machine_s.reg", "Vale.PPC64LE.Print_s.printer", "Prims.op_Hat", "Vale.PPC64LE.Print_s.__proj__Mkprinter__item__reg_prefix", "Prims.string_of_int", "Prims.string" ]
[]
module Vale.PPC64LE.Print_s // Trusted code for producing assembly code open Vale.PPC64LE.Machine_s open Vale.PPC64LE.Semantics_s open FStar.IO noeq type printer = { reg_prefix : unit -> string; vec_prefix : unit -> string; vsr_prefix : unit -> string; maddr : string -> string -> string; const : int -> string; align : unit -> string; header : unit -> string; footer : unit -> string; proc_name : string -> string; ret : string -> string; }
false
true
Vale.PPC64LE.Print_s.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val print_reg : r: Vale.PPC64LE.Machine_s.reg -> p: Vale.PPC64LE.Print_s.printer -> Prims.string
[]
Vale.PPC64LE.Print_s.print_reg
{ "file_name": "vale/specs/hardware/Vale.PPC64LE.Print_s.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
r: Vale.PPC64LE.Machine_s.reg -> p: Vale.PPC64LE.Print_s.printer -> Prims.string
{ "end_col": 34, "end_line": 23, "start_col": 2, "start_line": 23 }
Prims.Tot
[ { "abbrev": false, "full_module": "FStar.IO", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let print_first_cmp_opr (o:cmp_opr) (p:printer) = match o with | CReg r -> print_reg r p | _ -> "!!! INVALID first compare operand !!! Expected general purpose register."
let print_first_cmp_opr (o: cmp_opr) (p: printer) =
false
null
false
match o with | CReg r -> print_reg r p | _ -> "!!! INVALID first compare operand !!! Expected general purpose register."
{ "checked_file": "Vale.PPC64LE.Print_s.fst.checked", "dependencies": [ "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IO.fst.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.Print_s.fst" }
[ "total" ]
[ "Vale.PPC64LE.Machine_s.cmp_opr", "Vale.PPC64LE.Print_s.printer", "Vale.PPC64LE.Machine_s.reg", "Vale.PPC64LE.Print_s.print_reg", "Prims.string" ]
[]
module Vale.PPC64LE.Print_s // Trusted code for producing assembly code open Vale.PPC64LE.Machine_s open Vale.PPC64LE.Semantics_s open FStar.IO noeq type printer = { reg_prefix : unit -> string; vec_prefix : unit -> string; vsr_prefix : unit -> string; maddr : string -> string -> string; const : int -> string; align : unit -> string; header : unit -> string; footer : unit -> string; proc_name : string -> string; ret : string -> string; } let print_reg (r:reg) (p:printer) = p.reg_prefix() ^ string_of_int r let print_vec (v:vec) (vsr:bool) (p:printer) = if vsr then p.vsr_prefix() ^ "32+" ^ string_of_int v else p.vec_prefix() ^ string_of_int v let print_maddr (m:maddr) (p:printer) = p.maddr (string_of_int m.offset) (print_reg m.address p) let cmp_not(o:ocmp) : ocmp = match o with | OEq o1 o2 -> ONe o1 o2 | ONe o1 o2 -> OEq o1 o2 | OLe o1 o2 -> OGt o1 o2 | OGe o1 o2 -> OLt o1 o2 | OLt o1 o2 -> OGe o1 o2 | OGt o1 o2 -> OLe o1 o2 // Sanity check let _ = assert (forall o . o == cmp_not (cmp_not o))
false
true
Vale.PPC64LE.Print_s.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val print_first_cmp_opr : o: Vale.PPC64LE.Machine_s.cmp_opr -> p: Vale.PPC64LE.Print_s.printer -> Prims.string
[]
Vale.PPC64LE.Print_s.print_first_cmp_opr
{ "file_name": "vale/specs/hardware/Vale.PPC64LE.Print_s.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
o: Vale.PPC64LE.Machine_s.cmp_opr -> p: Vale.PPC64LE.Print_s.printer -> Prims.string
{ "end_col": 83, "end_line": 47, "start_col": 2, "start_line": 45 }
FStar.All.ML
[ { "abbrev": false, "full_module": "FStar.IO", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let print_footer (p:printer) = print_string (p.footer())
let print_footer (p: printer) =
true
null
false
print_string (p.footer ())
{ "checked_file": "Vale.PPC64LE.Print_s.fst.checked", "dependencies": [ "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IO.fst.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.Print_s.fst" }
[ "ml" ]
[ "Vale.PPC64LE.Print_s.printer", "FStar.IO.print_string", "Vale.PPC64LE.Print_s.__proj__Mkprinter__item__footer", "Prims.unit" ]
[]
module Vale.PPC64LE.Print_s // Trusted code for producing assembly code open Vale.PPC64LE.Machine_s open Vale.PPC64LE.Semantics_s open FStar.IO noeq type printer = { reg_prefix : unit -> string; vec_prefix : unit -> string; vsr_prefix : unit -> string; maddr : string -> string -> string; const : int -> string; align : unit -> string; header : unit -> string; footer : unit -> string; proc_name : string -> string; ret : string -> string; } let print_reg (r:reg) (p:printer) = p.reg_prefix() ^ string_of_int r let print_vec (v:vec) (vsr:bool) (p:printer) = if vsr then p.vsr_prefix() ^ "32+" ^ string_of_int v else p.vec_prefix() ^ string_of_int v let print_maddr (m:maddr) (p:printer) = p.maddr (string_of_int m.offset) (print_reg m.address p) let cmp_not(o:ocmp) : ocmp = match o with | OEq o1 o2 -> ONe o1 o2 | ONe o1 o2 -> OEq o1 o2 | OLe o1 o2 -> OGt o1 o2 | OGe o1 o2 -> OLt o1 o2 | OLt o1 o2 -> OGe o1 o2 | OGt o1 o2 -> OLe o1 o2 // Sanity check let _ = assert (forall o . o == cmp_not (cmp_not o)) let print_first_cmp_opr (o:cmp_opr) (p:printer) = match o with | CReg r -> print_reg r p | _ -> "!!! INVALID first compare operand !!! Expected general purpose register." let print_ins (ins:ins) (p:printer) = let print_pair (o1 o2:string) = o1 ^ ", " ^ o2 in let print_triple (o1 o2 o3:string) = o1 ^ ", " ^ o2 ^ ", " ^ o3 in let print_quadruple (o1 o2 o3 o4:string) = o1 ^ ", " ^ o2 ^ ", " ^ o3 ^ ", " ^ o4 in let print_reg_pair (dst src:reg) = print_pair (print_reg dst p) (print_reg src p) in let print_reg_mem (o1:reg) (o2:maddr) = print_pair (print_reg o1 p) (print_maddr o2 p) in let print_reg_triple (dst src1 src2:reg) = print_triple (print_reg dst p) (print_reg src1 p) (print_reg src2 p) in let print_reg_imm (dst:reg) (src:int) = print_pair (print_reg dst p) (p.const src) in let print_reg_pair_imm (dst src1:reg) (src2:int) = print_triple (print_reg dst p) (print_reg src1 p) (p.const src2) in let print_reg_vec (dst:reg) (src:vec) (vsr:bool) = print_pair (print_reg dst p) (print_vec src vsr p) in let print_vec_reg (dst:vec) (src:reg) (vsr:bool) = print_pair (print_vec dst vsr p) (print_reg src p) in let print_vec_reg_pair (dst:vec) (src1 src2:reg) (vsr:bool) = print_triple (print_vec dst vsr p) (print_reg src1 p) (print_reg src2 p) in let print_vec_pair (dst src:vec) (vsr:bool) = print_pair (print_vec dst vsr p) (print_vec src vsr p) in let print_vec_triple (dst src1 src2:vec) (vsr:bool) = print_triple (print_vec dst vsr p) (print_vec src1 vsr p) (print_vec src2 vsr p) in let print_vec_quadruple (dst src1 src2 src3:vec) (vsr:bool) = print_quadruple (print_vec dst vsr p) (print_vec src1 vsr p) (print_vec src2 vsr p) (print_vec src3 vsr p) in let print_vec_imm (dst:vec) (src:int) (vsr:bool) = print_pair (print_vec dst vsr p) (p.const src) in let print_vec_pair_imm (dst src:vec) (imm:int) (vsr:bool) = print_triple (print_vec dst vsr p) (print_vec src vsr p) (p.const imm) in let print_vec_triple_imm (dst src1 src2:vec) (count:int) (vsr:bool) = print_quadruple (print_vec dst vsr p) (print_vec src1 vsr p) (print_vec src2 vsr p) (p.const count) in let print_vec_mem (o1:vec) (o2:maddr) (vsr:bool) = print_pair (print_vec o1 vsr p) (print_maddr o2 p) in let print_vec_pair_imm_pair (dst src:vec) (s0 s1:int) (vsr:bool) = print_quadruple (print_vec dst vsr p) (print_vec src vsr p) (p.const s0) (p.const s1) in match ins with | Move dst src -> " mr " ^ print_reg_pair dst src | Load64 dst base offset -> " ld " ^ print_reg_mem dst ({ address = base; offset = offset }) | Store64 src base offset -> " std " ^ print_reg_mem src ({ address = base; offset = offset }) | LoadImm64 dst src -> " li " ^ print_reg_imm dst src | LoadImmShl64 dst src -> " lis " ^ print_reg_imm dst src | AddLa dst src1 src2 -> " la " ^ print_reg_mem dst ({ address = src1; offset = src2 }) | Add dst src1 src2 -> " add " ^ print_reg_triple dst src1 src2 | AddImm dst src1 src2 -> " addi " ^ print_reg_pair_imm dst src1 src2 | AddCarry dst src1 src2 -> " addc " ^ print_reg_triple dst src1 src2 | AddExtended dst src1 src2 -> " adde " ^ print_reg_triple dst src1 src2 | AddExtendedOV dst src1 src2 -> " addex " ^ print_reg_triple dst src1 src2 | Sub dst src1 src2 -> " sub " ^ print_reg_triple dst src1 src2 | SubImm dst src1 src2 -> " subi " ^ print_reg_pair_imm dst src1 src2 | MulLow64 dst src1 src2 -> " mulld " ^ print_reg_triple dst src1 src2 | MulHigh64U dst src1 src2 -> " mulhdu " ^ print_reg_triple dst src1 src2 | Xor dst src1 src2 -> " xor " ^ print_reg_triple dst src1 src2 | And dst src1 src2 -> " and " ^ print_reg_triple dst src1 src2 | Sr64Imm dst src1 src2 -> " srdi " ^ print_reg_pair_imm dst src1 src2 | Sl64Imm dst src1 src2 -> " sldi " ^ print_reg_pair_imm dst src1 src2 | Sr64 dst src1 src2 -> " srd " ^ print_reg_triple dst src1 src2 | Sl64 dst src1 src2 -> " sld " ^ print_reg_triple dst src1 src2 | Vmr dst src -> " vmr " ^ print_vec_pair dst src false | Mfvsrd dst src -> " mfvsrd " ^ print_reg_vec dst src true | Mfvsrld dst src -> " mfvsrld " ^ print_reg_vec dst src true | Mtvsrdd dst src1 src2 -> " mtvsrdd " ^ print_vec_reg_pair dst src1 src2 true | Mtvsrws dst src -> " mtvsrws " ^ print_vec_reg dst src true | Vadduwm dst src1 src2 -> " vadduwm " ^ print_vec_triple dst src1 src2 false | Vxor dst src1 src2 -> " vxor " ^ print_vec_triple dst src1 src2 false | Vand dst src1 src2 -> " vand " ^ print_vec_triple dst src1 src2 false | Vslw dst src1 src2 -> " vslw " ^ print_vec_triple dst src1 src2 false | Vsrw dst src1 src2 -> " vsrw " ^ print_vec_triple dst src1 src2 false | Vsl dst src1 src2 -> " vsl " ^ print_vec_triple dst src1 src2 false | Vcmpequw dst src1 src2 -> " vcmpequw " ^ print_vec_triple dst src1 src2 false | Vsldoi dst src1 src2 count -> " vsldoi " ^ print_vec_triple_imm dst src1 src2 count false | Vmrghw dst src1 src2 -> " vmrghw " ^ print_vec_triple dst src1 src2 false | Xxmrghd dst src1 src2 -> " xxmrghd " ^ print_vec_triple dst src1 src2 true | Vsel dst src1 src2 sel -> " vsel " ^ print_vec_quadruple dst src1 src2 sel false | Vspltw dst src uim -> " vspltw " ^ print_vec_pair_imm dst src uim false | Vspltisw dst src -> " vspltisw " ^ print_vec_imm dst src false | Vspltisb dst src -> " vspltisb " ^ print_vec_imm dst src false | Load128 dst base offset -> " lvx " ^ print_vec_reg_pair dst offset base false | Store128 src base offset -> " stvx " ^ print_vec_reg_pair src offset base false | Load128Word4 dst base -> " lxvw4x " ^ print_vec_reg_pair dst 0 base true | Load128Word4Index dst base offset -> " lxvw4x " ^ print_vec_reg_pair dst offset base true | Store128Word4 src base -> " stxvw4x " ^ print_vec_reg_pair src 0 base true | Store128Word4Index src base offset -> " stxvw4x " ^ print_vec_reg_pair src offset base true | Load128Byte16 dst base -> " lxvb16x " ^ print_vec_reg_pair dst 0 base true | Load128Byte16Index dst base offset -> " lxvb16x " ^ print_vec_reg_pair dst offset base true | Store128Byte16 src base -> " stxvb16x " ^ print_vec_reg_pair src 0 base true | Store128Byte16Index src base offset -> " stxvb16x " ^ print_vec_reg_pair src offset base true | Vshasigmaw0 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 0 0 false | Vshasigmaw1 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 0 15 false | Vshasigmaw2 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 1 0 false | Vshasigmaw3 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 1 15 false | Vsbox dst src -> " vsbox " ^ print_vec_pair dst src false | RotWord dst src1 src2 -> " vrlw " ^ print_vec_triple dst src1 src2 false | Vcipher dst src1 src2 -> " vcipher " ^ print_vec_triple dst src1 src2 false | Vcipherlast dst src1 src2 -> " vcipherlast " ^ print_vec_triple dst src1 src2 false | Vncipher dst src1 src2 -> " vncipher " ^ print_vec_triple dst src1 src2 false | Vncipherlast dst src1 src2 -> " vncipherlast " ^ print_vec_triple dst src1 src2 false | Vpmsumd dst src1 src2 -> " vpmsumd " ^ print_vec_triple dst src1 src2 false | Alloc n -> " subi " ^ print_reg_pair_imm 1 1 n | Dealloc n -> " addi " ^ print_reg_pair_imm 1 1 n | StoreStack128 src t offset -> " stxv " ^ print_vec_mem src ({ address = 1; offset = offset }) true | LoadStack128 dst t offset -> " lxv " ^ print_vec_mem dst ({ address = 1; offset = offset }) true | StoreStack64 src t offset -> " std " ^ print_reg_mem src ({ address = 1; offset = offset }) | LoadStack64 dst t offset -> " ld " ^ print_reg_mem dst ({ address = 1; offset = offset }) | Ghost _ -> "" let print_cmp (c:ocmp) (counter:int) (p:printer) : string = let print_cmp_ops (o1:cmp_opr) (o2:cmp_opr) : string = match o2 with | CReg r -> " cmpld " ^ (print_first_cmp_opr o1 p) ^ ", " ^ (print_reg r p) ^ "\n" | CImm n -> " cmpldi " ^ (print_first_cmp_opr o1 p) ^ ", " ^ (string_of_int n) ^ "\n" in match c with | OEq o1 o2 -> print_cmp_ops o1 o2 ^ " beq " ^ "L" ^ string_of_int counter ^ "\n" | ONe o1 o2 -> print_cmp_ops o1 o2 ^ " bne "^ "L" ^ string_of_int counter ^ "\n" | OLe o1 o2 -> print_cmp_ops o1 o2 ^ " ble "^ "L" ^ string_of_int counter ^ "\n" | OGe o1 o2 -> print_cmp_ops o1 o2 ^ " bge "^ "L" ^ string_of_int counter ^ "\n" | OLt o1 o2 -> print_cmp_ops o1 o2 ^ " blt " ^ "L" ^ string_of_int counter ^ "\n" | OGt o1 o2 -> print_cmp_ops o1 o2 ^ " bgt " ^ "L" ^ string_of_int counter ^ "\n" let rec print_block (b:codes) (n:int) (p:printer) : string & int = match b with | Nil -> ("", n) | head :: tail -> let (head_str, n') = print_code head n p in let (rest, n'') = print_block tail n' p in (head_str ^ rest, n'') and print_code (c:code) (n:int) (p:printer) : string & int = match c with | Ins ins -> (print_ins ins p ^ "\n", n) | Block b -> print_block b n p | IfElse cond true_code false_code -> let n1 = n in let n2 = n + 1 in let cmp = print_cmp (cmp_not cond) n1 p in let (true_str, n') = print_code true_code (n + 2) p in let branch = " b L" ^ string_of_int n2 ^ "\n" in let label1 = "L" ^ string_of_int n1 ^ ":\n" in let (false_str, n') = print_code false_code n' p in let label2 = "L" ^ string_of_int n2 ^ ":\n" in (cmp ^ true_str ^ branch ^ label1 ^ false_str ^ label2, n') | While cond body -> let n1 = n in let n2 = n + 1 in let branch = " b L" ^ string_of_int n2 ^ "\n" in let label1 = p.align() ^ " 4\nL" ^ string_of_int n1 ^ ":\n" in let (body_str, n') = print_code body (n + 2) p in let label2 = p.align() ^ " 4\nL" ^ string_of_int n2 ^ ":\n" in let cmp = print_cmp cond n1 p in (branch ^ label1 ^ body_str ^ label2 ^ cmp, n') let print_header (p:printer) = print_string (p.header()) let print_proc (name:string) (code:code) (label:int) (p:printer) : FStar.All.ML int = let proc = p.proc_name name in let (code_str, final_label) = print_code code label p in let ret = p.ret name in print_string (proc ^ code_str ^ ret); final_label
false
false
Vale.PPC64LE.Print_s.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val print_footer : p: Vale.PPC64LE.Print_s.printer -> FStar.All.ML Prims.unit
[]
Vale.PPC64LE.Print_s.print_footer
{ "file_name": "vale/specs/hardware/Vale.PPC64LE.Print_s.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
p: Vale.PPC64LE.Print_s.printer -> FStar.All.ML Prims.unit
{ "end_col": 27, "end_line": 232, "start_col": 2, "start_line": 232 }
Prims.Tot
val gcc:printer
[ { "abbrev": false, "full_module": "FStar.IO", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let gcc : printer = let reg_prefix unit = "" in let vec_prefix unit = "" in let vsr_prefix unit = "" in let maddr (offset:string) (address:string) = offset ^ "(" ^ address ^ ")" in let const (n:int) = string_of_int n in let align() = ".align" in let header() = ".text\n" in let footer() = ".section .note.GNU-stack,\"\",%progbits\n" in let proc_name (name:string) = ".global " ^ name ^ "\n" ^ name ^ ":\n" in let branch_link (name:string) = " blr\n\n" in { reg_prefix = reg_prefix; vec_prefix = vec_prefix; vsr_prefix = vsr_prefix; maddr = maddr; const = const; align = align; header = header; footer = footer; proc_name = proc_name; ret = branch_link; }
val gcc:printer let gcc:printer =
false
null
false
let reg_prefix unit = "" in let vec_prefix unit = "" in let vsr_prefix unit = "" in let maddr (offset address: string) = offset ^ "(" ^ address ^ ")" in let const (n: int) = string_of_int n in let align () = ".align" in let header () = ".text\n" in let footer () = ".section .note.GNU-stack,\"\",%progbits\n" in let proc_name (name: string) = ".global " ^ name ^ "\n" ^ name ^ ":\n" in let branch_link (name: string) = " blr\n\n" in { reg_prefix = reg_prefix; vec_prefix = vec_prefix; vsr_prefix = vsr_prefix; maddr = maddr; const = const; align = align; header = header; footer = footer; proc_name = proc_name; ret = branch_link }
{ "checked_file": "Vale.PPC64LE.Print_s.fst.checked", "dependencies": [ "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IO.fst.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.Print_s.fst" }
[ "total" ]
[ "Vale.PPC64LE.Print_s.Mkprinter", "Prims.string", "Prims.op_Hat", "Prims.unit", "Prims.int", "Prims.string_of_int" ]
[]
module Vale.PPC64LE.Print_s // Trusted code for producing assembly code open Vale.PPC64LE.Machine_s open Vale.PPC64LE.Semantics_s open FStar.IO noeq type printer = { reg_prefix : unit -> string; vec_prefix : unit -> string; vsr_prefix : unit -> string; maddr : string -> string -> string; const : int -> string; align : unit -> string; header : unit -> string; footer : unit -> string; proc_name : string -> string; ret : string -> string; } let print_reg (r:reg) (p:printer) = p.reg_prefix() ^ string_of_int r let print_vec (v:vec) (vsr:bool) (p:printer) = if vsr then p.vsr_prefix() ^ "32+" ^ string_of_int v else p.vec_prefix() ^ string_of_int v let print_maddr (m:maddr) (p:printer) = p.maddr (string_of_int m.offset) (print_reg m.address p) let cmp_not(o:ocmp) : ocmp = match o with | OEq o1 o2 -> ONe o1 o2 | ONe o1 o2 -> OEq o1 o2 | OLe o1 o2 -> OGt o1 o2 | OGe o1 o2 -> OLt o1 o2 | OLt o1 o2 -> OGe o1 o2 | OGt o1 o2 -> OLe o1 o2 // Sanity check let _ = assert (forall o . o == cmp_not (cmp_not o)) let print_first_cmp_opr (o:cmp_opr) (p:printer) = match o with | CReg r -> print_reg r p | _ -> "!!! INVALID first compare operand !!! Expected general purpose register." let print_ins (ins:ins) (p:printer) = let print_pair (o1 o2:string) = o1 ^ ", " ^ o2 in let print_triple (o1 o2 o3:string) = o1 ^ ", " ^ o2 ^ ", " ^ o3 in let print_quadruple (o1 o2 o3 o4:string) = o1 ^ ", " ^ o2 ^ ", " ^ o3 ^ ", " ^ o4 in let print_reg_pair (dst src:reg) = print_pair (print_reg dst p) (print_reg src p) in let print_reg_mem (o1:reg) (o2:maddr) = print_pair (print_reg o1 p) (print_maddr o2 p) in let print_reg_triple (dst src1 src2:reg) = print_triple (print_reg dst p) (print_reg src1 p) (print_reg src2 p) in let print_reg_imm (dst:reg) (src:int) = print_pair (print_reg dst p) (p.const src) in let print_reg_pair_imm (dst src1:reg) (src2:int) = print_triple (print_reg dst p) (print_reg src1 p) (p.const src2) in let print_reg_vec (dst:reg) (src:vec) (vsr:bool) = print_pair (print_reg dst p) (print_vec src vsr p) in let print_vec_reg (dst:vec) (src:reg) (vsr:bool) = print_pair (print_vec dst vsr p) (print_reg src p) in let print_vec_reg_pair (dst:vec) (src1 src2:reg) (vsr:bool) = print_triple (print_vec dst vsr p) (print_reg src1 p) (print_reg src2 p) in let print_vec_pair (dst src:vec) (vsr:bool) = print_pair (print_vec dst vsr p) (print_vec src vsr p) in let print_vec_triple (dst src1 src2:vec) (vsr:bool) = print_triple (print_vec dst vsr p) (print_vec src1 vsr p) (print_vec src2 vsr p) in let print_vec_quadruple (dst src1 src2 src3:vec) (vsr:bool) = print_quadruple (print_vec dst vsr p) (print_vec src1 vsr p) (print_vec src2 vsr p) (print_vec src3 vsr p) in let print_vec_imm (dst:vec) (src:int) (vsr:bool) = print_pair (print_vec dst vsr p) (p.const src) in let print_vec_pair_imm (dst src:vec) (imm:int) (vsr:bool) = print_triple (print_vec dst vsr p) (print_vec src vsr p) (p.const imm) in let print_vec_triple_imm (dst src1 src2:vec) (count:int) (vsr:bool) = print_quadruple (print_vec dst vsr p) (print_vec src1 vsr p) (print_vec src2 vsr p) (p.const count) in let print_vec_mem (o1:vec) (o2:maddr) (vsr:bool) = print_pair (print_vec o1 vsr p) (print_maddr o2 p) in let print_vec_pair_imm_pair (dst src:vec) (s0 s1:int) (vsr:bool) = print_quadruple (print_vec dst vsr p) (print_vec src vsr p) (p.const s0) (p.const s1) in match ins with | Move dst src -> " mr " ^ print_reg_pair dst src | Load64 dst base offset -> " ld " ^ print_reg_mem dst ({ address = base; offset = offset }) | Store64 src base offset -> " std " ^ print_reg_mem src ({ address = base; offset = offset }) | LoadImm64 dst src -> " li " ^ print_reg_imm dst src | LoadImmShl64 dst src -> " lis " ^ print_reg_imm dst src | AddLa dst src1 src2 -> " la " ^ print_reg_mem dst ({ address = src1; offset = src2 }) | Add dst src1 src2 -> " add " ^ print_reg_triple dst src1 src2 | AddImm dst src1 src2 -> " addi " ^ print_reg_pair_imm dst src1 src2 | AddCarry dst src1 src2 -> " addc " ^ print_reg_triple dst src1 src2 | AddExtended dst src1 src2 -> " adde " ^ print_reg_triple dst src1 src2 | AddExtendedOV dst src1 src2 -> " addex " ^ print_reg_triple dst src1 src2 | Sub dst src1 src2 -> " sub " ^ print_reg_triple dst src1 src2 | SubImm dst src1 src2 -> " subi " ^ print_reg_pair_imm dst src1 src2 | MulLow64 dst src1 src2 -> " mulld " ^ print_reg_triple dst src1 src2 | MulHigh64U dst src1 src2 -> " mulhdu " ^ print_reg_triple dst src1 src2 | Xor dst src1 src2 -> " xor " ^ print_reg_triple dst src1 src2 | And dst src1 src2 -> " and " ^ print_reg_triple dst src1 src2 | Sr64Imm dst src1 src2 -> " srdi " ^ print_reg_pair_imm dst src1 src2 | Sl64Imm dst src1 src2 -> " sldi " ^ print_reg_pair_imm dst src1 src2 | Sr64 dst src1 src2 -> " srd " ^ print_reg_triple dst src1 src2 | Sl64 dst src1 src2 -> " sld " ^ print_reg_triple dst src1 src2 | Vmr dst src -> " vmr " ^ print_vec_pair dst src false | Mfvsrd dst src -> " mfvsrd " ^ print_reg_vec dst src true | Mfvsrld dst src -> " mfvsrld " ^ print_reg_vec dst src true | Mtvsrdd dst src1 src2 -> " mtvsrdd " ^ print_vec_reg_pair dst src1 src2 true | Mtvsrws dst src -> " mtvsrws " ^ print_vec_reg dst src true | Vadduwm dst src1 src2 -> " vadduwm " ^ print_vec_triple dst src1 src2 false | Vxor dst src1 src2 -> " vxor " ^ print_vec_triple dst src1 src2 false | Vand dst src1 src2 -> " vand " ^ print_vec_triple dst src1 src2 false | Vslw dst src1 src2 -> " vslw " ^ print_vec_triple dst src1 src2 false | Vsrw dst src1 src2 -> " vsrw " ^ print_vec_triple dst src1 src2 false | Vsl dst src1 src2 -> " vsl " ^ print_vec_triple dst src1 src2 false | Vcmpequw dst src1 src2 -> " vcmpequw " ^ print_vec_triple dst src1 src2 false | Vsldoi dst src1 src2 count -> " vsldoi " ^ print_vec_triple_imm dst src1 src2 count false | Vmrghw dst src1 src2 -> " vmrghw " ^ print_vec_triple dst src1 src2 false | Xxmrghd dst src1 src2 -> " xxmrghd " ^ print_vec_triple dst src1 src2 true | Vsel dst src1 src2 sel -> " vsel " ^ print_vec_quadruple dst src1 src2 sel false | Vspltw dst src uim -> " vspltw " ^ print_vec_pair_imm dst src uim false | Vspltisw dst src -> " vspltisw " ^ print_vec_imm dst src false | Vspltisb dst src -> " vspltisb " ^ print_vec_imm dst src false | Load128 dst base offset -> " lvx " ^ print_vec_reg_pair dst offset base false | Store128 src base offset -> " stvx " ^ print_vec_reg_pair src offset base false | Load128Word4 dst base -> " lxvw4x " ^ print_vec_reg_pair dst 0 base true | Load128Word4Index dst base offset -> " lxvw4x " ^ print_vec_reg_pair dst offset base true | Store128Word4 src base -> " stxvw4x " ^ print_vec_reg_pair src 0 base true | Store128Word4Index src base offset -> " stxvw4x " ^ print_vec_reg_pair src offset base true | Load128Byte16 dst base -> " lxvb16x " ^ print_vec_reg_pair dst 0 base true | Load128Byte16Index dst base offset -> " lxvb16x " ^ print_vec_reg_pair dst offset base true | Store128Byte16 src base -> " stxvb16x " ^ print_vec_reg_pair src 0 base true | Store128Byte16Index src base offset -> " stxvb16x " ^ print_vec_reg_pair src offset base true | Vshasigmaw0 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 0 0 false | Vshasigmaw1 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 0 15 false | Vshasigmaw2 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 1 0 false | Vshasigmaw3 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 1 15 false | Vsbox dst src -> " vsbox " ^ print_vec_pair dst src false | RotWord dst src1 src2 -> " vrlw " ^ print_vec_triple dst src1 src2 false | Vcipher dst src1 src2 -> " vcipher " ^ print_vec_triple dst src1 src2 false | Vcipherlast dst src1 src2 -> " vcipherlast " ^ print_vec_triple dst src1 src2 false | Vncipher dst src1 src2 -> " vncipher " ^ print_vec_triple dst src1 src2 false | Vncipherlast dst src1 src2 -> " vncipherlast " ^ print_vec_triple dst src1 src2 false | Vpmsumd dst src1 src2 -> " vpmsumd " ^ print_vec_triple dst src1 src2 false | Alloc n -> " subi " ^ print_reg_pair_imm 1 1 n | Dealloc n -> " addi " ^ print_reg_pair_imm 1 1 n | StoreStack128 src t offset -> " stxv " ^ print_vec_mem src ({ address = 1; offset = offset }) true | LoadStack128 dst t offset -> " lxv " ^ print_vec_mem dst ({ address = 1; offset = offset }) true | StoreStack64 src t offset -> " std " ^ print_reg_mem src ({ address = 1; offset = offset }) | LoadStack64 dst t offset -> " ld " ^ print_reg_mem dst ({ address = 1; offset = offset }) | Ghost _ -> "" let print_cmp (c:ocmp) (counter:int) (p:printer) : string = let print_cmp_ops (o1:cmp_opr) (o2:cmp_opr) : string = match o2 with | CReg r -> " cmpld " ^ (print_first_cmp_opr o1 p) ^ ", " ^ (print_reg r p) ^ "\n" | CImm n -> " cmpldi " ^ (print_first_cmp_opr o1 p) ^ ", " ^ (string_of_int n) ^ "\n" in match c with | OEq o1 o2 -> print_cmp_ops o1 o2 ^ " beq " ^ "L" ^ string_of_int counter ^ "\n" | ONe o1 o2 -> print_cmp_ops o1 o2 ^ " bne "^ "L" ^ string_of_int counter ^ "\n" | OLe o1 o2 -> print_cmp_ops o1 o2 ^ " ble "^ "L" ^ string_of_int counter ^ "\n" | OGe o1 o2 -> print_cmp_ops o1 o2 ^ " bge "^ "L" ^ string_of_int counter ^ "\n" | OLt o1 o2 -> print_cmp_ops o1 o2 ^ " blt " ^ "L" ^ string_of_int counter ^ "\n" | OGt o1 o2 -> print_cmp_ops o1 o2 ^ " bgt " ^ "L" ^ string_of_int counter ^ "\n" let rec print_block (b:codes) (n:int) (p:printer) : string & int = match b with | Nil -> ("", n) | head :: tail -> let (head_str, n') = print_code head n p in let (rest, n'') = print_block tail n' p in (head_str ^ rest, n'') and print_code (c:code) (n:int) (p:printer) : string & int = match c with | Ins ins -> (print_ins ins p ^ "\n", n) | Block b -> print_block b n p | IfElse cond true_code false_code -> let n1 = n in let n2 = n + 1 in let cmp = print_cmp (cmp_not cond) n1 p in let (true_str, n') = print_code true_code (n + 2) p in let branch = " b L" ^ string_of_int n2 ^ "\n" in let label1 = "L" ^ string_of_int n1 ^ ":\n" in let (false_str, n') = print_code false_code n' p in let label2 = "L" ^ string_of_int n2 ^ ":\n" in (cmp ^ true_str ^ branch ^ label1 ^ false_str ^ label2, n') | While cond body -> let n1 = n in let n2 = n + 1 in let branch = " b L" ^ string_of_int n2 ^ "\n" in let label1 = p.align() ^ " 4\nL" ^ string_of_int n1 ^ ":\n" in let (body_str, n') = print_code body (n + 2) p in let label2 = p.align() ^ " 4\nL" ^ string_of_int n2 ^ ":\n" in let cmp = print_cmp cond n1 p in (branch ^ label1 ^ body_str ^ label2 ^ cmp, n') let print_header (p:printer) = print_string (p.header()) let print_proc (name:string) (code:code) (label:int) (p:printer) : FStar.All.ML int = let proc = p.proc_name name in let (code_str, final_label) = print_code code label p in let ret = p.ret name in print_string (proc ^ code_str ^ ret); final_label let print_footer (p:printer) = print_string (p.footer())
false
true
Vale.PPC64LE.Print_s.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val gcc:printer
[]
Vale.PPC64LE.Print_s.gcc
{ "file_name": "vale/specs/hardware/Vale.PPC64LE.Print_s.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Vale.PPC64LE.Print_s.printer
{ "end_col": 3, "end_line": 259, "start_col": 19, "start_line": 235 }
FStar.All.ML
val print_proc (name: string) (code: code) (label: int) (p: printer) : FStar.All.ML int
[ { "abbrev": false, "full_module": "FStar.IO", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let print_proc (name:string) (code:code) (label:int) (p:printer) : FStar.All.ML int = let proc = p.proc_name name in let (code_str, final_label) = print_code code label p in let ret = p.ret name in print_string (proc ^ code_str ^ ret); final_label
val print_proc (name: string) (code: code) (label: int) (p: printer) : FStar.All.ML int let print_proc (name: string) (code: code) (label: int) (p: printer) : FStar.All.ML int =
true
null
false
let proc = p.proc_name name in let code_str, final_label = print_code code label p in let ret = p.ret name in print_string (proc ^ code_str ^ ret); final_label
{ "checked_file": "Vale.PPC64LE.Print_s.fst.checked", "dependencies": [ "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IO.fst.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.Print_s.fst" }
[ "ml" ]
[ "Prims.string", "Vale.PPC64LE.Semantics_s.code", "Prims.int", "Vale.PPC64LE.Print_s.printer", "Prims.unit", "FStar.IO.print_string", "Prims.op_Hat", "Vale.PPC64LE.Print_s.__proj__Mkprinter__item__ret", "FStar.Pervasives.Native.tuple2", "Vale.PPC64LE.Print_s.print_code", "Vale.PPC64LE.Print_s.__proj__Mkprinter__item__proc_name" ]
[]
module Vale.PPC64LE.Print_s // Trusted code for producing assembly code open Vale.PPC64LE.Machine_s open Vale.PPC64LE.Semantics_s open FStar.IO noeq type printer = { reg_prefix : unit -> string; vec_prefix : unit -> string; vsr_prefix : unit -> string; maddr : string -> string -> string; const : int -> string; align : unit -> string; header : unit -> string; footer : unit -> string; proc_name : string -> string; ret : string -> string; } let print_reg (r:reg) (p:printer) = p.reg_prefix() ^ string_of_int r let print_vec (v:vec) (vsr:bool) (p:printer) = if vsr then p.vsr_prefix() ^ "32+" ^ string_of_int v else p.vec_prefix() ^ string_of_int v let print_maddr (m:maddr) (p:printer) = p.maddr (string_of_int m.offset) (print_reg m.address p) let cmp_not(o:ocmp) : ocmp = match o with | OEq o1 o2 -> ONe o1 o2 | ONe o1 o2 -> OEq o1 o2 | OLe o1 o2 -> OGt o1 o2 | OGe o1 o2 -> OLt o1 o2 | OLt o1 o2 -> OGe o1 o2 | OGt o1 o2 -> OLe o1 o2 // Sanity check let _ = assert (forall o . o == cmp_not (cmp_not o)) let print_first_cmp_opr (o:cmp_opr) (p:printer) = match o with | CReg r -> print_reg r p | _ -> "!!! INVALID first compare operand !!! Expected general purpose register." let print_ins (ins:ins) (p:printer) = let print_pair (o1 o2:string) = o1 ^ ", " ^ o2 in let print_triple (o1 o2 o3:string) = o1 ^ ", " ^ o2 ^ ", " ^ o3 in let print_quadruple (o1 o2 o3 o4:string) = o1 ^ ", " ^ o2 ^ ", " ^ o3 ^ ", " ^ o4 in let print_reg_pair (dst src:reg) = print_pair (print_reg dst p) (print_reg src p) in let print_reg_mem (o1:reg) (o2:maddr) = print_pair (print_reg o1 p) (print_maddr o2 p) in let print_reg_triple (dst src1 src2:reg) = print_triple (print_reg dst p) (print_reg src1 p) (print_reg src2 p) in let print_reg_imm (dst:reg) (src:int) = print_pair (print_reg dst p) (p.const src) in let print_reg_pair_imm (dst src1:reg) (src2:int) = print_triple (print_reg dst p) (print_reg src1 p) (p.const src2) in let print_reg_vec (dst:reg) (src:vec) (vsr:bool) = print_pair (print_reg dst p) (print_vec src vsr p) in let print_vec_reg (dst:vec) (src:reg) (vsr:bool) = print_pair (print_vec dst vsr p) (print_reg src p) in let print_vec_reg_pair (dst:vec) (src1 src2:reg) (vsr:bool) = print_triple (print_vec dst vsr p) (print_reg src1 p) (print_reg src2 p) in let print_vec_pair (dst src:vec) (vsr:bool) = print_pair (print_vec dst vsr p) (print_vec src vsr p) in let print_vec_triple (dst src1 src2:vec) (vsr:bool) = print_triple (print_vec dst vsr p) (print_vec src1 vsr p) (print_vec src2 vsr p) in let print_vec_quadruple (dst src1 src2 src3:vec) (vsr:bool) = print_quadruple (print_vec dst vsr p) (print_vec src1 vsr p) (print_vec src2 vsr p) (print_vec src3 vsr p) in let print_vec_imm (dst:vec) (src:int) (vsr:bool) = print_pair (print_vec dst vsr p) (p.const src) in let print_vec_pair_imm (dst src:vec) (imm:int) (vsr:bool) = print_triple (print_vec dst vsr p) (print_vec src vsr p) (p.const imm) in let print_vec_triple_imm (dst src1 src2:vec) (count:int) (vsr:bool) = print_quadruple (print_vec dst vsr p) (print_vec src1 vsr p) (print_vec src2 vsr p) (p.const count) in let print_vec_mem (o1:vec) (o2:maddr) (vsr:bool) = print_pair (print_vec o1 vsr p) (print_maddr o2 p) in let print_vec_pair_imm_pair (dst src:vec) (s0 s1:int) (vsr:bool) = print_quadruple (print_vec dst vsr p) (print_vec src vsr p) (p.const s0) (p.const s1) in match ins with | Move dst src -> " mr " ^ print_reg_pair dst src | Load64 dst base offset -> " ld " ^ print_reg_mem dst ({ address = base; offset = offset }) | Store64 src base offset -> " std " ^ print_reg_mem src ({ address = base; offset = offset }) | LoadImm64 dst src -> " li " ^ print_reg_imm dst src | LoadImmShl64 dst src -> " lis " ^ print_reg_imm dst src | AddLa dst src1 src2 -> " la " ^ print_reg_mem dst ({ address = src1; offset = src2 }) | Add dst src1 src2 -> " add " ^ print_reg_triple dst src1 src2 | AddImm dst src1 src2 -> " addi " ^ print_reg_pair_imm dst src1 src2 | AddCarry dst src1 src2 -> " addc " ^ print_reg_triple dst src1 src2 | AddExtended dst src1 src2 -> " adde " ^ print_reg_triple dst src1 src2 | AddExtendedOV dst src1 src2 -> " addex " ^ print_reg_triple dst src1 src2 | Sub dst src1 src2 -> " sub " ^ print_reg_triple dst src1 src2 | SubImm dst src1 src2 -> " subi " ^ print_reg_pair_imm dst src1 src2 | MulLow64 dst src1 src2 -> " mulld " ^ print_reg_triple dst src1 src2 | MulHigh64U dst src1 src2 -> " mulhdu " ^ print_reg_triple dst src1 src2 | Xor dst src1 src2 -> " xor " ^ print_reg_triple dst src1 src2 | And dst src1 src2 -> " and " ^ print_reg_triple dst src1 src2 | Sr64Imm dst src1 src2 -> " srdi " ^ print_reg_pair_imm dst src1 src2 | Sl64Imm dst src1 src2 -> " sldi " ^ print_reg_pair_imm dst src1 src2 | Sr64 dst src1 src2 -> " srd " ^ print_reg_triple dst src1 src2 | Sl64 dst src1 src2 -> " sld " ^ print_reg_triple dst src1 src2 | Vmr dst src -> " vmr " ^ print_vec_pair dst src false | Mfvsrd dst src -> " mfvsrd " ^ print_reg_vec dst src true | Mfvsrld dst src -> " mfvsrld " ^ print_reg_vec dst src true | Mtvsrdd dst src1 src2 -> " mtvsrdd " ^ print_vec_reg_pair dst src1 src2 true | Mtvsrws dst src -> " mtvsrws " ^ print_vec_reg dst src true | Vadduwm dst src1 src2 -> " vadduwm " ^ print_vec_triple dst src1 src2 false | Vxor dst src1 src2 -> " vxor " ^ print_vec_triple dst src1 src2 false | Vand dst src1 src2 -> " vand " ^ print_vec_triple dst src1 src2 false | Vslw dst src1 src2 -> " vslw " ^ print_vec_triple dst src1 src2 false | Vsrw dst src1 src2 -> " vsrw " ^ print_vec_triple dst src1 src2 false | Vsl dst src1 src2 -> " vsl " ^ print_vec_triple dst src1 src2 false | Vcmpequw dst src1 src2 -> " vcmpequw " ^ print_vec_triple dst src1 src2 false | Vsldoi dst src1 src2 count -> " vsldoi " ^ print_vec_triple_imm dst src1 src2 count false | Vmrghw dst src1 src2 -> " vmrghw " ^ print_vec_triple dst src1 src2 false | Xxmrghd dst src1 src2 -> " xxmrghd " ^ print_vec_triple dst src1 src2 true | Vsel dst src1 src2 sel -> " vsel " ^ print_vec_quadruple dst src1 src2 sel false | Vspltw dst src uim -> " vspltw " ^ print_vec_pair_imm dst src uim false | Vspltisw dst src -> " vspltisw " ^ print_vec_imm dst src false | Vspltisb dst src -> " vspltisb " ^ print_vec_imm dst src false | Load128 dst base offset -> " lvx " ^ print_vec_reg_pair dst offset base false | Store128 src base offset -> " stvx " ^ print_vec_reg_pair src offset base false | Load128Word4 dst base -> " lxvw4x " ^ print_vec_reg_pair dst 0 base true | Load128Word4Index dst base offset -> " lxvw4x " ^ print_vec_reg_pair dst offset base true | Store128Word4 src base -> " stxvw4x " ^ print_vec_reg_pair src 0 base true | Store128Word4Index src base offset -> " stxvw4x " ^ print_vec_reg_pair src offset base true | Load128Byte16 dst base -> " lxvb16x " ^ print_vec_reg_pair dst 0 base true | Load128Byte16Index dst base offset -> " lxvb16x " ^ print_vec_reg_pair dst offset base true | Store128Byte16 src base -> " stxvb16x " ^ print_vec_reg_pair src 0 base true | Store128Byte16Index src base offset -> " stxvb16x " ^ print_vec_reg_pair src offset base true | Vshasigmaw0 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 0 0 false | Vshasigmaw1 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 0 15 false | Vshasigmaw2 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 1 0 false | Vshasigmaw3 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 1 15 false | Vsbox dst src -> " vsbox " ^ print_vec_pair dst src false | RotWord dst src1 src2 -> " vrlw " ^ print_vec_triple dst src1 src2 false | Vcipher dst src1 src2 -> " vcipher " ^ print_vec_triple dst src1 src2 false | Vcipherlast dst src1 src2 -> " vcipherlast " ^ print_vec_triple dst src1 src2 false | Vncipher dst src1 src2 -> " vncipher " ^ print_vec_triple dst src1 src2 false | Vncipherlast dst src1 src2 -> " vncipherlast " ^ print_vec_triple dst src1 src2 false | Vpmsumd dst src1 src2 -> " vpmsumd " ^ print_vec_triple dst src1 src2 false | Alloc n -> " subi " ^ print_reg_pair_imm 1 1 n | Dealloc n -> " addi " ^ print_reg_pair_imm 1 1 n | StoreStack128 src t offset -> " stxv " ^ print_vec_mem src ({ address = 1; offset = offset }) true | LoadStack128 dst t offset -> " lxv " ^ print_vec_mem dst ({ address = 1; offset = offset }) true | StoreStack64 src t offset -> " std " ^ print_reg_mem src ({ address = 1; offset = offset }) | LoadStack64 dst t offset -> " ld " ^ print_reg_mem dst ({ address = 1; offset = offset }) | Ghost _ -> "" let print_cmp (c:ocmp) (counter:int) (p:printer) : string = let print_cmp_ops (o1:cmp_opr) (o2:cmp_opr) : string = match o2 with | CReg r -> " cmpld " ^ (print_first_cmp_opr o1 p) ^ ", " ^ (print_reg r p) ^ "\n" | CImm n -> " cmpldi " ^ (print_first_cmp_opr o1 p) ^ ", " ^ (string_of_int n) ^ "\n" in match c with | OEq o1 o2 -> print_cmp_ops o1 o2 ^ " beq " ^ "L" ^ string_of_int counter ^ "\n" | ONe o1 o2 -> print_cmp_ops o1 o2 ^ " bne "^ "L" ^ string_of_int counter ^ "\n" | OLe o1 o2 -> print_cmp_ops o1 o2 ^ " ble "^ "L" ^ string_of_int counter ^ "\n" | OGe o1 o2 -> print_cmp_ops o1 o2 ^ " bge "^ "L" ^ string_of_int counter ^ "\n" | OLt o1 o2 -> print_cmp_ops o1 o2 ^ " blt " ^ "L" ^ string_of_int counter ^ "\n" | OGt o1 o2 -> print_cmp_ops o1 o2 ^ " bgt " ^ "L" ^ string_of_int counter ^ "\n" let rec print_block (b:codes) (n:int) (p:printer) : string & int = match b with | Nil -> ("", n) | head :: tail -> let (head_str, n') = print_code head n p in let (rest, n'') = print_block tail n' p in (head_str ^ rest, n'') and print_code (c:code) (n:int) (p:printer) : string & int = match c with | Ins ins -> (print_ins ins p ^ "\n", n) | Block b -> print_block b n p | IfElse cond true_code false_code -> let n1 = n in let n2 = n + 1 in let cmp = print_cmp (cmp_not cond) n1 p in let (true_str, n') = print_code true_code (n + 2) p in let branch = " b L" ^ string_of_int n2 ^ "\n" in let label1 = "L" ^ string_of_int n1 ^ ":\n" in let (false_str, n') = print_code false_code n' p in let label2 = "L" ^ string_of_int n2 ^ ":\n" in (cmp ^ true_str ^ branch ^ label1 ^ false_str ^ label2, n') | While cond body -> let n1 = n in let n2 = n + 1 in let branch = " b L" ^ string_of_int n2 ^ "\n" in let label1 = p.align() ^ " 4\nL" ^ string_of_int n1 ^ ":\n" in let (body_str, n') = print_code body (n + 2) p in let label2 = p.align() ^ " 4\nL" ^ string_of_int n2 ^ ":\n" in let cmp = print_cmp cond n1 p in (branch ^ label1 ^ body_str ^ label2 ^ cmp, n') let print_header (p:printer) = print_string (p.header())
false
false
Vale.PPC64LE.Print_s.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val print_proc (name: string) (code: code) (label: int) (p: printer) : FStar.All.ML int
[]
Vale.PPC64LE.Print_s.print_proc
{ "file_name": "vale/specs/hardware/Vale.PPC64LE.Print_s.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
name: Prims.string -> code: Vale.PPC64LE.Semantics_s.code -> label: Prims.int -> p: Vale.PPC64LE.Print_s.printer -> FStar.All.ML Prims.int
{ "end_col": 13, "end_line": 229, "start_col": 85, "start_line": 224 }
FStar.All.ML
[ { "abbrev": false, "full_module": "FStar.IO", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let print_header (p:printer) = print_string (p.header())
let print_header (p: printer) =
true
null
false
print_string (p.header ())
{ "checked_file": "Vale.PPC64LE.Print_s.fst.checked", "dependencies": [ "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IO.fst.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.Print_s.fst" }
[ "ml" ]
[ "Vale.PPC64LE.Print_s.printer", "FStar.IO.print_string", "Vale.PPC64LE.Print_s.__proj__Mkprinter__item__header", "Prims.unit" ]
[]
module Vale.PPC64LE.Print_s // Trusted code for producing assembly code open Vale.PPC64LE.Machine_s open Vale.PPC64LE.Semantics_s open FStar.IO noeq type printer = { reg_prefix : unit -> string; vec_prefix : unit -> string; vsr_prefix : unit -> string; maddr : string -> string -> string; const : int -> string; align : unit -> string; header : unit -> string; footer : unit -> string; proc_name : string -> string; ret : string -> string; } let print_reg (r:reg) (p:printer) = p.reg_prefix() ^ string_of_int r let print_vec (v:vec) (vsr:bool) (p:printer) = if vsr then p.vsr_prefix() ^ "32+" ^ string_of_int v else p.vec_prefix() ^ string_of_int v let print_maddr (m:maddr) (p:printer) = p.maddr (string_of_int m.offset) (print_reg m.address p) let cmp_not(o:ocmp) : ocmp = match o with | OEq o1 o2 -> ONe o1 o2 | ONe o1 o2 -> OEq o1 o2 | OLe o1 o2 -> OGt o1 o2 | OGe o1 o2 -> OLt o1 o2 | OLt o1 o2 -> OGe o1 o2 | OGt o1 o2 -> OLe o1 o2 // Sanity check let _ = assert (forall o . o == cmp_not (cmp_not o)) let print_first_cmp_opr (o:cmp_opr) (p:printer) = match o with | CReg r -> print_reg r p | _ -> "!!! INVALID first compare operand !!! Expected general purpose register." let print_ins (ins:ins) (p:printer) = let print_pair (o1 o2:string) = o1 ^ ", " ^ o2 in let print_triple (o1 o2 o3:string) = o1 ^ ", " ^ o2 ^ ", " ^ o3 in let print_quadruple (o1 o2 o3 o4:string) = o1 ^ ", " ^ o2 ^ ", " ^ o3 ^ ", " ^ o4 in let print_reg_pair (dst src:reg) = print_pair (print_reg dst p) (print_reg src p) in let print_reg_mem (o1:reg) (o2:maddr) = print_pair (print_reg o1 p) (print_maddr o2 p) in let print_reg_triple (dst src1 src2:reg) = print_triple (print_reg dst p) (print_reg src1 p) (print_reg src2 p) in let print_reg_imm (dst:reg) (src:int) = print_pair (print_reg dst p) (p.const src) in let print_reg_pair_imm (dst src1:reg) (src2:int) = print_triple (print_reg dst p) (print_reg src1 p) (p.const src2) in let print_reg_vec (dst:reg) (src:vec) (vsr:bool) = print_pair (print_reg dst p) (print_vec src vsr p) in let print_vec_reg (dst:vec) (src:reg) (vsr:bool) = print_pair (print_vec dst vsr p) (print_reg src p) in let print_vec_reg_pair (dst:vec) (src1 src2:reg) (vsr:bool) = print_triple (print_vec dst vsr p) (print_reg src1 p) (print_reg src2 p) in let print_vec_pair (dst src:vec) (vsr:bool) = print_pair (print_vec dst vsr p) (print_vec src vsr p) in let print_vec_triple (dst src1 src2:vec) (vsr:bool) = print_triple (print_vec dst vsr p) (print_vec src1 vsr p) (print_vec src2 vsr p) in let print_vec_quadruple (dst src1 src2 src3:vec) (vsr:bool) = print_quadruple (print_vec dst vsr p) (print_vec src1 vsr p) (print_vec src2 vsr p) (print_vec src3 vsr p) in let print_vec_imm (dst:vec) (src:int) (vsr:bool) = print_pair (print_vec dst vsr p) (p.const src) in let print_vec_pair_imm (dst src:vec) (imm:int) (vsr:bool) = print_triple (print_vec dst vsr p) (print_vec src vsr p) (p.const imm) in let print_vec_triple_imm (dst src1 src2:vec) (count:int) (vsr:bool) = print_quadruple (print_vec dst vsr p) (print_vec src1 vsr p) (print_vec src2 vsr p) (p.const count) in let print_vec_mem (o1:vec) (o2:maddr) (vsr:bool) = print_pair (print_vec o1 vsr p) (print_maddr o2 p) in let print_vec_pair_imm_pair (dst src:vec) (s0 s1:int) (vsr:bool) = print_quadruple (print_vec dst vsr p) (print_vec src vsr p) (p.const s0) (p.const s1) in match ins with | Move dst src -> " mr " ^ print_reg_pair dst src | Load64 dst base offset -> " ld " ^ print_reg_mem dst ({ address = base; offset = offset }) | Store64 src base offset -> " std " ^ print_reg_mem src ({ address = base; offset = offset }) | LoadImm64 dst src -> " li " ^ print_reg_imm dst src | LoadImmShl64 dst src -> " lis " ^ print_reg_imm dst src | AddLa dst src1 src2 -> " la " ^ print_reg_mem dst ({ address = src1; offset = src2 }) | Add dst src1 src2 -> " add " ^ print_reg_triple dst src1 src2 | AddImm dst src1 src2 -> " addi " ^ print_reg_pair_imm dst src1 src2 | AddCarry dst src1 src2 -> " addc " ^ print_reg_triple dst src1 src2 | AddExtended dst src1 src2 -> " adde " ^ print_reg_triple dst src1 src2 | AddExtendedOV dst src1 src2 -> " addex " ^ print_reg_triple dst src1 src2 | Sub dst src1 src2 -> " sub " ^ print_reg_triple dst src1 src2 | SubImm dst src1 src2 -> " subi " ^ print_reg_pair_imm dst src1 src2 | MulLow64 dst src1 src2 -> " mulld " ^ print_reg_triple dst src1 src2 | MulHigh64U dst src1 src2 -> " mulhdu " ^ print_reg_triple dst src1 src2 | Xor dst src1 src2 -> " xor " ^ print_reg_triple dst src1 src2 | And dst src1 src2 -> " and " ^ print_reg_triple dst src1 src2 | Sr64Imm dst src1 src2 -> " srdi " ^ print_reg_pair_imm dst src1 src2 | Sl64Imm dst src1 src2 -> " sldi " ^ print_reg_pair_imm dst src1 src2 | Sr64 dst src1 src2 -> " srd " ^ print_reg_triple dst src1 src2 | Sl64 dst src1 src2 -> " sld " ^ print_reg_triple dst src1 src2 | Vmr dst src -> " vmr " ^ print_vec_pair dst src false | Mfvsrd dst src -> " mfvsrd " ^ print_reg_vec dst src true | Mfvsrld dst src -> " mfvsrld " ^ print_reg_vec dst src true | Mtvsrdd dst src1 src2 -> " mtvsrdd " ^ print_vec_reg_pair dst src1 src2 true | Mtvsrws dst src -> " mtvsrws " ^ print_vec_reg dst src true | Vadduwm dst src1 src2 -> " vadduwm " ^ print_vec_triple dst src1 src2 false | Vxor dst src1 src2 -> " vxor " ^ print_vec_triple dst src1 src2 false | Vand dst src1 src2 -> " vand " ^ print_vec_triple dst src1 src2 false | Vslw dst src1 src2 -> " vslw " ^ print_vec_triple dst src1 src2 false | Vsrw dst src1 src2 -> " vsrw " ^ print_vec_triple dst src1 src2 false | Vsl dst src1 src2 -> " vsl " ^ print_vec_triple dst src1 src2 false | Vcmpequw dst src1 src2 -> " vcmpequw " ^ print_vec_triple dst src1 src2 false | Vsldoi dst src1 src2 count -> " vsldoi " ^ print_vec_triple_imm dst src1 src2 count false | Vmrghw dst src1 src2 -> " vmrghw " ^ print_vec_triple dst src1 src2 false | Xxmrghd dst src1 src2 -> " xxmrghd " ^ print_vec_triple dst src1 src2 true | Vsel dst src1 src2 sel -> " vsel " ^ print_vec_quadruple dst src1 src2 sel false | Vspltw dst src uim -> " vspltw " ^ print_vec_pair_imm dst src uim false | Vspltisw dst src -> " vspltisw " ^ print_vec_imm dst src false | Vspltisb dst src -> " vspltisb " ^ print_vec_imm dst src false | Load128 dst base offset -> " lvx " ^ print_vec_reg_pair dst offset base false | Store128 src base offset -> " stvx " ^ print_vec_reg_pair src offset base false | Load128Word4 dst base -> " lxvw4x " ^ print_vec_reg_pair dst 0 base true | Load128Word4Index dst base offset -> " lxvw4x " ^ print_vec_reg_pair dst offset base true | Store128Word4 src base -> " stxvw4x " ^ print_vec_reg_pair src 0 base true | Store128Word4Index src base offset -> " stxvw4x " ^ print_vec_reg_pair src offset base true | Load128Byte16 dst base -> " lxvb16x " ^ print_vec_reg_pair dst 0 base true | Load128Byte16Index dst base offset -> " lxvb16x " ^ print_vec_reg_pair dst offset base true | Store128Byte16 src base -> " stxvb16x " ^ print_vec_reg_pair src 0 base true | Store128Byte16Index src base offset -> " stxvb16x " ^ print_vec_reg_pair src offset base true | Vshasigmaw0 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 0 0 false | Vshasigmaw1 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 0 15 false | Vshasigmaw2 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 1 0 false | Vshasigmaw3 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 1 15 false | Vsbox dst src -> " vsbox " ^ print_vec_pair dst src false | RotWord dst src1 src2 -> " vrlw " ^ print_vec_triple dst src1 src2 false | Vcipher dst src1 src2 -> " vcipher " ^ print_vec_triple dst src1 src2 false | Vcipherlast dst src1 src2 -> " vcipherlast " ^ print_vec_triple dst src1 src2 false | Vncipher dst src1 src2 -> " vncipher " ^ print_vec_triple dst src1 src2 false | Vncipherlast dst src1 src2 -> " vncipherlast " ^ print_vec_triple dst src1 src2 false | Vpmsumd dst src1 src2 -> " vpmsumd " ^ print_vec_triple dst src1 src2 false | Alloc n -> " subi " ^ print_reg_pair_imm 1 1 n | Dealloc n -> " addi " ^ print_reg_pair_imm 1 1 n | StoreStack128 src t offset -> " stxv " ^ print_vec_mem src ({ address = 1; offset = offset }) true | LoadStack128 dst t offset -> " lxv " ^ print_vec_mem dst ({ address = 1; offset = offset }) true | StoreStack64 src t offset -> " std " ^ print_reg_mem src ({ address = 1; offset = offset }) | LoadStack64 dst t offset -> " ld " ^ print_reg_mem dst ({ address = 1; offset = offset }) | Ghost _ -> "" let print_cmp (c:ocmp) (counter:int) (p:printer) : string = let print_cmp_ops (o1:cmp_opr) (o2:cmp_opr) : string = match o2 with | CReg r -> " cmpld " ^ (print_first_cmp_opr o1 p) ^ ", " ^ (print_reg r p) ^ "\n" | CImm n -> " cmpldi " ^ (print_first_cmp_opr o1 p) ^ ", " ^ (string_of_int n) ^ "\n" in match c with | OEq o1 o2 -> print_cmp_ops o1 o2 ^ " beq " ^ "L" ^ string_of_int counter ^ "\n" | ONe o1 o2 -> print_cmp_ops o1 o2 ^ " bne "^ "L" ^ string_of_int counter ^ "\n" | OLe o1 o2 -> print_cmp_ops o1 o2 ^ " ble "^ "L" ^ string_of_int counter ^ "\n" | OGe o1 o2 -> print_cmp_ops o1 o2 ^ " bge "^ "L" ^ string_of_int counter ^ "\n" | OLt o1 o2 -> print_cmp_ops o1 o2 ^ " blt " ^ "L" ^ string_of_int counter ^ "\n" | OGt o1 o2 -> print_cmp_ops o1 o2 ^ " bgt " ^ "L" ^ string_of_int counter ^ "\n" let rec print_block (b:codes) (n:int) (p:printer) : string & int = match b with | Nil -> ("", n) | head :: tail -> let (head_str, n') = print_code head n p in let (rest, n'') = print_block tail n' p in (head_str ^ rest, n'') and print_code (c:code) (n:int) (p:printer) : string & int = match c with | Ins ins -> (print_ins ins p ^ "\n", n) | Block b -> print_block b n p | IfElse cond true_code false_code -> let n1 = n in let n2 = n + 1 in let cmp = print_cmp (cmp_not cond) n1 p in let (true_str, n') = print_code true_code (n + 2) p in let branch = " b L" ^ string_of_int n2 ^ "\n" in let label1 = "L" ^ string_of_int n1 ^ ":\n" in let (false_str, n') = print_code false_code n' p in let label2 = "L" ^ string_of_int n2 ^ ":\n" in (cmp ^ true_str ^ branch ^ label1 ^ false_str ^ label2, n') | While cond body -> let n1 = n in let n2 = n + 1 in let branch = " b L" ^ string_of_int n2 ^ "\n" in let label1 = p.align() ^ " 4\nL" ^ string_of_int n1 ^ ":\n" in let (body_str, n') = print_code body (n + 2) p in let label2 = p.align() ^ " 4\nL" ^ string_of_int n2 ^ ":\n" in let cmp = print_cmp cond n1 p in (branch ^ label1 ^ body_str ^ label2 ^ cmp, n')
false
false
Vale.PPC64LE.Print_s.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val print_header : p: Vale.PPC64LE.Print_s.printer -> FStar.All.ML Prims.unit
[]
Vale.PPC64LE.Print_s.print_header
{ "file_name": "vale/specs/hardware/Vale.PPC64LE.Print_s.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
p: Vale.PPC64LE.Print_s.printer -> FStar.All.ML Prims.unit
{ "end_col": 27, "end_line": 222, "start_col": 2, "start_line": 222 }
Prims.Tot
val cmp_not (o: ocmp) : ocmp
[ { "abbrev": false, "full_module": "FStar.IO", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let cmp_not(o:ocmp) : ocmp = match o with | OEq o1 o2 -> ONe o1 o2 | ONe o1 o2 -> OEq o1 o2 | OLe o1 o2 -> OGt o1 o2 | OGe o1 o2 -> OLt o1 o2 | OLt o1 o2 -> OGe o1 o2 | OGt o1 o2 -> OLe o1 o2
val cmp_not (o: ocmp) : ocmp let cmp_not (o: ocmp) : ocmp =
false
null
false
match o with | OEq o1 o2 -> ONe o1 o2 | ONe o1 o2 -> OEq o1 o2 | OLe o1 o2 -> OGt o1 o2 | OGe o1 o2 -> OLt o1 o2 | OLt o1 o2 -> OGe o1 o2 | OGt o1 o2 -> OLe o1 o2
{ "checked_file": "Vale.PPC64LE.Print_s.fst.checked", "dependencies": [ "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IO.fst.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.Print_s.fst" }
[ "total" ]
[ "Vale.PPC64LE.Semantics_s.ocmp", "Vale.PPC64LE.Machine_s.cmp_opr", "Vale.PPC64LE.Semantics_s.ONe", "Vale.PPC64LE.Semantics_s.OEq", "Vale.PPC64LE.Semantics_s.OGt", "Vale.PPC64LE.Semantics_s.OLt", "Vale.PPC64LE.Semantics_s.OGe", "Vale.PPC64LE.Semantics_s.OLe" ]
[]
module Vale.PPC64LE.Print_s // Trusted code for producing assembly code open Vale.PPC64LE.Machine_s open Vale.PPC64LE.Semantics_s open FStar.IO noeq type printer = { reg_prefix : unit -> string; vec_prefix : unit -> string; vsr_prefix : unit -> string; maddr : string -> string -> string; const : int -> string; align : unit -> string; header : unit -> string; footer : unit -> string; proc_name : string -> string; ret : string -> string; } let print_reg (r:reg) (p:printer) = p.reg_prefix() ^ string_of_int r let print_vec (v:vec) (vsr:bool) (p:printer) = if vsr then p.vsr_prefix() ^ "32+" ^ string_of_int v else p.vec_prefix() ^ string_of_int v let print_maddr (m:maddr) (p:printer) = p.maddr (string_of_int m.offset) (print_reg m.address p)
false
true
Vale.PPC64LE.Print_s.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val cmp_not (o: ocmp) : ocmp
[]
Vale.PPC64LE.Print_s.cmp_not
{ "file_name": "vale/specs/hardware/Vale.PPC64LE.Print_s.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
o: Vale.PPC64LE.Semantics_s.ocmp -> Vale.PPC64LE.Semantics_s.ocmp
{ "end_col": 26, "end_line": 39, "start_col": 2, "start_line": 33 }
Prims.Tot
val print_cmp (c: ocmp) (counter: int) (p: printer) : string
[ { "abbrev": false, "full_module": "FStar.IO", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let print_cmp (c:ocmp) (counter:int) (p:printer) : string = let print_cmp_ops (o1:cmp_opr) (o2:cmp_opr) : string = match o2 with | CReg r -> " cmpld " ^ (print_first_cmp_opr o1 p) ^ ", " ^ (print_reg r p) ^ "\n" | CImm n -> " cmpldi " ^ (print_first_cmp_opr o1 p) ^ ", " ^ (string_of_int n) ^ "\n" in match c with | OEq o1 o2 -> print_cmp_ops o1 o2 ^ " beq " ^ "L" ^ string_of_int counter ^ "\n" | ONe o1 o2 -> print_cmp_ops o1 o2 ^ " bne "^ "L" ^ string_of_int counter ^ "\n" | OLe o1 o2 -> print_cmp_ops o1 o2 ^ " ble "^ "L" ^ string_of_int counter ^ "\n" | OGe o1 o2 -> print_cmp_ops o1 o2 ^ " bge "^ "L" ^ string_of_int counter ^ "\n" | OLt o1 o2 -> print_cmp_ops o1 o2 ^ " blt " ^ "L" ^ string_of_int counter ^ "\n" | OGt o1 o2 -> print_cmp_ops o1 o2 ^ " bgt " ^ "L" ^ string_of_int counter ^ "\n"
val print_cmp (c: ocmp) (counter: int) (p: printer) : string let print_cmp (c: ocmp) (counter: int) (p: printer) : string =
false
null
false
let print_cmp_ops (o1 o2: cmp_opr) : string = match o2 with | CReg r -> " cmpld " ^ (print_first_cmp_opr o1 p) ^ ", " ^ (print_reg r p) ^ "\n" | CImm n -> " cmpldi " ^ (print_first_cmp_opr o1 p) ^ ", " ^ (string_of_int n) ^ "\n" in match c with | OEq o1 o2 -> print_cmp_ops o1 o2 ^ " beq " ^ "L" ^ string_of_int counter ^ "\n" | ONe o1 o2 -> print_cmp_ops o1 o2 ^ " bne " ^ "L" ^ string_of_int counter ^ "\n" | OLe o1 o2 -> print_cmp_ops o1 o2 ^ " ble " ^ "L" ^ string_of_int counter ^ "\n" | OGe o1 o2 -> print_cmp_ops o1 o2 ^ " bge " ^ "L" ^ string_of_int counter ^ "\n" | OLt o1 o2 -> print_cmp_ops o1 o2 ^ " blt " ^ "L" ^ string_of_int counter ^ "\n" | OGt o1 o2 -> print_cmp_ops o1 o2 ^ " bgt " ^ "L" ^ string_of_int counter ^ "\n"
{ "checked_file": "Vale.PPC64LE.Print_s.fst.checked", "dependencies": [ "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IO.fst.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.Print_s.fst" }
[ "total" ]
[ "Vale.PPC64LE.Semantics_s.ocmp", "Prims.int", "Vale.PPC64LE.Print_s.printer", "Vale.PPC64LE.Machine_s.cmp_opr", "Prims.op_Hat", "Prims.string_of_int", "Prims.string", "Vale.PPC64LE.Machine_s.reg", "Vale.PPC64LE.Print_s.print_first_cmp_opr", "Vale.PPC64LE.Print_s.print_reg", "Vale.PPC64LE.Machine_s.imm16" ]
[]
module Vale.PPC64LE.Print_s // Trusted code for producing assembly code open Vale.PPC64LE.Machine_s open Vale.PPC64LE.Semantics_s open FStar.IO noeq type printer = { reg_prefix : unit -> string; vec_prefix : unit -> string; vsr_prefix : unit -> string; maddr : string -> string -> string; const : int -> string; align : unit -> string; header : unit -> string; footer : unit -> string; proc_name : string -> string; ret : string -> string; } let print_reg (r:reg) (p:printer) = p.reg_prefix() ^ string_of_int r let print_vec (v:vec) (vsr:bool) (p:printer) = if vsr then p.vsr_prefix() ^ "32+" ^ string_of_int v else p.vec_prefix() ^ string_of_int v let print_maddr (m:maddr) (p:printer) = p.maddr (string_of_int m.offset) (print_reg m.address p) let cmp_not(o:ocmp) : ocmp = match o with | OEq o1 o2 -> ONe o1 o2 | ONe o1 o2 -> OEq o1 o2 | OLe o1 o2 -> OGt o1 o2 | OGe o1 o2 -> OLt o1 o2 | OLt o1 o2 -> OGe o1 o2 | OGt o1 o2 -> OLe o1 o2 // Sanity check let _ = assert (forall o . o == cmp_not (cmp_not o)) let print_first_cmp_opr (o:cmp_opr) (p:printer) = match o with | CReg r -> print_reg r p | _ -> "!!! INVALID first compare operand !!! Expected general purpose register." let print_ins (ins:ins) (p:printer) = let print_pair (o1 o2:string) = o1 ^ ", " ^ o2 in let print_triple (o1 o2 o3:string) = o1 ^ ", " ^ o2 ^ ", " ^ o3 in let print_quadruple (o1 o2 o3 o4:string) = o1 ^ ", " ^ o2 ^ ", " ^ o3 ^ ", " ^ o4 in let print_reg_pair (dst src:reg) = print_pair (print_reg dst p) (print_reg src p) in let print_reg_mem (o1:reg) (o2:maddr) = print_pair (print_reg o1 p) (print_maddr o2 p) in let print_reg_triple (dst src1 src2:reg) = print_triple (print_reg dst p) (print_reg src1 p) (print_reg src2 p) in let print_reg_imm (dst:reg) (src:int) = print_pair (print_reg dst p) (p.const src) in let print_reg_pair_imm (dst src1:reg) (src2:int) = print_triple (print_reg dst p) (print_reg src1 p) (p.const src2) in let print_reg_vec (dst:reg) (src:vec) (vsr:bool) = print_pair (print_reg dst p) (print_vec src vsr p) in let print_vec_reg (dst:vec) (src:reg) (vsr:bool) = print_pair (print_vec dst vsr p) (print_reg src p) in let print_vec_reg_pair (dst:vec) (src1 src2:reg) (vsr:bool) = print_triple (print_vec dst vsr p) (print_reg src1 p) (print_reg src2 p) in let print_vec_pair (dst src:vec) (vsr:bool) = print_pair (print_vec dst vsr p) (print_vec src vsr p) in let print_vec_triple (dst src1 src2:vec) (vsr:bool) = print_triple (print_vec dst vsr p) (print_vec src1 vsr p) (print_vec src2 vsr p) in let print_vec_quadruple (dst src1 src2 src3:vec) (vsr:bool) = print_quadruple (print_vec dst vsr p) (print_vec src1 vsr p) (print_vec src2 vsr p) (print_vec src3 vsr p) in let print_vec_imm (dst:vec) (src:int) (vsr:bool) = print_pair (print_vec dst vsr p) (p.const src) in let print_vec_pair_imm (dst src:vec) (imm:int) (vsr:bool) = print_triple (print_vec dst vsr p) (print_vec src vsr p) (p.const imm) in let print_vec_triple_imm (dst src1 src2:vec) (count:int) (vsr:bool) = print_quadruple (print_vec dst vsr p) (print_vec src1 vsr p) (print_vec src2 vsr p) (p.const count) in let print_vec_mem (o1:vec) (o2:maddr) (vsr:bool) = print_pair (print_vec o1 vsr p) (print_maddr o2 p) in let print_vec_pair_imm_pair (dst src:vec) (s0 s1:int) (vsr:bool) = print_quadruple (print_vec dst vsr p) (print_vec src vsr p) (p.const s0) (p.const s1) in match ins with | Move dst src -> " mr " ^ print_reg_pair dst src | Load64 dst base offset -> " ld " ^ print_reg_mem dst ({ address = base; offset = offset }) | Store64 src base offset -> " std " ^ print_reg_mem src ({ address = base; offset = offset }) | LoadImm64 dst src -> " li " ^ print_reg_imm dst src | LoadImmShl64 dst src -> " lis " ^ print_reg_imm dst src | AddLa dst src1 src2 -> " la " ^ print_reg_mem dst ({ address = src1; offset = src2 }) | Add dst src1 src2 -> " add " ^ print_reg_triple dst src1 src2 | AddImm dst src1 src2 -> " addi " ^ print_reg_pair_imm dst src1 src2 | AddCarry dst src1 src2 -> " addc " ^ print_reg_triple dst src1 src2 | AddExtended dst src1 src2 -> " adde " ^ print_reg_triple dst src1 src2 | AddExtendedOV dst src1 src2 -> " addex " ^ print_reg_triple dst src1 src2 | Sub dst src1 src2 -> " sub " ^ print_reg_triple dst src1 src2 | SubImm dst src1 src2 -> " subi " ^ print_reg_pair_imm dst src1 src2 | MulLow64 dst src1 src2 -> " mulld " ^ print_reg_triple dst src1 src2 | MulHigh64U dst src1 src2 -> " mulhdu " ^ print_reg_triple dst src1 src2 | Xor dst src1 src2 -> " xor " ^ print_reg_triple dst src1 src2 | And dst src1 src2 -> " and " ^ print_reg_triple dst src1 src2 | Sr64Imm dst src1 src2 -> " srdi " ^ print_reg_pair_imm dst src1 src2 | Sl64Imm dst src1 src2 -> " sldi " ^ print_reg_pair_imm dst src1 src2 | Sr64 dst src1 src2 -> " srd " ^ print_reg_triple dst src1 src2 | Sl64 dst src1 src2 -> " sld " ^ print_reg_triple dst src1 src2 | Vmr dst src -> " vmr " ^ print_vec_pair dst src false | Mfvsrd dst src -> " mfvsrd " ^ print_reg_vec dst src true | Mfvsrld dst src -> " mfvsrld " ^ print_reg_vec dst src true | Mtvsrdd dst src1 src2 -> " mtvsrdd " ^ print_vec_reg_pair dst src1 src2 true | Mtvsrws dst src -> " mtvsrws " ^ print_vec_reg dst src true | Vadduwm dst src1 src2 -> " vadduwm " ^ print_vec_triple dst src1 src2 false | Vxor dst src1 src2 -> " vxor " ^ print_vec_triple dst src1 src2 false | Vand dst src1 src2 -> " vand " ^ print_vec_triple dst src1 src2 false | Vslw dst src1 src2 -> " vslw " ^ print_vec_triple dst src1 src2 false | Vsrw dst src1 src2 -> " vsrw " ^ print_vec_triple dst src1 src2 false | Vsl dst src1 src2 -> " vsl " ^ print_vec_triple dst src1 src2 false | Vcmpequw dst src1 src2 -> " vcmpequw " ^ print_vec_triple dst src1 src2 false | Vsldoi dst src1 src2 count -> " vsldoi " ^ print_vec_triple_imm dst src1 src2 count false | Vmrghw dst src1 src2 -> " vmrghw " ^ print_vec_triple dst src1 src2 false | Xxmrghd dst src1 src2 -> " xxmrghd " ^ print_vec_triple dst src1 src2 true | Vsel dst src1 src2 sel -> " vsel " ^ print_vec_quadruple dst src1 src2 sel false | Vspltw dst src uim -> " vspltw " ^ print_vec_pair_imm dst src uim false | Vspltisw dst src -> " vspltisw " ^ print_vec_imm dst src false | Vspltisb dst src -> " vspltisb " ^ print_vec_imm dst src false | Load128 dst base offset -> " lvx " ^ print_vec_reg_pair dst offset base false | Store128 src base offset -> " stvx " ^ print_vec_reg_pair src offset base false | Load128Word4 dst base -> " lxvw4x " ^ print_vec_reg_pair dst 0 base true | Load128Word4Index dst base offset -> " lxvw4x " ^ print_vec_reg_pair dst offset base true | Store128Word4 src base -> " stxvw4x " ^ print_vec_reg_pair src 0 base true | Store128Word4Index src base offset -> " stxvw4x " ^ print_vec_reg_pair src offset base true | Load128Byte16 dst base -> " lxvb16x " ^ print_vec_reg_pair dst 0 base true | Load128Byte16Index dst base offset -> " lxvb16x " ^ print_vec_reg_pair dst offset base true | Store128Byte16 src base -> " stxvb16x " ^ print_vec_reg_pair src 0 base true | Store128Byte16Index src base offset -> " stxvb16x " ^ print_vec_reg_pair src offset base true | Vshasigmaw0 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 0 0 false | Vshasigmaw1 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 0 15 false | Vshasigmaw2 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 1 0 false | Vshasigmaw3 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 1 15 false | Vsbox dst src -> " vsbox " ^ print_vec_pair dst src false | RotWord dst src1 src2 -> " vrlw " ^ print_vec_triple dst src1 src2 false | Vcipher dst src1 src2 -> " vcipher " ^ print_vec_triple dst src1 src2 false | Vcipherlast dst src1 src2 -> " vcipherlast " ^ print_vec_triple dst src1 src2 false | Vncipher dst src1 src2 -> " vncipher " ^ print_vec_triple dst src1 src2 false | Vncipherlast dst src1 src2 -> " vncipherlast " ^ print_vec_triple dst src1 src2 false | Vpmsumd dst src1 src2 -> " vpmsumd " ^ print_vec_triple dst src1 src2 false | Alloc n -> " subi " ^ print_reg_pair_imm 1 1 n | Dealloc n -> " addi " ^ print_reg_pair_imm 1 1 n | StoreStack128 src t offset -> " stxv " ^ print_vec_mem src ({ address = 1; offset = offset }) true | LoadStack128 dst t offset -> " lxv " ^ print_vec_mem dst ({ address = 1; offset = offset }) true | StoreStack64 src t offset -> " std " ^ print_reg_mem src ({ address = 1; offset = offset }) | LoadStack64 dst t offset -> " ld " ^ print_reg_mem dst ({ address = 1; offset = offset })
false
true
Vale.PPC64LE.Print_s.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val print_cmp (c: ocmp) (counter: int) (p: printer) : string
[]
Vale.PPC64LE.Print_s.print_cmp
{ "file_name": "vale/specs/hardware/Vale.PPC64LE.Print_s.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
c: Vale.PPC64LE.Semantics_s.ocmp -> counter: Prims.int -> p: Vale.PPC64LE.Print_s.printer -> Prims.string
{ "end_col": 84, "end_line": 188, "start_col": 59, "start_line": 176 }
Prims.Tot
[ { "abbrev": false, "full_module": "FStar.IO", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Semantics_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let print_ins (ins:ins) (p:printer) = let print_pair (o1 o2:string) = o1 ^ ", " ^ o2 in let print_triple (o1 o2 o3:string) = o1 ^ ", " ^ o2 ^ ", " ^ o3 in let print_quadruple (o1 o2 o3 o4:string) = o1 ^ ", " ^ o2 ^ ", " ^ o3 ^ ", " ^ o4 in let print_reg_pair (dst src:reg) = print_pair (print_reg dst p) (print_reg src p) in let print_reg_mem (o1:reg) (o2:maddr) = print_pair (print_reg o1 p) (print_maddr o2 p) in let print_reg_triple (dst src1 src2:reg) = print_triple (print_reg dst p) (print_reg src1 p) (print_reg src2 p) in let print_reg_imm (dst:reg) (src:int) = print_pair (print_reg dst p) (p.const src) in let print_reg_pair_imm (dst src1:reg) (src2:int) = print_triple (print_reg dst p) (print_reg src1 p) (p.const src2) in let print_reg_vec (dst:reg) (src:vec) (vsr:bool) = print_pair (print_reg dst p) (print_vec src vsr p) in let print_vec_reg (dst:vec) (src:reg) (vsr:bool) = print_pair (print_vec dst vsr p) (print_reg src p) in let print_vec_reg_pair (dst:vec) (src1 src2:reg) (vsr:bool) = print_triple (print_vec dst vsr p) (print_reg src1 p) (print_reg src2 p) in let print_vec_pair (dst src:vec) (vsr:bool) = print_pair (print_vec dst vsr p) (print_vec src vsr p) in let print_vec_triple (dst src1 src2:vec) (vsr:bool) = print_triple (print_vec dst vsr p) (print_vec src1 vsr p) (print_vec src2 vsr p) in let print_vec_quadruple (dst src1 src2 src3:vec) (vsr:bool) = print_quadruple (print_vec dst vsr p) (print_vec src1 vsr p) (print_vec src2 vsr p) (print_vec src3 vsr p) in let print_vec_imm (dst:vec) (src:int) (vsr:bool) = print_pair (print_vec dst vsr p) (p.const src) in let print_vec_pair_imm (dst src:vec) (imm:int) (vsr:bool) = print_triple (print_vec dst vsr p) (print_vec src vsr p) (p.const imm) in let print_vec_triple_imm (dst src1 src2:vec) (count:int) (vsr:bool) = print_quadruple (print_vec dst vsr p) (print_vec src1 vsr p) (print_vec src2 vsr p) (p.const count) in let print_vec_mem (o1:vec) (o2:maddr) (vsr:bool) = print_pair (print_vec o1 vsr p) (print_maddr o2 p) in let print_vec_pair_imm_pair (dst src:vec) (s0 s1:int) (vsr:bool) = print_quadruple (print_vec dst vsr p) (print_vec src vsr p) (p.const s0) (p.const s1) in match ins with | Move dst src -> " mr " ^ print_reg_pair dst src | Load64 dst base offset -> " ld " ^ print_reg_mem dst ({ address = base; offset = offset }) | Store64 src base offset -> " std " ^ print_reg_mem src ({ address = base; offset = offset }) | LoadImm64 dst src -> " li " ^ print_reg_imm dst src | LoadImmShl64 dst src -> " lis " ^ print_reg_imm dst src | AddLa dst src1 src2 -> " la " ^ print_reg_mem dst ({ address = src1; offset = src2 }) | Add dst src1 src2 -> " add " ^ print_reg_triple dst src1 src2 | AddImm dst src1 src2 -> " addi " ^ print_reg_pair_imm dst src1 src2 | AddCarry dst src1 src2 -> " addc " ^ print_reg_triple dst src1 src2 | AddExtended dst src1 src2 -> " adde " ^ print_reg_triple dst src1 src2 | AddExtendedOV dst src1 src2 -> " addex " ^ print_reg_triple dst src1 src2 | Sub dst src1 src2 -> " sub " ^ print_reg_triple dst src1 src2 | SubImm dst src1 src2 -> " subi " ^ print_reg_pair_imm dst src1 src2 | MulLow64 dst src1 src2 -> " mulld " ^ print_reg_triple dst src1 src2 | MulHigh64U dst src1 src2 -> " mulhdu " ^ print_reg_triple dst src1 src2 | Xor dst src1 src2 -> " xor " ^ print_reg_triple dst src1 src2 | And dst src1 src2 -> " and " ^ print_reg_triple dst src1 src2 | Sr64Imm dst src1 src2 -> " srdi " ^ print_reg_pair_imm dst src1 src2 | Sl64Imm dst src1 src2 -> " sldi " ^ print_reg_pair_imm dst src1 src2 | Sr64 dst src1 src2 -> " srd " ^ print_reg_triple dst src1 src2 | Sl64 dst src1 src2 -> " sld " ^ print_reg_triple dst src1 src2 | Vmr dst src -> " vmr " ^ print_vec_pair dst src false | Mfvsrd dst src -> " mfvsrd " ^ print_reg_vec dst src true | Mfvsrld dst src -> " mfvsrld " ^ print_reg_vec dst src true | Mtvsrdd dst src1 src2 -> " mtvsrdd " ^ print_vec_reg_pair dst src1 src2 true | Mtvsrws dst src -> " mtvsrws " ^ print_vec_reg dst src true | Vadduwm dst src1 src2 -> " vadduwm " ^ print_vec_triple dst src1 src2 false | Vxor dst src1 src2 -> " vxor " ^ print_vec_triple dst src1 src2 false | Vand dst src1 src2 -> " vand " ^ print_vec_triple dst src1 src2 false | Vslw dst src1 src2 -> " vslw " ^ print_vec_triple dst src1 src2 false | Vsrw dst src1 src2 -> " vsrw " ^ print_vec_triple dst src1 src2 false | Vsl dst src1 src2 -> " vsl " ^ print_vec_triple dst src1 src2 false | Vcmpequw dst src1 src2 -> " vcmpequw " ^ print_vec_triple dst src1 src2 false | Vsldoi dst src1 src2 count -> " vsldoi " ^ print_vec_triple_imm dst src1 src2 count false | Vmrghw dst src1 src2 -> " vmrghw " ^ print_vec_triple dst src1 src2 false | Xxmrghd dst src1 src2 -> " xxmrghd " ^ print_vec_triple dst src1 src2 true | Vsel dst src1 src2 sel -> " vsel " ^ print_vec_quadruple dst src1 src2 sel false | Vspltw dst src uim -> " vspltw " ^ print_vec_pair_imm dst src uim false | Vspltisw dst src -> " vspltisw " ^ print_vec_imm dst src false | Vspltisb dst src -> " vspltisb " ^ print_vec_imm dst src false | Load128 dst base offset -> " lvx " ^ print_vec_reg_pair dst offset base false | Store128 src base offset -> " stvx " ^ print_vec_reg_pair src offset base false | Load128Word4 dst base -> " lxvw4x " ^ print_vec_reg_pair dst 0 base true | Load128Word4Index dst base offset -> " lxvw4x " ^ print_vec_reg_pair dst offset base true | Store128Word4 src base -> " stxvw4x " ^ print_vec_reg_pair src 0 base true | Store128Word4Index src base offset -> " stxvw4x " ^ print_vec_reg_pair src offset base true | Load128Byte16 dst base -> " lxvb16x " ^ print_vec_reg_pair dst 0 base true | Load128Byte16Index dst base offset -> " lxvb16x " ^ print_vec_reg_pair dst offset base true | Store128Byte16 src base -> " stxvb16x " ^ print_vec_reg_pair src 0 base true | Store128Byte16Index src base offset -> " stxvb16x " ^ print_vec_reg_pair src offset base true | Vshasigmaw0 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 0 0 false | Vshasigmaw1 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 0 15 false | Vshasigmaw2 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 1 0 false | Vshasigmaw3 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 1 15 false | Vsbox dst src -> " vsbox " ^ print_vec_pair dst src false | RotWord dst src1 src2 -> " vrlw " ^ print_vec_triple dst src1 src2 false | Vcipher dst src1 src2 -> " vcipher " ^ print_vec_triple dst src1 src2 false | Vcipherlast dst src1 src2 -> " vcipherlast " ^ print_vec_triple dst src1 src2 false | Vncipher dst src1 src2 -> " vncipher " ^ print_vec_triple dst src1 src2 false | Vncipherlast dst src1 src2 -> " vncipherlast " ^ print_vec_triple dst src1 src2 false | Vpmsumd dst src1 src2 -> " vpmsumd " ^ print_vec_triple dst src1 src2 false | Alloc n -> " subi " ^ print_reg_pair_imm 1 1 n | Dealloc n -> " addi " ^ print_reg_pair_imm 1 1 n | StoreStack128 src t offset -> " stxv " ^ print_vec_mem src ({ address = 1; offset = offset }) true | LoadStack128 dst t offset -> " lxv " ^ print_vec_mem dst ({ address = 1; offset = offset }) true | StoreStack64 src t offset -> " std " ^ print_reg_mem src ({ address = 1; offset = offset }) | LoadStack64 dst t offset -> " ld " ^ print_reg_mem dst ({ address = 1; offset = offset }) | Ghost _ -> ""
let print_ins (ins: ins) (p: printer) =
false
null
false
let print_pair (o1 o2: string) = o1 ^ ", " ^ o2 in let print_triple (o1 o2 o3: string) = o1 ^ ", " ^ o2 ^ ", " ^ o3 in let print_quadruple (o1 o2 o3 o4: string) = o1 ^ ", " ^ o2 ^ ", " ^ o3 ^ ", " ^ o4 in let print_reg_pair (dst src: reg) = print_pair (print_reg dst p) (print_reg src p) in let print_reg_mem (o1: reg) (o2: maddr) = print_pair (print_reg o1 p) (print_maddr o2 p) in let print_reg_triple (dst src1 src2: reg) = print_triple (print_reg dst p) (print_reg src1 p) (print_reg src2 p) in let print_reg_imm (dst: reg) (src: int) = print_pair (print_reg dst p) (p.const src) in let print_reg_pair_imm (dst src1: reg) (src2: int) = print_triple (print_reg dst p) (print_reg src1 p) (p.const src2) in let print_reg_vec (dst: reg) (src: vec) (vsr: bool) = print_pair (print_reg dst p) (print_vec src vsr p) in let print_vec_reg (dst: vec) (src: reg) (vsr: bool) = print_pair (print_vec dst vsr p) (print_reg src p) in let print_vec_reg_pair (dst: vec) (src1 src2: reg) (vsr: bool) = print_triple (print_vec dst vsr p) (print_reg src1 p) (print_reg src2 p) in let print_vec_pair (dst src: vec) (vsr: bool) = print_pair (print_vec dst vsr p) (print_vec src vsr p) in let print_vec_triple (dst src1 src2: vec) (vsr: bool) = print_triple (print_vec dst vsr p) (print_vec src1 vsr p) (print_vec src2 vsr p) in let print_vec_quadruple (dst src1 src2 src3: vec) (vsr: bool) = print_quadruple (print_vec dst vsr p) (print_vec src1 vsr p) (print_vec src2 vsr p) (print_vec src3 vsr p) in let print_vec_imm (dst: vec) (src: int) (vsr: bool) = print_pair (print_vec dst vsr p) (p.const src) in let print_vec_pair_imm (dst src: vec) (imm: int) (vsr: bool) = print_triple (print_vec dst vsr p) (print_vec src vsr p) (p.const imm) in let print_vec_triple_imm (dst src1 src2: vec) (count: int) (vsr: bool) = print_quadruple (print_vec dst vsr p) (print_vec src1 vsr p) (print_vec src2 vsr p) (p.const count) in let print_vec_mem (o1: vec) (o2: maddr) (vsr: bool) = print_pair (print_vec o1 vsr p) (print_maddr o2 p) in let print_vec_pair_imm_pair (dst src: vec) (s0 s1: int) (vsr: bool) = print_quadruple (print_vec dst vsr p) (print_vec src vsr p) (p.const s0) (p.const s1) in match ins with | Move dst src -> " mr " ^ print_reg_pair dst src | Load64 dst base offset -> " ld " ^ print_reg_mem dst ({ address = base; offset = offset }) | Store64 src base offset -> " std " ^ print_reg_mem src ({ address = base; offset = offset }) | LoadImm64 dst src -> " li " ^ print_reg_imm dst src | LoadImmShl64 dst src -> " lis " ^ print_reg_imm dst src | AddLa dst src1 src2 -> " la " ^ print_reg_mem dst ({ address = src1; offset = src2 }) | Add dst src1 src2 -> " add " ^ print_reg_triple dst src1 src2 | AddImm dst src1 src2 -> " addi " ^ print_reg_pair_imm dst src1 src2 | AddCarry dst src1 src2 -> " addc " ^ print_reg_triple dst src1 src2 | AddExtended dst src1 src2 -> " adde " ^ print_reg_triple dst src1 src2 | AddExtendedOV dst src1 src2 -> " addex " ^ print_reg_triple dst src1 src2 | Sub dst src1 src2 -> " sub " ^ print_reg_triple dst src1 src2 | SubImm dst src1 src2 -> " subi " ^ print_reg_pair_imm dst src1 src2 | MulLow64 dst src1 src2 -> " mulld " ^ print_reg_triple dst src1 src2 | MulHigh64U dst src1 src2 -> " mulhdu " ^ print_reg_triple dst src1 src2 | Xor dst src1 src2 -> " xor " ^ print_reg_triple dst src1 src2 | And dst src1 src2 -> " and " ^ print_reg_triple dst src1 src2 | Sr64Imm dst src1 src2 -> " srdi " ^ print_reg_pair_imm dst src1 src2 | Sl64Imm dst src1 src2 -> " sldi " ^ print_reg_pair_imm dst src1 src2 | Sr64 dst src1 src2 -> " srd " ^ print_reg_triple dst src1 src2 | Sl64 dst src1 src2 -> " sld " ^ print_reg_triple dst src1 src2 | Vmr dst src -> " vmr " ^ print_vec_pair dst src false | Mfvsrd dst src -> " mfvsrd " ^ print_reg_vec dst src true | Mfvsrld dst src -> " mfvsrld " ^ print_reg_vec dst src true | Mtvsrdd dst src1 src2 -> " mtvsrdd " ^ print_vec_reg_pair dst src1 src2 true | Mtvsrws dst src -> " mtvsrws " ^ print_vec_reg dst src true | Vadduwm dst src1 src2 -> " vadduwm " ^ print_vec_triple dst src1 src2 false | Vxor dst src1 src2 -> " vxor " ^ print_vec_triple dst src1 src2 false | Vand dst src1 src2 -> " vand " ^ print_vec_triple dst src1 src2 false | Vslw dst src1 src2 -> " vslw " ^ print_vec_triple dst src1 src2 false | Vsrw dst src1 src2 -> " vsrw " ^ print_vec_triple dst src1 src2 false | Vsl dst src1 src2 -> " vsl " ^ print_vec_triple dst src1 src2 false | Vcmpequw dst src1 src2 -> " vcmpequw " ^ print_vec_triple dst src1 src2 false | Vsldoi dst src1 src2 count -> " vsldoi " ^ print_vec_triple_imm dst src1 src2 count false | Vmrghw dst src1 src2 -> " vmrghw " ^ print_vec_triple dst src1 src2 false | Xxmrghd dst src1 src2 -> " xxmrghd " ^ print_vec_triple dst src1 src2 true | Vsel dst src1 src2 sel -> " vsel " ^ print_vec_quadruple dst src1 src2 sel false | Vspltw dst src uim -> " vspltw " ^ print_vec_pair_imm dst src uim false | Vspltisw dst src -> " vspltisw " ^ print_vec_imm dst src false | Vspltisb dst src -> " vspltisb " ^ print_vec_imm dst src false | Load128 dst base offset -> " lvx " ^ print_vec_reg_pair dst offset base false | Store128 src base offset -> " stvx " ^ print_vec_reg_pair src offset base false | Load128Word4 dst base -> " lxvw4x " ^ print_vec_reg_pair dst 0 base true | Load128Word4Index dst base offset -> " lxvw4x " ^ print_vec_reg_pair dst offset base true | Store128Word4 src base -> " stxvw4x " ^ print_vec_reg_pair src 0 base true | Store128Word4Index src base offset -> " stxvw4x " ^ print_vec_reg_pair src offset base true | Load128Byte16 dst base -> " lxvb16x " ^ print_vec_reg_pair dst 0 base true | Load128Byte16Index dst base offset -> " lxvb16x " ^ print_vec_reg_pair dst offset base true | Store128Byte16 src base -> " stxvb16x " ^ print_vec_reg_pair src 0 base true | Store128Byte16Index src base offset -> " stxvb16x " ^ print_vec_reg_pair src offset base true | Vshasigmaw0 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 0 0 false | Vshasigmaw1 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 0 15 false | Vshasigmaw2 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 1 0 false | Vshasigmaw3 dst src -> " vshasigmaw " ^ print_vec_pair_imm_pair dst src 1 15 false | Vsbox dst src -> " vsbox " ^ print_vec_pair dst src false | RotWord dst src1 src2 -> " vrlw " ^ print_vec_triple dst src1 src2 false | Vcipher dst src1 src2 -> " vcipher " ^ print_vec_triple dst src1 src2 false | Vcipherlast dst src1 src2 -> " vcipherlast " ^ print_vec_triple dst src1 src2 false | Vncipher dst src1 src2 -> " vncipher " ^ print_vec_triple dst src1 src2 false | Vncipherlast dst src1 src2 -> " vncipherlast " ^ print_vec_triple dst src1 src2 false | Vpmsumd dst src1 src2 -> " vpmsumd " ^ print_vec_triple dst src1 src2 false | Alloc n -> " subi " ^ print_reg_pair_imm 1 1 n | Dealloc n -> " addi " ^ print_reg_pair_imm 1 1 n | StoreStack128 src t offset -> " stxv " ^ print_vec_mem src ({ address = 1; offset = offset }) true | LoadStack128 dst t offset -> " lxv " ^ print_vec_mem dst ({ address = 1; offset = offset }) true | StoreStack64 src t offset -> " std " ^ print_reg_mem src ({ address = 1; offset = offset }) | LoadStack64 dst t offset -> " ld " ^ print_reg_mem dst ({ address = 1; offset = offset }) | Ghost _ -> ""
{ "checked_file": "Vale.PPC64LE.Print_s.fst.checked", "dependencies": [ "Vale.PPC64LE.Semantics_s.fst.checked", "Vale.PPC64LE.Machine_s.fst.checked", "prims.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.IO.fst.checked", "FStar.All.fst.checked" ], "interface_file": false, "source_file": "Vale.PPC64LE.Print_s.fst" }
[ "total" ]
[ "Vale.PPC64LE.Semantics_s.ins", "Vale.PPC64LE.Print_s.printer", "Vale.PPC64LE.Machine_s.reg", "Prims.op_Hat", "Prims.int", "Vale.PPC64LE.Machine_s.Mkmaddr", "Vale.PPC64LE.Machine_s.simm16", "Vale.PPC64LE.Machine_s.nsimm16", "Vale.PPC64LE.Machine_s.bits64", "Vale.PPC64LE.Machine_s.vec", "Vale.PPC64LE.Machine_s.quad32bytes", "Vale.Def.Words_s.nat2", "Vale.PPC64LE.Machine_s.sim", "Vale.Def.Types_s.nat64", "Vale.Arch.HeapTypes_s.taint", "Prims.unit", "Prims.string", "Prims.bool", "Vale.PPC64LE.Print_s.print_vec", "Vale.PPC64LE.Print_s.__proj__Mkprinter__item__const", "Vale.PPC64LE.Machine_s.maddr", "Vale.PPC64LE.Print_s.print_maddr", "Vale.PPC64LE.Print_s.print_reg" ]
[]
module Vale.PPC64LE.Print_s // Trusted code for producing assembly code open Vale.PPC64LE.Machine_s open Vale.PPC64LE.Semantics_s open FStar.IO noeq type printer = { reg_prefix : unit -> string; vec_prefix : unit -> string; vsr_prefix : unit -> string; maddr : string -> string -> string; const : int -> string; align : unit -> string; header : unit -> string; footer : unit -> string; proc_name : string -> string; ret : string -> string; } let print_reg (r:reg) (p:printer) = p.reg_prefix() ^ string_of_int r let print_vec (v:vec) (vsr:bool) (p:printer) = if vsr then p.vsr_prefix() ^ "32+" ^ string_of_int v else p.vec_prefix() ^ string_of_int v let print_maddr (m:maddr) (p:printer) = p.maddr (string_of_int m.offset) (print_reg m.address p) let cmp_not(o:ocmp) : ocmp = match o with | OEq o1 o2 -> ONe o1 o2 | ONe o1 o2 -> OEq o1 o2 | OLe o1 o2 -> OGt o1 o2 | OGe o1 o2 -> OLt o1 o2 | OLt o1 o2 -> OGe o1 o2 | OGt o1 o2 -> OLe o1 o2 // Sanity check let _ = assert (forall o . o == cmp_not (cmp_not o)) let print_first_cmp_opr (o:cmp_opr) (p:printer) = match o with | CReg r -> print_reg r p | _ -> "!!! INVALID first compare operand !!! Expected general purpose register."
false
true
Vale.PPC64LE.Print_s.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val print_ins : ins: Vale.PPC64LE.Semantics_s.ins -> p: Vale.PPC64LE.Print_s.printer -> Prims.string
[]
Vale.PPC64LE.Print_s.print_ins
{ "file_name": "vale/specs/hardware/Vale.PPC64LE.Print_s.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
ins: Vale.PPC64LE.Semantics_s.ins -> p: Vale.PPC64LE.Print_s.printer -> Prims.string
{ "end_col": 17, "end_line": 175, "start_col": 37, "start_line": 49 }
Prims.Tot
[ { "abbrev": false, "full_module": "Binding", "short_module": null }, { "abbrev": true, "full_module": "Target", "short_module": "T" }, { "abbrev": true, "full_module": "Ast", "short_module": "A" }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let readable_itype = (i: itype { allow_reader_of_itype i == true })
let readable_itype =
false
null
false
(i: itype{allow_reader_of_itype i == true})
{ "checked_file": "InterpreterTarget.fsti.checked", "dependencies": [ "Target.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked", "Binding.fsti.checked", "Ast.fst.checked" ], "interface_file": false, "source_file": "InterpreterTarget.fsti" }
[ "total" ]
[ "InterpreterTarget.itype", "Prims.eq2", "Prims.bool", "InterpreterTarget.allow_reader_of_itype" ]
[]
(* Copyright 2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module InterpreterTarget (* The abstract syntax for the code produced by 3d, targeting prelude/Interpreter.fst *) open FStar.All module A = Ast module T = Target open Binding let expr = T.expr let action = T.action let lam a = A.ident & a type itype = | UInt8 | UInt16 | UInt32 | UInt64 | UInt8BE | UInt16BE | UInt32BE | UInt64BE | Unit | AllBytes | AllZeros let allow_reader_of_itype (i:itype) : bool = match i with | AllBytes | AllZeros -> false | _ -> true
false
true
InterpreterTarget.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val readable_itype : Type0
[]
InterpreterTarget.readable_itype
{ "file_name": "src/3d/InterpreterTarget.fsti", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
Type0
{ "end_col": 67, "end_line": 45, "start_col": 21, "start_line": 45 }
Prims.Tot
[ { "abbrev": false, "full_module": "Binding", "short_module": null }, { "abbrev": true, "full_module": "Target", "short_module": "T" }, { "abbrev": true, "full_module": "Ast", "short_module": "A" }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let lam a = A.ident & a
let lam a =
false
null
false
A.ident & a
{ "checked_file": "InterpreterTarget.fsti.checked", "dependencies": [ "Target.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked", "Binding.fsti.checked", "Ast.fst.checked" ], "interface_file": false, "source_file": "InterpreterTarget.fsti" }
[ "total" ]
[ "FStar.Pervasives.Native.tuple2", "Ast.ident" ]
[]
(* Copyright 2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module InterpreterTarget (* The abstract syntax for the code produced by 3d, targeting prelude/Interpreter.fst *) open FStar.All module A = Ast module T = Target open Binding let expr = T.expr
false
true
InterpreterTarget.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val lam : a: Type -> Type
[]
InterpreterTarget.lam
{ "file_name": "src/3d/InterpreterTarget.fsti", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
a: Type -> Type
{ "end_col": 23, "end_line": 24, "start_col": 12, "start_line": 24 }
Prims.Tot
[ { "abbrev": false, "full_module": "Binding", "short_module": null }, { "abbrev": true, "full_module": "Target", "short_module": "T" }, { "abbrev": true, "full_module": "Ast", "short_module": "A" }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let non_empty_string = s:string { s <> "" }
let non_empty_string =
false
null
false
s: string{s <> ""}
{ "checked_file": "InterpreterTarget.fsti.checked", "dependencies": [ "Target.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked", "Binding.fsti.checked", "Ast.fst.checked" ], "interface_file": false, "source_file": "InterpreterTarget.fsti" }
[ "total" ]
[ "Prims.string", "Prims.b2t", "Prims.op_disEquality" ]
[]
(* Copyright 2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module InterpreterTarget (* The abstract syntax for the code produced by 3d, targeting prelude/Interpreter.fst *) open FStar.All module A = Ast module T = Target open Binding let expr = T.expr let action = T.action let lam a = A.ident & a type itype = | UInt8 | UInt16 | UInt32 | UInt64 | UInt8BE | UInt16BE | UInt32BE | UInt64BE | Unit | AllBytes | AllZeros let allow_reader_of_itype (i:itype) : bool = match i with | AllBytes | AllZeros -> false | _ -> true let readable_itype = (i: itype { allow_reader_of_itype i == true }) noeq type dtyp : Type = | DT_IType: i:itype -> dtyp | DT_App: readable: bool -> hd:A.ident -> args:list expr -> dtyp let allow_reader_of_dtyp (d: dtyp) : Tot bool = match d with | DT_IType i -> allow_reader_of_itype i | DT_App readable _ _ -> readable let readable_dtyp = (d: dtyp { allow_reader_of_dtyp d == true })
false
true
InterpreterTarget.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val non_empty_string : Type0
[]
InterpreterTarget.non_empty_string
{ "file_name": "src/3d/InterpreterTarget.fsti", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
Type0
{ "end_col": 43, "end_line": 65, "start_col": 23, "start_line": 65 }
Prims.Tot
[ { "abbrev": false, "full_module": "Binding", "short_module": null }, { "abbrev": true, "full_module": "Target", "short_module": "T" }, { "abbrev": true, "full_module": "Ast", "short_module": "A" }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let readable_dtyp = (d: dtyp { allow_reader_of_dtyp d == true })
let readable_dtyp =
false
null
false
(d: dtyp{allow_reader_of_dtyp d == true})
{ "checked_file": "InterpreterTarget.fsti.checked", "dependencies": [ "Target.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked", "Binding.fsti.checked", "Ast.fst.checked" ], "interface_file": false, "source_file": "InterpreterTarget.fsti" }
[ "total" ]
[ "InterpreterTarget.dtyp", "Prims.eq2", "Prims.bool", "InterpreterTarget.allow_reader_of_dtyp" ]
[]
(* Copyright 2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module InterpreterTarget (* The abstract syntax for the code produced by 3d, targeting prelude/Interpreter.fst *) open FStar.All module A = Ast module T = Target open Binding let expr = T.expr let action = T.action let lam a = A.ident & a type itype = | UInt8 | UInt16 | UInt32 | UInt64 | UInt8BE | UInt16BE | UInt32BE | UInt64BE | Unit | AllBytes | AllZeros let allow_reader_of_itype (i:itype) : bool = match i with | AllBytes | AllZeros -> false | _ -> true let readable_itype = (i: itype { allow_reader_of_itype i == true }) noeq type dtyp : Type = | DT_IType: i:itype -> dtyp | DT_App: readable: bool -> hd:A.ident -> args:list expr -> dtyp let allow_reader_of_dtyp (d: dtyp) : Tot bool = match d with | DT_IType i -> allow_reader_of_itype i | DT_App readable _ _ -> readable
false
true
InterpreterTarget.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val readable_dtyp : Type0
[]
InterpreterTarget.readable_dtyp
{ "file_name": "src/3d/InterpreterTarget.fsti", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
Type0
{ "end_col": 64, "end_line": 63, "start_col": 20, "start_line": 63 }
Prims.Tot
[ { "abbrev": false, "full_module": "Binding", "short_module": null }, { "abbrev": true, "full_module": "Target", "short_module": "T" }, { "abbrev": true, "full_module": "Ast", "short_module": "A" }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let action = T.action
let action =
false
null
false
T.action
{ "checked_file": "InterpreterTarget.fsti.checked", "dependencies": [ "Target.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked", "Binding.fsti.checked", "Ast.fst.checked" ], "interface_file": false, "source_file": "InterpreterTarget.fsti" }
[ "total" ]
[ "Target.action" ]
[]
(* Copyright 2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module InterpreterTarget (* The abstract syntax for the code produced by 3d, targeting prelude/Interpreter.fst *) open FStar.All module A = Ast module T = Target open Binding
false
true
InterpreterTarget.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val action : Type0
[]
InterpreterTarget.action
{ "file_name": "src/3d/InterpreterTarget.fsti", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
Type0
{ "end_col": 21, "end_line": 23, "start_col": 13, "start_line": 23 }
Prims.Tot
val allow_reader_of_itype (i: itype) : bool
[ { "abbrev": false, "full_module": "Binding", "short_module": null }, { "abbrev": true, "full_module": "Target", "short_module": "T" }, { "abbrev": true, "full_module": "Ast", "short_module": "A" }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let allow_reader_of_itype (i:itype) : bool = match i with | AllBytes | AllZeros -> false | _ -> true
val allow_reader_of_itype (i: itype) : bool let allow_reader_of_itype (i: itype) : bool =
false
null
false
match i with | AllBytes | AllZeros -> false | _ -> true
{ "checked_file": "InterpreterTarget.fsti.checked", "dependencies": [ "Target.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked", "Binding.fsti.checked", "Ast.fst.checked" ], "interface_file": false, "source_file": "InterpreterTarget.fsti" }
[ "total" ]
[ "InterpreterTarget.itype", "Prims.bool" ]
[]
(* Copyright 2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module InterpreterTarget (* The abstract syntax for the code produced by 3d, targeting prelude/Interpreter.fst *) open FStar.All module A = Ast module T = Target open Binding let expr = T.expr let action = T.action let lam a = A.ident & a type itype = | UInt8 | UInt16 | UInt32 | UInt64 | UInt8BE | UInt16BE | UInt32BE | UInt64BE | Unit | AllBytes | AllZeros let allow_reader_of_itype (i:itype)
false
true
InterpreterTarget.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val allow_reader_of_itype (i: itype) : bool
[]
InterpreterTarget.allow_reader_of_itype
{ "file_name": "src/3d/InterpreterTarget.fsti", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
i: InterpreterTarget.itype -> Prims.bool
{ "end_col": 15, "end_line": 43, "start_col": 4, "start_line": 40 }
Prims.Tot
[ { "abbrev": false, "full_module": "Binding", "short_module": null }, { "abbrev": true, "full_module": "Target", "short_module": "T" }, { "abbrev": true, "full_module": "Ast", "short_module": "A" }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let expr = T.expr
let expr =
false
null
false
T.expr
{ "checked_file": "InterpreterTarget.fsti.checked", "dependencies": [ "Target.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked", "Binding.fsti.checked", "Ast.fst.checked" ], "interface_file": false, "source_file": "InterpreterTarget.fsti" }
[ "total" ]
[ "Target.expr" ]
[]
(* Copyright 2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module InterpreterTarget (* The abstract syntax for the code produced by 3d, targeting prelude/Interpreter.fst *) open FStar.All module A = Ast module T = Target
false
true
InterpreterTarget.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val expr : Type0
[]
InterpreterTarget.expr
{ "file_name": "src/3d/InterpreterTarget.fsti", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
Type0
{ "end_col": 17, "end_line": 22, "start_col": 11, "start_line": 22 }
Prims.Tot
[ { "abbrev": false, "full_module": "Binding", "short_module": null }, { "abbrev": true, "full_module": "Target", "short_module": "T" }, { "abbrev": true, "full_module": "Ast", "short_module": "A" }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let not_type_decl = (d: T.decl { ~ (T.Type_decl? (fst d)) })
let not_type_decl =
false
null
false
(d: T.decl{~(T.Type_decl? (fst d))})
{ "checked_file": "InterpreterTarget.fsti.checked", "dependencies": [ "Target.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked", "Binding.fsti.checked", "Ast.fst.checked" ], "interface_file": false, "source_file": "InterpreterTarget.fsti" }
[ "total" ]
[ "Target.decl", "Prims.l_not", "Prims.b2t", "Target.uu___is_Type_decl", "FStar.Pervasives.Native.fst", "Target.decl'", "Target.decl_attributes" ]
[]
(* Copyright 2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module InterpreterTarget (* The abstract syntax for the code produced by 3d, targeting prelude/Interpreter.fst *) open FStar.All module A = Ast module T = Target open Binding let expr = T.expr let action = T.action let lam a = A.ident & a type itype = | UInt8 | UInt16 | UInt32 | UInt64 | UInt8BE | UInt16BE | UInt32BE | UInt64BE | Unit | AllBytes | AllZeros let allow_reader_of_itype (i:itype) : bool = match i with | AllBytes | AllZeros -> false | _ -> true let readable_itype = (i: itype { allow_reader_of_itype i == true }) noeq type dtyp : Type = | DT_IType: i:itype -> dtyp | DT_App: readable: bool -> hd:A.ident -> args:list expr -> dtyp let allow_reader_of_dtyp (d: dtyp) : Tot bool = match d with | DT_IType i -> allow_reader_of_itype i | DT_App readable _ _ -> readable let readable_dtyp = (d: dtyp { allow_reader_of_dtyp d == true }) let non_empty_string = s:string { s <> "" } let nes (s:string) : non_empty_string = if s = "" then "missing" else s noeq type typ : Type = | T_false: fn:non_empty_string -> typ | T_denoted: fn:non_empty_string -> d:dtyp -> typ | T_pair: fn:non_empty_string -> t1:typ -> t2:typ -> typ | T_dep_pair: fn:non_empty_string -> t1:readable_dtyp -> t2:lam typ -> typ | T_refine: fn:non_empty_string -> base:readable_dtyp -> refinement:lam expr -> typ | T_refine_with_action: fn:non_empty_string -> base:readable_dtyp -> refinement:lam expr -> a:lam action -> typ | T_dep_pair_with_refinement: fn:non_empty_string -> base:readable_dtyp -> refinement:lam expr -> k:lam typ -> typ | T_dep_pair_with_action: fn:non_empty_string -> base:readable_dtyp -> k:lam typ -> a:lam action -> typ | T_dep_pair_with_refinement_and_action: fn:non_empty_string -> base:readable_dtyp -> refinement:lam expr -> k:lam typ -> a:lam action -> typ | T_if_else: b:expr -> t1:typ -> t2:typ -> typ | T_with_action: fn:non_empty_string -> base:typ -> act:action -> typ | T_with_dep_action: fn:non_empty_string -> head:readable_dtyp -> act:lam action -> typ | T_with_comment: fn:non_empty_string -> t:typ -> c:string -> typ | T_nlist: fn:non_empty_string -> n:expr -> t:typ -> typ | T_at_most: fn:non_empty_string -> n:expr -> t:typ -> typ | T_exact: fn:non_empty_string -> n:expr -> t:typ -> typ | T_string: fn:non_empty_string -> element_type:readable_dtyp -> terminator:expr -> typ val inv_eloc : Type0 noeq type type_decl = { name : T.typedef_name; typ : typ; kind : T.parser_kind; inv_eloc : inv_eloc; allow_reading: bool; attrs : T.decl_attributes; enum_typ: option (t:T.typ {T.T_refine? t })
false
true
InterpreterTarget.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val not_type_decl : Type0
[]
InterpreterTarget.not_type_decl
{ "file_name": "src/3d/InterpreterTarget.fsti", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
Type0
{ "end_col": 60, "end_line": 188, "start_col": 20, "start_line": 188 }
Prims.Tot
val decl:Type0
[ { "abbrev": false, "full_module": "Binding", "short_module": null }, { "abbrev": true, "full_module": "Target", "short_module": "T" }, { "abbrev": true, "full_module": "Ast", "short_module": "A" }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let decl : Type0 = either not_type_decl type_decl
val decl:Type0 let decl:Type0 =
false
null
false
either not_type_decl type_decl
{ "checked_file": "InterpreterTarget.fsti.checked", "dependencies": [ "Target.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked", "Binding.fsti.checked", "Ast.fst.checked" ], "interface_file": false, "source_file": "InterpreterTarget.fsti" }
[ "total" ]
[ "FStar.Pervasives.either", "InterpreterTarget.not_type_decl", "InterpreterTarget.type_decl" ]
[]
(* Copyright 2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module InterpreterTarget (* The abstract syntax for the code produced by 3d, targeting prelude/Interpreter.fst *) open FStar.All module A = Ast module T = Target open Binding let expr = T.expr let action = T.action let lam a = A.ident & a type itype = | UInt8 | UInt16 | UInt32 | UInt64 | UInt8BE | UInt16BE | UInt32BE | UInt64BE | Unit | AllBytes | AllZeros let allow_reader_of_itype (i:itype) : bool = match i with | AllBytes | AllZeros -> false | _ -> true let readable_itype = (i: itype { allow_reader_of_itype i == true }) noeq type dtyp : Type = | DT_IType: i:itype -> dtyp | DT_App: readable: bool -> hd:A.ident -> args:list expr -> dtyp let allow_reader_of_dtyp (d: dtyp) : Tot bool = match d with | DT_IType i -> allow_reader_of_itype i | DT_App readable _ _ -> readable let readable_dtyp = (d: dtyp { allow_reader_of_dtyp d == true }) let non_empty_string = s:string { s <> "" } let nes (s:string) : non_empty_string = if s = "" then "missing" else s noeq type typ : Type = | T_false: fn:non_empty_string -> typ | T_denoted: fn:non_empty_string -> d:dtyp -> typ | T_pair: fn:non_empty_string -> t1:typ -> t2:typ -> typ | T_dep_pair: fn:non_empty_string -> t1:readable_dtyp -> t2:lam typ -> typ | T_refine: fn:non_empty_string -> base:readable_dtyp -> refinement:lam expr -> typ | T_refine_with_action: fn:non_empty_string -> base:readable_dtyp -> refinement:lam expr -> a:lam action -> typ | T_dep_pair_with_refinement: fn:non_empty_string -> base:readable_dtyp -> refinement:lam expr -> k:lam typ -> typ | T_dep_pair_with_action: fn:non_empty_string -> base:readable_dtyp -> k:lam typ -> a:lam action -> typ | T_dep_pair_with_refinement_and_action: fn:non_empty_string -> base:readable_dtyp -> refinement:lam expr -> k:lam typ -> a:lam action -> typ | T_if_else: b:expr -> t1:typ -> t2:typ -> typ | T_with_action: fn:non_empty_string -> base:typ -> act:action -> typ | T_with_dep_action: fn:non_empty_string -> head:readable_dtyp -> act:lam action -> typ | T_with_comment: fn:non_empty_string -> t:typ -> c:string -> typ | T_nlist: fn:non_empty_string -> n:expr -> t:typ -> typ | T_at_most: fn:non_empty_string -> n:expr -> t:typ -> typ | T_exact: fn:non_empty_string -> n:expr -> t:typ -> typ | T_string: fn:non_empty_string -> element_type:readable_dtyp -> terminator:expr -> typ val inv_eloc : Type0 noeq type type_decl = { name : T.typedef_name; typ : typ; kind : T.parser_kind; inv_eloc : inv_eloc; allow_reading: bool; attrs : T.decl_attributes; enum_typ: option (t:T.typ {T.T_refine? t }) }
false
true
InterpreterTarget.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val decl:Type0
[]
InterpreterTarget.decl
{ "file_name": "src/3d/InterpreterTarget.fsti", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
Type0
{ "end_col": 49, "end_line": 189, "start_col": 19, "start_line": 189 }
Prims.Tot
val nes (s: string) : non_empty_string
[ { "abbrev": false, "full_module": "Binding", "short_module": null }, { "abbrev": true, "full_module": "Target", "short_module": "T" }, { "abbrev": true, "full_module": "Ast", "short_module": "A" }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let nes (s:string) : non_empty_string = if s = "" then "missing" else s
val nes (s: string) : non_empty_string let nes (s: string) : non_empty_string =
false
null
false
if s = "" then "missing" else s
{ "checked_file": "InterpreterTarget.fsti.checked", "dependencies": [ "Target.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked", "Binding.fsti.checked", "Ast.fst.checked" ], "interface_file": false, "source_file": "InterpreterTarget.fsti" }
[ "total" ]
[ "Prims.string", "Prims.op_Equality", "Prims.bool", "InterpreterTarget.non_empty_string" ]
[]
(* Copyright 2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module InterpreterTarget (* The abstract syntax for the code produced by 3d, targeting prelude/Interpreter.fst *) open FStar.All module A = Ast module T = Target open Binding let expr = T.expr let action = T.action let lam a = A.ident & a type itype = | UInt8 | UInt16 | UInt32 | UInt64 | UInt8BE | UInt16BE | UInt32BE | UInt64BE | Unit | AllBytes | AllZeros let allow_reader_of_itype (i:itype) : bool = match i with | AllBytes | AllZeros -> false | _ -> true let readable_itype = (i: itype { allow_reader_of_itype i == true }) noeq type dtyp : Type = | DT_IType: i:itype -> dtyp | DT_App: readable: bool -> hd:A.ident -> args:list expr -> dtyp let allow_reader_of_dtyp (d: dtyp) : Tot bool = match d with | DT_IType i -> allow_reader_of_itype i | DT_App readable _ _ -> readable let readable_dtyp = (d: dtyp { allow_reader_of_dtyp d == true }) let non_empty_string = s:string { s <> "" } let nes (s:string)
false
true
InterpreterTarget.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val nes (s: string) : non_empty_string
[]
InterpreterTarget.nes
{ "file_name": "src/3d/InterpreterTarget.fsti", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
s: Prims.string -> InterpreterTarget.non_empty_string
{ "end_col": 35, "end_line": 69, "start_col": 4, "start_line": 69 }
Prims.Tot
val allow_reader_of_dtyp (d: dtyp) : Tot bool
[ { "abbrev": false, "full_module": "Binding", "short_module": null }, { "abbrev": true, "full_module": "Target", "short_module": "T" }, { "abbrev": true, "full_module": "Ast", "short_module": "A" }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let allow_reader_of_dtyp (d: dtyp) : Tot bool = match d with | DT_IType i -> allow_reader_of_itype i | DT_App readable _ _ -> readable
val allow_reader_of_dtyp (d: dtyp) : Tot bool let allow_reader_of_dtyp (d: dtyp) : Tot bool =
false
null
false
match d with | DT_IType i -> allow_reader_of_itype i | DT_App readable _ _ -> readable
{ "checked_file": "InterpreterTarget.fsti.checked", "dependencies": [ "Target.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.All.fst.checked", "Binding.fsti.checked", "Ast.fst.checked" ], "interface_file": false, "source_file": "InterpreterTarget.fsti" }
[ "total" ]
[ "InterpreterTarget.dtyp", "InterpreterTarget.itype", "InterpreterTarget.allow_reader_of_itype", "Prims.bool", "Ast.ident", "Prims.list", "InterpreterTarget.expr" ]
[]
(* Copyright 2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module InterpreterTarget (* The abstract syntax for the code produced by 3d, targeting prelude/Interpreter.fst *) open FStar.All module A = Ast module T = Target open Binding let expr = T.expr let action = T.action let lam a = A.ident & a type itype = | UInt8 | UInt16 | UInt32 | UInt64 | UInt8BE | UInt16BE | UInt32BE | UInt64BE | Unit | AllBytes | AllZeros let allow_reader_of_itype (i:itype) : bool = match i with | AllBytes | AllZeros -> false | _ -> true let readable_itype = (i: itype { allow_reader_of_itype i == true }) noeq type dtyp : Type = | DT_IType: i:itype -> dtyp | DT_App: readable: bool -> hd:A.ident -> args:list expr -> dtyp
false
true
InterpreterTarget.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val allow_reader_of_dtyp (d: dtyp) : Tot bool
[]
InterpreterTarget.allow_reader_of_dtyp
{ "file_name": "src/3d/InterpreterTarget.fsti", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
d: InterpreterTarget.dtyp -> Prims.bool
{ "end_col": 35, "end_line": 61, "start_col": 2, "start_line": 59 }
FStar.Pervasives.Lemma
val lemma_simd_round_key (prev0 prev1:quad32) (rcon:nat32) (round:int) : Lemma (simd_round_key_256 prev0 prev1 rcon round == round_key_256_rcon prev0 prev1 rcon round)
[ { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.AES_BE_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let lemma_simd_round_key (prev0 prev1:quad32) (rcon:nat32) (round:int) = quad32_xor_reveal (); commute_rot_word_sub_word prev1.lo0 rcon; Vale.Arch.Types.xor_lemmas ()
val lemma_simd_round_key (prev0 prev1:quad32) (rcon:nat32) (round:int) : Lemma (simd_round_key_256 prev0 prev1 rcon round == round_key_256_rcon prev0 prev1 rcon round) let lemma_simd_round_key (prev0 prev1: quad32) (rcon: nat32) (round: int) =
false
null
true
quad32_xor_reveal (); commute_rot_word_sub_word prev1.lo0 rcon; Vale.Arch.Types.xor_lemmas ()
{ "checked_file": "Vale.AES.AES256_helpers_BE.fst.checked", "dependencies": [ "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Vale.AES.AES256_helpers_BE.fst" }
[ "lemma" ]
[ "Vale.Def.Types_s.quad32", "Vale.Def.Types_s.nat32", "Prims.int", "Vale.Arch.Types.xor_lemmas", "Prims.unit", "Vale.AES.AES_BE_s.commute_rot_word_sub_word", "Vale.Def.Words_s.__proj__Mkfour__item__lo0", "Vale.Def.Types_s.quad32_xor_reveal" ]
[]
module Vale.AES.AES256_helpers_BE let lemma_reveal_expand_key_256 (key:aes_key_word AES_256) (round:nat) : Lemma (expand_key_256 key round == ( if round = 0 then Mkfour key.[3] key.[2] key.[1] key.[0] else if round = 1 then Mkfour key.[7] key.[6] key.[5] key.[4] else round_key_256 (expand_key_256 key (round - 2)) (expand_key_256 key (round - 1)) round )) = expand_key_256_reveal () #reset-options "--fuel 8 --ifuel 0" let lemma_expand_key_256_0 (key:aes_key_word AES_256) : Lemma (equal key (expand_key AES_256 key 8)) = expand_key_reveal () open FStar.Mul #reset-options "--fuel 1 --ifuel 0 --z3rlimit 40 --using_facts_from '* -FStar.Seq.Properties'" let lemma_expand_key_256_i (key:aes_key_word AES_256) (i:nat) : Lemma (requires 1 < i /\ i < 15 ) (ensures ( let m = 4 * (i - 2) in let n = 4 * i in let v = expand_key AES_256 key n in // Current let w = expand_key AES_256 key (n + 4) in // Next 4 words let prev0 = Mkfour v.[m + 3] v.[m + 2] v.[m + 1] v.[m + 0] in // Penultimate 4 words in Current let prev1 = Mkfour v.[m + 7] v.[m + 6] v.[m + 5] v.[m + 4] in // Ultimate 4 words in Current round_key_256 prev0 prev1 i == Mkfour w.[n + 3] w.[n + 2] w.[n + 1] w.[n + 0] // NextQuad == Next 4 words )) = expand_key_reveal (); let n = 4 * i in // unfold expand_key 8 times (could use fuel, but that unfolds everything): let _ = expand_key AES_256 key (n + 1) in let _ = expand_key AES_256 key (n + 2) in let _ = expand_key AES_256 key (n + 3) in let _ = expand_key AES_256 key (n + 4) in if i < 14 then ( let _ = expand_key AES_256 key (n + 5) in let _ = expand_key AES_256 key (n + 6) in let _ = expand_key AES_256 key (n + 7) in () ) else (); () #reset-options // expand_key for large 'size' argument agrees with expand_key for smaller 'size' argument let rec lemma_expand_append (key:aes_key_word AES_256) (size1:nat) (size2:nat) : Lemma (requires size1 <= size2 /\ size2 <= 60) (ensures equal (expand_key AES_256 key size1) (slice (expand_key AES_256 key size2) 0 size1)) (decreases size2) = expand_key_reveal (); if size1 < size2 then lemma_expand_append key size1 (size2 - 1) // quad32 key expansion is equivalent to nat32 key expansion let rec lemma_expand_key_256 (key:seq nat32) (size:nat) = lemma_expand_append key (4 * size) 60; if size = 0 then () else let i = size - 1 in lemma_expand_key_256 key i; lemma_reveal_expand_key_256 key i; if i < 2 then ( lemma_expand_append key 4 60; lemma_expand_append key 8 60; lemma_expand_key_256_0 key ) else ( lemma_expand_append key (4 * i) 60; lemma_expand_key_256 key (i - 1); lemma_expand_key_256_i key i ) // SIMD version of round_key_256 is equivalent to scalar round_key_256 #push-options "--fuel 3 --ifuel 3" // REVIEW: Why do we need this?
false
false
Vale.AES.AES256_helpers_BE.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 3, "initial_ifuel": 3, "max_fuel": 3, "max_ifuel": 3, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val lemma_simd_round_key (prev0 prev1:quad32) (rcon:nat32) (round:int) : Lemma (simd_round_key_256 prev0 prev1 rcon round == round_key_256_rcon prev0 prev1 rcon round)
[]
Vale.AES.AES256_helpers_BE.lemma_simd_round_key
{ "file_name": "vale/code/crypto/aes/Vale.AES.AES256_helpers_BE.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
prev0: Vale.Def.Types_s.quad32 -> prev1: Vale.Def.Types_s.quad32 -> rcon: Vale.Def.Types_s.nat32 -> round: Prims.int -> FStar.Pervasives.Lemma (ensures Vale.AES.AES256_helpers_BE.simd_round_key_256 prev0 prev1 rcon round == Vale.AES.AES256_helpers_BE.round_key_256_rcon prev0 prev1 rcon round)
{ "end_col": 31, "end_line": 84, "start_col": 2, "start_line": 82 }
FStar.Pervasives.Lemma
val lemma_reveal_expand_key_256 (key: aes_key_word AES_256) (round: nat) : Lemma (expand_key_256 key round == (if round = 0 then Mkfour key.[ 3 ] key.[ 2 ] key.[ 1 ] key.[ 0 ] else if round = 1 then Mkfour key.[ 7 ] key.[ 6 ] key.[ 5 ] key.[ 4 ] else round_key_256 (expand_key_256 key (round - 2)) (expand_key_256 key (round - 1)) round ))
[ { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.AES_BE_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let lemma_reveal_expand_key_256 (key:aes_key_word AES_256) (round:nat) : Lemma (expand_key_256 key round == ( if round = 0 then Mkfour key.[3] key.[2] key.[1] key.[0] else if round = 1 then Mkfour key.[7] key.[6] key.[5] key.[4] else round_key_256 (expand_key_256 key (round - 2)) (expand_key_256 key (round - 1)) round )) = expand_key_256_reveal ()
val lemma_reveal_expand_key_256 (key: aes_key_word AES_256) (round: nat) : Lemma (expand_key_256 key round == (if round = 0 then Mkfour key.[ 3 ] key.[ 2 ] key.[ 1 ] key.[ 0 ] else if round = 1 then Mkfour key.[ 7 ] key.[ 6 ] key.[ 5 ] key.[ 4 ] else round_key_256 (expand_key_256 key (round - 2)) (expand_key_256 key (round - 1)) round )) let lemma_reveal_expand_key_256 (key: aes_key_word AES_256) (round: nat) : Lemma (expand_key_256 key round == (if round = 0 then Mkfour key.[ 3 ] key.[ 2 ] key.[ 1 ] key.[ 0 ] else if round = 1 then Mkfour key.[ 7 ] key.[ 6 ] key.[ 5 ] key.[ 4 ] else round_key_256 (expand_key_256 key (round - 2)) (expand_key_256 key (round - 1)) round )) =
false
null
true
expand_key_256_reveal ()
{ "checked_file": "Vale.AES.AES256_helpers_BE.fst.checked", "dependencies": [ "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Vale.AES.AES256_helpers_BE.fst" }
[ "lemma" ]
[ "Vale.AES.AES_BE_s.aes_key_word", "Vale.AES.AES_common_s.AES_256", "Prims.nat", "Vale.AES.AES256_helpers_BE.expand_key_256_reveal", "Prims.unit", "Prims.l_True", "Prims.squash", "Prims.eq2", "Vale.Def.Words_s.four", "Vale.Def.Types_s.nat32", "Vale.AES.AES256_helpers_BE.expand_key_256", "Prims.op_Equality", "Prims.int", "Vale.Def.Words_s.Mkfour", "Vale.AES.AES256_helpers_BE.op_String_Access", "Prims.bool", "Vale.AES.AES256_helpers_BE.round_key_256", "Prims.op_Subtraction", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
module Vale.AES.AES256_helpers_BE let lemma_reveal_expand_key_256 (key:aes_key_word AES_256) (round:nat) : Lemma (expand_key_256 key round == ( if round = 0 then Mkfour key.[3] key.[2] key.[1] key.[0] else if round = 1 then Mkfour key.[7] key.[6] key.[5] key.[4] else round_key_256 (expand_key_256 key (round - 2)) (expand_key_256 key (round - 1)) round ))
false
false
Vale.AES.AES256_helpers_BE.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val lemma_reveal_expand_key_256 (key: aes_key_word AES_256) (round: nat) : Lemma (expand_key_256 key round == (if round = 0 then Mkfour key.[ 3 ] key.[ 2 ] key.[ 1 ] key.[ 0 ] else if round = 1 then Mkfour key.[ 7 ] key.[ 6 ] key.[ 5 ] key.[ 4 ] else round_key_256 (expand_key_256 key (round - 2)) (expand_key_256 key (round - 1)) round ))
[]
Vale.AES.AES256_helpers_BE.lemma_reveal_expand_key_256
{ "file_name": "vale/code/crypto/aes/Vale.AES.AES256_helpers_BE.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
key: Vale.AES.AES_BE_s.aes_key_word Vale.AES.AES_common_s.AES_256 -> round: Prims.nat -> FStar.Pervasives.Lemma (ensures Vale.AES.AES256_helpers_BE.expand_key_256 key round == (match round = 0 with | true -> Vale.Def.Words_s.Mkfour key.[ 3 ] key.[ 2 ] key.[ 1 ] key.[ 0 ] | _ -> (match round = 1 with | true -> Vale.Def.Words_s.Mkfour key.[ 7 ] key.[ 6 ] key.[ 5 ] key.[ 4 ] | _ -> Vale.AES.AES256_helpers_BE.round_key_256 (Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 2)) (Vale.AES.AES256_helpers_BE.expand_key_256 key (round - 1)) round) <: Vale.Def.Words_s.four Vale.Def.Types_s.nat32))
{ "end_col": 26, "end_line": 10, "start_col": 2, "start_line": 10 }
FStar.Pervasives.Lemma
val lemma_expand_key_256_0 (key: aes_key_word AES_256) : Lemma (equal key (expand_key AES_256 key 8))
[ { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.AES_BE_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let lemma_expand_key_256_0 (key:aes_key_word AES_256) : Lemma (equal key (expand_key AES_256 key 8)) = expand_key_reveal ()
val lemma_expand_key_256_0 (key: aes_key_word AES_256) : Lemma (equal key (expand_key AES_256 key 8)) let lemma_expand_key_256_0 (key: aes_key_word AES_256) : Lemma (equal key (expand_key AES_256 key 8)) =
false
null
true
expand_key_reveal ()
{ "checked_file": "Vale.AES.AES256_helpers_BE.fst.checked", "dependencies": [ "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Vale.AES.AES256_helpers_BE.fst" }
[ "lemma" ]
[ "Vale.AES.AES_BE_s.aes_key_word", "Vale.AES.AES_common_s.AES_256", "Vale.AES.AES_BE_s.expand_key_reveal", "Prims.unit", "Prims.l_True", "Prims.squash", "FStar.Seq.Base.equal", "Vale.Def.Types_s.nat32", "Vale.AES.AES_BE_s.expand_key", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
module Vale.AES.AES256_helpers_BE let lemma_reveal_expand_key_256 (key:aes_key_word AES_256) (round:nat) : Lemma (expand_key_256 key round == ( if round = 0 then Mkfour key.[3] key.[2] key.[1] key.[0] else if round = 1 then Mkfour key.[7] key.[6] key.[5] key.[4] else round_key_256 (expand_key_256 key (round - 2)) (expand_key_256 key (round - 1)) round )) = expand_key_256_reveal () #reset-options "--fuel 8 --ifuel 0" let lemma_expand_key_256_0 (key:aes_key_word AES_256) : Lemma (equal key (expand_key AES_256 key 8))
false
false
Vale.AES.AES256_helpers_BE.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 8, "initial_ifuel": 0, "max_fuel": 8, "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": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val lemma_expand_key_256_0 (key: aes_key_word AES_256) : Lemma (equal key (expand_key AES_256 key 8))
[]
Vale.AES.AES256_helpers_BE.lemma_expand_key_256_0
{ "file_name": "vale/code/crypto/aes/Vale.AES.AES256_helpers_BE.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
key: Vale.AES.AES_BE_s.aes_key_word Vale.AES.AES_common_s.AES_256 -> FStar.Pervasives.Lemma (ensures FStar.Seq.Base.equal key (Vale.AES.AES_BE_s.expand_key Vale.AES.AES_common_s.AES_256 key 8))
{ "end_col": 22, "end_line": 16, "start_col": 2, "start_line": 16 }
FStar.Pervasives.Lemma
val lemma_expand_append (key: aes_key_word AES_256) (size1 size2: nat) : Lemma (requires size1 <= size2 /\ size2 <= 60) (ensures equal (expand_key AES_256 key size1) (slice (expand_key AES_256 key size2) 0 size1)) (decreases size2)
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.AES_BE_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let rec lemma_expand_append (key:aes_key_word AES_256) (size1:nat) (size2:nat) : Lemma (requires size1 <= size2 /\ size2 <= 60) (ensures equal (expand_key AES_256 key size1) (slice (expand_key AES_256 key size2) 0 size1)) (decreases size2) = expand_key_reveal (); if size1 < size2 then lemma_expand_append key size1 (size2 - 1)
val lemma_expand_append (key: aes_key_word AES_256) (size1 size2: nat) : Lemma (requires size1 <= size2 /\ size2 <= 60) (ensures equal (expand_key AES_256 key size1) (slice (expand_key AES_256 key size2) 0 size1)) (decreases size2) let rec lemma_expand_append (key: aes_key_word AES_256) (size1 size2: nat) : Lemma (requires size1 <= size2 /\ size2 <= 60) (ensures equal (expand_key AES_256 key size1) (slice (expand_key AES_256 key size2) 0 size1)) (decreases size2) =
false
null
true
expand_key_reveal (); if size1 < size2 then lemma_expand_append key size1 (size2 - 1)
{ "checked_file": "Vale.AES.AES256_helpers_BE.fst.checked", "dependencies": [ "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Vale.AES.AES256_helpers_BE.fst" }
[ "lemma", "" ]
[ "Vale.AES.AES_BE_s.aes_key_word", "Vale.AES.AES_common_s.AES_256", "Prims.nat", "Prims.op_LessThan", "Vale.AES.AES256_helpers_BE.lemma_expand_append", "Prims.op_Subtraction", "Prims.bool", "Prims.unit", "Vale.AES.AES_BE_s.expand_key_reveal", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.squash", "FStar.Seq.Base.equal", "Vale.Def.Types_s.nat32", "Vale.AES.AES_BE_s.expand_key", "FStar.Seq.Base.slice", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
module Vale.AES.AES256_helpers_BE let lemma_reveal_expand_key_256 (key:aes_key_word AES_256) (round:nat) : Lemma (expand_key_256 key round == ( if round = 0 then Mkfour key.[3] key.[2] key.[1] key.[0] else if round = 1 then Mkfour key.[7] key.[6] key.[5] key.[4] else round_key_256 (expand_key_256 key (round - 2)) (expand_key_256 key (round - 1)) round )) = expand_key_256_reveal () #reset-options "--fuel 8 --ifuel 0" let lemma_expand_key_256_0 (key:aes_key_word AES_256) : Lemma (equal key (expand_key AES_256 key 8)) = expand_key_reveal () open FStar.Mul #reset-options "--fuel 1 --ifuel 0 --z3rlimit 40 --using_facts_from '* -FStar.Seq.Properties'" let lemma_expand_key_256_i (key:aes_key_word AES_256) (i:nat) : Lemma (requires 1 < i /\ i < 15 ) (ensures ( let m = 4 * (i - 2) in let n = 4 * i in let v = expand_key AES_256 key n in // Current let w = expand_key AES_256 key (n + 4) in // Next 4 words let prev0 = Mkfour v.[m + 3] v.[m + 2] v.[m + 1] v.[m + 0] in // Penultimate 4 words in Current let prev1 = Mkfour v.[m + 7] v.[m + 6] v.[m + 5] v.[m + 4] in // Ultimate 4 words in Current round_key_256 prev0 prev1 i == Mkfour w.[n + 3] w.[n + 2] w.[n + 1] w.[n + 0] // NextQuad == Next 4 words )) = expand_key_reveal (); let n = 4 * i in // unfold expand_key 8 times (could use fuel, but that unfolds everything): let _ = expand_key AES_256 key (n + 1) in let _ = expand_key AES_256 key (n + 2) in let _ = expand_key AES_256 key (n + 3) in let _ = expand_key AES_256 key (n + 4) in if i < 14 then ( let _ = expand_key AES_256 key (n + 5) in let _ = expand_key AES_256 key (n + 6) in let _ = expand_key AES_256 key (n + 7) in () ) else (); () #reset-options // expand_key for large 'size' argument agrees with expand_key for smaller 'size' argument let rec lemma_expand_append (key:aes_key_word AES_256) (size1:nat) (size2:nat) : Lemma (requires size1 <= size2 /\ size2 <= 60) (ensures equal (expand_key AES_256 key size1) (slice (expand_key AES_256 key size2) 0 size1)) (decreases size2)
false
false
Vale.AES.AES256_helpers_BE.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val lemma_expand_append (key: aes_key_word AES_256) (size1 size2: nat) : Lemma (requires size1 <= size2 /\ size2 <= 60) (ensures equal (expand_key AES_256 key size1) (slice (expand_key AES_256 key size2) 0 size1)) (decreases size2)
[ "recursion" ]
Vale.AES.AES256_helpers_BE.lemma_expand_append
{ "file_name": "vale/code/crypto/aes/Vale.AES.AES256_helpers_BE.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
key: Vale.AES.AES_BE_s.aes_key_word Vale.AES.AES_common_s.AES_256 -> size1: Prims.nat -> size2: Prims.nat -> FStar.Pervasives.Lemma (requires size1 <= size2 /\ size2 <= 60) (ensures FStar.Seq.Base.equal (Vale.AES.AES_BE_s.expand_key Vale.AES.AES_common_s.AES_256 key size1) (FStar.Seq.Base.slice (Vale.AES.AES_BE_s.expand_key Vale.AES.AES_common_s.AES_256 key size2) 0 size1)) (decreases size2)
{ "end_col": 65, "end_line": 57, "start_col": 2, "start_line": 56 }
FStar.Pervasives.Lemma
val lemma_expand_key_256 (key:seq nat32) (size:nat) : Lemma (requires size <= 15 /\ is_aes_key_word AES_256 key) (ensures ( let s = key_schedule_to_round_keys size (expand_key AES_256 key 60) in (forall (i:nat).{:pattern (expand_key_256 key i)} i < size ==> expand_key_256 key i == s.[i]) ))
[ { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.AES_BE_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let rec lemma_expand_key_256 (key:seq nat32) (size:nat) = lemma_expand_append key (4 * size) 60; if size = 0 then () else let i = size - 1 in lemma_expand_key_256 key i; lemma_reveal_expand_key_256 key i; if i < 2 then ( lemma_expand_append key 4 60; lemma_expand_append key 8 60; lemma_expand_key_256_0 key ) else ( lemma_expand_append key (4 * i) 60; lemma_expand_key_256 key (i - 1); lemma_expand_key_256_i key i )
val lemma_expand_key_256 (key:seq nat32) (size:nat) : Lemma (requires size <= 15 /\ is_aes_key_word AES_256 key) (ensures ( let s = key_schedule_to_round_keys size (expand_key AES_256 key 60) in (forall (i:nat).{:pattern (expand_key_256 key i)} i < size ==> expand_key_256 key i == s.[i]) )) let rec lemma_expand_key_256 (key: seq nat32) (size: nat) =
false
null
true
lemma_expand_append key (4 * size) 60; if size = 0 then () else let i = size - 1 in lemma_expand_key_256 key i; lemma_reveal_expand_key_256 key i; if i < 2 then (lemma_expand_append key 4 60; lemma_expand_append key 8 60; lemma_expand_key_256_0 key) else (lemma_expand_append key (4 * i) 60; lemma_expand_key_256 key (i - 1); lemma_expand_key_256_i key i)
{ "checked_file": "Vale.AES.AES256_helpers_BE.fst.checked", "dependencies": [ "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Vale.AES.AES256_helpers_BE.fst" }
[ "lemma" ]
[ "FStar.Seq.Base.seq", "Vale.Def.Types_s.nat32", "Prims.nat", "Prims.op_Equality", "Prims.int", "Prims.bool", "Prims.op_LessThan", "Vale.AES.AES256_helpers_BE.lemma_expand_key_256_0", "Prims.unit", "Vale.AES.AES256_helpers_BE.lemma_expand_append", "Vale.AES.AES256_helpers_BE.lemma_expand_key_256_i", "Vale.AES.AES256_helpers_BE.lemma_expand_key_256", "Prims.op_Subtraction", "FStar.Mul.op_Star", "Vale.AES.AES256_helpers_BE.lemma_reveal_expand_key_256" ]
[]
module Vale.AES.AES256_helpers_BE let lemma_reveal_expand_key_256 (key:aes_key_word AES_256) (round:nat) : Lemma (expand_key_256 key round == ( if round = 0 then Mkfour key.[3] key.[2] key.[1] key.[0] else if round = 1 then Mkfour key.[7] key.[6] key.[5] key.[4] else round_key_256 (expand_key_256 key (round - 2)) (expand_key_256 key (round - 1)) round )) = expand_key_256_reveal () #reset-options "--fuel 8 --ifuel 0" let lemma_expand_key_256_0 (key:aes_key_word AES_256) : Lemma (equal key (expand_key AES_256 key 8)) = expand_key_reveal () open FStar.Mul #reset-options "--fuel 1 --ifuel 0 --z3rlimit 40 --using_facts_from '* -FStar.Seq.Properties'" let lemma_expand_key_256_i (key:aes_key_word AES_256) (i:nat) : Lemma (requires 1 < i /\ i < 15 ) (ensures ( let m = 4 * (i - 2) in let n = 4 * i in let v = expand_key AES_256 key n in // Current let w = expand_key AES_256 key (n + 4) in // Next 4 words let prev0 = Mkfour v.[m + 3] v.[m + 2] v.[m + 1] v.[m + 0] in // Penultimate 4 words in Current let prev1 = Mkfour v.[m + 7] v.[m + 6] v.[m + 5] v.[m + 4] in // Ultimate 4 words in Current round_key_256 prev0 prev1 i == Mkfour w.[n + 3] w.[n + 2] w.[n + 1] w.[n + 0] // NextQuad == Next 4 words )) = expand_key_reveal (); let n = 4 * i in // unfold expand_key 8 times (could use fuel, but that unfolds everything): let _ = expand_key AES_256 key (n + 1) in let _ = expand_key AES_256 key (n + 2) in let _ = expand_key AES_256 key (n + 3) in let _ = expand_key AES_256 key (n + 4) in if i < 14 then ( let _ = expand_key AES_256 key (n + 5) in let _ = expand_key AES_256 key (n + 6) in let _ = expand_key AES_256 key (n + 7) in () ) else (); () #reset-options // expand_key for large 'size' argument agrees with expand_key for smaller 'size' argument let rec lemma_expand_append (key:aes_key_word AES_256) (size1:nat) (size2:nat) : Lemma (requires size1 <= size2 /\ size2 <= 60) (ensures equal (expand_key AES_256 key size1) (slice (expand_key AES_256 key size2) 0 size1)) (decreases size2) = expand_key_reveal (); if size1 < size2 then lemma_expand_append key size1 (size2 - 1) // quad32 key expansion is equivalent to nat32 key expansion
false
false
Vale.AES.AES256_helpers_BE.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val lemma_expand_key_256 (key:seq nat32) (size:nat) : Lemma (requires size <= 15 /\ is_aes_key_word AES_256 key) (ensures ( let s = key_schedule_to_round_keys size (expand_key AES_256 key 60) in (forall (i:nat).{:pattern (expand_key_256 key i)} i < size ==> expand_key_256 key i == s.[i]) ))
[ "recursion" ]
Vale.AES.AES256_helpers_BE.lemma_expand_key_256
{ "file_name": "vale/code/crypto/aes/Vale.AES.AES256_helpers_BE.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
key: FStar.Seq.Base.seq Vale.Def.Types_s.nat32 -> size: Prims.nat -> FStar.Pervasives.Lemma (requires size <= 15 /\ Vale.AES.AES_BE_s.is_aes_key_word Vale.AES.AES_common_s.AES_256 key) (ensures (let s = Vale.AES.AES_BE_s.key_schedule_to_round_keys size (Vale.AES.AES_BE_s.expand_key Vale.AES.AES_common_s.AES_256 key 60) in forall (i: Prims.nat). {:pattern Vale.AES.AES256_helpers_BE.expand_key_256 key i} i < size ==> Vale.AES.AES256_helpers_BE.expand_key_256 key i == s.[ i ]))
{ "end_col": 3, "end_line": 77, "start_col": 2, "start_line": 61 }
FStar.Pervasives.Lemma
val lemma_expand_key_256_i (key: aes_key_word AES_256) (i: nat) : Lemma (requires 1 < i /\ i < 15) (ensures (let m = 4 * (i - 2) in let n = 4 * i in let v = expand_key AES_256 key n in let w = expand_key AES_256 key (n + 4) in let prev0 = Mkfour v.[ m + 3 ] v.[ m + 2 ] v.[ m + 1 ] v.[ m + 0 ] in let prev1 = Mkfour v.[ m + 7 ] v.[ m + 6 ] v.[ m + 5 ] v.[ m + 4 ] in round_key_256 prev0 prev1 i == Mkfour w.[ n + 3 ] w.[ n + 2 ] w.[ n + 1 ] w.[ n + 0 ]))
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.AES_BE_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let lemma_expand_key_256_i (key:aes_key_word AES_256) (i:nat) : Lemma (requires 1 < i /\ i < 15 ) (ensures ( let m = 4 * (i - 2) in let n = 4 * i in let v = expand_key AES_256 key n in // Current let w = expand_key AES_256 key (n + 4) in // Next 4 words let prev0 = Mkfour v.[m + 3] v.[m + 2] v.[m + 1] v.[m + 0] in // Penultimate 4 words in Current let prev1 = Mkfour v.[m + 7] v.[m + 6] v.[m + 5] v.[m + 4] in // Ultimate 4 words in Current round_key_256 prev0 prev1 i == Mkfour w.[n + 3] w.[n + 2] w.[n + 1] w.[n + 0] // NextQuad == Next 4 words )) = expand_key_reveal (); let n = 4 * i in // unfold expand_key 8 times (could use fuel, but that unfolds everything): let _ = expand_key AES_256 key (n + 1) in let _ = expand_key AES_256 key (n + 2) in let _ = expand_key AES_256 key (n + 3) in let _ = expand_key AES_256 key (n + 4) in if i < 14 then ( let _ = expand_key AES_256 key (n + 5) in let _ = expand_key AES_256 key (n + 6) in let _ = expand_key AES_256 key (n + 7) in () ) else (); ()
val lemma_expand_key_256_i (key: aes_key_word AES_256) (i: nat) : Lemma (requires 1 < i /\ i < 15) (ensures (let m = 4 * (i - 2) in let n = 4 * i in let v = expand_key AES_256 key n in let w = expand_key AES_256 key (n + 4) in let prev0 = Mkfour v.[ m + 3 ] v.[ m + 2 ] v.[ m + 1 ] v.[ m + 0 ] in let prev1 = Mkfour v.[ m + 7 ] v.[ m + 6 ] v.[ m + 5 ] v.[ m + 4 ] in round_key_256 prev0 prev1 i == Mkfour w.[ n + 3 ] w.[ n + 2 ] w.[ n + 1 ] w.[ n + 0 ])) let lemma_expand_key_256_i (key: aes_key_word AES_256) (i: nat) : Lemma (requires 1 < i /\ i < 15) (ensures (let m = 4 * (i - 2) in let n = 4 * i in let v = expand_key AES_256 key n in let w = expand_key AES_256 key (n + 4) in let prev0 = Mkfour v.[ m + 3 ] v.[ m + 2 ] v.[ m + 1 ] v.[ m + 0 ] in let prev1 = Mkfour v.[ m + 7 ] v.[ m + 6 ] v.[ m + 5 ] v.[ m + 4 ] in round_key_256 prev0 prev1 i == Mkfour w.[ n + 3 ] w.[ n + 2 ] w.[ n + 1 ] w.[ n + 0 ])) =
false
null
true
expand_key_reveal (); let n = 4 * i in let _ = expand_key AES_256 key (n + 1) in let _ = expand_key AES_256 key (n + 2) in let _ = expand_key AES_256 key (n + 3) in let _ = expand_key AES_256 key (n + 4) in if i < 14 then (let _ = expand_key AES_256 key (n + 5) in let _ = expand_key AES_256 key (n + 6) in let _ = expand_key AES_256 key (n + 7) in ()); ()
{ "checked_file": "Vale.AES.AES256_helpers_BE.fst.checked", "dependencies": [ "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Vale.AES.AES256_helpers_BE.fst" }
[ "lemma" ]
[ "Vale.AES.AES_BE_s.aes_key_word", "Vale.AES.AES_common_s.AES_256", "Prims.nat", "Prims.unit", "Prims.op_LessThan", "FStar.Seq.Base.seq", "Vale.Def.Words_s.nat32", "Prims.eq2", "FStar.Seq.Base.length", "Prims.op_Addition", "Vale.AES.AES_BE_s.expand_key", "Prims.bool", "Prims.int", "FStar.Mul.op_Star", "Vale.AES.AES_BE_s.expand_key_reveal", "Prims.l_and", "Prims.b2t", "Prims.squash", "Vale.Def.Words_s.four", "Vale.Def.Types_s.nat32", "Vale.AES.AES256_helpers_BE.round_key_256", "Vale.Def.Words_s.Mkfour", "Vale.AES.AES256_helpers_BE.op_String_Access", "Prims.op_Subtraction", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
module Vale.AES.AES256_helpers_BE let lemma_reveal_expand_key_256 (key:aes_key_word AES_256) (round:nat) : Lemma (expand_key_256 key round == ( if round = 0 then Mkfour key.[3] key.[2] key.[1] key.[0] else if round = 1 then Mkfour key.[7] key.[6] key.[5] key.[4] else round_key_256 (expand_key_256 key (round - 2)) (expand_key_256 key (round - 1)) round )) = expand_key_256_reveal () #reset-options "--fuel 8 --ifuel 0" let lemma_expand_key_256_0 (key:aes_key_word AES_256) : Lemma (equal key (expand_key AES_256 key 8)) = expand_key_reveal () open FStar.Mul #reset-options "--fuel 1 --ifuel 0 --z3rlimit 40 --using_facts_from '* -FStar.Seq.Properties'" let lemma_expand_key_256_i (key:aes_key_word AES_256) (i:nat) : Lemma (requires 1 < i /\ i < 15 ) (ensures ( let m = 4 * (i - 2) in let n = 4 * i in let v = expand_key AES_256 key n in // Current let w = expand_key AES_256 key (n + 4) in // Next 4 words let prev0 = Mkfour v.[m + 3] v.[m + 2] v.[m + 1] v.[m + 0] in // Penultimate 4 words in Current let prev1 = Mkfour v.[m + 7] v.[m + 6] v.[m + 5] v.[m + 4] in // Ultimate 4 words in Current round_key_256 prev0 prev1 i == Mkfour w.[n + 3] w.[n + 2] w.[n + 1] w.[n + 0] // NextQuad == Next 4 words ))
false
false
Vale.AES.AES256_helpers_BE.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 1, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": 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": 40, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val lemma_expand_key_256_i (key: aes_key_word AES_256) (i: nat) : Lemma (requires 1 < i /\ i < 15) (ensures (let m = 4 * (i - 2) in let n = 4 * i in let v = expand_key AES_256 key n in let w = expand_key AES_256 key (n + 4) in let prev0 = Mkfour v.[ m + 3 ] v.[ m + 2 ] v.[ m + 1 ] v.[ m + 0 ] in let prev1 = Mkfour v.[ m + 7 ] v.[ m + 6 ] v.[ m + 5 ] v.[ m + 4 ] in round_key_256 prev0 prev1 i == Mkfour w.[ n + 3 ] w.[ n + 2 ] w.[ n + 1 ] w.[ n + 0 ]))
[]
Vale.AES.AES256_helpers_BE.lemma_expand_key_256_i
{ "file_name": "vale/code/crypto/aes/Vale.AES.AES256_helpers_BE.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
key: Vale.AES.AES_BE_s.aes_key_word Vale.AES.AES_common_s.AES_256 -> i: Prims.nat -> FStar.Pervasives.Lemma (requires 1 < i /\ i < 15) (ensures (let m = 4 * (i - 2) in let n = 4 * i in let v = Vale.AES.AES_BE_s.expand_key Vale.AES.AES_common_s.AES_256 key n in let w = Vale.AES.AES_BE_s.expand_key Vale.AES.AES_common_s.AES_256 key (n + 4) in let prev0 = Vale.Def.Words_s.Mkfour v.[ m + 3 ] v.[ m + 2 ] v.[ m + 1 ] v.[ m + 0 ] in let prev1 = Vale.Def.Words_s.Mkfour v.[ m + 7 ] v.[ m + 6 ] v.[ m + 5 ] v.[ m + 4 ] in Vale.AES.AES256_helpers_BE.round_key_256 prev0 prev1 i == Vale.Def.Words_s.Mkfour w.[ n + 3 ] w.[ n + 2 ] w.[ n + 1 ] w.[ n + 0 ]))
{ "end_col": 4, "end_line": 47, "start_col": 2, "start_line": 34 }
Prims.Tot
val almost_mont_mul: pbits:pos -> rLen:nat -> n:pos -> mu:nat -> a:nat -> b:nat -> int
[ { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": false, "full_module": "Lib.LoopCombinators", "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.AlmostMontgomery", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.AlmostMontgomery", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let almost_mont_mul pbits rLen n mu a b = let c = a * b in almost_mont_reduction pbits rLen n mu c
val almost_mont_mul: pbits:pos -> rLen:nat -> n:pos -> mu:nat -> a:nat -> b:nat -> int let almost_mont_mul pbits rLen n mu a b =
false
null
false
let c = a * b in almost_mont_reduction pbits rLen n mu c
{ "checked_file": "Hacl.Spec.AlmostMontgomery.Lemmas.fst.checked", "dependencies": [ "prims.fst.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.AlmostMontgomery.Lemmas.fst" }
[ "total" ]
[ "Prims.pos", "Prims.nat", "Hacl.Spec.AlmostMontgomery.Lemmas.almost_mont_reduction", "Prims.int", "FStar.Mul.op_Star" ]
[]
module Hacl.Spec.AlmostMontgomery.Lemmas open FStar.Mul open Lib.IntTypes open Lib.LoopCombinators module M = Hacl.Spec.Montgomery.Lemmas #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" /// High-level specification of Almost Montgomery Multiplication val almost_mont_reduction: pbits:pos -> rLen:nat -> n:pos -> mu:nat -> c:nat -> int let almost_mont_reduction pbits rLen n mu c = let res = M.mont_reduction_loop_div_r pbits rLen n mu c in if res < pow2 (pbits * rLen) then res else res - n
false
true
Hacl.Spec.AlmostMontgomery.Lemmas.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val almost_mont_mul: pbits:pos -> rLen:nat -> n:pos -> mu:nat -> a:nat -> b:nat -> int
[]
Hacl.Spec.AlmostMontgomery.Lemmas.almost_mont_mul
{ "file_name": "code/bignum/Hacl.Spec.AlmostMontgomery.Lemmas.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
pbits: Prims.pos -> rLen: Prims.nat -> n: Prims.pos -> mu: Prims.nat -> a: Prims.nat -> b: Prims.nat -> Prims.int
{ "end_col": 41, "end_line": 22, "start_col": 41, "start_line": 20 }
Prims.Tot
val almost_mont_sqr: pbits:pos -> rLen:nat -> n:pos -> mu:nat -> a:nat -> int
[ { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": false, "full_module": "Lib.LoopCombinators", "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.AlmostMontgomery", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.AlmostMontgomery", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let almost_mont_sqr pbits rLen n mu a = let c = a * a in almost_mont_reduction pbits rLen n mu c
val almost_mont_sqr: pbits:pos -> rLen:nat -> n:pos -> mu:nat -> a:nat -> int let almost_mont_sqr pbits rLen n mu a =
false
null
false
let c = a * a in almost_mont_reduction pbits rLen n mu c
{ "checked_file": "Hacl.Spec.AlmostMontgomery.Lemmas.fst.checked", "dependencies": [ "prims.fst.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.AlmostMontgomery.Lemmas.fst" }
[ "total" ]
[ "Prims.pos", "Prims.nat", "Hacl.Spec.AlmostMontgomery.Lemmas.almost_mont_reduction", "Prims.int", "FStar.Mul.op_Star" ]
[]
module Hacl.Spec.AlmostMontgomery.Lemmas open FStar.Mul open Lib.IntTypes open Lib.LoopCombinators module M = Hacl.Spec.Montgomery.Lemmas #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" /// High-level specification of Almost Montgomery Multiplication val almost_mont_reduction: pbits:pos -> rLen:nat -> n:pos -> mu:nat -> c:nat -> int let almost_mont_reduction pbits rLen n mu c = let res = M.mont_reduction_loop_div_r pbits rLen n mu c in if res < pow2 (pbits * rLen) then res else res - n val almost_mont_mul: pbits:pos -> rLen:nat -> n:pos -> mu:nat -> a:nat -> b:nat -> int let almost_mont_mul pbits rLen n mu a b = let c = a * b in almost_mont_reduction pbits rLen n mu c
false
true
Hacl.Spec.AlmostMontgomery.Lemmas.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val almost_mont_sqr: pbits:pos -> rLen:nat -> n:pos -> mu:nat -> a:nat -> int
[]
Hacl.Spec.AlmostMontgomery.Lemmas.almost_mont_sqr
{ "file_name": "code/bignum/Hacl.Spec.AlmostMontgomery.Lemmas.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
pbits: Prims.pos -> rLen: Prims.nat -> n: Prims.pos -> mu: Prims.nat -> a: Prims.nat -> Prims.int
{ "end_col": 41, "end_line": 27, "start_col": 39, "start_line": 25 }
Prims.Tot
val almost_mont_reduction: pbits:pos -> rLen:nat -> n:pos -> mu:nat -> c:nat -> int
[ { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": false, "full_module": "Lib.LoopCombinators", "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.AlmostMontgomery", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.AlmostMontgomery", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let almost_mont_reduction pbits rLen n mu c = let res = M.mont_reduction_loop_div_r pbits rLen n mu c in if res < pow2 (pbits * rLen) then res else res - n
val almost_mont_reduction: pbits:pos -> rLen:nat -> n:pos -> mu:nat -> c:nat -> int let almost_mont_reduction pbits rLen n mu c =
false
null
false
let res = M.mont_reduction_loop_div_r pbits rLen n mu c in if res < pow2 (pbits * rLen) then res else res - n
{ "checked_file": "Hacl.Spec.AlmostMontgomery.Lemmas.fst.checked", "dependencies": [ "prims.fst.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.AlmostMontgomery.Lemmas.fst" }
[ "total" ]
[ "Prims.pos", "Prims.nat", "Prims.op_LessThan", "Prims.pow2", "FStar.Mul.op_Star", "Prims.bool", "Prims.op_Subtraction", "Prims.int", "Hacl.Spec.Montgomery.Lemmas.mont_reduction_loop_div_r" ]
[]
module Hacl.Spec.AlmostMontgomery.Lemmas open FStar.Mul open Lib.IntTypes open Lib.LoopCombinators module M = Hacl.Spec.Montgomery.Lemmas #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" /// High-level specification of Almost Montgomery Multiplication
false
true
Hacl.Spec.AlmostMontgomery.Lemmas.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val almost_mont_reduction: pbits:pos -> rLen:nat -> n:pos -> mu:nat -> c:nat -> int
[]
Hacl.Spec.AlmostMontgomery.Lemmas.almost_mont_reduction
{ "file_name": "code/bignum/Hacl.Spec.AlmostMontgomery.Lemmas.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
pbits: Prims.pos -> rLen: Prims.nat -> n: Prims.pos -> mu: Prims.nat -> c: Prims.nat -> Prims.int
{ "end_col": 52, "end_line": 17, "start_col": 45, "start_line": 15 }
FStar.Pervasives.Lemma
val lemma_fits_c_lt_rr: c:nat -> r:pos -> n:pos -> Lemma (requires c < r * r) (ensures (c - n) / r < r)
[ { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": false, "full_module": "Lib.LoopCombinators", "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.AlmostMontgomery", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.AlmostMontgomery", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let lemma_fits_c_lt_rr c r n = assert (c < r * r); Math.Lemmas.cancel_mul_div r r; assert (c / r < r); Math.Lemmas.lemma_div_le (c - n) c r
val lemma_fits_c_lt_rr: c:nat -> r:pos -> n:pos -> Lemma (requires c < r * r) (ensures (c - n) / r < r) let lemma_fits_c_lt_rr c r n =
false
null
true
assert (c < r * r); Math.Lemmas.cancel_mul_div r r; assert (c / r < r); Math.Lemmas.lemma_div_le (c - n) c r
{ "checked_file": "Hacl.Spec.AlmostMontgomery.Lemmas.fst.checked", "dependencies": [ "prims.fst.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.AlmostMontgomery.Lemmas.fst" }
[ "lemma" ]
[ "Prims.nat", "Prims.pos", "FStar.Math.Lemmas.lemma_div_le", "Prims.op_Subtraction", "Prims.unit", "Prims._assert", "Prims.b2t", "Prims.op_LessThan", "Prims.op_Division", "FStar.Math.Lemmas.cancel_mul_div", "FStar.Mul.op_Star" ]
[]
module Hacl.Spec.AlmostMontgomery.Lemmas open FStar.Mul open Lib.IntTypes open Lib.LoopCombinators module M = Hacl.Spec.Montgomery.Lemmas #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" /// High-level specification of Almost Montgomery Multiplication val almost_mont_reduction: pbits:pos -> rLen:nat -> n:pos -> mu:nat -> c:nat -> int let almost_mont_reduction pbits rLen n mu c = let res = M.mont_reduction_loop_div_r pbits rLen n mu c in if res < pow2 (pbits * rLen) then res else res - n val almost_mont_mul: pbits:pos -> rLen:nat -> n:pos -> mu:nat -> a:nat -> b:nat -> int let almost_mont_mul pbits rLen n mu a b = let c = a * b in almost_mont_reduction pbits rLen n mu c val almost_mont_sqr: pbits:pos -> rLen:nat -> n:pos -> mu:nat -> a:nat -> int let almost_mont_sqr pbits rLen n mu a = let c = a * a in almost_mont_reduction pbits rLen n mu c /// Lemma (almost_mont_mul pbits rLen n mu a b % n == a * b * d % n) val lemma_fits_c_lt_rr: c:nat -> r:pos -> n:pos -> Lemma (requires c < r * r) (ensures (c - n) / r < r)
false
false
Hacl.Spec.AlmostMontgomery.Lemmas.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val lemma_fits_c_lt_rr: c:nat -> r:pos -> n:pos -> Lemma (requires c < r * r) (ensures (c - n) / r < r)
[]
Hacl.Spec.AlmostMontgomery.Lemmas.lemma_fits_c_lt_rr
{ "file_name": "code/bignum/Hacl.Spec.AlmostMontgomery.Lemmas.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
c: Prims.nat -> r: Prims.pos -> n: Prims.pos -> FStar.Pervasives.Lemma (requires c < r * r) (ensures (c - n) / r < r)
{ "end_col": 38, "end_line": 40, "start_col": 2, "start_line": 37 }
FStar.Pervasives.Lemma
val almost_mont_mul_lemma: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> a:nat -> b:nat -> Lemma (requires (let r = pow2 (pbits * rLen) in M.mont_pre pbits rLen n mu /\ a < r /\ b < r)) (ensures (let res = almost_mont_mul pbits rLen n mu a b in let r = pow2 (pbits * rLen) in let d, _ = M.eea_pow2_odd (pbits * rLen) n in res % n == a * b * d % n /\ res < r))
[ { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": false, "full_module": "Lib.LoopCombinators", "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.AlmostMontgomery", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.AlmostMontgomery", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let almost_mont_mul_lemma pbits rLen n mu a b = let r = pow2 (pbits * rLen) in let res = almost_mont_mul pbits rLen n mu a b in Math.Lemmas.lemma_mult_lt_sqr a b r; assert (a * b < r * r); almost_mont_reduction_lemma pbits rLen n mu (a * b)
val almost_mont_mul_lemma: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> a:nat -> b:nat -> Lemma (requires (let r = pow2 (pbits * rLen) in M.mont_pre pbits rLen n mu /\ a < r /\ b < r)) (ensures (let res = almost_mont_mul pbits rLen n mu a b in let r = pow2 (pbits * rLen) in let d, _ = M.eea_pow2_odd (pbits * rLen) n in res % n == a * b * d % n /\ res < r)) let almost_mont_mul_lemma pbits rLen n mu a b =
false
null
true
let r = pow2 (pbits * rLen) in let res = almost_mont_mul pbits rLen n mu a b in Math.Lemmas.lemma_mult_lt_sqr a b r; assert (a * b < r * r); almost_mont_reduction_lemma pbits rLen n mu (a * b)
{ "checked_file": "Hacl.Spec.AlmostMontgomery.Lemmas.fst.checked", "dependencies": [ "prims.fst.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.AlmostMontgomery.Lemmas.fst" }
[ "lemma" ]
[ "Prims.pos", "Prims.nat", "Hacl.Spec.AlmostMontgomery.Lemmas.almost_mont_reduction_lemma", "FStar.Mul.op_Star", "Prims.unit", "Prims._assert", "Prims.b2t", "Prims.op_LessThan", "FStar.Math.Lemmas.lemma_mult_lt_sqr", "Prims.int", "Hacl.Spec.AlmostMontgomery.Lemmas.almost_mont_mul", "Prims.pow2" ]
[]
module Hacl.Spec.AlmostMontgomery.Lemmas open FStar.Mul open Lib.IntTypes open Lib.LoopCombinators module M = Hacl.Spec.Montgomery.Lemmas #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" /// High-level specification of Almost Montgomery Multiplication val almost_mont_reduction: pbits:pos -> rLen:nat -> n:pos -> mu:nat -> c:nat -> int let almost_mont_reduction pbits rLen n mu c = let res = M.mont_reduction_loop_div_r pbits rLen n mu c in if res < pow2 (pbits * rLen) then res else res - n val almost_mont_mul: pbits:pos -> rLen:nat -> n:pos -> mu:nat -> a:nat -> b:nat -> int let almost_mont_mul pbits rLen n mu a b = let c = a * b in almost_mont_reduction pbits rLen n mu c val almost_mont_sqr: pbits:pos -> rLen:nat -> n:pos -> mu:nat -> a:nat -> int let almost_mont_sqr pbits rLen n mu a = let c = a * a in almost_mont_reduction pbits rLen n mu c /// Lemma (almost_mont_mul pbits rLen n mu a b % n == a * b * d % n) val lemma_fits_c_lt_rr: c:nat -> r:pos -> n:pos -> Lemma (requires c < r * r) (ensures (c - n) / r < r) let lemma_fits_c_lt_rr c r n = assert (c < r * r); Math.Lemmas.cancel_mul_div r r; assert (c / r < r); Math.Lemmas.lemma_div_le (c - n) c r val almost_mont_reduction_lemma: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> c:nat -> Lemma (requires (let r = pow2 (pbits * rLen) in M.mont_pre pbits rLen n mu /\ c < r * r)) (ensures (let res = almost_mont_reduction pbits rLen n mu c in let r = pow2 (pbits * rLen) in let d, _ = M.eea_pow2_odd (pbits * rLen) n in res % n == c * d % n /\ res < r)) let almost_mont_reduction_lemma pbits rLen n mu c = let r = pow2 (pbits * rLen) in let d, _ = M.eea_pow2_odd (pbits * rLen) n in let res = M.mont_reduction_loop_div_r pbits rLen n mu c in M.mont_reduction_loop_div_r_lemma pbits rLen n mu c; assert (res % n == c * d % n /\ res <= (c - n) / r + n); let res1 = if res < r then res else res - n in if res < r then () else begin assert (res1 % n == (res - n) % n); Math.Lemmas.lemma_mod_sub res n 1; assert (res1 % n == res % n); assert (res1 <= (c - n) / r); lemma_fits_c_lt_rr c r n end val almost_mont_mul_lemma: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> a:nat -> b:nat -> Lemma (requires (let r = pow2 (pbits * rLen) in M.mont_pre pbits rLen n mu /\ a < r /\ b < r)) (ensures (let res = almost_mont_mul pbits rLen n mu a b in let r = pow2 (pbits * rLen) in let d, _ = M.eea_pow2_odd (pbits * rLen) n in res % n == a * b * d % n /\ res < r))
false
false
Hacl.Spec.AlmostMontgomery.Lemmas.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val almost_mont_mul_lemma: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> a:nat -> b:nat -> Lemma (requires (let r = pow2 (pbits * rLen) in M.mont_pre pbits rLen n mu /\ a < r /\ b < r)) (ensures (let res = almost_mont_mul pbits rLen n mu a b in let r = pow2 (pbits * rLen) in let d, _ = M.eea_pow2_odd (pbits * rLen) n in res % n == a * b * d % n /\ res < r))
[]
Hacl.Spec.AlmostMontgomery.Lemmas.almost_mont_mul_lemma
{ "file_name": "code/bignum/Hacl.Spec.AlmostMontgomery.Lemmas.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
pbits: Prims.pos -> rLen: Prims.pos -> n: Prims.pos -> mu: Prims.nat -> a: Prims.nat -> b: Prims.nat -> FStar.Pervasives.Lemma (requires (let r = Prims.pow2 (pbits * rLen) in Hacl.Spec.Montgomery.Lemmas.mont_pre pbits rLen n mu /\ a < r /\ b < r)) (ensures (let res = Hacl.Spec.AlmostMontgomery.Lemmas.almost_mont_mul pbits rLen n mu a b in let r = Prims.pow2 (pbits * rLen) in let _ = Hacl.Spec.Montgomery.Lemmas.eea_pow2_odd (pbits * rLen) n in (let FStar.Pervasives.Native.Mktuple2 #_ #_ d _ = _ in res % n == (a * b) * d % n /\ res < r) <: Type0))
{ "end_col": 53, "end_line": 81, "start_col": 47, "start_line": 76 }
FStar.Pervasives.Lemma
val almost_mont_reduction_lemma: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> c:nat -> Lemma (requires (let r = pow2 (pbits * rLen) in M.mont_pre pbits rLen n mu /\ c < r * r)) (ensures (let res = almost_mont_reduction pbits rLen n mu c in let r = pow2 (pbits * rLen) in let d, _ = M.eea_pow2_odd (pbits * rLen) n in res % n == c * d % n /\ res < r))
[ { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": false, "full_module": "Lib.LoopCombinators", "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.AlmostMontgomery", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.AlmostMontgomery", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let almost_mont_reduction_lemma pbits rLen n mu c = let r = pow2 (pbits * rLen) in let d, _ = M.eea_pow2_odd (pbits * rLen) n in let res = M.mont_reduction_loop_div_r pbits rLen n mu c in M.mont_reduction_loop_div_r_lemma pbits rLen n mu c; assert (res % n == c * d % n /\ res <= (c - n) / r + n); let res1 = if res < r then res else res - n in if res < r then () else begin assert (res1 % n == (res - n) % n); Math.Lemmas.lemma_mod_sub res n 1; assert (res1 % n == res % n); assert (res1 <= (c - n) / r); lemma_fits_c_lt_rr c r n end
val almost_mont_reduction_lemma: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> c:nat -> Lemma (requires (let r = pow2 (pbits * rLen) in M.mont_pre pbits rLen n mu /\ c < r * r)) (ensures (let res = almost_mont_reduction pbits rLen n mu c in let r = pow2 (pbits * rLen) in let d, _ = M.eea_pow2_odd (pbits * rLen) n in res % n == c * d % n /\ res < r)) let almost_mont_reduction_lemma pbits rLen n mu c =
false
null
true
let r = pow2 (pbits * rLen) in let d, _ = M.eea_pow2_odd (pbits * rLen) n in let res = M.mont_reduction_loop_div_r pbits rLen n mu c in M.mont_reduction_loop_div_r_lemma pbits rLen n mu c; assert (res % n == c * d % n /\ res <= (c - n) / r + n); let res1 = if res < r then res else res - n in if res < r then () else (assert (res1 % n == (res - n) % n); Math.Lemmas.lemma_mod_sub res n 1; assert (res1 % n == res % n); assert (res1 <= (c - n) / r); lemma_fits_c_lt_rr c r n)
{ "checked_file": "Hacl.Spec.AlmostMontgomery.Lemmas.fst.checked", "dependencies": [ "prims.fst.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.AlmostMontgomery.Lemmas.fst" }
[ "lemma" ]
[ "Prims.pos", "Prims.nat", "Prims.int", "Prims.op_LessThan", "Prims.bool", "Hacl.Spec.AlmostMontgomery.Lemmas.lemma_fits_c_lt_rr", "Prims.unit", "Prims._assert", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_Division", "Prims.op_Subtraction", "Prims.eq2", "Prims.op_Modulus", "FStar.Math.Lemmas.lemma_mod_sub", "Prims.l_and", "FStar.Mul.op_Star", "Prims.op_Addition", "Hacl.Spec.Montgomery.Lemmas.mont_reduction_loop_div_r_lemma", "Hacl.Spec.Montgomery.Lemmas.mont_reduction_loop_div_r", "FStar.Pervasives.Native.tuple2", "Hacl.Spec.Montgomery.Lemmas.eea_pow2_odd", "Prims.pow2" ]
[]
module Hacl.Spec.AlmostMontgomery.Lemmas open FStar.Mul open Lib.IntTypes open Lib.LoopCombinators module M = Hacl.Spec.Montgomery.Lemmas #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" /// High-level specification of Almost Montgomery Multiplication val almost_mont_reduction: pbits:pos -> rLen:nat -> n:pos -> mu:nat -> c:nat -> int let almost_mont_reduction pbits rLen n mu c = let res = M.mont_reduction_loop_div_r pbits rLen n mu c in if res < pow2 (pbits * rLen) then res else res - n val almost_mont_mul: pbits:pos -> rLen:nat -> n:pos -> mu:nat -> a:nat -> b:nat -> int let almost_mont_mul pbits rLen n mu a b = let c = a * b in almost_mont_reduction pbits rLen n mu c val almost_mont_sqr: pbits:pos -> rLen:nat -> n:pos -> mu:nat -> a:nat -> int let almost_mont_sqr pbits rLen n mu a = let c = a * a in almost_mont_reduction pbits rLen n mu c /// Lemma (almost_mont_mul pbits rLen n mu a b % n == a * b * d % n) val lemma_fits_c_lt_rr: c:nat -> r:pos -> n:pos -> Lemma (requires c < r * r) (ensures (c - n) / r < r) let lemma_fits_c_lt_rr c r n = assert (c < r * r); Math.Lemmas.cancel_mul_div r r; assert (c / r < r); Math.Lemmas.lemma_div_le (c - n) c r val almost_mont_reduction_lemma: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> c:nat -> Lemma (requires (let r = pow2 (pbits * rLen) in M.mont_pre pbits rLen n mu /\ c < r * r)) (ensures (let res = almost_mont_reduction pbits rLen n mu c in let r = pow2 (pbits * rLen) in let d, _ = M.eea_pow2_odd (pbits * rLen) n in res % n == c * d % n /\ res < r))
false
false
Hacl.Spec.AlmostMontgomery.Lemmas.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val almost_mont_reduction_lemma: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> c:nat -> Lemma (requires (let r = pow2 (pbits * rLen) in M.mont_pre pbits rLen n mu /\ c < r * r)) (ensures (let res = almost_mont_reduction pbits rLen n mu c in let r = pow2 (pbits * rLen) in let d, _ = M.eea_pow2_odd (pbits * rLen) n in res % n == c * d % n /\ res < r))
[]
Hacl.Spec.AlmostMontgomery.Lemmas.almost_mont_reduction_lemma
{ "file_name": "code/bignum/Hacl.Spec.AlmostMontgomery.Lemmas.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
pbits: Prims.pos -> rLen: Prims.pos -> n: Prims.pos -> mu: Prims.nat -> c: Prims.nat -> FStar.Pervasives.Lemma (requires (let r = Prims.pow2 (pbits * rLen) in Hacl.Spec.Montgomery.Lemmas.mont_pre pbits rLen n mu /\ c < r * r)) (ensures (let res = Hacl.Spec.AlmostMontgomery.Lemmas.almost_mont_reduction pbits rLen n mu c in let r = Prims.pow2 (pbits * rLen) in let _ = Hacl.Spec.Montgomery.Lemmas.eea_pow2_odd (pbits * rLen) n in (let FStar.Pervasives.Native.Mktuple2 #_ #_ d _ = _ in res % n == c * d % n /\ res < r) <: Type0))
{ "end_col": 32, "end_line": 65, "start_col": 51, "start_line": 51 }
FStar.Pervasives.Lemma
val almost_mont_mul_is_mont_mul_lemma: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> a:nat-> b:nat -> Lemma (requires (let r = pow2 (pbits * rLen) in M.mont_pre pbits rLen n mu /\ a < r /\ b < r)) (ensures (let c = almost_mont_mul pbits rLen n mu a b in let r = pow2 (pbits * rLen) in c % n == M.mont_mul pbits rLen n mu (a % n) (b % n) /\ c < r))
[ { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": false, "full_module": "Lib.LoopCombinators", "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.AlmostMontgomery", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.AlmostMontgomery", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let almost_mont_mul_is_mont_mul_lemma pbits rLen n mu a b = let c = almost_mont_mul pbits rLen n mu a b in almost_mont_mul_lemma pbits rLen n mu a b; let r = pow2 (pbits * rLen) in let d, _ = M.eea_pow2_odd (pbits * rLen) n in assert (c % n == a * b * d % n /\ c < r); let c1 = M.mont_mul pbits rLen n mu (a % n) (b % n) in calc (==) { c1; (==) { M.mont_mul_lemma pbits rLen n mu (a % n) (b % n) } (a % n) * (b % n) * d % n; (==) { M.lemma_mod_mul_distr3 (a % n) b d n } (a % n) * b * d % n; (==) { Math.Lemmas.paren_mul_right (a % n) b d; Math.Lemmas.lemma_mod_mul_distr_l a (b * d) n; Math.Lemmas.paren_mul_right a b d } a * b * d % n; }; assert (c % n == c1)
val almost_mont_mul_is_mont_mul_lemma: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> a:nat-> b:nat -> Lemma (requires (let r = pow2 (pbits * rLen) in M.mont_pre pbits rLen n mu /\ a < r /\ b < r)) (ensures (let c = almost_mont_mul pbits rLen n mu a b in let r = pow2 (pbits * rLen) in c % n == M.mont_mul pbits rLen n mu (a % n) (b % n) /\ c < r)) let almost_mont_mul_is_mont_mul_lemma pbits rLen n mu a b =
false
null
true
let c = almost_mont_mul pbits rLen n mu a b in almost_mont_mul_lemma pbits rLen n mu a b; let r = pow2 (pbits * rLen) in let d, _ = M.eea_pow2_odd (pbits * rLen) n in assert (c % n == (a * b) * d % n /\ c < r); let c1 = M.mont_mul pbits rLen n mu (a % n) (b % n) in calc ( == ) { c1; ( == ) { M.mont_mul_lemma pbits rLen n mu (a % n) (b % n) } ((a % n) * (b % n)) * d % n; ( == ) { M.lemma_mod_mul_distr3 (a % n) b d n } ((a % n) * b) * d % n; ( == ) { (Math.Lemmas.paren_mul_right (a % n) b d; Math.Lemmas.lemma_mod_mul_distr_l a (b * d) n; Math.Lemmas.paren_mul_right a b d) } (a * b) * d % n; }; assert (c % n == c1)
{ "checked_file": "Hacl.Spec.AlmostMontgomery.Lemmas.fst.checked", "dependencies": [ "prims.fst.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.AlmostMontgomery.Lemmas.fst" }
[ "lemma" ]
[ "Prims.pos", "Prims.nat", "Prims.int", "Prims._assert", "Prims.eq2", "Prims.op_Modulus", "Prims.unit", "FStar.Calc.calc_finish", "FStar.Mul.op_Star", "Prims.Cons", "FStar.Preorder.relation", "Prims.Nil", "FStar.Calc.calc_step", "FStar.Calc.calc_init", "FStar.Calc.calc_pack", "Hacl.Spec.Montgomery.Lemmas.mont_mul_lemma", "Prims.squash", "Hacl.Spec.Montgomery.Lemmas.lemma_mod_mul_distr3", "FStar.Math.Lemmas.paren_mul_right", "FStar.Math.Lemmas.lemma_mod_mul_distr_l", "Hacl.Spec.Montgomery.Lemmas.mont_mul", "Prims.l_and", "Prims.b2t", "Prims.op_LessThan", "FStar.Pervasives.Native.tuple2", "Hacl.Spec.Montgomery.Lemmas.eea_pow2_odd", "Prims.pow2", "Hacl.Spec.AlmostMontgomery.Lemmas.almost_mont_mul_lemma", "Hacl.Spec.AlmostMontgomery.Lemmas.almost_mont_mul" ]
[]
module Hacl.Spec.AlmostMontgomery.Lemmas open FStar.Mul open Lib.IntTypes open Lib.LoopCombinators module M = Hacl.Spec.Montgomery.Lemmas #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" /// High-level specification of Almost Montgomery Multiplication val almost_mont_reduction: pbits:pos -> rLen:nat -> n:pos -> mu:nat -> c:nat -> int let almost_mont_reduction pbits rLen n mu c = let res = M.mont_reduction_loop_div_r pbits rLen n mu c in if res < pow2 (pbits * rLen) then res else res - n val almost_mont_mul: pbits:pos -> rLen:nat -> n:pos -> mu:nat -> a:nat -> b:nat -> int let almost_mont_mul pbits rLen n mu a b = let c = a * b in almost_mont_reduction pbits rLen n mu c val almost_mont_sqr: pbits:pos -> rLen:nat -> n:pos -> mu:nat -> a:nat -> int let almost_mont_sqr pbits rLen n mu a = let c = a * a in almost_mont_reduction pbits rLen n mu c /// Lemma (almost_mont_mul pbits rLen n mu a b % n == a * b * d % n) val lemma_fits_c_lt_rr: c:nat -> r:pos -> n:pos -> Lemma (requires c < r * r) (ensures (c - n) / r < r) let lemma_fits_c_lt_rr c r n = assert (c < r * r); Math.Lemmas.cancel_mul_div r r; assert (c / r < r); Math.Lemmas.lemma_div_le (c - n) c r val almost_mont_reduction_lemma: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> c:nat -> Lemma (requires (let r = pow2 (pbits * rLen) in M.mont_pre pbits rLen n mu /\ c < r * r)) (ensures (let res = almost_mont_reduction pbits rLen n mu c in let r = pow2 (pbits * rLen) in let d, _ = M.eea_pow2_odd (pbits * rLen) n in res % n == c * d % n /\ res < r)) let almost_mont_reduction_lemma pbits rLen n mu c = let r = pow2 (pbits * rLen) in let d, _ = M.eea_pow2_odd (pbits * rLen) n in let res = M.mont_reduction_loop_div_r pbits rLen n mu c in M.mont_reduction_loop_div_r_lemma pbits rLen n mu c; assert (res % n == c * d % n /\ res <= (c - n) / r + n); let res1 = if res < r then res else res - n in if res < r then () else begin assert (res1 % n == (res - n) % n); Math.Lemmas.lemma_mod_sub res n 1; assert (res1 % n == res % n); assert (res1 <= (c - n) / r); lemma_fits_c_lt_rr c r n end val almost_mont_mul_lemma: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> a:nat -> b:nat -> Lemma (requires (let r = pow2 (pbits * rLen) in M.mont_pre pbits rLen n mu /\ a < r /\ b < r)) (ensures (let res = almost_mont_mul pbits rLen n mu a b in let r = pow2 (pbits * rLen) in let d, _ = M.eea_pow2_odd (pbits * rLen) n in res % n == a * b * d % n /\ res < r)) let almost_mont_mul_lemma pbits rLen n mu a b = let r = pow2 (pbits * rLen) in let res = almost_mont_mul pbits rLen n mu a b in Math.Lemmas.lemma_mult_lt_sqr a b r; assert (a * b < r * r); almost_mont_reduction_lemma pbits rLen n mu (a * b) /// Properties val almost_mont_mul_is_mont_mul_lemma: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> a:nat-> b:nat -> Lemma (requires (let r = pow2 (pbits * rLen) in M.mont_pre pbits rLen n mu /\ a < r /\ b < r)) (ensures (let c = almost_mont_mul pbits rLen n mu a b in let r = pow2 (pbits * rLen) in c % n == M.mont_mul pbits rLen n mu (a % n) (b % n) /\ c < r))
false
false
Hacl.Spec.AlmostMontgomery.Lemmas.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val almost_mont_mul_is_mont_mul_lemma: pbits:pos -> rLen:pos -> n:pos -> mu:nat -> a:nat-> b:nat -> Lemma (requires (let r = pow2 (pbits * rLen) in M.mont_pre pbits rLen n mu /\ a < r /\ b < r)) (ensures (let c = almost_mont_mul pbits rLen n mu a b in let r = pow2 (pbits * rLen) in c % n == M.mont_mul pbits rLen n mu (a % n) (b % n) /\ c < r))
[]
Hacl.Spec.AlmostMontgomery.Lemmas.almost_mont_mul_is_mont_mul_lemma
{ "file_name": "code/bignum/Hacl.Spec.AlmostMontgomery.Lemmas.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
pbits: Prims.pos -> rLen: Prims.pos -> n: Prims.pos -> mu: Prims.nat -> a: Prims.nat -> b: Prims.nat -> FStar.Pervasives.Lemma (requires (let r = Prims.pow2 (pbits * rLen) in Hacl.Spec.Montgomery.Lemmas.mont_pre pbits rLen n mu /\ a < r /\ b < r)) (ensures (let c = Hacl.Spec.AlmostMontgomery.Lemmas.almost_mont_mul pbits rLen n mu a b in let r = Prims.pow2 (pbits * rLen) in c % n == Hacl.Spec.Montgomery.Lemmas.mont_mul pbits rLen n mu (a % n) (b % n) /\ c < r))
{ "end_col": 22, "end_line": 114, "start_col": 59, "start_line": 94 }
Prims.Tot
[ { "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 } ]
false
let n = 8
let n =
false
null
false
8
{ "checked_file": "FStar.Int8.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int8.fsti" }
[ "total" ]
[]
[]
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int8 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)
false
true
FStar.Int8.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val n : Prims.int
[]
FStar.Int8.n
{ "file_name": "ulib/FStar.Int8.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
Prims.int
{ "end_col": 16, "end_line": 20, "start_col": 15, "start_line": 20 }
Prims.Pure
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "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 } ]
false
let op_Plus_Hat = add
let op_Plus_Hat =
false
null
false
add
{ "checked_file": "FStar.Int8.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int8.fsti" }
[]
[ "FStar.Int8.add" ]
[]
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int8 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 8 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
false
false
FStar.Int8.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val op_Plus_Hat : a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.Pure FStar.Int8.t
[]
FStar.Int8.op_Plus_Hat
{ "file_name": "ulib/FStar.Int8.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.Pure FStar.Int8.t
{ "end_col": 28, "end_line": 121, "start_col": 25, "start_line": 121 }
Prims.Tot
val gt (a b: t) : Tot bool
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "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 } ]
false
let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
val gt (a b: t) : Tot bool let gt (a b: t) : Tot bool =
false
null
false
gt #n (v a) (v b)
{ "checked_file": "FStar.Int8.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int8.fsti" }
[ "total" ]
[ "FStar.Int8.t", "FStar.Int.gt", "FStar.Int8.n", "FStar.Int8.v", "Prims.bool" ]
[]
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int8 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 8 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *)
false
true
FStar.Int8.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val gt (a b: t) : Tot bool
[]
FStar.Int8.gt
{ "file_name": "ulib/FStar.Int8.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.bool
{ "end_col": 49, "end_line": 115, "start_col": 32, "start_line": 115 }
Prims.Pure
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "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 } ]
false
let op_Percent_Hat = rem
let op_Percent_Hat =
false
null
false
rem
{ "checked_file": "FStar.Int8.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int8.fsti" }
[]
[ "FStar.Int8.rem" ]
[]
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int8 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 8 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub unfold let op_Star_Hat = mul
false
false
FStar.Int8.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val op_Percent_Hat : a: FStar.Int8.t -> b: FStar.Int8.t{FStar.Int8.v b <> 0} -> Prims.Pure FStar.Int8.t
[]
FStar.Int8.op_Percent_Hat
{ "file_name": "ulib/FStar.Int8.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.Int8.t -> b: FStar.Int8.t{FStar.Int8.v b <> 0} -> Prims.Pure FStar.Int8.t
{ "end_col": 31, "end_line": 125, "start_col": 28, "start_line": 125 }
Prims.Tot
val lt (a b: t) : Tot bool
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "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 } ]
false
let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)
val lt (a b: t) : Tot bool let lt (a b: t) : Tot bool =
false
null
false
lt #n (v a) (v b)
{ "checked_file": "FStar.Int8.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int8.fsti" }
[ "total" ]
[ "FStar.Int8.t", "FStar.Int.lt", "FStar.Int8.n", "FStar.Int8.v", "Prims.bool" ]
[]
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int8 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 8 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)
false
true
FStar.Int8.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val lt (a b: t) : Tot bool
[]
FStar.Int8.lt
{ "file_name": "ulib/FStar.Int8.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.bool
{ "end_col": 49, "end_line": 117, "start_col": 32, "start_line": 117 }
Prims.Pure
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "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 } ]
false
let op_Star_Hat = mul
let op_Star_Hat =
false
null
false
mul
{ "checked_file": "FStar.Int8.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int8.fsti" }
[]
[ "FStar.Int8.mul" ]
[]
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int8 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 8 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add
false
false
FStar.Int8.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val op_Star_Hat : a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.Pure FStar.Int8.t
[]
FStar.Int8.op_Star_Hat
{ "file_name": "ulib/FStar.Int8.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.Pure FStar.Int8.t
{ "end_col": 28, "end_line": 123, "start_col": 25, "start_line": 123 }
Prims.Pure
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "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 } ]
false
let op_Less_Less_Hat = shift_left
let op_Less_Less_Hat =
false
null
false
shift_left
{ "checked_file": "FStar.Int8.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int8.fsti" }
[]
[ "FStar.Int8.shift_left" ]
[]
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int8 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 8 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub unfold let op_Star_Hat = mul unfold let op_Slash_Hat = div unfold let op_Percent_Hat = rem unfold let op_Hat_Hat = logxor unfold let op_Amp_Hat = logand
false
false
FStar.Int8.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val op_Less_Less_Hat : a: FStar.Int8.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int8.t
[]
FStar.Int8.op_Less_Less_Hat
{ "file_name": "ulib/FStar.Int8.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.Int8.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int8.t
{ "end_col": 40, "end_line": 129, "start_col": 30, "start_line": 129 }
Prims.Pure
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "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 } ]
false
let op_Subtraction_Hat = sub
let op_Subtraction_Hat =
false
null
false
sub
{ "checked_file": "FStar.Int8.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int8.fsti" }
[]
[ "FStar.Int8.sub" ]
[]
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int8 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 8 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *)
false
false
FStar.Int8.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val op_Subtraction_Hat : a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.Pure FStar.Int8.t
[]
FStar.Int8.op_Subtraction_Hat
{ "file_name": "ulib/FStar.Int8.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.Pure FStar.Int8.t
{ "end_col": 35, "end_line": 122, "start_col": 32, "start_line": 122 }
Prims.Tot
val gte (a b: t) : Tot bool
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "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 } ]
false
let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
val gte (a b: t) : Tot bool let gte (a b: t) : Tot bool =
false
null
false
gte #n (v a) (v b)
{ "checked_file": "FStar.Int8.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int8.fsti" }
[ "total" ]
[ "FStar.Int8.t", "FStar.Int.gte", "FStar.Int8.n", "FStar.Int8.v", "Prims.bool" ]
[]
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int8 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 8 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
false
true
FStar.Int8.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val gte (a b: t) : Tot bool
[]
FStar.Int8.gte
{ "file_name": "ulib/FStar.Int8.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.bool
{ "end_col": 51, "end_line": 116, "start_col": 33, "start_line": 116 }
Prims.Tot
val eq (a b: t) : Tot bool
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "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 } ]
false
let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)
val eq (a b: t) : Tot bool let eq (a b: t) : Tot bool =
false
null
false
eq #n (v a) (v b)
{ "checked_file": "FStar.Int8.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int8.fsti" }
[ "total" ]
[ "FStar.Int8.t", "FStar.Int.eq", "FStar.Int8.n", "FStar.Int8.v", "Prims.bool" ]
[]
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int8 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 8 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))
false
true
FStar.Int8.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val eq (a b: t) : Tot bool
[]
FStar.Int8.eq
{ "file_name": "ulib/FStar.Int8.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.bool
{ "end_col": 49, "end_line": 114, "start_col": 32, "start_line": 114 }
Prims.Pure
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "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 } ]
false
let op_Greater_Greater_Hat = shift_right
let op_Greater_Greater_Hat =
false
null
false
shift_right
{ "checked_file": "FStar.Int8.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int8.fsti" }
[]
[ "FStar.Int8.shift_right" ]
[]
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int8 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 8 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub unfold let op_Star_Hat = mul unfold let op_Slash_Hat = div unfold let op_Percent_Hat = rem unfold let op_Hat_Hat = logxor unfold let op_Amp_Hat = logand unfold let op_Bar_Hat = logor
false
false
FStar.Int8.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val op_Greater_Greater_Hat : a: FStar.Int8.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int8.t
[]
FStar.Int8.op_Greater_Greater_Hat
{ "file_name": "ulib/FStar.Int8.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.Int8.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int8.t
{ "end_col": 47, "end_line": 130, "start_col": 36, "start_line": 130 }
Prims.Tot
val lte (a b: t) : Tot bool
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "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 } ]
false
let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)
val lte (a b: t) : Tot bool let lte (a b: t) : Tot bool =
false
null
false
lte #n (v a) (v b)
{ "checked_file": "FStar.Int8.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int8.fsti" }
[ "total" ]
[ "FStar.Int8.t", "FStar.Int.lte", "FStar.Int8.n", "FStar.Int8.v", "Prims.bool" ]
[]
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int8 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 8 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)
false
true
FStar.Int8.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val lte (a b: t) : Tot bool
[]
FStar.Int8.lte
{ "file_name": "ulib/FStar.Int8.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.bool
{ "end_col": 51, "end_line": 118, "start_col": 33, "start_line": 118 }
Prims.Pure
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "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 } ]
false
let op_Amp_Hat = logand
let op_Amp_Hat =
false
null
false
logand
{ "checked_file": "FStar.Int8.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int8.fsti" }
[]
[ "FStar.Int8.logand" ]
[]
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int8 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 8 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub unfold let op_Star_Hat = mul unfold let op_Slash_Hat = div unfold let op_Percent_Hat = rem
false
false
FStar.Int8.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val op_Amp_Hat : x: FStar.Int8.t -> y: FStar.Int8.t -> Prims.Pure FStar.Int8.t
[]
FStar.Int8.op_Amp_Hat
{ "file_name": "ulib/FStar.Int8.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
x: FStar.Int8.t -> y: FStar.Int8.t -> Prims.Pure FStar.Int8.t
{ "end_col": 30, "end_line": 127, "start_col": 24, "start_line": 127 }
Prims.Pure
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "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 } ]
false
let op_Greater_Greater_Greater_Hat = shift_arithmetic_right
let op_Greater_Greater_Greater_Hat =
false
null
false
shift_arithmetic_right
{ "checked_file": "FStar.Int8.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int8.fsti" }
[]
[ "FStar.Int8.shift_arithmetic_right" ]
[]
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int8 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 8 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub unfold let op_Star_Hat = mul unfold let op_Slash_Hat = div unfold let op_Percent_Hat = rem unfold let op_Hat_Hat = logxor unfold let op_Amp_Hat = logand unfold let op_Bar_Hat = logor unfold let op_Less_Less_Hat = shift_left
false
false
FStar.Int8.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val op_Greater_Greater_Greater_Hat : a: FStar.Int8.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int8.t
[]
FStar.Int8.op_Greater_Greater_Greater_Hat
{ "file_name": "ulib/FStar.Int8.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.Int8.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int8.t
{ "end_col": 66, "end_line": 131, "start_col": 44, "start_line": 131 }
Prims.Tot
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "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 } ]
false
let op_Greater_Equals_Hat = gte
let op_Greater_Equals_Hat =
false
null
false
gte
{ "checked_file": "FStar.Int8.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int8.fsti" }
[ "total" ]
[ "FStar.Int8.gte" ]
[]
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int8 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 8 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub unfold let op_Star_Hat = mul unfold let op_Slash_Hat = div unfold let op_Percent_Hat = rem unfold let op_Hat_Hat = logxor unfold let op_Amp_Hat = logand unfold let op_Bar_Hat = logor unfold let op_Less_Less_Hat = shift_left unfold let op_Greater_Greater_Hat = shift_right unfold let op_Greater_Greater_Greater_Hat = shift_arithmetic_right unfold let op_Equals_Hat = eq
false
true
FStar.Int8.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val op_Greater_Equals_Hat : a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.bool
[]
FStar.Int8.op_Greater_Equals_Hat
{ "file_name": "ulib/FStar.Int8.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.bool
{ "end_col": 38, "end_line": 134, "start_col": 35, "start_line": 134 }
Prims.Tot
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "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 } ]
false
let op_Equals_Hat = eq
let op_Equals_Hat =
false
null
false
eq
{ "checked_file": "FStar.Int8.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int8.fsti" }
[ "total" ]
[ "FStar.Int8.eq" ]
[]
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int8 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 8 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub unfold let op_Star_Hat = mul unfold let op_Slash_Hat = div unfold let op_Percent_Hat = rem unfold let op_Hat_Hat = logxor unfold let op_Amp_Hat = logand unfold let op_Bar_Hat = logor unfold let op_Less_Less_Hat = shift_left unfold let op_Greater_Greater_Hat = shift_right
false
true
FStar.Int8.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val op_Equals_Hat : a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.bool
[]
FStar.Int8.op_Equals_Hat
{ "file_name": "ulib/FStar.Int8.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.bool
{ "end_col": 29, "end_line": 132, "start_col": 27, "start_line": 132 }
Prims.Pure
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "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 } ]
false
let op_Slash_Hat = div
let op_Slash_Hat =
false
null
false
div
{ "checked_file": "FStar.Int8.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int8.fsti" }
[]
[ "FStar.Int8.div" ]
[]
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int8 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 8 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub
false
false
FStar.Int8.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val op_Slash_Hat : a: FStar.Int8.t -> b: FStar.Int8.t{FStar.Int8.v b <> 0} -> Prims.Pure FStar.Int8.t
[]
FStar.Int8.op_Slash_Hat
{ "file_name": "ulib/FStar.Int8.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.Int8.t -> b: FStar.Int8.t{FStar.Int8.v b <> 0} -> Prims.Pure FStar.Int8.t
{ "end_col": 29, "end_line": 124, "start_col": 26, "start_line": 124 }
Prims.Tot
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "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 } ]
false
let op_Greater_Hat = gt
let op_Greater_Hat =
false
null
false
gt
{ "checked_file": "FStar.Int8.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int8.fsti" }
[ "total" ]
[ "FStar.Int8.gt" ]
[]
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int8 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 8 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub unfold let op_Star_Hat = mul unfold let op_Slash_Hat = div unfold let op_Percent_Hat = rem unfold let op_Hat_Hat = logxor unfold let op_Amp_Hat = logand unfold let op_Bar_Hat = logor unfold let op_Less_Less_Hat = shift_left unfold let op_Greater_Greater_Hat = shift_right unfold let op_Greater_Greater_Greater_Hat = shift_arithmetic_right
false
true
FStar.Int8.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val op_Greater_Hat : a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.bool
[]
FStar.Int8.op_Greater_Hat
{ "file_name": "ulib/FStar.Int8.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.bool
{ "end_col": 30, "end_line": 133, "start_col": 28, "start_line": 133 }
Prims.Tot
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "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 } ]
false
let op_Less_Equals_Hat = lte
let op_Less_Equals_Hat =
false
null
false
lte
{ "checked_file": "FStar.Int8.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int8.fsti" }
[ "total" ]
[ "FStar.Int8.lte" ]
[]
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int8 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 8 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub unfold let op_Star_Hat = mul unfold let op_Slash_Hat = div unfold let op_Percent_Hat = rem unfold let op_Hat_Hat = logxor unfold let op_Amp_Hat = logand unfold let op_Bar_Hat = logor unfold let op_Less_Less_Hat = shift_left unfold let op_Greater_Greater_Hat = shift_right unfold let op_Greater_Greater_Greater_Hat = shift_arithmetic_right unfold let op_Equals_Hat = eq unfold let op_Greater_Hat = gt unfold let op_Greater_Equals_Hat = gte
false
true
FStar.Int8.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val op_Less_Equals_Hat : a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.bool
[]
FStar.Int8.op_Less_Equals_Hat
{ "file_name": "ulib/FStar.Int8.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.bool
{ "end_col": 35, "end_line": 136, "start_col": 32, "start_line": 136 }
Prims.Pure
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "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 } ]
false
let op_Hat_Hat = logxor
let op_Hat_Hat =
false
null
false
logxor
{ "checked_file": "FStar.Int8.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int8.fsti" }
[]
[ "FStar.Int8.logxor" ]
[]
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int8 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 8 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub unfold let op_Star_Hat = mul unfold let op_Slash_Hat = div
false
false
FStar.Int8.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val op_Hat_Hat : x: FStar.Int8.t -> y: FStar.Int8.t -> Prims.Pure FStar.Int8.t
[]
FStar.Int8.op_Hat_Hat
{ "file_name": "ulib/FStar.Int8.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
x: FStar.Int8.t -> y: FStar.Int8.t -> Prims.Pure FStar.Int8.t
{ "end_col": 30, "end_line": 126, "start_col": 24, "start_line": 126 }
Prims.Tot
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "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 } ]
false
let op_Less_Hat = lt
let op_Less_Hat =
false
null
false
lt
{ "checked_file": "FStar.Int8.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int8.fsti" }
[ "total" ]
[ "FStar.Int8.lt" ]
[]
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int8 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 8 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub unfold let op_Star_Hat = mul unfold let op_Slash_Hat = div unfold let op_Percent_Hat = rem unfold let op_Hat_Hat = logxor unfold let op_Amp_Hat = logand unfold let op_Bar_Hat = logor unfold let op_Less_Less_Hat = shift_left unfold let op_Greater_Greater_Hat = shift_right unfold let op_Greater_Greater_Greater_Hat = shift_arithmetic_right unfold let op_Equals_Hat = eq unfold let op_Greater_Hat = gt
false
true
FStar.Int8.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val op_Less_Hat : a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.bool
[]
FStar.Int8.op_Less_Hat
{ "file_name": "ulib/FStar.Int8.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.bool
{ "end_col": 27, "end_line": 135, "start_col": 25, "start_line": 135 }
Prims.Pure
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "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 } ]
false
let op_Bar_Hat = logor
let op_Bar_Hat =
false
null
false
logor
{ "checked_file": "FStar.Int8.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int8.fsti" }
[]
[ "FStar.Int8.logor" ]
[]
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int8 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 8 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub unfold let op_Star_Hat = mul unfold let op_Slash_Hat = div unfold let op_Percent_Hat = rem unfold let op_Hat_Hat = logxor
false
false
FStar.Int8.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val op_Bar_Hat : x: FStar.Int8.t -> y: FStar.Int8.t -> Prims.Pure FStar.Int8.t
[]
FStar.Int8.op_Bar_Hat
{ "file_name": "ulib/FStar.Int8.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
x: FStar.Int8.t -> y: FStar.Int8.t -> Prims.Pure FStar.Int8.t
{ "end_col": 29, "end_line": 128, "start_col": 24, "start_line": 128 }
Prims.Tot
val ct_abs (a: t{min_int n < v a}) : Tot (b: t{v b = abs (v a)})
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Int", "short_module": null }, { "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 } ]
false
let ct_abs (a:t{min_int n < v a}) : Tot (b:t{v b = abs (v a)}) = let mask = a >>>^ UInt32.uint_to_t (n - 1) in if 0 <= v a then begin sign_bit_positive (v a); nth_lemma (v mask) (FStar.Int.zero _); logxor_lemma_1 (v a) end else begin sign_bit_negative (v a); nth_lemma (v mask) (ones _); logxor_lemma_2 (v a); lognot_negative (v a); UInt.lemma_lognot_value #n (to_uint (v a)) end; (a ^^ mask) -^ mask
val ct_abs (a: t{min_int n < v a}) : Tot (b: t{v b = abs (v a)}) let ct_abs (a: t{min_int n < v a}) : Tot (b: t{v b = abs (v a)}) =
false
null
false
let mask = a >>>^ UInt32.uint_to_t (n - 1) in if 0 <= v a then (sign_bit_positive (v a); nth_lemma (v mask) (FStar.Int.zero _); logxor_lemma_1 (v a)) else (sign_bit_negative (v a); nth_lemma (v mask) (ones _); logxor_lemma_2 (v a); lognot_negative (v a); UInt.lemma_lognot_value #n (to_uint (v a))); (a ^^ mask) -^ mask
{ "checked_file": "FStar.Int8.fsti.checked", "dependencies": [ "prims.fst.checked", "FStar.UInt32.fsti.checked", "FStar.UInt.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Int.fsti.checked" ], "interface_file": false, "source_file": "FStar.Int8.fsti" }
[ "total" ]
[ "FStar.Int8.t", "Prims.b2t", "Prims.op_LessThan", "FStar.Int.min_int", "FStar.Int8.n", "FStar.Int8.v", "FStar.Int8.op_Subtraction_Hat", "FStar.Int8.op_Hat_Hat", "Prims.unit", "Prims.op_LessThanOrEqual", "FStar.Int.logxor_lemma_1", "FStar.Int.nth_lemma", "FStar.Int.zero", "FStar.Int.sign_bit_positive", "Prims.bool", "FStar.UInt.lemma_lognot_value", "FStar.Int.to_uint", "FStar.Int.lognot_negative", "FStar.Int.logxor_lemma_2", "FStar.Int.ones", "FStar.Int.sign_bit_negative", "FStar.Int8.op_Greater_Greater_Greater_Hat", "FStar.UInt32.uint_to_t", "Prims.op_Subtraction", "Prims.op_Equality", "Prims.int", "Prims.abs" ]
[]
(* Copyright 2008-2019 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Int8 (**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****) unfold let n = 8 open FStar.Int open FStar.Mul #set-options "--max_fuel 0 --max_ifuel 0" (* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly * a copy-paste of this module. *) new val t : eqtype val v (x:t) : Tot (int_t n) val int_to_t: x:int_t n -> Pure t (requires True) (ensures (fun y -> v y = x)) val uv_inv (x : t) : Lemma (ensures (int_to_t (v x) == x)) [SMTPat (v x)] val vu_inv (x : int_t n) : Lemma (ensures (v (int_to_t x) == x)) [SMTPat (int_to_t x)] val v_inj (x1 x2: t): Lemma (requires (v x1 == v x2)) (ensures (x1 == x2)) val zero : x:t{v x = 0} val one : x:t{v x = 1} val add (a:t) (b:t) : Pure t (requires (size (v a + v b) n)) (ensures (fun c -> v a + v b = v c)) (* Subtraction primitives *) val sub (a:t) (b:t) : Pure t (requires (size (v a - v b) n)) (ensures (fun c -> v a - v b = v c)) (* Multiplication primitives *) val mul (a:t) (b:t) : Pure t (requires (size (v a * v b) n)) (ensures (fun c -> v a * v b = v c)) (* Division primitives *) val div (a:t) (b:t{v b <> 0}) : Pure t // division overflows on INT_MIN / -1 (requires (size (v a / v b) n)) (ensures (fun c -> v a / v b = v c)) (* Modulo primitives *) (* If a/b is not representable the result of a%b is undefind *) val rem (a:t) (b:t{v b <> 0}) : Pure t (requires (size (v a / v b) n)) (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c)) (* Bitwise operators *) val logand (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logand` v y = v z)) val logxor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logxor` v y == v z)) val logor (x:t) (y:t) : Pure t (requires True) (ensures (fun z -> v x `logor` v y == v z)) val lognot (x:t) : Pure t (requires True) (ensures (fun z -> lognot (v x) == v z)) (* Shift operators *) (** If a is negative the result is implementation-defined *) val shift_right (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c)) (** If a is negative or a * pow2 s is not representable the result is undefined *) val shift_left (a:t) (s:UInt32.t) : Pure t (requires (0 <= v a /\ v a * pow2 (UInt32.v s) <= max_int n /\ UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c)) val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t (requires (UInt32.v s < n)) (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c)) (* Comparison operators *) let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b) let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b) let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b) let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b) let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b) (* Infix notations *) unfold let op_Plus_Hat = add unfold let op_Subtraction_Hat = sub unfold let op_Star_Hat = mul unfold let op_Slash_Hat = div unfold let op_Percent_Hat = rem unfold let op_Hat_Hat = logxor unfold let op_Amp_Hat = logand unfold let op_Bar_Hat = logor unfold let op_Less_Less_Hat = shift_left unfold let op_Greater_Greater_Hat = shift_right unfold let op_Greater_Greater_Greater_Hat = shift_arithmetic_right unfold let op_Equals_Hat = eq unfold let op_Greater_Hat = gt unfold let op_Greater_Equals_Hat = gte unfold let op_Less_Hat = lt unfold let op_Less_Equals_Hat = lte
false
false
FStar.Int8.fsti
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val ct_abs (a: t{min_int n < v a}) : Tot (b: t{v b = abs (v a)})
[]
FStar.Int8.ct_abs
{ "file_name": "ulib/FStar.Int8.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.Int8.t{FStar.Int.min_int FStar.Int8.n < FStar.Int8.v a} -> b: FStar.Int8.t{FStar.Int8.v b = Prims.abs (FStar.Int8.v a)}
{ "end_col": 21, "end_line": 155, "start_col": 64, "start_line": 139 }
FStar.Pervasives.Lemma
val lemma_shift_update_last: a:alg -> rem: nat -> b:block_s a -> d:bytes{length d + (size_block a) <= max_limb a /\ rem <= length d /\ rem <= size_block a} -> s:state a -> Lemma ( blake2_update_last a 0 rem (b `Seq.append` d) s == blake2_update_last a (size_block a) rem d s )
[ { "abbrev": true, "full_module": "Lib.UpdateMulti", "short_module": "UpdateMulti" }, { "abbrev": true, "full_module": "Lib.Sequence.Lemmas", "short_module": "Lems" }, { "abbrev": false, "full_module": "Lib.LoopCombinators", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Blake2", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Blake2", "short_module": null }, { "abbrev": false, "full_module": "Spec.Blake2", "short_module": null }, { "abbrev": false, "full_module": "Spec.Blake2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let lemma_shift_update_last a rem b d s = let m = b `Seq.append` d in assert (Seq.slice m (length m - rem) (length m) `Seq.equal` Seq.slice d (length d - rem) (length d)); assert (get_last_padded_block a (b `Seq.append` d) rem == get_last_padded_block a d rem)
val lemma_shift_update_last: a:alg -> rem: nat -> b:block_s a -> d:bytes{length d + (size_block a) <= max_limb a /\ rem <= length d /\ rem <= size_block a} -> s:state a -> Lemma ( blake2_update_last a 0 rem (b `Seq.append` d) s == blake2_update_last a (size_block a) rem d s ) let lemma_shift_update_last a rem b d s =
false
null
true
let m = b `Seq.append` d in assert ((Seq.slice m (length m - rem) (length m)) `Seq.equal` (Seq.slice d (length d - rem) (length d))); assert (get_last_padded_block a (b `Seq.append` d) rem == get_last_padded_block a d rem)
{ "checked_file": "Spec.Blake2.Alternative.fst.checked", "dependencies": [ "Spec.Blake2.fst.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.Lemmas.fsti.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Spec.Blake2.Alternative.fst" }
[ "lemma" ]
[ "Spec.Blake2.alg", "Prims.nat", "Spec.Blake2.block_s", "Lib.ByteSequence.bytes", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_Addition", "Lib.Sequence.length", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Blake2.size_block", "Spec.Blake2.max_limb", "Spec.Blake2.state", "Prims._assert", "Prims.eq2", "Spec.Blake2.get_last_padded_block", "FStar.Seq.Base.append", "Lib.IntTypes.uint8", "Prims.unit", "FStar.Seq.Base.equal", "FStar.Seq.Base.slice", "Prims.op_Subtraction", "FStar.Seq.Base.seq", "Lib.IntTypes.int_t" ]
[]
module Spec.Blake2.Alternative open Spec.Blake2 open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence open Lib.LoopCombinators module Lems = Lib.Sequence.Lemmas module UpdateMulti = Lib.UpdateMulti #set-options "--fuel 0 --ifuel 0 --z3rlimit 50" val lemma_shift_update_last: a:alg -> rem: nat -> b:block_s a -> d:bytes{length d + (size_block a) <= max_limb a /\ rem <= length d /\ rem <= size_block a} -> s:state a -> Lemma ( blake2_update_last a 0 rem (b `Seq.append` d) s == blake2_update_last a (size_block a) rem d s )
false
false
Spec.Blake2.Alternative.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val lemma_shift_update_last: a:alg -> rem: nat -> b:block_s a -> d:bytes{length d + (size_block a) <= max_limb a /\ rem <= length d /\ rem <= size_block a} -> s:state a -> Lemma ( blake2_update_last a 0 rem (b `Seq.append` d) s == blake2_update_last a (size_block a) rem d s )
[]
Spec.Blake2.Alternative.lemma_shift_update_last
{ "file_name": "specs/lemmas/Spec.Blake2.Alternative.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Blake2.alg -> rem: Prims.nat -> b: Spec.Blake2.block_s a -> d: Lib.ByteSequence.bytes { Lib.Sequence.length d + Spec.Blake2.size_block a <= Spec.Blake2.max_limb a /\ rem <= Lib.Sequence.length d /\ rem <= Spec.Blake2.size_block a } -> s: Spec.Blake2.state a -> FStar.Pervasives.Lemma (ensures Spec.Blake2.blake2_update_last a 0 rem (FStar.Seq.Base.append b d) s == Spec.Blake2.blake2_update_last a (Spec.Blake2.size_block a) rem d s)
{ "end_col": 90, "end_line": 30, "start_col": 41, "start_line": 27 }
FStar.Pervasives.Lemma
val lemma_update1_shift: a:alg -> b:block_s a -> d:bytes{length d + (size_block a) <= max_limb a} -> i:nat{i < length d / size_block a /\ (size_block a) + length d <= max_limb a} -> s:state a -> Lemma ( blake2_update1 a 0 (b `Seq.append` d) (i + 1) s == blake2_update1 a (size_block a) d i s )
[ { "abbrev": true, "full_module": "Lib.UpdateMulti", "short_module": "UpdateMulti" }, { "abbrev": true, "full_module": "Lib.Sequence.Lemmas", "short_module": "Lems" }, { "abbrev": false, "full_module": "Lib.LoopCombinators", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.RawIntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Blake2", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Blake2", "short_module": null }, { "abbrev": false, "full_module": "Spec.Blake2", "short_module": null }, { "abbrev": false, "full_module": "Spec.Blake2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let lemma_update1_shift a b d i s = assert (get_blocki a (b `Seq.append` d) (i + 1) `Seq.equal` get_blocki a d i)
val lemma_update1_shift: a:alg -> b:block_s a -> d:bytes{length d + (size_block a) <= max_limb a} -> i:nat{i < length d / size_block a /\ (size_block a) + length d <= max_limb a} -> s:state a -> Lemma ( blake2_update1 a 0 (b `Seq.append` d) (i + 1) s == blake2_update1 a (size_block a) d i s ) let lemma_update1_shift a b d i s =
false
null
true
assert ((get_blocki a (b `Seq.append` d) (i + 1)) `Seq.equal` (get_blocki a d i))
{ "checked_file": "Spec.Blake2.Alternative.fst.checked", "dependencies": [ "Spec.Blake2.fst.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.Lemmas.fsti.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Spec.Blake2.Alternative.fst" }
[ "lemma" ]
[ "Spec.Blake2.alg", "Spec.Blake2.block_s", "Lib.ByteSequence.bytes", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_Addition", "Lib.Sequence.length", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Blake2.size_block", "Spec.Blake2.max_limb", "Prims.nat", "Prims.l_and", "Prims.op_LessThan", "Prims.op_Division", "Spec.Blake2.state", "Prims._assert", "FStar.Seq.Base.equal", "Lib.IntTypes.uint8", "Spec.Blake2.get_blocki", "FStar.Seq.Base.append", "Prims.unit" ]
[]
module Spec.Blake2.Alternative open Spec.Blake2 open FStar.Mul open Lib.IntTypes open Lib.RawIntTypes open Lib.Sequence open Lib.ByteSequence open Lib.LoopCombinators module Lems = Lib.Sequence.Lemmas module UpdateMulti = Lib.UpdateMulti #set-options "--fuel 0 --ifuel 0 --z3rlimit 50" val lemma_shift_update_last: a:alg -> rem: nat -> b:block_s a -> d:bytes{length d + (size_block a) <= max_limb a /\ rem <= length d /\ rem <= size_block a} -> s:state a -> Lemma ( blake2_update_last a 0 rem (b `Seq.append` d) s == blake2_update_last a (size_block a) rem d s ) let lemma_shift_update_last a rem b d s = let m = b `Seq.append` d in assert (Seq.slice m (length m - rem) (length m) `Seq.equal` Seq.slice d (length d - rem) (length d)); assert (get_last_padded_block a (b `Seq.append` d) rem == get_last_padded_block a d rem) val lemma_update1_shift: a:alg -> b:block_s a -> d:bytes{length d + (size_block a) <= max_limb a} -> i:nat{i < length d / size_block a /\ (size_block a) + length d <= max_limb a} -> s:state a -> Lemma ( blake2_update1 a 0 (b `Seq.append` d) (i + 1) s == blake2_update1 a (size_block a) d i s )
false
false
Spec.Blake2.Alternative.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val lemma_update1_shift: a:alg -> b:block_s a -> d:bytes{length d + (size_block a) <= max_limb a} -> i:nat{i < length d / size_block a /\ (size_block a) + length d <= max_limb a} -> s:state a -> Lemma ( blake2_update1 a 0 (b `Seq.append` d) (i + 1) s == blake2_update1 a (size_block a) d i s )
[]
Spec.Blake2.Alternative.lemma_update1_shift
{ "file_name": "specs/lemmas/Spec.Blake2.Alternative.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Blake2.alg -> b: Spec.Blake2.block_s a -> d: Lib.ByteSequence.bytes {Lib.Sequence.length d + Spec.Blake2.size_block a <= Spec.Blake2.max_limb a} -> i: Prims.nat { i < Lib.Sequence.length d / Spec.Blake2.size_block a /\ Spec.Blake2.size_block a + Lib.Sequence.length d <= Spec.Blake2.max_limb a } -> s: Spec.Blake2.state a -> FStar.Pervasives.Lemma (ensures Spec.Blake2.blake2_update1 a 0 (FStar.Seq.Base.append b d) (i + 1) s == Spec.Blake2.blake2_update1 a (Spec.Blake2.size_block a) d i s)
{ "end_col": 79, "end_line": 43, "start_col": 2, "start_line": 43 }