file_name
stringlengths
5
52
name
stringlengths
4
95
original_source_type
stringlengths
0
23k
source_type
stringlengths
9
23k
source_definition
stringlengths
9
57.9k
source
dict
source_range
dict
file_context
stringlengths
0
721k
dependencies
dict
opens_and_abbrevs
listlengths
2
94
vconfig
dict
interleaved
bool
1 class
verbose_type
stringlengths
1
7.42k
effect
stringclasses
118 values
effect_flags
sequencelengths
0
2
mutual_with
sequencelengths
0
11
ideal_premises
sequencelengths
0
236
proof_features
sequencelengths
0
1
is_simple_lemma
bool
2 classes
is_div
bool
2 classes
is_proof
bool
2 classes
is_simply_typed
bool
2 classes
is_type
bool
2 classes
partial_definition
stringlengths
5
3.99k
completed_definiton
stringlengths
1
1.63M
isa_cross_project_example
bool
1 class
EverCrypt.AutoConfig2.fst
EverCrypt.AutoConfig2.disable_pclmulqdq
val disable_pclmulqdq: disabler
val disable_pclmulqdq: disabler
let disable_pclmulqdq () = B.recall cpu_has_pclmulqdq; B.upd cpu_has_pclmulqdq 0ul false
{ "file_name": "providers/evercrypt/fst/EverCrypt.AutoConfig2.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 88, "end_line": 245, "start_col": 0, "start_line": 245 }
module EverCrypt.AutoConfig2 module ST = FStar.HyperStack.ST module HS = FStar.HyperStack module B = LowStar.Buffer module S = FStar.Seq open FStar.HyperStack.ST #set-options "--max_fuel 0 --max_ifuel 0" (** Only partially specified; the flag may be false because it has been intentionally disabled by the client, for instance. *) type flag (b: bool) = b':bool { b' ==> b } (** Flags, cached in a mutable global reference *) let eternal_pointer a = buf:B.buffer a { B.recallable buf /\ B.length buf = 1 } unfold let cached_flag (b: bool) = eternal_pointer (flag b) let cpu_has_shaext: cached_flag Vale.X64.CPU_Features_s.sha_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_aesni: cached_flag Vale.X64.CPU_Features_s.aesni_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_pclmulqdq: cached_flag Vale.X64.CPU_Features_s.pclmulqdq_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_avx2: cached_flag Vale.X64.CPU_Features_s.avx2_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_avx: cached_flag Vale.X64.CPU_Features_s.avx_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_bmi2: cached_flag Vale.X64.CPU_Features_s.bmi2_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_adx: cached_flag Vale.X64.CPU_Features_s.adx_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_sse: cached_flag Vale.X64.CPU_Features_s.sse_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_movbe: cached_flag Vale.X64.CPU_Features_s.movbe_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_rdrand: cached_flag Vale.X64.CPU_Features_s.rdrand_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_avx512: cached_flag Vale.X64.CPU_Features_s.avx512_enabled = B.gcmalloc_of_list HS.root [ false ] inline_for_extraction let mk_getter #b (f: cached_flag b): getter b = fun () -> B.recall f; B.index f 0ul let has_shaext = mk_getter cpu_has_shaext let has_aesni = mk_getter cpu_has_aesni let has_pclmulqdq = mk_getter cpu_has_pclmulqdq let has_avx2 = mk_getter cpu_has_avx2 let has_avx = mk_getter cpu_has_avx let has_bmi2 = mk_getter cpu_has_bmi2 let has_adx = mk_getter cpu_has_adx let has_sse = mk_getter cpu_has_sse let has_movbe = mk_getter cpu_has_movbe let has_rdrand = mk_getter cpu_has_rdrand let has_avx512 = mk_getter cpu_has_avx512 let fp () = B.loc_buffer cpu_has_shaext `B.loc_union` B.loc_buffer cpu_has_aesni `B.loc_union` B.loc_buffer cpu_has_pclmulqdq `B.loc_union` B.loc_buffer cpu_has_avx2 `B.loc_union` B.loc_buffer cpu_has_avx `B.loc_union` B.loc_buffer cpu_has_bmi2 `B.loc_union` B.loc_buffer cpu_has_adx `B.loc_union` B.loc_buffer cpu_has_sse `B.loc_union` B.loc_buffer cpu_has_movbe `B.loc_union` B.loc_buffer cpu_has_rdrand `B.loc_union` B.loc_buffer cpu_has_avx512 let recall () = B.recall cpu_has_shaext; B.recall cpu_has_aesni; B.recall cpu_has_pclmulqdq; B.recall cpu_has_avx2; B.recall cpu_has_avx; B.recall cpu_has_bmi2; B.recall cpu_has_adx; B.recall cpu_has_sse; B.recall cpu_has_movbe; B.recall cpu_has_rdrand; B.recall cpu_has_avx512 inline_for_extraction noextract val init_aesni_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_aesni_flags () = if Vale.Wrapper.X64.Cpuid.check_aesni () <> 0UL then begin B.recall cpu_has_aesni; B.upd cpu_has_aesni 0ul true; B.recall cpu_has_pclmulqdq; B.upd cpu_has_pclmulqdq 0ul true end inline_for_extraction noextract val init_shaext_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_shaext_flags () = if Vale.Wrapper.X64.Cpuid.check_sha () <> 0UL then begin B.recall cpu_has_shaext; B.upd cpu_has_shaext 0ul true end inline_for_extraction noextract val init_avx_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_avx_flags () = if Vale.Wrapper.X64.Cpuid.check_avx () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_osxsave () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx_xcr0 () <> 0UL then begin B.recall cpu_has_avx; B.upd cpu_has_avx 0ul true end inline_for_extraction noextract val init_avx2_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_avx2_flags () = if Vale.Wrapper.X64.Cpuid.check_avx2 () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_osxsave () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx_xcr0 () <> 0UL then begin B.recall cpu_has_avx2; B.upd cpu_has_avx2 0ul true end inline_for_extraction noextract val init_adx_bmi2_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_adx_bmi2_flags () = if Vale.Wrapper.X64.Cpuid.check_adx_bmi2 () <> 0UL then begin B.recall cpu_has_bmi2; B.upd cpu_has_bmi2 0ul true; B.recall cpu_has_adx; B.upd cpu_has_adx 0ul true end inline_for_extraction noextract val init_sse_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_sse_flags () = if Vale.Wrapper.X64.Cpuid.check_sse () <> 0UL then begin B.recall cpu_has_sse; B.upd cpu_has_sse 0ul true end inline_for_extraction noextract val init_movbe_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_movbe_flags () = if Vale.Wrapper.X64.Cpuid.check_movbe () <> 0UL then begin B.recall cpu_has_movbe; B.upd cpu_has_movbe 0ul true end inline_for_extraction noextract val init_rdrand_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_rdrand_flags() = if Vale.Wrapper.X64.Cpuid.check_rdrand () <> 0UL then begin B.recall cpu_has_rdrand; B.upd cpu_has_rdrand 0ul true end inline_for_extraction noextract val init_avx512_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_avx512_flags () = if Vale.Wrapper.X64.Cpuid.check_avx512 () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_osxsave () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx_xcr0 () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx512_xcr0 () <> 0UL then begin B.recall cpu_has_avx512; B.upd cpu_has_avx512 0ul true end inline_for_extraction noextract val init_cpu_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_cpu_flags () = if EverCrypt.TargetConfig.hacl_can_compile_vale then begin init_aesni_flags (); init_shaext_flags (); init_adx_bmi2_flags(); init_avx_flags (); init_avx2_flags (); init_sse_flags (); init_movbe_flags (); init_rdrand_flags (); init_avx512_flags () end #set-options "--z3rlimit 50" let init () = init_cpu_flags() inline_for_extraction noextract let mk_disabler (f: eternal_pointer bool { B.loc_includes (fp ()) (B.loc_buffer f) }): disabler = fun () -> B.recall f; B.upd f 0ul false /// FIXME use mk_disabler let disable_avx2 () = B.recall cpu_has_avx2; B.upd cpu_has_avx2 0ul false let disable_avx () = B.recall cpu_has_avx; B.upd cpu_has_avx 0ul false let disable_bmi2 () = B.recall cpu_has_bmi2; B.upd cpu_has_bmi2 0ul false let disable_adx () = B.recall cpu_has_adx; B.upd cpu_has_adx 0ul false let disable_shaext () = B.recall cpu_has_shaext; B.upd cpu_has_shaext 0ul false
{ "checked_file": "/", "dependencies": [ "Vale.X64.CPU_Features_s.fst.checked", "Vale.Wrapper.X64.Cpuid.fsti.checked", "prims.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "EverCrypt.TargetConfig.fsti.checked" ], "interface_file": true, "source_file": "EverCrypt.AutoConfig2.fst" }
[ { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "EverCrypt.TargetConfig", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
EverCrypt.AutoConfig2.disabler
Prims.Tot
[ "total" ]
[]
[ "Prims.unit", "LowStar.Monotonic.Buffer.upd", "EverCrypt.AutoConfig2.flag", "Vale.X64.CPU_Features_s.pclmulqdq_enabled", "LowStar.Buffer.trivial_preorder", "EverCrypt.AutoConfig2.cpu_has_pclmulqdq", "FStar.UInt32.__uint_to_t", "LowStar.Monotonic.Buffer.recall" ]
[]
false
false
false
true
false
let disable_pclmulqdq () =
B.recall cpu_has_pclmulqdq; B.upd cpu_has_pclmulqdq 0ul false
false
EverCrypt.AutoConfig2.fst
EverCrypt.AutoConfig2.disable_rdrand
val disable_rdrand: disabler
val disable_rdrand: disabler
let disable_rdrand () = B.recall cpu_has_rdrand; B.upd cpu_has_rdrand 0ul false
{ "file_name": "providers/evercrypt/fst/EverCrypt.AutoConfig2.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 79, "end_line": 248, "start_col": 0, "start_line": 248 }
module EverCrypt.AutoConfig2 module ST = FStar.HyperStack.ST module HS = FStar.HyperStack module B = LowStar.Buffer module S = FStar.Seq open FStar.HyperStack.ST #set-options "--max_fuel 0 --max_ifuel 0" (** Only partially specified; the flag may be false because it has been intentionally disabled by the client, for instance. *) type flag (b: bool) = b':bool { b' ==> b } (** Flags, cached in a mutable global reference *) let eternal_pointer a = buf:B.buffer a { B.recallable buf /\ B.length buf = 1 } unfold let cached_flag (b: bool) = eternal_pointer (flag b) let cpu_has_shaext: cached_flag Vale.X64.CPU_Features_s.sha_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_aesni: cached_flag Vale.X64.CPU_Features_s.aesni_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_pclmulqdq: cached_flag Vale.X64.CPU_Features_s.pclmulqdq_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_avx2: cached_flag Vale.X64.CPU_Features_s.avx2_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_avx: cached_flag Vale.X64.CPU_Features_s.avx_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_bmi2: cached_flag Vale.X64.CPU_Features_s.bmi2_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_adx: cached_flag Vale.X64.CPU_Features_s.adx_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_sse: cached_flag Vale.X64.CPU_Features_s.sse_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_movbe: cached_flag Vale.X64.CPU_Features_s.movbe_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_rdrand: cached_flag Vale.X64.CPU_Features_s.rdrand_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_avx512: cached_flag Vale.X64.CPU_Features_s.avx512_enabled = B.gcmalloc_of_list HS.root [ false ] inline_for_extraction let mk_getter #b (f: cached_flag b): getter b = fun () -> B.recall f; B.index f 0ul let has_shaext = mk_getter cpu_has_shaext let has_aesni = mk_getter cpu_has_aesni let has_pclmulqdq = mk_getter cpu_has_pclmulqdq let has_avx2 = mk_getter cpu_has_avx2 let has_avx = mk_getter cpu_has_avx let has_bmi2 = mk_getter cpu_has_bmi2 let has_adx = mk_getter cpu_has_adx let has_sse = mk_getter cpu_has_sse let has_movbe = mk_getter cpu_has_movbe let has_rdrand = mk_getter cpu_has_rdrand let has_avx512 = mk_getter cpu_has_avx512 let fp () = B.loc_buffer cpu_has_shaext `B.loc_union` B.loc_buffer cpu_has_aesni `B.loc_union` B.loc_buffer cpu_has_pclmulqdq `B.loc_union` B.loc_buffer cpu_has_avx2 `B.loc_union` B.loc_buffer cpu_has_avx `B.loc_union` B.loc_buffer cpu_has_bmi2 `B.loc_union` B.loc_buffer cpu_has_adx `B.loc_union` B.loc_buffer cpu_has_sse `B.loc_union` B.loc_buffer cpu_has_movbe `B.loc_union` B.loc_buffer cpu_has_rdrand `B.loc_union` B.loc_buffer cpu_has_avx512 let recall () = B.recall cpu_has_shaext; B.recall cpu_has_aesni; B.recall cpu_has_pclmulqdq; B.recall cpu_has_avx2; B.recall cpu_has_avx; B.recall cpu_has_bmi2; B.recall cpu_has_adx; B.recall cpu_has_sse; B.recall cpu_has_movbe; B.recall cpu_has_rdrand; B.recall cpu_has_avx512 inline_for_extraction noextract val init_aesni_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_aesni_flags () = if Vale.Wrapper.X64.Cpuid.check_aesni () <> 0UL then begin B.recall cpu_has_aesni; B.upd cpu_has_aesni 0ul true; B.recall cpu_has_pclmulqdq; B.upd cpu_has_pclmulqdq 0ul true end inline_for_extraction noextract val init_shaext_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_shaext_flags () = if Vale.Wrapper.X64.Cpuid.check_sha () <> 0UL then begin B.recall cpu_has_shaext; B.upd cpu_has_shaext 0ul true end inline_for_extraction noextract val init_avx_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_avx_flags () = if Vale.Wrapper.X64.Cpuid.check_avx () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_osxsave () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx_xcr0 () <> 0UL then begin B.recall cpu_has_avx; B.upd cpu_has_avx 0ul true end inline_for_extraction noextract val init_avx2_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_avx2_flags () = if Vale.Wrapper.X64.Cpuid.check_avx2 () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_osxsave () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx_xcr0 () <> 0UL then begin B.recall cpu_has_avx2; B.upd cpu_has_avx2 0ul true end inline_for_extraction noextract val init_adx_bmi2_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_adx_bmi2_flags () = if Vale.Wrapper.X64.Cpuid.check_adx_bmi2 () <> 0UL then begin B.recall cpu_has_bmi2; B.upd cpu_has_bmi2 0ul true; B.recall cpu_has_adx; B.upd cpu_has_adx 0ul true end inline_for_extraction noextract val init_sse_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_sse_flags () = if Vale.Wrapper.X64.Cpuid.check_sse () <> 0UL then begin B.recall cpu_has_sse; B.upd cpu_has_sse 0ul true end inline_for_extraction noextract val init_movbe_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_movbe_flags () = if Vale.Wrapper.X64.Cpuid.check_movbe () <> 0UL then begin B.recall cpu_has_movbe; B.upd cpu_has_movbe 0ul true end inline_for_extraction noextract val init_rdrand_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_rdrand_flags() = if Vale.Wrapper.X64.Cpuid.check_rdrand () <> 0UL then begin B.recall cpu_has_rdrand; B.upd cpu_has_rdrand 0ul true end inline_for_extraction noextract val init_avx512_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_avx512_flags () = if Vale.Wrapper.X64.Cpuid.check_avx512 () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_osxsave () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx_xcr0 () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx512_xcr0 () <> 0UL then begin B.recall cpu_has_avx512; B.upd cpu_has_avx512 0ul true end inline_for_extraction noextract val init_cpu_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_cpu_flags () = if EverCrypt.TargetConfig.hacl_can_compile_vale then begin init_aesni_flags (); init_shaext_flags (); init_adx_bmi2_flags(); init_avx_flags (); init_avx2_flags (); init_sse_flags (); init_movbe_flags (); init_rdrand_flags (); init_avx512_flags () end #set-options "--z3rlimit 50" let init () = init_cpu_flags() inline_for_extraction noextract let mk_disabler (f: eternal_pointer bool { B.loc_includes (fp ()) (B.loc_buffer f) }): disabler = fun () -> B.recall f; B.upd f 0ul false /// FIXME use mk_disabler let disable_avx2 () = B.recall cpu_has_avx2; B.upd cpu_has_avx2 0ul false let disable_avx () = B.recall cpu_has_avx; B.upd cpu_has_avx 0ul false let disable_bmi2 () = B.recall cpu_has_bmi2; B.upd cpu_has_bmi2 0ul false let disable_adx () = B.recall cpu_has_adx; B.upd cpu_has_adx 0ul false let disable_shaext () = B.recall cpu_has_shaext; B.upd cpu_has_shaext 0ul false let disable_aesni () = B.recall cpu_has_aesni; B.upd cpu_has_aesni 0ul false let disable_pclmulqdq () = B.recall cpu_has_pclmulqdq; B.upd cpu_has_pclmulqdq 0ul false let disable_sse () = B.recall cpu_has_sse; B.upd cpu_has_sse 0ul false
{ "checked_file": "/", "dependencies": [ "Vale.X64.CPU_Features_s.fst.checked", "Vale.Wrapper.X64.Cpuid.fsti.checked", "prims.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "EverCrypt.TargetConfig.fsti.checked" ], "interface_file": true, "source_file": "EverCrypt.AutoConfig2.fst" }
[ { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "EverCrypt.TargetConfig", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
EverCrypt.AutoConfig2.disabler
Prims.Tot
[ "total" ]
[]
[ "Prims.unit", "LowStar.Monotonic.Buffer.upd", "EverCrypt.AutoConfig2.flag", "Vale.X64.CPU_Features_s.rdrand_enabled", "LowStar.Buffer.trivial_preorder", "EverCrypt.AutoConfig2.cpu_has_rdrand", "FStar.UInt32.__uint_to_t", "LowStar.Monotonic.Buffer.recall" ]
[]
false
false
false
true
false
let disable_rdrand () =
B.recall cpu_has_rdrand; B.upd cpu_has_rdrand 0ul false
false
EverCrypt.AutoConfig2.fst
EverCrypt.AutoConfig2.disable_avx512
val disable_avx512: disabler
val disable_avx512: disabler
let disable_avx512 () = B.recall cpu_has_avx512; B.upd cpu_has_avx512 0ul false
{ "file_name": "providers/evercrypt/fst/EverCrypt.AutoConfig2.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 79, "end_line": 249, "start_col": 0, "start_line": 249 }
module EverCrypt.AutoConfig2 module ST = FStar.HyperStack.ST module HS = FStar.HyperStack module B = LowStar.Buffer module S = FStar.Seq open FStar.HyperStack.ST #set-options "--max_fuel 0 --max_ifuel 0" (** Only partially specified; the flag may be false because it has been intentionally disabled by the client, for instance. *) type flag (b: bool) = b':bool { b' ==> b } (** Flags, cached in a mutable global reference *) let eternal_pointer a = buf:B.buffer a { B.recallable buf /\ B.length buf = 1 } unfold let cached_flag (b: bool) = eternal_pointer (flag b) let cpu_has_shaext: cached_flag Vale.X64.CPU_Features_s.sha_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_aesni: cached_flag Vale.X64.CPU_Features_s.aesni_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_pclmulqdq: cached_flag Vale.X64.CPU_Features_s.pclmulqdq_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_avx2: cached_flag Vale.X64.CPU_Features_s.avx2_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_avx: cached_flag Vale.X64.CPU_Features_s.avx_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_bmi2: cached_flag Vale.X64.CPU_Features_s.bmi2_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_adx: cached_flag Vale.X64.CPU_Features_s.adx_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_sse: cached_flag Vale.X64.CPU_Features_s.sse_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_movbe: cached_flag Vale.X64.CPU_Features_s.movbe_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_rdrand: cached_flag Vale.X64.CPU_Features_s.rdrand_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_avx512: cached_flag Vale.X64.CPU_Features_s.avx512_enabled = B.gcmalloc_of_list HS.root [ false ] inline_for_extraction let mk_getter #b (f: cached_flag b): getter b = fun () -> B.recall f; B.index f 0ul let has_shaext = mk_getter cpu_has_shaext let has_aesni = mk_getter cpu_has_aesni let has_pclmulqdq = mk_getter cpu_has_pclmulqdq let has_avx2 = mk_getter cpu_has_avx2 let has_avx = mk_getter cpu_has_avx let has_bmi2 = mk_getter cpu_has_bmi2 let has_adx = mk_getter cpu_has_adx let has_sse = mk_getter cpu_has_sse let has_movbe = mk_getter cpu_has_movbe let has_rdrand = mk_getter cpu_has_rdrand let has_avx512 = mk_getter cpu_has_avx512 let fp () = B.loc_buffer cpu_has_shaext `B.loc_union` B.loc_buffer cpu_has_aesni `B.loc_union` B.loc_buffer cpu_has_pclmulqdq `B.loc_union` B.loc_buffer cpu_has_avx2 `B.loc_union` B.loc_buffer cpu_has_avx `B.loc_union` B.loc_buffer cpu_has_bmi2 `B.loc_union` B.loc_buffer cpu_has_adx `B.loc_union` B.loc_buffer cpu_has_sse `B.loc_union` B.loc_buffer cpu_has_movbe `B.loc_union` B.loc_buffer cpu_has_rdrand `B.loc_union` B.loc_buffer cpu_has_avx512 let recall () = B.recall cpu_has_shaext; B.recall cpu_has_aesni; B.recall cpu_has_pclmulqdq; B.recall cpu_has_avx2; B.recall cpu_has_avx; B.recall cpu_has_bmi2; B.recall cpu_has_adx; B.recall cpu_has_sse; B.recall cpu_has_movbe; B.recall cpu_has_rdrand; B.recall cpu_has_avx512 inline_for_extraction noextract val init_aesni_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_aesni_flags () = if Vale.Wrapper.X64.Cpuid.check_aesni () <> 0UL then begin B.recall cpu_has_aesni; B.upd cpu_has_aesni 0ul true; B.recall cpu_has_pclmulqdq; B.upd cpu_has_pclmulqdq 0ul true end inline_for_extraction noextract val init_shaext_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_shaext_flags () = if Vale.Wrapper.X64.Cpuid.check_sha () <> 0UL then begin B.recall cpu_has_shaext; B.upd cpu_has_shaext 0ul true end inline_for_extraction noextract val init_avx_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_avx_flags () = if Vale.Wrapper.X64.Cpuid.check_avx () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_osxsave () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx_xcr0 () <> 0UL then begin B.recall cpu_has_avx; B.upd cpu_has_avx 0ul true end inline_for_extraction noextract val init_avx2_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_avx2_flags () = if Vale.Wrapper.X64.Cpuid.check_avx2 () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_osxsave () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx_xcr0 () <> 0UL then begin B.recall cpu_has_avx2; B.upd cpu_has_avx2 0ul true end inline_for_extraction noextract val init_adx_bmi2_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_adx_bmi2_flags () = if Vale.Wrapper.X64.Cpuid.check_adx_bmi2 () <> 0UL then begin B.recall cpu_has_bmi2; B.upd cpu_has_bmi2 0ul true; B.recall cpu_has_adx; B.upd cpu_has_adx 0ul true end inline_for_extraction noextract val init_sse_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_sse_flags () = if Vale.Wrapper.X64.Cpuid.check_sse () <> 0UL then begin B.recall cpu_has_sse; B.upd cpu_has_sse 0ul true end inline_for_extraction noextract val init_movbe_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_movbe_flags () = if Vale.Wrapper.X64.Cpuid.check_movbe () <> 0UL then begin B.recall cpu_has_movbe; B.upd cpu_has_movbe 0ul true end inline_for_extraction noextract val init_rdrand_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_rdrand_flags() = if Vale.Wrapper.X64.Cpuid.check_rdrand () <> 0UL then begin B.recall cpu_has_rdrand; B.upd cpu_has_rdrand 0ul true end inline_for_extraction noextract val init_avx512_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_avx512_flags () = if Vale.Wrapper.X64.Cpuid.check_avx512 () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_osxsave () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx_xcr0 () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx512_xcr0 () <> 0UL then begin B.recall cpu_has_avx512; B.upd cpu_has_avx512 0ul true end inline_for_extraction noextract val init_cpu_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_cpu_flags () = if EverCrypt.TargetConfig.hacl_can_compile_vale then begin init_aesni_flags (); init_shaext_flags (); init_adx_bmi2_flags(); init_avx_flags (); init_avx2_flags (); init_sse_flags (); init_movbe_flags (); init_rdrand_flags (); init_avx512_flags () end #set-options "--z3rlimit 50" let init () = init_cpu_flags() inline_for_extraction noextract let mk_disabler (f: eternal_pointer bool { B.loc_includes (fp ()) (B.loc_buffer f) }): disabler = fun () -> B.recall f; B.upd f 0ul false /// FIXME use mk_disabler let disable_avx2 () = B.recall cpu_has_avx2; B.upd cpu_has_avx2 0ul false let disable_avx () = B.recall cpu_has_avx; B.upd cpu_has_avx 0ul false let disable_bmi2 () = B.recall cpu_has_bmi2; B.upd cpu_has_bmi2 0ul false let disable_adx () = B.recall cpu_has_adx; B.upd cpu_has_adx 0ul false let disable_shaext () = B.recall cpu_has_shaext; B.upd cpu_has_shaext 0ul false let disable_aesni () = B.recall cpu_has_aesni; B.upd cpu_has_aesni 0ul false let disable_pclmulqdq () = B.recall cpu_has_pclmulqdq; B.upd cpu_has_pclmulqdq 0ul false let disable_sse () = B.recall cpu_has_sse; B.upd cpu_has_sse 0ul false let disable_movbe () = B.recall cpu_has_movbe; B.upd cpu_has_movbe 0ul false
{ "checked_file": "/", "dependencies": [ "Vale.X64.CPU_Features_s.fst.checked", "Vale.Wrapper.X64.Cpuid.fsti.checked", "prims.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "EverCrypt.TargetConfig.fsti.checked" ], "interface_file": true, "source_file": "EverCrypt.AutoConfig2.fst" }
[ { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "EverCrypt.TargetConfig", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
EverCrypt.AutoConfig2.disabler
Prims.Tot
[ "total" ]
[]
[ "Prims.unit", "LowStar.Monotonic.Buffer.upd", "EverCrypt.AutoConfig2.flag", "Vale.X64.CPU_Features_s.avx512_enabled", "LowStar.Buffer.trivial_preorder", "EverCrypt.AutoConfig2.cpu_has_avx512", "FStar.UInt32.__uint_to_t", "LowStar.Monotonic.Buffer.recall" ]
[]
false
false
false
true
false
let disable_avx512 () =
B.recall cpu_has_avx512; B.upd cpu_has_avx512 0ul false
false
EverCrypt.AutoConfig2.fst
EverCrypt.AutoConfig2.disable_adx
val disable_adx: disabler
val disable_adx: disabler
let disable_adx () = B.recall cpu_has_adx; B.upd cpu_has_adx 0ul false
{ "file_name": "providers/evercrypt/fst/EverCrypt.AutoConfig2.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 70, "end_line": 242, "start_col": 0, "start_line": 242 }
module EverCrypt.AutoConfig2 module ST = FStar.HyperStack.ST module HS = FStar.HyperStack module B = LowStar.Buffer module S = FStar.Seq open FStar.HyperStack.ST #set-options "--max_fuel 0 --max_ifuel 0" (** Only partially specified; the flag may be false because it has been intentionally disabled by the client, for instance. *) type flag (b: bool) = b':bool { b' ==> b } (** Flags, cached in a mutable global reference *) let eternal_pointer a = buf:B.buffer a { B.recallable buf /\ B.length buf = 1 } unfold let cached_flag (b: bool) = eternal_pointer (flag b) let cpu_has_shaext: cached_flag Vale.X64.CPU_Features_s.sha_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_aesni: cached_flag Vale.X64.CPU_Features_s.aesni_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_pclmulqdq: cached_flag Vale.X64.CPU_Features_s.pclmulqdq_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_avx2: cached_flag Vale.X64.CPU_Features_s.avx2_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_avx: cached_flag Vale.X64.CPU_Features_s.avx_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_bmi2: cached_flag Vale.X64.CPU_Features_s.bmi2_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_adx: cached_flag Vale.X64.CPU_Features_s.adx_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_sse: cached_flag Vale.X64.CPU_Features_s.sse_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_movbe: cached_flag Vale.X64.CPU_Features_s.movbe_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_rdrand: cached_flag Vale.X64.CPU_Features_s.rdrand_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_avx512: cached_flag Vale.X64.CPU_Features_s.avx512_enabled = B.gcmalloc_of_list HS.root [ false ] inline_for_extraction let mk_getter #b (f: cached_flag b): getter b = fun () -> B.recall f; B.index f 0ul let has_shaext = mk_getter cpu_has_shaext let has_aesni = mk_getter cpu_has_aesni let has_pclmulqdq = mk_getter cpu_has_pclmulqdq let has_avx2 = mk_getter cpu_has_avx2 let has_avx = mk_getter cpu_has_avx let has_bmi2 = mk_getter cpu_has_bmi2 let has_adx = mk_getter cpu_has_adx let has_sse = mk_getter cpu_has_sse let has_movbe = mk_getter cpu_has_movbe let has_rdrand = mk_getter cpu_has_rdrand let has_avx512 = mk_getter cpu_has_avx512 let fp () = B.loc_buffer cpu_has_shaext `B.loc_union` B.loc_buffer cpu_has_aesni `B.loc_union` B.loc_buffer cpu_has_pclmulqdq `B.loc_union` B.loc_buffer cpu_has_avx2 `B.loc_union` B.loc_buffer cpu_has_avx `B.loc_union` B.loc_buffer cpu_has_bmi2 `B.loc_union` B.loc_buffer cpu_has_adx `B.loc_union` B.loc_buffer cpu_has_sse `B.loc_union` B.loc_buffer cpu_has_movbe `B.loc_union` B.loc_buffer cpu_has_rdrand `B.loc_union` B.loc_buffer cpu_has_avx512 let recall () = B.recall cpu_has_shaext; B.recall cpu_has_aesni; B.recall cpu_has_pclmulqdq; B.recall cpu_has_avx2; B.recall cpu_has_avx; B.recall cpu_has_bmi2; B.recall cpu_has_adx; B.recall cpu_has_sse; B.recall cpu_has_movbe; B.recall cpu_has_rdrand; B.recall cpu_has_avx512 inline_for_extraction noextract val init_aesni_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_aesni_flags () = if Vale.Wrapper.X64.Cpuid.check_aesni () <> 0UL then begin B.recall cpu_has_aesni; B.upd cpu_has_aesni 0ul true; B.recall cpu_has_pclmulqdq; B.upd cpu_has_pclmulqdq 0ul true end inline_for_extraction noextract val init_shaext_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_shaext_flags () = if Vale.Wrapper.X64.Cpuid.check_sha () <> 0UL then begin B.recall cpu_has_shaext; B.upd cpu_has_shaext 0ul true end inline_for_extraction noextract val init_avx_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_avx_flags () = if Vale.Wrapper.X64.Cpuid.check_avx () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_osxsave () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx_xcr0 () <> 0UL then begin B.recall cpu_has_avx; B.upd cpu_has_avx 0ul true end inline_for_extraction noextract val init_avx2_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_avx2_flags () = if Vale.Wrapper.X64.Cpuid.check_avx2 () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_osxsave () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx_xcr0 () <> 0UL then begin B.recall cpu_has_avx2; B.upd cpu_has_avx2 0ul true end inline_for_extraction noextract val init_adx_bmi2_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_adx_bmi2_flags () = if Vale.Wrapper.X64.Cpuid.check_adx_bmi2 () <> 0UL then begin B.recall cpu_has_bmi2; B.upd cpu_has_bmi2 0ul true; B.recall cpu_has_adx; B.upd cpu_has_adx 0ul true end inline_for_extraction noextract val init_sse_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_sse_flags () = if Vale.Wrapper.X64.Cpuid.check_sse () <> 0UL then begin B.recall cpu_has_sse; B.upd cpu_has_sse 0ul true end inline_for_extraction noextract val init_movbe_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_movbe_flags () = if Vale.Wrapper.X64.Cpuid.check_movbe () <> 0UL then begin B.recall cpu_has_movbe; B.upd cpu_has_movbe 0ul true end inline_for_extraction noextract val init_rdrand_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_rdrand_flags() = if Vale.Wrapper.X64.Cpuid.check_rdrand () <> 0UL then begin B.recall cpu_has_rdrand; B.upd cpu_has_rdrand 0ul true end inline_for_extraction noextract val init_avx512_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_avx512_flags () = if Vale.Wrapper.X64.Cpuid.check_avx512 () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_osxsave () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx_xcr0 () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx512_xcr0 () <> 0UL then begin B.recall cpu_has_avx512; B.upd cpu_has_avx512 0ul true end inline_for_extraction noextract val init_cpu_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_cpu_flags () = if EverCrypt.TargetConfig.hacl_can_compile_vale then begin init_aesni_flags (); init_shaext_flags (); init_adx_bmi2_flags(); init_avx_flags (); init_avx2_flags (); init_sse_flags (); init_movbe_flags (); init_rdrand_flags (); init_avx512_flags () end #set-options "--z3rlimit 50" let init () = init_cpu_flags() inline_for_extraction noextract let mk_disabler (f: eternal_pointer bool { B.loc_includes (fp ()) (B.loc_buffer f) }): disabler = fun () -> B.recall f; B.upd f 0ul false /// FIXME use mk_disabler let disable_avx2 () = B.recall cpu_has_avx2; B.upd cpu_has_avx2 0ul false let disable_avx () = B.recall cpu_has_avx; B.upd cpu_has_avx 0ul false
{ "checked_file": "/", "dependencies": [ "Vale.X64.CPU_Features_s.fst.checked", "Vale.Wrapper.X64.Cpuid.fsti.checked", "prims.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "EverCrypt.TargetConfig.fsti.checked" ], "interface_file": true, "source_file": "EverCrypt.AutoConfig2.fst" }
[ { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "EverCrypt.TargetConfig", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
EverCrypt.AutoConfig2.disabler
Prims.Tot
[ "total" ]
[]
[ "Prims.unit", "LowStar.Monotonic.Buffer.upd", "EverCrypt.AutoConfig2.flag", "Vale.X64.CPU_Features_s.adx_enabled", "LowStar.Buffer.trivial_preorder", "EverCrypt.AutoConfig2.cpu_has_adx", "FStar.UInt32.__uint_to_t", "LowStar.Monotonic.Buffer.recall" ]
[]
false
false
false
true
false
let disable_adx () =
B.recall cpu_has_adx; B.upd cpu_has_adx 0ul false
false
EverCrypt.AutoConfig2.fst
EverCrypt.AutoConfig2.has_vec256
val has_vec256: getter vec256_enabled
val has_vec256: getter vec256_enabled
let has_vec256 () = let avx2 = has_avx2 () in let other = has_vec256_not_avx2 () in avx2 || other
{ "file_name": "providers/evercrypt/fst/EverCrypt.AutoConfig2.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 15, "end_line": 259, "start_col": 0, "start_line": 256 }
module EverCrypt.AutoConfig2 module ST = FStar.HyperStack.ST module HS = FStar.HyperStack module B = LowStar.Buffer module S = FStar.Seq open FStar.HyperStack.ST #set-options "--max_fuel 0 --max_ifuel 0" (** Only partially specified; the flag may be false because it has been intentionally disabled by the client, for instance. *) type flag (b: bool) = b':bool { b' ==> b } (** Flags, cached in a mutable global reference *) let eternal_pointer a = buf:B.buffer a { B.recallable buf /\ B.length buf = 1 } unfold let cached_flag (b: bool) = eternal_pointer (flag b) let cpu_has_shaext: cached_flag Vale.X64.CPU_Features_s.sha_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_aesni: cached_flag Vale.X64.CPU_Features_s.aesni_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_pclmulqdq: cached_flag Vale.X64.CPU_Features_s.pclmulqdq_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_avx2: cached_flag Vale.X64.CPU_Features_s.avx2_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_avx: cached_flag Vale.X64.CPU_Features_s.avx_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_bmi2: cached_flag Vale.X64.CPU_Features_s.bmi2_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_adx: cached_flag Vale.X64.CPU_Features_s.adx_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_sse: cached_flag Vale.X64.CPU_Features_s.sse_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_movbe: cached_flag Vale.X64.CPU_Features_s.movbe_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_rdrand: cached_flag Vale.X64.CPU_Features_s.rdrand_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_avx512: cached_flag Vale.X64.CPU_Features_s.avx512_enabled = B.gcmalloc_of_list HS.root [ false ] inline_for_extraction let mk_getter #b (f: cached_flag b): getter b = fun () -> B.recall f; B.index f 0ul let has_shaext = mk_getter cpu_has_shaext let has_aesni = mk_getter cpu_has_aesni let has_pclmulqdq = mk_getter cpu_has_pclmulqdq let has_avx2 = mk_getter cpu_has_avx2 let has_avx = mk_getter cpu_has_avx let has_bmi2 = mk_getter cpu_has_bmi2 let has_adx = mk_getter cpu_has_adx let has_sse = mk_getter cpu_has_sse let has_movbe = mk_getter cpu_has_movbe let has_rdrand = mk_getter cpu_has_rdrand let has_avx512 = mk_getter cpu_has_avx512 let fp () = B.loc_buffer cpu_has_shaext `B.loc_union` B.loc_buffer cpu_has_aesni `B.loc_union` B.loc_buffer cpu_has_pclmulqdq `B.loc_union` B.loc_buffer cpu_has_avx2 `B.loc_union` B.loc_buffer cpu_has_avx `B.loc_union` B.loc_buffer cpu_has_bmi2 `B.loc_union` B.loc_buffer cpu_has_adx `B.loc_union` B.loc_buffer cpu_has_sse `B.loc_union` B.loc_buffer cpu_has_movbe `B.loc_union` B.loc_buffer cpu_has_rdrand `B.loc_union` B.loc_buffer cpu_has_avx512 let recall () = B.recall cpu_has_shaext; B.recall cpu_has_aesni; B.recall cpu_has_pclmulqdq; B.recall cpu_has_avx2; B.recall cpu_has_avx; B.recall cpu_has_bmi2; B.recall cpu_has_adx; B.recall cpu_has_sse; B.recall cpu_has_movbe; B.recall cpu_has_rdrand; B.recall cpu_has_avx512 inline_for_extraction noextract val init_aesni_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_aesni_flags () = if Vale.Wrapper.X64.Cpuid.check_aesni () <> 0UL then begin B.recall cpu_has_aesni; B.upd cpu_has_aesni 0ul true; B.recall cpu_has_pclmulqdq; B.upd cpu_has_pclmulqdq 0ul true end inline_for_extraction noextract val init_shaext_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_shaext_flags () = if Vale.Wrapper.X64.Cpuid.check_sha () <> 0UL then begin B.recall cpu_has_shaext; B.upd cpu_has_shaext 0ul true end inline_for_extraction noextract val init_avx_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_avx_flags () = if Vale.Wrapper.X64.Cpuid.check_avx () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_osxsave () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx_xcr0 () <> 0UL then begin B.recall cpu_has_avx; B.upd cpu_has_avx 0ul true end inline_for_extraction noextract val init_avx2_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_avx2_flags () = if Vale.Wrapper.X64.Cpuid.check_avx2 () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_osxsave () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx_xcr0 () <> 0UL then begin B.recall cpu_has_avx2; B.upd cpu_has_avx2 0ul true end inline_for_extraction noextract val init_adx_bmi2_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_adx_bmi2_flags () = if Vale.Wrapper.X64.Cpuid.check_adx_bmi2 () <> 0UL then begin B.recall cpu_has_bmi2; B.upd cpu_has_bmi2 0ul true; B.recall cpu_has_adx; B.upd cpu_has_adx 0ul true end inline_for_extraction noextract val init_sse_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_sse_flags () = if Vale.Wrapper.X64.Cpuid.check_sse () <> 0UL then begin B.recall cpu_has_sse; B.upd cpu_has_sse 0ul true end inline_for_extraction noextract val init_movbe_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_movbe_flags () = if Vale.Wrapper.X64.Cpuid.check_movbe () <> 0UL then begin B.recall cpu_has_movbe; B.upd cpu_has_movbe 0ul true end inline_for_extraction noextract val init_rdrand_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_rdrand_flags() = if Vale.Wrapper.X64.Cpuid.check_rdrand () <> 0UL then begin B.recall cpu_has_rdrand; B.upd cpu_has_rdrand 0ul true end inline_for_extraction noextract val init_avx512_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_avx512_flags () = if Vale.Wrapper.X64.Cpuid.check_avx512 () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_osxsave () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx_xcr0 () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx512_xcr0 () <> 0UL then begin B.recall cpu_has_avx512; B.upd cpu_has_avx512 0ul true end inline_for_extraction noextract val init_cpu_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_cpu_flags () = if EverCrypt.TargetConfig.hacl_can_compile_vale then begin init_aesni_flags (); init_shaext_flags (); init_adx_bmi2_flags(); init_avx_flags (); init_avx2_flags (); init_sse_flags (); init_movbe_flags (); init_rdrand_flags (); init_avx512_flags () end #set-options "--z3rlimit 50" let init () = init_cpu_flags() inline_for_extraction noextract let mk_disabler (f: eternal_pointer bool { B.loc_includes (fp ()) (B.loc_buffer f) }): disabler = fun () -> B.recall f; B.upd f 0ul false /// FIXME use mk_disabler let disable_avx2 () = B.recall cpu_has_avx2; B.upd cpu_has_avx2 0ul false let disable_avx () = B.recall cpu_has_avx; B.upd cpu_has_avx 0ul false let disable_bmi2 () = B.recall cpu_has_bmi2; B.upd cpu_has_bmi2 0ul false let disable_adx () = B.recall cpu_has_adx; B.upd cpu_has_adx 0ul false let disable_shaext () = B.recall cpu_has_shaext; B.upd cpu_has_shaext 0ul false let disable_aesni () = B.recall cpu_has_aesni; B.upd cpu_has_aesni 0ul false let disable_pclmulqdq () = B.recall cpu_has_pclmulqdq; B.upd cpu_has_pclmulqdq 0ul false let disable_sse () = B.recall cpu_has_sse; B.upd cpu_has_sse 0ul false let disable_movbe () = B.recall cpu_has_movbe; B.upd cpu_has_movbe 0ul false let disable_rdrand () = B.recall cpu_has_rdrand; B.upd cpu_has_rdrand 0ul false let disable_avx512 () = B.recall cpu_has_avx512; B.upd cpu_has_avx512 0ul false let has_vec128 () = let avx = has_avx () in let other = has_vec128_not_avx () in avx || other
{ "checked_file": "/", "dependencies": [ "Vale.X64.CPU_Features_s.fst.checked", "Vale.Wrapper.X64.Cpuid.fsti.checked", "prims.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "EverCrypt.TargetConfig.fsti.checked" ], "interface_file": true, "source_file": "EverCrypt.AutoConfig2.fst" }
[ { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "EverCrypt.TargetConfig", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
EverCrypt.AutoConfig2.getter EverCrypt.AutoConfig2.vec256_enabled
Prims.Tot
[ "total" ]
[]
[ "Prims.unit", "Prims.op_BarBar", "Prims.bool", "EverCrypt.TargetConfig.has_vec256_not_avx2", "EverCrypt.AutoConfig2.has_avx2" ]
[]
false
false
false
true
false
let has_vec256 () =
let avx2 = has_avx2 () in let other = has_vec256_not_avx2 () in avx2 || other
false
EverCrypt.AutoConfig2.fst
EverCrypt.AutoConfig2.disable_movbe
val disable_movbe: disabler
val disable_movbe: disabler
let disable_movbe () = B.recall cpu_has_movbe; B.upd cpu_has_movbe 0ul false
{ "file_name": "providers/evercrypt/fst/EverCrypt.AutoConfig2.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 76, "end_line": 247, "start_col": 0, "start_line": 247 }
module EverCrypt.AutoConfig2 module ST = FStar.HyperStack.ST module HS = FStar.HyperStack module B = LowStar.Buffer module S = FStar.Seq open FStar.HyperStack.ST #set-options "--max_fuel 0 --max_ifuel 0" (** Only partially specified; the flag may be false because it has been intentionally disabled by the client, for instance. *) type flag (b: bool) = b':bool { b' ==> b } (** Flags, cached in a mutable global reference *) let eternal_pointer a = buf:B.buffer a { B.recallable buf /\ B.length buf = 1 } unfold let cached_flag (b: bool) = eternal_pointer (flag b) let cpu_has_shaext: cached_flag Vale.X64.CPU_Features_s.sha_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_aesni: cached_flag Vale.X64.CPU_Features_s.aesni_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_pclmulqdq: cached_flag Vale.X64.CPU_Features_s.pclmulqdq_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_avx2: cached_flag Vale.X64.CPU_Features_s.avx2_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_avx: cached_flag Vale.X64.CPU_Features_s.avx_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_bmi2: cached_flag Vale.X64.CPU_Features_s.bmi2_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_adx: cached_flag Vale.X64.CPU_Features_s.adx_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_sse: cached_flag Vale.X64.CPU_Features_s.sse_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_movbe: cached_flag Vale.X64.CPU_Features_s.movbe_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_rdrand: cached_flag Vale.X64.CPU_Features_s.rdrand_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_avx512: cached_flag Vale.X64.CPU_Features_s.avx512_enabled = B.gcmalloc_of_list HS.root [ false ] inline_for_extraction let mk_getter #b (f: cached_flag b): getter b = fun () -> B.recall f; B.index f 0ul let has_shaext = mk_getter cpu_has_shaext let has_aesni = mk_getter cpu_has_aesni let has_pclmulqdq = mk_getter cpu_has_pclmulqdq let has_avx2 = mk_getter cpu_has_avx2 let has_avx = mk_getter cpu_has_avx let has_bmi2 = mk_getter cpu_has_bmi2 let has_adx = mk_getter cpu_has_adx let has_sse = mk_getter cpu_has_sse let has_movbe = mk_getter cpu_has_movbe let has_rdrand = mk_getter cpu_has_rdrand let has_avx512 = mk_getter cpu_has_avx512 let fp () = B.loc_buffer cpu_has_shaext `B.loc_union` B.loc_buffer cpu_has_aesni `B.loc_union` B.loc_buffer cpu_has_pclmulqdq `B.loc_union` B.loc_buffer cpu_has_avx2 `B.loc_union` B.loc_buffer cpu_has_avx `B.loc_union` B.loc_buffer cpu_has_bmi2 `B.loc_union` B.loc_buffer cpu_has_adx `B.loc_union` B.loc_buffer cpu_has_sse `B.loc_union` B.loc_buffer cpu_has_movbe `B.loc_union` B.loc_buffer cpu_has_rdrand `B.loc_union` B.loc_buffer cpu_has_avx512 let recall () = B.recall cpu_has_shaext; B.recall cpu_has_aesni; B.recall cpu_has_pclmulqdq; B.recall cpu_has_avx2; B.recall cpu_has_avx; B.recall cpu_has_bmi2; B.recall cpu_has_adx; B.recall cpu_has_sse; B.recall cpu_has_movbe; B.recall cpu_has_rdrand; B.recall cpu_has_avx512 inline_for_extraction noextract val init_aesni_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_aesni_flags () = if Vale.Wrapper.X64.Cpuid.check_aesni () <> 0UL then begin B.recall cpu_has_aesni; B.upd cpu_has_aesni 0ul true; B.recall cpu_has_pclmulqdq; B.upd cpu_has_pclmulqdq 0ul true end inline_for_extraction noextract val init_shaext_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_shaext_flags () = if Vale.Wrapper.X64.Cpuid.check_sha () <> 0UL then begin B.recall cpu_has_shaext; B.upd cpu_has_shaext 0ul true end inline_for_extraction noextract val init_avx_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_avx_flags () = if Vale.Wrapper.X64.Cpuid.check_avx () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_osxsave () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx_xcr0 () <> 0UL then begin B.recall cpu_has_avx; B.upd cpu_has_avx 0ul true end inline_for_extraction noextract val init_avx2_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_avx2_flags () = if Vale.Wrapper.X64.Cpuid.check_avx2 () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_osxsave () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx_xcr0 () <> 0UL then begin B.recall cpu_has_avx2; B.upd cpu_has_avx2 0ul true end inline_for_extraction noextract val init_adx_bmi2_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_adx_bmi2_flags () = if Vale.Wrapper.X64.Cpuid.check_adx_bmi2 () <> 0UL then begin B.recall cpu_has_bmi2; B.upd cpu_has_bmi2 0ul true; B.recall cpu_has_adx; B.upd cpu_has_adx 0ul true end inline_for_extraction noextract val init_sse_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_sse_flags () = if Vale.Wrapper.X64.Cpuid.check_sse () <> 0UL then begin B.recall cpu_has_sse; B.upd cpu_has_sse 0ul true end inline_for_extraction noextract val init_movbe_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_movbe_flags () = if Vale.Wrapper.X64.Cpuid.check_movbe () <> 0UL then begin B.recall cpu_has_movbe; B.upd cpu_has_movbe 0ul true end inline_for_extraction noextract val init_rdrand_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_rdrand_flags() = if Vale.Wrapper.X64.Cpuid.check_rdrand () <> 0UL then begin B.recall cpu_has_rdrand; B.upd cpu_has_rdrand 0ul true end inline_for_extraction noextract val init_avx512_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_avx512_flags () = if Vale.Wrapper.X64.Cpuid.check_avx512 () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_osxsave () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx_xcr0 () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx512_xcr0 () <> 0UL then begin B.recall cpu_has_avx512; B.upd cpu_has_avx512 0ul true end inline_for_extraction noextract val init_cpu_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_cpu_flags () = if EverCrypt.TargetConfig.hacl_can_compile_vale then begin init_aesni_flags (); init_shaext_flags (); init_adx_bmi2_flags(); init_avx_flags (); init_avx2_flags (); init_sse_flags (); init_movbe_flags (); init_rdrand_flags (); init_avx512_flags () end #set-options "--z3rlimit 50" let init () = init_cpu_flags() inline_for_extraction noextract let mk_disabler (f: eternal_pointer bool { B.loc_includes (fp ()) (B.loc_buffer f) }): disabler = fun () -> B.recall f; B.upd f 0ul false /// FIXME use mk_disabler let disable_avx2 () = B.recall cpu_has_avx2; B.upd cpu_has_avx2 0ul false let disable_avx () = B.recall cpu_has_avx; B.upd cpu_has_avx 0ul false let disable_bmi2 () = B.recall cpu_has_bmi2; B.upd cpu_has_bmi2 0ul false let disable_adx () = B.recall cpu_has_adx; B.upd cpu_has_adx 0ul false let disable_shaext () = B.recall cpu_has_shaext; B.upd cpu_has_shaext 0ul false let disable_aesni () = B.recall cpu_has_aesni; B.upd cpu_has_aesni 0ul false let disable_pclmulqdq () = B.recall cpu_has_pclmulqdq; B.upd cpu_has_pclmulqdq 0ul false
{ "checked_file": "/", "dependencies": [ "Vale.X64.CPU_Features_s.fst.checked", "Vale.Wrapper.X64.Cpuid.fsti.checked", "prims.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "EverCrypt.TargetConfig.fsti.checked" ], "interface_file": true, "source_file": "EverCrypt.AutoConfig2.fst" }
[ { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "EverCrypt.TargetConfig", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
EverCrypt.AutoConfig2.disabler
Prims.Tot
[ "total" ]
[]
[ "Prims.unit", "LowStar.Monotonic.Buffer.upd", "EverCrypt.AutoConfig2.flag", "Vale.X64.CPU_Features_s.movbe_enabled", "LowStar.Buffer.trivial_preorder", "EverCrypt.AutoConfig2.cpu_has_movbe", "FStar.UInt32.__uint_to_t", "LowStar.Monotonic.Buffer.recall" ]
[]
false
false
false
true
false
let disable_movbe () =
B.recall cpu_has_movbe; B.upd cpu_has_movbe 0ul false
false
EverCrypt.AutoConfig2.fst
EverCrypt.AutoConfig2.has_vec128
val has_vec128: getter vec128_enabled
val has_vec128: getter vec128_enabled
let has_vec128 () = let avx = has_avx () in let other = has_vec128_not_avx () in avx || other
{ "file_name": "providers/evercrypt/fst/EverCrypt.AutoConfig2.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 14, "end_line": 254, "start_col": 0, "start_line": 251 }
module EverCrypt.AutoConfig2 module ST = FStar.HyperStack.ST module HS = FStar.HyperStack module B = LowStar.Buffer module S = FStar.Seq open FStar.HyperStack.ST #set-options "--max_fuel 0 --max_ifuel 0" (** Only partially specified; the flag may be false because it has been intentionally disabled by the client, for instance. *) type flag (b: bool) = b':bool { b' ==> b } (** Flags, cached in a mutable global reference *) let eternal_pointer a = buf:B.buffer a { B.recallable buf /\ B.length buf = 1 } unfold let cached_flag (b: bool) = eternal_pointer (flag b) let cpu_has_shaext: cached_flag Vale.X64.CPU_Features_s.sha_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_aesni: cached_flag Vale.X64.CPU_Features_s.aesni_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_pclmulqdq: cached_flag Vale.X64.CPU_Features_s.pclmulqdq_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_avx2: cached_flag Vale.X64.CPU_Features_s.avx2_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_avx: cached_flag Vale.X64.CPU_Features_s.avx_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_bmi2: cached_flag Vale.X64.CPU_Features_s.bmi2_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_adx: cached_flag Vale.X64.CPU_Features_s.adx_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_sse: cached_flag Vale.X64.CPU_Features_s.sse_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_movbe: cached_flag Vale.X64.CPU_Features_s.movbe_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_rdrand: cached_flag Vale.X64.CPU_Features_s.rdrand_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_avx512: cached_flag Vale.X64.CPU_Features_s.avx512_enabled = B.gcmalloc_of_list HS.root [ false ] inline_for_extraction let mk_getter #b (f: cached_flag b): getter b = fun () -> B.recall f; B.index f 0ul let has_shaext = mk_getter cpu_has_shaext let has_aesni = mk_getter cpu_has_aesni let has_pclmulqdq = mk_getter cpu_has_pclmulqdq let has_avx2 = mk_getter cpu_has_avx2 let has_avx = mk_getter cpu_has_avx let has_bmi2 = mk_getter cpu_has_bmi2 let has_adx = mk_getter cpu_has_adx let has_sse = mk_getter cpu_has_sse let has_movbe = mk_getter cpu_has_movbe let has_rdrand = mk_getter cpu_has_rdrand let has_avx512 = mk_getter cpu_has_avx512 let fp () = B.loc_buffer cpu_has_shaext `B.loc_union` B.loc_buffer cpu_has_aesni `B.loc_union` B.loc_buffer cpu_has_pclmulqdq `B.loc_union` B.loc_buffer cpu_has_avx2 `B.loc_union` B.loc_buffer cpu_has_avx `B.loc_union` B.loc_buffer cpu_has_bmi2 `B.loc_union` B.loc_buffer cpu_has_adx `B.loc_union` B.loc_buffer cpu_has_sse `B.loc_union` B.loc_buffer cpu_has_movbe `B.loc_union` B.loc_buffer cpu_has_rdrand `B.loc_union` B.loc_buffer cpu_has_avx512 let recall () = B.recall cpu_has_shaext; B.recall cpu_has_aesni; B.recall cpu_has_pclmulqdq; B.recall cpu_has_avx2; B.recall cpu_has_avx; B.recall cpu_has_bmi2; B.recall cpu_has_adx; B.recall cpu_has_sse; B.recall cpu_has_movbe; B.recall cpu_has_rdrand; B.recall cpu_has_avx512 inline_for_extraction noextract val init_aesni_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_aesni_flags () = if Vale.Wrapper.X64.Cpuid.check_aesni () <> 0UL then begin B.recall cpu_has_aesni; B.upd cpu_has_aesni 0ul true; B.recall cpu_has_pclmulqdq; B.upd cpu_has_pclmulqdq 0ul true end inline_for_extraction noextract val init_shaext_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_shaext_flags () = if Vale.Wrapper.X64.Cpuid.check_sha () <> 0UL then begin B.recall cpu_has_shaext; B.upd cpu_has_shaext 0ul true end inline_for_extraction noextract val init_avx_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_avx_flags () = if Vale.Wrapper.X64.Cpuid.check_avx () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_osxsave () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx_xcr0 () <> 0UL then begin B.recall cpu_has_avx; B.upd cpu_has_avx 0ul true end inline_for_extraction noextract val init_avx2_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_avx2_flags () = if Vale.Wrapper.X64.Cpuid.check_avx2 () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_osxsave () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx_xcr0 () <> 0UL then begin B.recall cpu_has_avx2; B.upd cpu_has_avx2 0ul true end inline_for_extraction noextract val init_adx_bmi2_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_adx_bmi2_flags () = if Vale.Wrapper.X64.Cpuid.check_adx_bmi2 () <> 0UL then begin B.recall cpu_has_bmi2; B.upd cpu_has_bmi2 0ul true; B.recall cpu_has_adx; B.upd cpu_has_adx 0ul true end inline_for_extraction noextract val init_sse_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_sse_flags () = if Vale.Wrapper.X64.Cpuid.check_sse () <> 0UL then begin B.recall cpu_has_sse; B.upd cpu_has_sse 0ul true end inline_for_extraction noextract val init_movbe_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_movbe_flags () = if Vale.Wrapper.X64.Cpuid.check_movbe () <> 0UL then begin B.recall cpu_has_movbe; B.upd cpu_has_movbe 0ul true end inline_for_extraction noextract val init_rdrand_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_rdrand_flags() = if Vale.Wrapper.X64.Cpuid.check_rdrand () <> 0UL then begin B.recall cpu_has_rdrand; B.upd cpu_has_rdrand 0ul true end inline_for_extraction noextract val init_avx512_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_avx512_flags () = if Vale.Wrapper.X64.Cpuid.check_avx512 () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_osxsave () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx_xcr0 () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx512_xcr0 () <> 0UL then begin B.recall cpu_has_avx512; B.upd cpu_has_avx512 0ul true end inline_for_extraction noextract val init_cpu_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_cpu_flags () = if EverCrypt.TargetConfig.hacl_can_compile_vale then begin init_aesni_flags (); init_shaext_flags (); init_adx_bmi2_flags(); init_avx_flags (); init_avx2_flags (); init_sse_flags (); init_movbe_flags (); init_rdrand_flags (); init_avx512_flags () end #set-options "--z3rlimit 50" let init () = init_cpu_flags() inline_for_extraction noextract let mk_disabler (f: eternal_pointer bool { B.loc_includes (fp ()) (B.loc_buffer f) }): disabler = fun () -> B.recall f; B.upd f 0ul false /// FIXME use mk_disabler let disable_avx2 () = B.recall cpu_has_avx2; B.upd cpu_has_avx2 0ul false let disable_avx () = B.recall cpu_has_avx; B.upd cpu_has_avx 0ul false let disable_bmi2 () = B.recall cpu_has_bmi2; B.upd cpu_has_bmi2 0ul false let disable_adx () = B.recall cpu_has_adx; B.upd cpu_has_adx 0ul false let disable_shaext () = B.recall cpu_has_shaext; B.upd cpu_has_shaext 0ul false let disable_aesni () = B.recall cpu_has_aesni; B.upd cpu_has_aesni 0ul false let disable_pclmulqdq () = B.recall cpu_has_pclmulqdq; B.upd cpu_has_pclmulqdq 0ul false let disable_sse () = B.recall cpu_has_sse; B.upd cpu_has_sse 0ul false let disable_movbe () = B.recall cpu_has_movbe; B.upd cpu_has_movbe 0ul false let disable_rdrand () = B.recall cpu_has_rdrand; B.upd cpu_has_rdrand 0ul false let disable_avx512 () = B.recall cpu_has_avx512; B.upd cpu_has_avx512 0ul false
{ "checked_file": "/", "dependencies": [ "Vale.X64.CPU_Features_s.fst.checked", "Vale.Wrapper.X64.Cpuid.fsti.checked", "prims.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "EverCrypt.TargetConfig.fsti.checked" ], "interface_file": true, "source_file": "EverCrypt.AutoConfig2.fst" }
[ { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "EverCrypt.TargetConfig", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
EverCrypt.AutoConfig2.getter EverCrypt.AutoConfig2.vec128_enabled
Prims.Tot
[ "total" ]
[]
[ "Prims.unit", "Prims.op_BarBar", "Prims.bool", "EverCrypt.TargetConfig.has_vec128_not_avx", "EverCrypt.AutoConfig2.has_avx" ]
[]
false
false
false
true
false
let has_vec128 () =
let avx = has_avx () in let other = has_vec128_not_avx () in avx || other
false
Pulse.Extract.Main.fst
Pulse.Extract.Main.extract
val extract (g: env) (p: st_term) : T.Tac (mlexpr & e_tag)
val extract (g: env) (p: st_term) : T.Tac (mlexpr & e_tag)
let rec extract (g:env) (p:st_term) : T.Tac (mlexpr & e_tag) = let erased_result = mle_unit, e_tag_erasable in debug g (fun _ -> Printf.sprintf "Extracting term@%s:\n%s\n" (T.range_to_string p.range) (st_term_to_string p)); if is_erasable p then erased_result else begin match p.term with | Tm_IntroPure _ | Tm_ElimExists _ | Tm_IntroExists _ | Tm_Rewrite _ -> erased_result | Tm_Abs { b; q; body } -> let g, mlident, mlty, name = extend_env g b in let mlattrs = b.binder_attrs |> T.unseal |> T.map (term_as_mlexpr g) in let body = LN.open_st_term_nv body name in let body, _ = extract g body in let res = mle_fun [mlident, mlty, mlattrs] body in res, e_tag_pure | Tm_Return { term } -> term_as_mlexpr g term, e_tag_pure | Tm_STApp { head; arg } -> ( match maybe_inline g head arg with | None -> let head = term_as_mlexpr g head in let arg = term_as_mlexpr g arg in mle_app head [arg], e_tag_impure | Some t -> debug g (fun _ -> Printf.sprintf "Inlined to: %s\n" (st_term_to_string t)); extract g t ) | Tm_Bind { binder; head; body } -> if is_erasable head then ( let body = LN.subst_st_term body [LN.DT 0 unit_val] in debug g (fun _ -> Printf.sprintf "Erasing head of bind %s\nopened body to %s" (st_term_to_string head) (st_term_to_string body)); extract g body ) else ( let head, _ = extract g head in let g, mlident, mlty, name = extend_env g binder in let body = LN.open_st_term_nv body name in let body, _ = extract g body in let mllb = mk_mllb mlident ([], mlty) head in let mlletbinding = mk_mlletbinding false [mllb] in mle_let mlletbinding body, e_tag_impure ) // tot here means non-stateful, head could also be ghost, we should rename it | Tm_TotBind { binder; head; body } -> let head = term_as_mlexpr g head in let g, mlident, mlty, name = extend_env g binder in let body = LN.open_st_term_nv body name in let body, _ = extract g body in let mllb = mk_mllb mlident ([], mlty) head in let mlletbinding = mk_mlletbinding false [mllb] in mle_let mlletbinding body, e_tag_impure | Tm_If { b; then_; else_ } -> let b = term_as_mlexpr g b in let then_, _ = extract g then_ in let else_, _ = extract g else_ in mle_if b then_ (Some else_), e_tag_impure | Tm_Match { sc; brs } -> let sc = term_as_mlexpr g sc in let extract_branch (pat0, body) = let g, pat, bs = extend_env_pat g pat0 in debug g (fun _ -> Printf.sprintf "Extracting branch with pattern %s\n" (Pulse.Syntax.Printer.pattern_to_string pat0) ); let body = Pulse.Checker.Match.open_st_term_bs body bs in let body, _ = extract g body in pat, body in let brs = T.map extract_branch brs in mle_match sc brs, e_tag_impure | Tm_While { condition; body } -> let condition, _ = extract g condition in let body, _ = extract g body in let condition = mle_fun [("_", mlty_unit, [])] condition in let body = mle_fun [("_", mlty_unit, [])] body in let w = mle_app (mle_name (["Pulse"; "Lib"; "Core"], "while_")) [condition; body] in w, e_tag_impure | Tm_Par { body1; body2 } -> let body1, _ = extract g body1 in let body2, _ = extract g body2 in let body1 = mle_fun [("_", mlty_unit, [])] body1 in let body2 = mle_fun [("_", mlty_unit, [])] body2 in let p = mle_app (mle_name (["Pulse"; "Lib"; "Core"], "par")) [body1; body2] in p, e_tag_impure | Tm_WithLocal { binder; initializer; body } -> let initializer = term_as_mlexpr g initializer in let g, mlident, mlty, name = extend_env g { binder with binder_ty = binder.binder_ty } in let body = LN.open_st_term_nv body name in let body, _ = extract g body in let allocator = mle_app (mle_name (["Pulse"; "Lib"; "Reference"] , "alloc")) [initializer] in let mllb = mk_mut_mllb mlident ([], mlty) allocator in let mlletbinding = mk_mlletbinding false [mllb] in mle_let mlletbinding body, e_tag_impure | Tm_WithLocalArray { binder; initializer; length; body } -> let initializer = term_as_mlexpr g initializer in let length = term_as_mlexpr g length in let g, mlident, mlty, name = extend_env g { binder with binder_ty = binder.binder_ty } in let body = LN.open_st_term_nv body name in let body, _ = extract g body in // // Slice library doesn't have an alloc // // This is parsed by Pulse2Rust // let allocator = mle_app (mle_name (["Pulse"; "Lib"; "Array"; "Core"] , "alloc")) [initializer; length] in let mllb = mk_mut_mllb mlident ([], mlty) allocator in let mlletbinding = mk_mlletbinding false [mllb] in mle_let mlletbinding body, e_tag_impure | Tm_WithInv { body } -> extract g body | Tm_Unreachable -> mle_app (mle_name (["Pulse"; "Lib"; "Core"], "unreachable")) [mle_unit], e_tag_impure | Tm_ProofHintWithBinders { t } -> T.fail "Unexpected constructor: ProofHintWithBinders should have been desugared away" | Tm_Admit _ -> mle_app (mle_name ([], "failwith")) [mle_unit], e_tag_impure // T.raise (Extraction_failure (Printf.sprintf "Cannot extract code with admit: %s\n" (Pulse.Syntax.Printer.st_term_to_string p))) end
{ "file_name": "lib/steel/pulse/Pulse.Extract.Main.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 7, "end_line": 682, "start_col": 0, "start_line": 536 }
(* Copyright 2023 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module Pulse.Extract.Main open Pulse.Syntax.Base open Pulse.Syntax.Pure open Pulse.Extract.CompilerLib open Pulse.Syntax.Printer open FStar.List.Tot module L = FStar.List.Tot module R = FStar.Reflection module RT = FStar.Reflection.Typing module T = FStar.Tactics.V2 module RB = Pulse.Readback module Elab = Pulse.Elaborate.Pure module E = Pulse.Typing.Env module LN = Pulse.Syntax.Naming module RU = Pulse.RuntimeUtils module ECL = Pulse.Extract.CompilerLib exception Extraction_failure of string noeq type env = { uenv_inner: uenv; coreenv: Pulse.Typing.Env.env } let name = ppname & nat let topenv_of_env (g:env) = E.fstar_env g.coreenv let tcenv_of_env (g:env) = Pulse.Typing.elab_env g.coreenv let uenv_of_env (g:env) = set_tcenv g.uenv_inner (tcenv_of_env g) let debug (g:env) (f: unit -> T.Tac string) : T.Tac unit = if RU.debug_at_level (E.fstar_env g.coreenv) "pulse_extraction" then T.print (f()) let term_as_mlexpr (g:env) (t:term) : T.Tac mlexpr = let t = Elab.elab_term t in let uenv = uenv_of_env g in let t = normalize_for_extraction uenv t in let mlt, _, _ = term_as_mlexpr uenv t in mlt let term_as_mlty (g:env) (t:term) : T.Tac mlty = let t = Elab.elab_term t in term_as_mlty (uenv_of_env g) t let extend_env (g:env) (b:binder) : T.Tac (env & mlident & mlty & name) = let mlty = term_as_mlty g b.binder_ty in let x = E.fresh g.coreenv in let coreenv = E.push_binding g.coreenv x b.binder_ppname b.binder_ty in debug g (fun _ -> Printf.sprintf "Extending environment with %s : %s\n" (binder_to_string b) (term_to_string b.binder_ty)); let uenv_inner, mlident = extend_bv g.uenv_inner b.binder_ppname x mlty in { uenv_inner; coreenv }, mlident, mlty, (b.binder_ppname, x) let rec name_as_mlpath (x:T.name) : T.Tac mlpath = match x with | [] -> T.fail "Unexpected empty name" | [x] -> [], x | x :: xs -> let xs, x = name_as_mlpath xs in x :: xs, x module R = FStar.Reflection.V2 let extract_constant (g:env) (c:T.vconst) : T.Tac mlconstant = let e = T.pack_ln (R.Tv_Const c) in let mle, _, _ = CompilerLib.term_as_mlexpr (uenv_of_env g) e in match mlconstant_of_mlexpr mle with | None -> T.raise (Extraction_failure "Failed to extract constant") | Some c -> c let rec extend_env_pat_core (g:env) (p:pattern) : T.Tac (env & list mlpattern & list Pulse.Typing.Env.binding) = match p with | Pat_Dot_Term _ -> g, [], [] | Pat_Var pp sort -> let x = E.fresh g.coreenv in let pp = mk_ppname pp FStar.Range.range_0 in let ty = T.unseal sort in assume (not_tv_unknown ty); let ty = tm_fstar ty (T.range_of_term ty) in debug g (fun _ -> Printf.sprintf "Pushing pat_var %s : %s\n" (T.unseal pp.name) (term_to_string ty)); let coreenv = E.push_binding g.coreenv x pp ty in let uenv_inner, mlident = extend_bv g.uenv_inner pp x mlty_top in { uenv_inner; coreenv }, [ mlp_var mlident ], [ (x, tm_unknown) ] | Pat_Cons f pats -> let g, pats, bindings = T.fold_left (fun (g, pats, bindings) (p, _) -> let g, pats', bindings' = extend_env_pat_core g p in g, pats @ pats', bindings@bindings') (g, [], []) pats in g, [mlp_constructor (name_as_mlpath f.fv_name) pats], bindings | Pat_Constant c -> let c = extract_constant g c in g, [mlp_const c], [] let extend_env_pat g p = let g, pats, bs = extend_env_pat_core g p in match pats with | [p] -> g, p, bs | _ -> T.raise (Extraction_failure "Unexpected extraction of pattern") let unit_val : term = tm_fstar Pulse.Reflection.Util.unit_tm Range.range_0 let is_erasable (p:st_term) : T.Tac bool = let tag = T.unseal p.effect_tag in match tag with | Some STT_Ghost -> true | _ -> false let head_and_args (t:term) : option (R.term & list R.argv) = match t.t with | Tm_FStar t0 -> Some (R.collect_app_ln t0) | _ -> None let term_eq_string (s:string) (t:R.term) : bool = match R.inspect_ln t with | R.Tv_Const (R.C_String s') -> s=s' | _ -> false let maybe_unfold_head (g:env) (head:R.term) : T.Tac (option (either st_term R.term)) = debug g (fun _ -> Printf.sprintf "Maybe unfolding head %s\n" (T.term_to_string head)); match R.inspect_ln head with | R.Tv_FVar f -> ( let name = R.inspect_fv f in match R.lookup_typ (topenv_of_env g) name with | None -> None | Some se -> let attrs = R.sigelt_attrs se in let quals = R.sigelt_quals se in if List.Tot.existsb (term_eq_string "inline") attrs || List.Tot.existsb (function | R.Inline_for_extraction -> true | _ -> false) quals then match sigelt_extension_data se with | Some se -> debug g (fun _ -> Printf.sprintf "Unfolded head %s\n" (T.term_to_string head)); debug g (fun _ -> Printf.sprintf "to %s\n" (st_term_to_string se)); Some (Inl se) | None -> ( match T.inspect_sigelt se with | T.Sg_Let { isrec=false; lbs = [ { lb_us=[]; lb_def }] } -> Some (Inr lb_def) | _ -> None ) else None ) | R.Tv_UInst f _ -> //No universe-polymorphic inlining ... yet None | _ -> None let rec st_term_abs_take_n_args (n_args:nat) (t:st_term) : res:(st_term & nat){snd res <= n_args} = if n_args = 0 then t, 0 else ( match t.term with | Tm_Abs { body } -> st_term_abs_take_n_args (n_args - 1) body | _ -> (t, n_args) ) let rec term_abs_take_n_args (n_args:nat) (t:R.term) : res:(R.term & nat){snd res <= n_args} = if n_args = 0 then t, 0 else ( match R.inspect_ln t with | R.Tv_Abs _ body -> term_abs_take_n_args (n_args - 1) body | _ -> (t, n_args) ) let abs_take_n_args (n_args:nat) (t:either st_term R.term) : T.Tac (res:(either st_term R.term & nat){snd res <= n_args}) = match t with | Inl t -> let t, n_args = st_term_abs_take_n_args n_args t in Inl t, n_args | Inr t -> let t, n_args = term_abs_take_n_args n_args t in Inr t, n_args let rec unascribe (t:R.term) : T.Tac R.term = match R.inspect_ln t with | R.Tv_AscribedT e _ _ _ -> unascribe e | R.Tv_AscribedC e _ _ _ -> unascribe e | _ -> t let maybe_inline (g:env) (head:term) (arg:term) :T.Tac (option st_term) = debug g (fun _ -> Printf.sprintf "Considering inlining %s\n" (term_to_string head)); match head_and_args head with | None -> None | Some (head, args) -> debug g (fun _ -> Printf.sprintf "head=%s with %d args\n" (T.term_to_string head) (List.length args)); match maybe_unfold_head g head with | None -> debug g (fun _ -> Printf.sprintf "No unfolding of %s\n" (T.term_to_string head)); None | Some def -> // debug g (fun _ -> Printf.sprintf "Unfolded %s to body %s\n" // (T.term_to_string head) // (st_term_to_string body)); let as_term (a:R.term) = assume (not_tv_unknown a); tm_fstar a Range.range_0 in let all_args : list (term & option qualifier) = L.map #R.argv (fun (t, q) -> let t = as_term t in let qual = if R.Q_Implicit? q then Some Implicit else None in t, qual) args @ [arg, None] in let n_args = L.length all_args in let body, remaining_args = abs_take_n_args n_args def in let args, rest = L.splitAt (n_args - remaining_args) all_args in let _, subst = L.fold_right (fun arg (i, subst) -> i + 1, LN.DT i (fst arg)::subst) args (0, []) in match body with | Inl body -> ( let applied_body = LN.subst_st_term body subst in match rest with | [] -> Some applied_body | _ -> T.fail (Printf.sprintf "Partial or over application of inlined Pulse definition is not yet supported\n\ %s has %d arguments, but %s were left unapplied" (T.term_to_string head) (L.length args) (String.concat ", " (T.map (fun x -> term_to_string (fst x)) rest)) ) ) | Inr body -> assume (not_tv_unknown body); let applied_body = unascribe (LN.subst_host_term body subst) in let mk_st_app (head:R.term) (arg:term) (arg_qual:option qualifier) = assume (not_tv_unknown head); let head = tm_fstar head (T.range_of_term head) in let tm = Tm_STApp { head; arg_qual; arg } in Some { term = tm; range=FStar.Range.range_0; effect_tag=default_effect_hint } in match rest with | [] -> ( match R.inspect_ln applied_body with | R.Tv_App head (arg, aqual) -> assume (not_tv_unknown arg); let arg = tm_fstar arg (T.range_of_term arg) in let arg_qual = if R.Q_Implicit? aqual then Some Implicit else None in mk_st_app head arg arg_qual | _ -> T.fail (Printf.sprintf "Cannot inline F* definitions of stt terms whose body is not an application; got %s" (T.term_to_string applied_body)) ) | rest -> FStar.List.Tot.lemma_splitAt_snd_length (L.length rest - 1) rest; let rest, [last] = L.splitAt (L.length rest - 1) rest in let head = L.fold_left (fun head (tm, qual) -> R.pack_ln ( R.Tv_App head (Pulse.Elaborate.Pure.elab_term tm, (if Some? qual then R.Q_Implicit else R.Q_Explicit)) )) applied_body rest in mk_st_app head (fst last) (snd last) let fresh (g:env) = Pulse.Typing.fresh g.coreenv let push_binding (g:env) (x:var { ~ (x `Set.mem` E.dom g.coreenv )}) (b:binder) = { g with coreenv = E.push_binding g.coreenv x b.binder_ppname b.binder_ty } let with_open (g:env) (b:binder) (e:st_term) (f:env -> st_term -> T.Tac st_term) : T.Tac st_term = let open Pulse.Syntax.Naming in let x = fresh g in let e = open_st_term' e (tm_var { nm_index = x; nm_ppname = b.binder_ppname }) 0 in let e = f (push_binding g x b) e in close_st_term' e x 0 let is_internal_binder (b:binder) : T.Tac bool = let s = T.unseal b.binder_ppname.name in s = "_fret" || s = "_bind_c" || s = "_while_c" || s = "_tbind_c" || s = "_if_br" || s = "_br" let is_return (e:st_term) : option term = match e.term with | Tm_Return { term } -> Some term | _ -> None let is_return_bv0 (e:st_term) : bool = match is_return e with | Some term -> is_bvar term = Some 0 | _ -> false // // let x = (let y = e1 in e2) in e3 ~~> let y = e1 in let x = e2 in e3 // // The y let binding can be a TotBind, Bind, let mut, let mut array // let simplify_nested_let (e:st_term) (b_x:binder) (head:st_term) (e3:st_term) : option st_term = let mk t : st_term = { range = e.range; effect_tag = default_effect_hint; term = t } in let body e2 = mk (Tm_Bind { binder = b_x; head = e2; body = e3 }) in match head.term with | Tm_TotBind { binder = b_y; head = e1; body = e2 } -> Some (mk (Tm_TotBind { binder = b_y; head = e1; body = body e2 })) | Tm_Bind { binder = b_y; head = e1; body = e2 } -> Some (mk (Tm_Bind { binder = b_y; head = e1; body = body e2 })) | Tm_WithLocal { binder = b_y; initializer = e1; body = e2 } -> Some (mk (Tm_WithLocal { binder = b_y; initializer = e1; body = body e2 })) | Tm_WithLocalArray { binder = b_y; initializer = e1; length; body = e2 } -> Some (mk (Tm_WithLocalArray { binder = b_y; initializer = e1; length; body = body e2 })) | _ -> None // // 1. let x = e in x ~~> e // 2. let x = return e1 in e2 ~~> e2[e1/x] // 3. The nested let rule above // // These apply only when x is an internal binder // let rec simplify_st_term (g:env) (e:st_term) : T.Tac st_term = let ret t = { e with term = t } in let with_open b e = with_open g b e simplify_st_term in match e.term with | Tm_Return _ | Tm_IntroPure _ | Tm_ElimExists _ | Tm_IntroExists _ | Tm_STApp _ | Tm_Rewrite _ | Tm_Admit _ | Tm_ProofHintWithBinders _ -> e | Tm_Abs { b; q; ascription; body } -> ret (Tm_Abs { b; q; ascription; body = with_open b body }) | Tm_Bind { binder; head; body } -> let is_internal_binder = is_internal_binder binder in if is_internal_binder && is_return_bv0 body then simplify_st_term g head else if is_internal_binder && Some? (is_return head) then let Some head = is_return head in simplify_st_term g (LN.subst_st_term body [LN.DT 0 head]) else begin match simplify_nested_let e binder head body with | Some e -> simplify_st_term g e | None -> let head = simplify_st_term g head in let body = with_open binder body in ret (Tm_Bind { binder; head; body }) end | Tm_TotBind { binder; head; body } -> ret (Tm_TotBind { binder; head; body = with_open binder body }) | Tm_If { b; then_; else_; post } -> ret (Tm_If { b; then_ = simplify_st_term g then_; else_ = simplify_st_term g else_; post }) | Tm_Match { sc; returns_; brs } -> ret (Tm_Match { sc; returns_; brs = T.map (simplify_branch g) brs }) | Tm_While { invariant; condition; condition_var; body } -> let condition = simplify_st_term g condition in let body = simplify_st_term g body in { e with term = Tm_While { invariant; condition; condition_var; body } } | Tm_Par { pre1; body1; post1; pre2; body2; post2 } -> let body1 = simplify_st_term g body1 in let body2 = simplify_st_term g body2 in { e with term = Tm_Par { pre1; body1; post1; pre2; body2; post2 } } | Tm_WithLocal { binder; initializer; body } -> ret (Tm_WithLocal { binder; initializer; body = with_open binder body }) | Tm_WithLocalArray { binder; initializer; length; body } -> ret (Tm_WithLocalArray { binder; initializer; length; body = with_open binder body }) | Tm_WithInv {body} -> simplify_st_term g body | Tm_Unreachable -> e and simplify_branch (g:env) (b:branch) : T.Tac branch = let pat, body = b in let g, _, bs = extend_env_pat g pat in let body = Pulse.Checker.Match.open_st_term_bs body bs in let body = simplify_st_term g body in pat, Pulse.Syntax.Naming.close_st_term_n body (L.map fst bs) let erase_type_for_extraction (g:env) (t:term) : T.Tac bool = match t.t with | Tm_FStar t -> RU.must_erase_for_extraction (tcenv_of_env g) t | _ -> false let rec erase_ghost_subterms (g:env) (p:st_term) : T.Tac st_term = let open Pulse.Syntax.Naming in let fresh (g:env) = Pulse.Typing.fresh g.coreenv in let push_binding g x b = { g with coreenv = E.push_binding g.coreenv x b.binder_ppname b.binder_ty } in let open_erase_close (g:env) (b:binder) (e:st_term) : T.Tac st_term = let x = fresh g in let e = open_st_term' e (tm_var { nm_index = x; nm_ppname = b.binder_ppname }) 0 in let e = erase_ghost_subterms (push_binding g x b) e in close_st_term' e x 0 in let unit_tm = { p with term = Tm_Return { expected_type=tm_unknown; insert_eq = false; term = unit_val } } in let ret (t:st_term') = { p with term = t } in if is_erasable p then unit_tm else begin match p.term with | Tm_IntroPure _ | Tm_ElimExists _ | Tm_IntroExists _ | Tm_Rewrite _ -> unit_tm | Tm_Abs { b; q; body; ascription } -> let body = open_erase_close g b body in ret (Tm_Abs { b; q; body; ascription }) | Tm_Return _ -> p | Tm_STApp _ -> p | Tm_Bind { binder; head; body } -> if is_erasable head then let body = LN.subst_st_term body [LN.DT 0 unit_val] in erase_ghost_subterms g body else let head = erase_ghost_subterms g head in let body = open_erase_close g binder body in ret (Tm_Bind { binder; head; body }) | Tm_TotBind { binder; head; body } -> if erase_type_for_extraction g binder.binder_ty then let body = LN.subst_st_term body [LN.DT 0 unit_val] in erase_ghost_subterms g body else let body = open_erase_close g binder body in ret (Tm_TotBind { binder; head; body }) | Tm_If { b; then_; else_; post } -> let then_ = erase_ghost_subterms g then_ in let else_ = erase_ghost_subterms g else_ in ret (Tm_If { b; then_; else_; post }) | Tm_Match { sc; brs; returns_ } -> let brs = T.map (erase_ghost_subterms_branch g) brs in ret (Tm_Match { sc; brs; returns_ }) | Tm_While { invariant; condition; condition_var; body } -> let condition = erase_ghost_subterms g condition in let body = erase_ghost_subterms g body in ret (Tm_While { invariant; condition; condition_var; body }) | Tm_Par { pre1; body1; post1; pre2; body2; post2 } -> let body1 = erase_ghost_subterms g body1 in let body2 = erase_ghost_subterms g body2 in ret (Tm_Par { pre1; body1; post1; pre2; body2; post2 }) | Tm_WithLocal { binder; initializer; body } -> let body = open_erase_close g binder body in ret (Tm_WithLocal { binder; initializer; body }) | Tm_WithLocalArray { binder; initializer; length; body } -> let body = open_erase_close g binder body in ret (Tm_WithLocalArray { binder; initializer; length; body }) | Tm_Unreachable -> p | Tm_Admit _ -> p | _ -> T.fail "Unexpected st term when erasing ghost subterms" end and erase_ghost_subterms_branch (g:env) (b:branch) : T.Tac branch = let pat, body = b in let g, _, bs = extend_env_pat g pat in let body = Pulse.Checker.Match.open_st_term_bs body bs in let body = erase_ghost_subterms g body in pat, Pulse.Syntax.Naming.close_st_term_n body (L.map fst bs)
{ "checked_file": "/", "dependencies": [ "Pulse.Typing.Env.fsti.checked", "Pulse.Typing.fst.checked", "Pulse.Syntax.Pure.fst.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.Syntax.Naming.fsti.checked", "Pulse.Syntax.Base.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Readback.fsti.checked", "Pulse.Extract.CompilerLib.fsti.checked", "Pulse.Elaborate.Pure.fst.checked", "Pulse.Checker.Match.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.String.fsti.checked", "FStar.Set.fsti.checked", "FStar.Sealed.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Reflection.fst.checked", "FStar.Range.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.List.fst.checked" ], "interface_file": false, "source_file": "Pulse.Extract.Main.fst" }
[ { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "Pulse.Extract.CompilerLib", "short_module": "ECL" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Syntax.Naming", "short_module": "LN" }, { "abbrev": true, "full_module": "Pulse.Typing.Env", "short_module": "E" }, { "abbrev": true, "full_module": "Pulse.Elaborate.Pure", "short_module": "Elab" }, { "abbrev": true, "full_module": "Pulse.Readback", "short_module": "RB" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": true, "full_module": "FStar.Reflection", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax.Printer", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Extract.CompilerLib", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax.Pure", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax.Base", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Extract", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Extract", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
g: Pulse.Extract.Main.env -> p: Pulse.Syntax.Base.st_term -> FStar.Tactics.Effect.Tac (Pulse.Extract.CompilerLib.mlexpr * Pulse.Extract.CompilerLib.e_tag)
FStar.Tactics.Effect.Tac
[]
[]
[ "Pulse.Extract.Main.env", "Pulse.Syntax.Base.st_term", "FStar.Pervasives.Native.tuple2", "Pulse.Extract.CompilerLib.mlexpr", "Pulse.Extract.CompilerLib.e_tag", "Prims.bool", "Pulse.Syntax.Base.__proj__Mkst_term__item__term", "Pulse.Syntax.Base.st_term'__Tm_IntroPure__payload", "Pulse.Syntax.Base.st_term'__Tm_ElimExists__payload", "Pulse.Syntax.Base.st_term'__Tm_IntroExists__payload", "Pulse.Syntax.Base.st_term'__Tm_Rewrite__payload", "Pulse.Syntax.Base.binder", "FStar.Pervasives.Native.option", "Pulse.Syntax.Base.qualifier", "Pulse.Syntax.Base.comp_ascription", "Pulse.Extract.CompilerLib.mlident", "Pulse.Extract.CompilerLib.mlty", "Pulse.Extract.Main.name", "FStar.Pervasives.Native.Mktuple2", "Pulse.Extract.CompilerLib.e_tag_pure", "Pulse.Extract.CompilerLib.mle_fun", "Prims.Cons", "FStar.Pervasives.Native.tuple3", "Prims.list", "FStar.Pervasives.Native.Mktuple3", "Prims.Nil", "Pulse.Extract.Main.extract", "Pulse.Syntax.Naming.open_st_term_nv", "FStar.Tactics.Util.map", "Pulse.Syntax.Base.term", "Pulse.Extract.Main.term_as_mlexpr", "FStar.Tactics.Unseal.unseal", "Pulse.Syntax.Base.__proj__Mkbinder__item__binder_attrs", "FStar.Pervasives.Native.tuple4", "Pulse.Extract.Main.extend_env", "Pulse.Extract.CompilerLib.mle_app", "Pulse.Extract.CompilerLib.e_tag_impure", "Prims.unit", "Pulse.Extract.Main.debug", "FStar.Printf.sprintf", "Prims.string", "Pulse.Syntax.Printer.st_term_to_string", "Pulse.Extract.Main.maybe_inline", "Pulse.Syntax.Naming.subst_st_term", "Pulse.Syntax.Naming.subst_elt", "Pulse.Syntax.Naming.DT", "Pulse.Extract.Main.unit_val", "Pulse.Extract.CompilerLib.mle_let", "Pulse.Extract.CompilerLib.mlletbinding", "Pulse.Extract.CompilerLib.mk_mlletbinding", "Pulse.Extract.CompilerLib.mllb", "Pulse.Extract.CompilerLib.mk_mllb", "Pulse.Extract.Main.is_erasable", "Pulse.Syntax.Base.vprop", "Pulse.Extract.CompilerLib.mle_if", "FStar.Pervasives.Native.Some", "Pulse.Syntax.Base.pattern", "Pulse.Extract.CompilerLib.mle_match", "Pulse.Extract.CompilerLib.mlpattern", "Pulse.Typing.Env.binding", "Pulse.Checker.Match.open_st_term_bs", "Pulse.Syntax.Printer.pattern_to_string", "Pulse.Extract.Main.extend_env_pat", "Pulse.Syntax.Base.ppname", "Pulse.Extract.CompilerLib.mle_name", "Pulse.Extract.CompilerLib.mlsymbol", "Pulse.Extract.CompilerLib.mlty_unit", "Pulse.Extract.CompilerLib.mk_mut_mllb", "Pulse.Syntax.Base.Mkbinder", "Pulse.Syntax.Base.__proj__Mkbinder__item__binder_ty", "Pulse.Syntax.Base.__proj__Mkbinder__item__binder_ppname", "Pulse.Extract.CompilerLib.mle_unit", "Pulse.Syntax.Base.proof_hint_type", "FStar.Tactics.V2.Derived.fail", "Pulse.Syntax.Base.st_term'__Tm_Admit__payload", "FStar.Stubs.Tactics.V2.Builtins.range_to_string", "Pulse.Syntax.Base.__proj__Mkst_term__item__range", "Pulse.Extract.CompilerLib.e_tag_erasable" ]
[ "recursion" ]
false
true
false
false
false
let rec extract (g: env) (p: st_term) : T.Tac (mlexpr & e_tag) =
let erased_result = mle_unit, e_tag_erasable in debug g (fun _ -> Printf.sprintf "Extracting term@%s:\n%s\n" (T.range_to_string p.range) (st_term_to_string p)); if is_erasable p then erased_result else match p.term with | Tm_IntroPure _ | Tm_ElimExists _ | Tm_IntroExists _ | Tm_Rewrite _ -> erased_result | Tm_Abs { b = b ; q = q ; body = body } -> let g, mlident, mlty, name = extend_env g b in let mlattrs = b.binder_attrs |> T.unseal |> T.map (term_as_mlexpr g) in let body = LN.open_st_term_nv body name in let body, _ = extract g body in let res = mle_fun [mlident, mlty, mlattrs] body in res, e_tag_pure | Tm_Return { term = term } -> term_as_mlexpr g term, e_tag_pure | Tm_STApp { head = head ; arg = arg } -> (match maybe_inline g head arg with | None -> let head = term_as_mlexpr g head in let arg = term_as_mlexpr g arg in mle_app head [arg], e_tag_impure | Some t -> debug g (fun _ -> Printf.sprintf "Inlined to: %s\n" (st_term_to_string t)); extract g t) | Tm_Bind { binder = binder ; head = head ; body = body } -> if is_erasable head then (let body = LN.subst_st_term body [LN.DT 0 unit_val] in debug g (fun _ -> Printf.sprintf "Erasing head of bind %s\nopened body to %s" (st_term_to_string head) (st_term_to_string body)); extract g body) else (let head, _ = extract g head in let g, mlident, mlty, name = extend_env g binder in let body = LN.open_st_term_nv body name in let body, _ = extract g body in let mllb = mk_mllb mlident ([], mlty) head in let mlletbinding = mk_mlletbinding false [mllb] in mle_let mlletbinding body, e_tag_impure) | Tm_TotBind { binder = binder ; head = head ; body = body } -> let head = term_as_mlexpr g head in let g, mlident, mlty, name = extend_env g binder in let body = LN.open_st_term_nv body name in let body, _ = extract g body in let mllb = mk_mllb mlident ([], mlty) head in let mlletbinding = mk_mlletbinding false [mllb] in mle_let mlletbinding body, e_tag_impure | Tm_If { b = b ; then_ = then_ ; else_ = else_ } -> let b = term_as_mlexpr g b in let then_, _ = extract g then_ in let else_, _ = extract g else_ in mle_if b then_ (Some else_), e_tag_impure | Tm_Match { sc = sc ; brs = brs } -> let sc = term_as_mlexpr g sc in let extract_branch (pat0, body) = let g, pat, bs = extend_env_pat g pat0 in debug g (fun _ -> Printf.sprintf "Extracting branch with pattern %s\n" (Pulse.Syntax.Printer.pattern_to_string pat0)); let body = Pulse.Checker.Match.open_st_term_bs body bs in let body, _ = extract g body in pat, body in let brs = T.map extract_branch brs in mle_match sc brs, e_tag_impure | Tm_While { condition = condition ; body = body } -> let condition, _ = extract g condition in let body, _ = extract g body in let condition = mle_fun [("_", mlty_unit, [])] condition in let body = mle_fun [("_", mlty_unit, [])] body in let w = mle_app (mle_name (["Pulse"; "Lib"; "Core"], "while_")) [condition; body] in w, e_tag_impure | Tm_Par { body1 = body1 ; body2 = body2 } -> let body1, _ = extract g body1 in let body2, _ = extract g body2 in let body1 = mle_fun [("_", mlty_unit, [])] body1 in let body2 = mle_fun [("_", mlty_unit, [])] body2 in let p = mle_app (mle_name (["Pulse"; "Lib"; "Core"], "par")) [body1; body2] in p, e_tag_impure | Tm_WithLocal { binder = binder ; initializer = initializer ; body = body } -> let initializer = term_as_mlexpr g initializer in let g, mlident, mlty, name = extend_env g ({ binder with binder_ty = binder.binder_ty }) in let body = LN.open_st_term_nv body name in let body, _ = extract g body in let allocator = mle_app (mle_name (["Pulse"; "Lib"; "Reference"], "alloc")) [initializer] in let mllb = mk_mut_mllb mlident ([], mlty) allocator in let mlletbinding = mk_mlletbinding false [mllb] in mle_let mlletbinding body, e_tag_impure | Tm_WithLocalArray { binder = binder ; initializer = initializer ; length = length ; body = body } -> let initializer = term_as_mlexpr g initializer in let length = term_as_mlexpr g length in let g, mlident, mlty, name = extend_env g ({ binder with binder_ty = binder.binder_ty }) in let body = LN.open_st_term_nv body name in let body, _ = extract g body in let allocator = mle_app (mle_name (["Pulse"; "Lib"; "Array"; "Core"], "alloc")) [initializer; length] in let mllb = mk_mut_mllb mlident ([], mlty) allocator in let mlletbinding = mk_mlletbinding false [mllb] in mle_let mlletbinding body, e_tag_impure | Tm_WithInv { body = body } -> extract g body | Tm_Unreachable -> mle_app (mle_name (["Pulse"; "Lib"; "Core"], "unreachable")) [mle_unit], e_tag_impure | Tm_ProofHintWithBinders { t = t } -> T.fail "Unexpected constructor: ProofHintWithBinders should have been desugared away" | Tm_Admit _ -> mle_app (mle_name ([], "failwith")) [mle_unit], e_tag_impure
false
EverCrypt.AutoConfig2.fst
EverCrypt.AutoConfig2.disable_sse
val disable_sse: disabler
val disable_sse: disabler
let disable_sse () = B.recall cpu_has_sse; B.upd cpu_has_sse 0ul false
{ "file_name": "providers/evercrypt/fst/EverCrypt.AutoConfig2.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 70, "end_line": 246, "start_col": 0, "start_line": 246 }
module EverCrypt.AutoConfig2 module ST = FStar.HyperStack.ST module HS = FStar.HyperStack module B = LowStar.Buffer module S = FStar.Seq open FStar.HyperStack.ST #set-options "--max_fuel 0 --max_ifuel 0" (** Only partially specified; the flag may be false because it has been intentionally disabled by the client, for instance. *) type flag (b: bool) = b':bool { b' ==> b } (** Flags, cached in a mutable global reference *) let eternal_pointer a = buf:B.buffer a { B.recallable buf /\ B.length buf = 1 } unfold let cached_flag (b: bool) = eternal_pointer (flag b) let cpu_has_shaext: cached_flag Vale.X64.CPU_Features_s.sha_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_aesni: cached_flag Vale.X64.CPU_Features_s.aesni_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_pclmulqdq: cached_flag Vale.X64.CPU_Features_s.pclmulqdq_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_avx2: cached_flag Vale.X64.CPU_Features_s.avx2_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_avx: cached_flag Vale.X64.CPU_Features_s.avx_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_bmi2: cached_flag Vale.X64.CPU_Features_s.bmi2_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_adx: cached_flag Vale.X64.CPU_Features_s.adx_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_sse: cached_flag Vale.X64.CPU_Features_s.sse_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_movbe: cached_flag Vale.X64.CPU_Features_s.movbe_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_rdrand: cached_flag Vale.X64.CPU_Features_s.rdrand_enabled = B.gcmalloc_of_list HS.root [ false ] let cpu_has_avx512: cached_flag Vale.X64.CPU_Features_s.avx512_enabled = B.gcmalloc_of_list HS.root [ false ] inline_for_extraction let mk_getter #b (f: cached_flag b): getter b = fun () -> B.recall f; B.index f 0ul let has_shaext = mk_getter cpu_has_shaext let has_aesni = mk_getter cpu_has_aesni let has_pclmulqdq = mk_getter cpu_has_pclmulqdq let has_avx2 = mk_getter cpu_has_avx2 let has_avx = mk_getter cpu_has_avx let has_bmi2 = mk_getter cpu_has_bmi2 let has_adx = mk_getter cpu_has_adx let has_sse = mk_getter cpu_has_sse let has_movbe = mk_getter cpu_has_movbe let has_rdrand = mk_getter cpu_has_rdrand let has_avx512 = mk_getter cpu_has_avx512 let fp () = B.loc_buffer cpu_has_shaext `B.loc_union` B.loc_buffer cpu_has_aesni `B.loc_union` B.loc_buffer cpu_has_pclmulqdq `B.loc_union` B.loc_buffer cpu_has_avx2 `B.loc_union` B.loc_buffer cpu_has_avx `B.loc_union` B.loc_buffer cpu_has_bmi2 `B.loc_union` B.loc_buffer cpu_has_adx `B.loc_union` B.loc_buffer cpu_has_sse `B.loc_union` B.loc_buffer cpu_has_movbe `B.loc_union` B.loc_buffer cpu_has_rdrand `B.loc_union` B.loc_buffer cpu_has_avx512 let recall () = B.recall cpu_has_shaext; B.recall cpu_has_aesni; B.recall cpu_has_pclmulqdq; B.recall cpu_has_avx2; B.recall cpu_has_avx; B.recall cpu_has_bmi2; B.recall cpu_has_adx; B.recall cpu_has_sse; B.recall cpu_has_movbe; B.recall cpu_has_rdrand; B.recall cpu_has_avx512 inline_for_extraction noextract val init_aesni_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_aesni_flags () = if Vale.Wrapper.X64.Cpuid.check_aesni () <> 0UL then begin B.recall cpu_has_aesni; B.upd cpu_has_aesni 0ul true; B.recall cpu_has_pclmulqdq; B.upd cpu_has_pclmulqdq 0ul true end inline_for_extraction noextract val init_shaext_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_shaext_flags () = if Vale.Wrapper.X64.Cpuid.check_sha () <> 0UL then begin B.recall cpu_has_shaext; B.upd cpu_has_shaext 0ul true end inline_for_extraction noextract val init_avx_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_avx_flags () = if Vale.Wrapper.X64.Cpuid.check_avx () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_osxsave () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx_xcr0 () <> 0UL then begin B.recall cpu_has_avx; B.upd cpu_has_avx 0ul true end inline_for_extraction noextract val init_avx2_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_avx2_flags () = if Vale.Wrapper.X64.Cpuid.check_avx2 () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_osxsave () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx_xcr0 () <> 0UL then begin B.recall cpu_has_avx2; B.upd cpu_has_avx2 0ul true end inline_for_extraction noextract val init_adx_bmi2_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_adx_bmi2_flags () = if Vale.Wrapper.X64.Cpuid.check_adx_bmi2 () <> 0UL then begin B.recall cpu_has_bmi2; B.upd cpu_has_bmi2 0ul true; B.recall cpu_has_adx; B.upd cpu_has_adx 0ul true end inline_for_extraction noextract val init_sse_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_sse_flags () = if Vale.Wrapper.X64.Cpuid.check_sse () <> 0UL then begin B.recall cpu_has_sse; B.upd cpu_has_sse 0ul true end inline_for_extraction noextract val init_movbe_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_movbe_flags () = if Vale.Wrapper.X64.Cpuid.check_movbe () <> 0UL then begin B.recall cpu_has_movbe; B.upd cpu_has_movbe 0ul true end inline_for_extraction noextract val init_rdrand_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_rdrand_flags() = if Vale.Wrapper.X64.Cpuid.check_rdrand () <> 0UL then begin B.recall cpu_has_rdrand; B.upd cpu_has_rdrand 0ul true end inline_for_extraction noextract val init_avx512_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_avx512_flags () = if Vale.Wrapper.X64.Cpuid.check_avx512 () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_osxsave () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx_xcr0 () <> 0UL then if Vale.Wrapper.X64.Cpuid.check_avx512_xcr0 () <> 0UL then begin B.recall cpu_has_avx512; B.upd cpu_has_avx512 0ul true end inline_for_extraction noextract val init_cpu_flags: unit -> Stack unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> B.modifies (fp ()) h0 h1)) let init_cpu_flags () = if EverCrypt.TargetConfig.hacl_can_compile_vale then begin init_aesni_flags (); init_shaext_flags (); init_adx_bmi2_flags(); init_avx_flags (); init_avx2_flags (); init_sse_flags (); init_movbe_flags (); init_rdrand_flags (); init_avx512_flags () end #set-options "--z3rlimit 50" let init () = init_cpu_flags() inline_for_extraction noextract let mk_disabler (f: eternal_pointer bool { B.loc_includes (fp ()) (B.loc_buffer f) }): disabler = fun () -> B.recall f; B.upd f 0ul false /// FIXME use mk_disabler let disable_avx2 () = B.recall cpu_has_avx2; B.upd cpu_has_avx2 0ul false let disable_avx () = B.recall cpu_has_avx; B.upd cpu_has_avx 0ul false let disable_bmi2 () = B.recall cpu_has_bmi2; B.upd cpu_has_bmi2 0ul false let disable_adx () = B.recall cpu_has_adx; B.upd cpu_has_adx 0ul false let disable_shaext () = B.recall cpu_has_shaext; B.upd cpu_has_shaext 0ul false let disable_aesni () = B.recall cpu_has_aesni; B.upd cpu_has_aesni 0ul false
{ "checked_file": "/", "dependencies": [ "Vale.X64.CPU_Features_s.fst.checked", "Vale.Wrapper.X64.Cpuid.fsti.checked", "prims.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "EverCrypt.TargetConfig.fsti.checked" ], "interface_file": true, "source_file": "EverCrypt.AutoConfig2.fst" }
[ { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "EverCrypt.TargetConfig", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": false, "full_module": "EverCrypt", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
EverCrypt.AutoConfig2.disabler
Prims.Tot
[ "total" ]
[]
[ "Prims.unit", "LowStar.Monotonic.Buffer.upd", "EverCrypt.AutoConfig2.flag", "Vale.X64.CPU_Features_s.sse_enabled", "LowStar.Buffer.trivial_preorder", "EverCrypt.AutoConfig2.cpu_has_sse", "FStar.UInt32.__uint_to_t", "LowStar.Monotonic.Buffer.recall" ]
[]
false
false
false
true
false
let disable_sse () =
B.recall cpu_has_sse; B.upd cpu_has_sse 0ul false
false
Spec.MD5.fst
Spec.MD5.f
val f (x y z: uint32) : Tot uint32
val f (x y z: uint32) : Tot uint32
let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z)
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 27, "end_line": 24, "start_col": 0, "start_line": 23 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *)
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: Lib.IntTypes.uint32 -> y: Lib.IntTypes.uint32 -> z: Lib.IntTypes.uint32 -> Lib.IntTypes.uint32
Prims.Tot
[ "total" ]
[]
[ "Lib.IntTypes.uint32", "Lib.IntTypes.op_Bar_Dot", "Lib.IntTypes.U32", "Lib.IntTypes.SEC", "Lib.IntTypes.op_Amp_Dot", "Lib.IntTypes.op_Tilde_Dot" ]
[]
false
false
false
true
false
let f (x y z: uint32) : Tot uint32 =
(x &. y) |. ((~.x) &. z)
false
Spec.MD5.fst
Spec.MD5.i
val i (x y z: uint32) : Tot uint32
val i (x y z: uint32) : Tot uint32
let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z)
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 18, "end_line": 36, "start_col": 0, "start_line": 35 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: Lib.IntTypes.uint32 -> y: Lib.IntTypes.uint32 -> z: Lib.IntTypes.uint32 -> Lib.IntTypes.uint32
Prims.Tot
[ "total" ]
[]
[ "Lib.IntTypes.uint32", "Lib.IntTypes.op_Hat_Dot", "Lib.IntTypes.U32", "Lib.IntTypes.SEC", "Lib.IntTypes.op_Bar_Dot", "Lib.IntTypes.op_Tilde_Dot" ]
[]
false
false
false
true
false
let i (x y z: uint32) : Tot uint32 =
y ^. (x |. ~.z)
false
Spec.MD5.fst
Spec.MD5.h
val h (x y z: uint32) : Tot uint32
val h (x y z: uint32) : Tot uint32
let h (x y z: uint32) : Tot uint32 = x ^. y ^. z
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 13, "end_line": 32, "start_col": 0, "start_line": 31 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z))
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: Lib.IntTypes.uint32 -> y: Lib.IntTypes.uint32 -> z: Lib.IntTypes.uint32 -> Lib.IntTypes.uint32
Prims.Tot
[ "total" ]
[]
[ "Lib.IntTypes.uint32", "Lib.IntTypes.op_Hat_Dot", "Lib.IntTypes.U32", "Lib.IntTypes.SEC" ]
[]
false
false
false
true
false
let h (x y z: uint32) : Tot uint32 =
x ^. y ^. z
false
Spec.MD5.fst
Spec.MD5.g
val g (x y z: uint32) : Tot uint32
val g (x y z: uint32) : Tot uint32
let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z))
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 27, "end_line": 28, "start_col": 0, "start_line": 27 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z)
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: Lib.IntTypes.uint32 -> y: Lib.IntTypes.uint32 -> z: Lib.IntTypes.uint32 -> Lib.IntTypes.uint32
Prims.Tot
[ "total" ]
[]
[ "Lib.IntTypes.uint32", "Lib.IntTypes.op_Bar_Dot", "Lib.IntTypes.U32", "Lib.IntTypes.SEC", "Lib.IntTypes.op_Amp_Dot", "Lib.IntTypes.op_Tilde_Dot" ]
[]
false
false
false
true
false
let g (x y z: uint32) : Tot uint32 =
(x &. z) |. (y &. (~.z))
false
Spec.MD5.fst
Spec.MD5.x_t
val x_t : Type0
let x_t = Seq.lseq uint32 16
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 28, "end_line": 122, "start_col": 0, "start_line": 122 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Type0
Prims.Tot
[ "total" ]
[]
[ "FStar.Seq.Properties.lseq", "Lib.IntTypes.uint32" ]
[]
false
false
false
true
true
let x_t =
Seq.lseq uint32 16
false
Spec.MD5.fst
Spec.MD5.abcd_t
val abcd_t : Type0
let abcd_t = Seq.lseq uint32 4
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 30, "end_line": 119, "start_col": 0, "start_line": 119 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } )
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Type0
Prims.Tot
[ "total" ]
[]
[ "FStar.Seq.Properties.lseq", "Lib.IntTypes.uint32" ]
[]
false
false
false
true
true
let abcd_t =
Seq.lseq uint32 4
false
Spec.MD5.fst
Spec.MD5.abcd_idx
val abcd_idx : Type0
let abcd_idx = (n: nat { n < 4 } )
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 34, "end_line": 117, "start_col": 0, "start_line": 117 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Type0
Prims.Tot
[ "total" ]
[]
[ "Prims.nat", "Prims.b2t", "Prims.op_LessThan" ]
[]
false
false
false
true
true
let abcd_idx =
(n: nat{n < 4})
false
Spec.MD5.fst
Spec.MD5.rotate_idx
val rotate_idx : Type0
let rotate_idx = rotval U32
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 27, "end_line": 127, "start_col": 0, "start_line": 127 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4 let x_idx = (n: nat { n < 16 } ) let x_t = Seq.lseq uint32 16 let t_idx = (n: nat { 1 <= n /\ n <= 64 } )
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Type0
Prims.Tot
[ "total" ]
[]
[ "Lib.IntTypes.rotval", "Lib.IntTypes.U32" ]
[]
false
false
false
true
true
let rotate_idx =
rotval U32
false
Spec.MD5.fst
Spec.MD5.x_idx
val x_idx : Type0
let x_idx = (n: nat { n < 16 } )
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 32, "end_line": 121, "start_col": 0, "start_line": 121 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Type0
Prims.Tot
[ "total" ]
[]
[ "Prims.nat", "Prims.b2t", "Prims.op_LessThan" ]
[]
false
false
false
true
true
let x_idx =
(n: nat{n < 16})
false
Spec.MD5.fst
Spec.MD5.t_idx
val t_idx : Type0
let t_idx = (n: nat { 1 <= n /\ n <= 64 } )
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 43, "end_line": 124, "start_col": 0, "start_line": 124 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4 let x_idx = (n: nat { n < 16 } ) let x_t = Seq.lseq uint32 16
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Type0
Prims.Tot
[ "total" ]
[]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual" ]
[]
false
false
false
true
true
let t_idx =
(n: nat{1 <= n /\ n <= 64})
false
Spec.MD5.fst
Spec.MD5.ia
val ia:abcd_idx
val ia:abcd_idx
let ia : abcd_idx = 0
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 21, "end_line": 143, "start_col": 0, "start_line": 143 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4 let x_idx = (n: nat { n < 16 } ) let x_t = Seq.lseq uint32 16 let t_idx = (n: nat { 1 <= n /\ n <= 64 } ) inline_for_extraction let rotate_idx = rotval U32 let round_op_gen_aux (f: (uint32 -> uint32 -> uint32 -> Tot uint32)) (abcd: abcd_t) (x: x_t) (a b c d: abcd_idx) (k: x_idx) (s: rotate_idx) (i: t_idx) : Tot abcd_t = let va = Seq.index abcd a in let vb = Seq.index abcd b in let vc = Seq.index abcd c in let vd = Seq.index abcd d in Seq.upd abcd a (vb +. ((va +. f vb vc vd +. Seq.index x k +. Seq.index t (i - 1)) <<<. s)) [@"opaque_to_smt"] let round_op_gen = round_op_gen_aux (* Round 1 *) let round1_op = round_op_gen f
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Spec.MD5.abcd_idx
Prims.Tot
[ "total" ]
[]
[]
[]
false
false
false
true
false
let ia:abcd_idx =
0
false
Spec.MD5.fst
Spec.MD5.round1_op
val round1_op : abcd: Spec.MD5.abcd_t -> x: Spec.MD5.x_t -> a: Spec.MD5.abcd_idx -> b: Spec.MD5.abcd_idx -> c: Spec.MD5.abcd_idx -> d: Spec.MD5.abcd_idx -> k: Spec.MD5.x_idx -> s: Spec.MD5.rotate_idx -> i: Spec.MD5.t_idx -> Spec.MD5.abcd_t
let round1_op = round_op_gen f
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 30, "end_line": 141, "start_col": 0, "start_line": 141 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4 let x_idx = (n: nat { n < 16 } ) let x_t = Seq.lseq uint32 16 let t_idx = (n: nat { 1 <= n /\ n <= 64 } ) inline_for_extraction let rotate_idx = rotval U32 let round_op_gen_aux (f: (uint32 -> uint32 -> uint32 -> Tot uint32)) (abcd: abcd_t) (x: x_t) (a b c d: abcd_idx) (k: x_idx) (s: rotate_idx) (i: t_idx) : Tot abcd_t = let va = Seq.index abcd a in let vb = Seq.index abcd b in let vc = Seq.index abcd c in let vd = Seq.index abcd d in Seq.upd abcd a (vb +. ((va +. f vb vc vd +. Seq.index x k +. Seq.index t (i - 1)) <<<. s)) [@"opaque_to_smt"] let round_op_gen = round_op_gen_aux (* Round 1 *)
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
abcd: Spec.MD5.abcd_t -> x: Spec.MD5.x_t -> a: Spec.MD5.abcd_idx -> b: Spec.MD5.abcd_idx -> c: Spec.MD5.abcd_idx -> d: Spec.MD5.abcd_idx -> k: Spec.MD5.x_idx -> s: Spec.MD5.rotate_idx -> i: Spec.MD5.t_idx -> Spec.MD5.abcd_t
Prims.Tot
[ "total" ]
[]
[ "Spec.MD5.round_op_gen", "Spec.MD5.f" ]
[]
false
false
false
true
false
let round1_op =
round_op_gen f
false
Hacl.K256.Scalar.fsti
Hacl.K256.Scalar.qeval
val qeval (h: mem) (e: qelem) : GTot S.qelem
val qeval (h: mem) (e: qelem) : GTot S.qelem
let qeval (h:mem) (e:qelem) : GTot S.qelem = qas_nat h e % S.q
{ "file_name": "code/k256/Hacl.K256.Scalar.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 62, "end_line": 32, "start_col": 0, "start_line": 32 }
module Hacl.K256.Scalar open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module BSeq = Lib.ByteSequence module S = Spec.K256 module SG = Hacl.Spec.K256.GLV module BD = Hacl.Bignum.Definitions #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let qnlimb = 4ul inline_for_extraction noextract let qelem = lbuffer uint64 qnlimb noextract let qas_nat (h:mem) (e:qelem) : GTot nat = BD.bn_v #U64 #qnlimb h e
{ "checked_file": "/", "dependencies": [ "Spec.K256.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.K256.GLV.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.K256.Scalar.fsti" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Hacl.Spec.K256.GLV", "short_module": "SG" }, { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "BSeq" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
h: FStar.Monotonic.HyperStack.mem -> e: Hacl.K256.Scalar.qelem -> Prims.GTot Spec.K256.PointOps.qelem
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.Monotonic.HyperStack.mem", "Hacl.K256.Scalar.qelem", "Prims.op_Modulus", "Hacl.K256.Scalar.qas_nat", "Spec.K256.PointOps.q", "Spec.K256.PointOps.qelem" ]
[]
false
false
false
false
false
let qeval (h: mem) (e: qelem) : GTot S.qelem =
qas_nat h e % S.q
false
Spec.MD5.fst
Spec.MD5.round_op_gen
val round_op_gen : f: (_: Lib.IntTypes.uint32 -> _: Lib.IntTypes.uint32 -> _: Lib.IntTypes.uint32 -> Lib.IntTypes.uint32) -> abcd: Spec.MD5.abcd_t -> x: Spec.MD5.x_t -> a: Spec.MD5.abcd_idx -> b: Spec.MD5.abcd_idx -> c: Spec.MD5.abcd_idx -> d: Spec.MD5.abcd_idx -> k: Spec.MD5.x_idx -> s: Spec.MD5.rotate_idx -> i: Spec.MD5.t_idx -> Spec.MD5.abcd_t
let round_op_gen = round_op_gen_aux
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 35, "end_line": 137, "start_col": 0, "start_line": 137 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4 let x_idx = (n: nat { n < 16 } ) let x_t = Seq.lseq uint32 16 let t_idx = (n: nat { 1 <= n /\ n <= 64 } ) inline_for_extraction let rotate_idx = rotval U32 let round_op_gen_aux (f: (uint32 -> uint32 -> uint32 -> Tot uint32)) (abcd: abcd_t) (x: x_t) (a b c d: abcd_idx) (k: x_idx) (s: rotate_idx) (i: t_idx) : Tot abcd_t = let va = Seq.index abcd a in let vb = Seq.index abcd b in let vc = Seq.index abcd c in let vd = Seq.index abcd d in Seq.upd abcd a (vb +. ((va +. f vb vc vd +. Seq.index x k +. Seq.index t (i - 1)) <<<. s))
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
f: (_: Lib.IntTypes.uint32 -> _: Lib.IntTypes.uint32 -> _: Lib.IntTypes.uint32 -> Lib.IntTypes.uint32) -> abcd: Spec.MD5.abcd_t -> x: Spec.MD5.x_t -> a: Spec.MD5.abcd_idx -> b: Spec.MD5.abcd_idx -> c: Spec.MD5.abcd_idx -> d: Spec.MD5.abcd_idx -> k: Spec.MD5.x_idx -> s: Spec.MD5.rotate_idx -> i: Spec.MD5.t_idx -> Spec.MD5.abcd_t
Prims.Tot
[ "total" ]
[]
[ "Spec.MD5.round_op_gen_aux" ]
[]
false
false
false
true
false
let round_op_gen =
round_op_gen_aux
false
Spec.MD5.fst
Spec.MD5.ib
val ib:abcd_idx
val ib:abcd_idx
let ib : abcd_idx = 1
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 21, "end_line": 144, "start_col": 0, "start_line": 144 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4 let x_idx = (n: nat { n < 16 } ) let x_t = Seq.lseq uint32 16 let t_idx = (n: nat { 1 <= n /\ n <= 64 } ) inline_for_extraction let rotate_idx = rotval U32 let round_op_gen_aux (f: (uint32 -> uint32 -> uint32 -> Tot uint32)) (abcd: abcd_t) (x: x_t) (a b c d: abcd_idx) (k: x_idx) (s: rotate_idx) (i: t_idx) : Tot abcd_t = let va = Seq.index abcd a in let vb = Seq.index abcd b in let vc = Seq.index abcd c in let vd = Seq.index abcd d in Seq.upd abcd a (vb +. ((va +. f vb vc vd +. Seq.index x k +. Seq.index t (i - 1)) <<<. s)) [@"opaque_to_smt"] let round_op_gen = round_op_gen_aux (* Round 1 *) let round1_op = round_op_gen f
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Spec.MD5.abcd_idx
Prims.Tot
[ "total" ]
[]
[]
[]
false
false
false
true
false
let ib:abcd_idx =
1
false
Spec.MD5.fst
Spec.MD5.id
val id:abcd_idx
val id:abcd_idx
let id : abcd_idx = 3
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 21, "end_line": 146, "start_col": 0, "start_line": 146 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4 let x_idx = (n: nat { n < 16 } ) let x_t = Seq.lseq uint32 16 let t_idx = (n: nat { 1 <= n /\ n <= 64 } ) inline_for_extraction let rotate_idx = rotval U32 let round_op_gen_aux (f: (uint32 -> uint32 -> uint32 -> Tot uint32)) (abcd: abcd_t) (x: x_t) (a b c d: abcd_idx) (k: x_idx) (s: rotate_idx) (i: t_idx) : Tot abcd_t = let va = Seq.index abcd a in let vb = Seq.index abcd b in let vc = Seq.index abcd c in let vd = Seq.index abcd d in Seq.upd abcd a (vb +. ((va +. f vb vc vd +. Seq.index x k +. Seq.index t (i - 1)) <<<. s)) [@"opaque_to_smt"] let round_op_gen = round_op_gen_aux (* Round 1 *) let round1_op = round_op_gen f let ia : abcd_idx = 0 let ib : abcd_idx = 1
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Spec.MD5.abcd_idx
Prims.Tot
[ "total" ]
[]
[]
[]
false
false
false
true
false
let id:abcd_idx =
3
false
Spec.MD5.fst
Spec.MD5.ic
val ic:abcd_idx
val ic:abcd_idx
let ic : abcd_idx = 2
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 21, "end_line": 145, "start_col": 0, "start_line": 145 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4 let x_idx = (n: nat { n < 16 } ) let x_t = Seq.lseq uint32 16 let t_idx = (n: nat { 1 <= n /\ n <= 64 } ) inline_for_extraction let rotate_idx = rotval U32 let round_op_gen_aux (f: (uint32 -> uint32 -> uint32 -> Tot uint32)) (abcd: abcd_t) (x: x_t) (a b c d: abcd_idx) (k: x_idx) (s: rotate_idx) (i: t_idx) : Tot abcd_t = let va = Seq.index abcd a in let vb = Seq.index abcd b in let vc = Seq.index abcd c in let vd = Seq.index abcd d in Seq.upd abcd a (vb +. ((va +. f vb vc vd +. Seq.index x k +. Seq.index t (i - 1)) <<<. s)) [@"opaque_to_smt"] let round_op_gen = round_op_gen_aux (* Round 1 *) let round1_op = round_op_gen f let ia : abcd_idx = 0
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Spec.MD5.abcd_idx
Prims.Tot
[ "total" ]
[]
[]
[]
false
false
false
true
false
let ic:abcd_idx =
2
false
Hacl.K256.Scalar.fsti
Hacl.K256.Scalar.qas_nat
val qas_nat (h: mem) (e: qelem) : GTot nat
val qas_nat (h: mem) (e: qelem) : GTot nat
let qas_nat (h:mem) (e:qelem) : GTot nat = BD.bn_v #U64 #qnlimb h e
{ "file_name": "code/k256/Hacl.K256.Scalar.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 67, "end_line": 29, "start_col": 0, "start_line": 29 }
module Hacl.K256.Scalar open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module BSeq = Lib.ByteSequence module S = Spec.K256 module SG = Hacl.Spec.K256.GLV module BD = Hacl.Bignum.Definitions #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract let qnlimb = 4ul inline_for_extraction noextract let qelem = lbuffer uint64 qnlimb
{ "checked_file": "/", "dependencies": [ "Spec.K256.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.K256.GLV.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.K256.Scalar.fsti" }
[ { "abbrev": true, "full_module": "Hacl.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Hacl.Spec.K256.GLV", "short_module": "SG" }, { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "BSeq" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
h: FStar.Monotonic.HyperStack.mem -> e: Hacl.K256.Scalar.qelem -> Prims.GTot Prims.nat
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.Monotonic.HyperStack.mem", "Hacl.K256.Scalar.qelem", "Hacl.Bignum.Definitions.bn_v", "Lib.IntTypes.U64", "Hacl.K256.Scalar.qnlimb", "Prims.nat" ]
[]
false
false
false
false
false
let qas_nat (h: mem) (e: qelem) : GTot nat =
BD.bn_v #U64 #qnlimb h e
false
Spec.MD5.fst
Spec.MD5.round1
val round1 : abcd: Spec.MD5.abcd_t -> x: Spec.MD5.x_t -> Spec.MD5.abcd_t
let round1 = round1_aux
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 23, "end_line": 172, "start_col": 0, "start_line": 172 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4 let x_idx = (n: nat { n < 16 } ) let x_t = Seq.lseq uint32 16 let t_idx = (n: nat { 1 <= n /\ n <= 64 } ) inline_for_extraction let rotate_idx = rotval U32 let round_op_gen_aux (f: (uint32 -> uint32 -> uint32 -> Tot uint32)) (abcd: abcd_t) (x: x_t) (a b c d: abcd_idx) (k: x_idx) (s: rotate_idx) (i: t_idx) : Tot abcd_t = let va = Seq.index abcd a in let vb = Seq.index abcd b in let vc = Seq.index abcd c in let vd = Seq.index abcd d in Seq.upd abcd a (vb +. ((va +. f vb vc vd +. Seq.index x k +. Seq.index t (i - 1)) <<<. s)) [@"opaque_to_smt"] let round_op_gen = round_op_gen_aux (* Round 1 *) let round1_op = round_op_gen f let ia : abcd_idx = 0 let ib : abcd_idx = 1 let ic : abcd_idx = 2 let id : abcd_idx = 3 let round1_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round1_op abcd x ia ib ic id 0 7ul 1 in let abcd = round1_op abcd x id ia ib ic 1 12ul 2 in let abcd = round1_op abcd x ic id ia ib 2 17ul 3 in let abcd = round1_op abcd x ib ic id ia 3 22ul 4 in let abcd = round1_op abcd x ia ib ic id 4 7ul 5 in let abcd = round1_op abcd x id ia ib ic 5 12ul 6 in let abcd = round1_op abcd x ic id ia ib 6 17ul 7 in let abcd = round1_op abcd x ib ic id ia 7 22ul 8 in let abcd = round1_op abcd x ia ib ic id 8 7ul 9 in let abcd = round1_op abcd x id ia ib ic 9 12ul 10 in let abcd = round1_op abcd x ic id ia ib 10 17ul 11 in let abcd = round1_op abcd x ib ic id ia 11 22ul 12 in let abcd = round1_op abcd x ia ib ic id 12 7ul 13 in let abcd = round1_op abcd x id ia ib ic 13 12ul 14 in let abcd = round1_op abcd x ic id ia ib 14 17ul 15 in let abcd = round1_op abcd x ib ic id ia 15 22ul 16 in abcd
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
abcd: Spec.MD5.abcd_t -> x: Spec.MD5.x_t -> Spec.MD5.abcd_t
Prims.Tot
[ "total" ]
[]
[ "Spec.MD5.round1_aux" ]
[]
false
false
false
true
false
let round1 =
round1_aux
false
Spec.MD5.fst
Spec.MD5.round2_op
val round2_op : abcd: Spec.MD5.abcd_t -> x: Spec.MD5.x_t -> a: Spec.MD5.abcd_idx -> b: Spec.MD5.abcd_idx -> c: Spec.MD5.abcd_idx -> d: Spec.MD5.abcd_idx -> k: Spec.MD5.x_idx -> s: Spec.MD5.rotate_idx -> i: Spec.MD5.t_idx -> Spec.MD5.abcd_t
let round2_op = round_op_gen g
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 30, "end_line": 174, "start_col": 0, "start_line": 174 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4 let x_idx = (n: nat { n < 16 } ) let x_t = Seq.lseq uint32 16 let t_idx = (n: nat { 1 <= n /\ n <= 64 } ) inline_for_extraction let rotate_idx = rotval U32 let round_op_gen_aux (f: (uint32 -> uint32 -> uint32 -> Tot uint32)) (abcd: abcd_t) (x: x_t) (a b c d: abcd_idx) (k: x_idx) (s: rotate_idx) (i: t_idx) : Tot abcd_t = let va = Seq.index abcd a in let vb = Seq.index abcd b in let vc = Seq.index abcd c in let vd = Seq.index abcd d in Seq.upd abcd a (vb +. ((va +. f vb vc vd +. Seq.index x k +. Seq.index t (i - 1)) <<<. s)) [@"opaque_to_smt"] let round_op_gen = round_op_gen_aux (* Round 1 *) let round1_op = round_op_gen f let ia : abcd_idx = 0 let ib : abcd_idx = 1 let ic : abcd_idx = 2 let id : abcd_idx = 3 let round1_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round1_op abcd x ia ib ic id 0 7ul 1 in let abcd = round1_op abcd x id ia ib ic 1 12ul 2 in let abcd = round1_op abcd x ic id ia ib 2 17ul 3 in let abcd = round1_op abcd x ib ic id ia 3 22ul 4 in let abcd = round1_op abcd x ia ib ic id 4 7ul 5 in let abcd = round1_op abcd x id ia ib ic 5 12ul 6 in let abcd = round1_op abcd x ic id ia ib 6 17ul 7 in let abcd = round1_op abcd x ib ic id ia 7 22ul 8 in let abcd = round1_op abcd x ia ib ic id 8 7ul 9 in let abcd = round1_op abcd x id ia ib ic 9 12ul 10 in let abcd = round1_op abcd x ic id ia ib 10 17ul 11 in let abcd = round1_op abcd x ib ic id ia 11 22ul 12 in let abcd = round1_op abcd x ia ib ic id 12 7ul 13 in let abcd = round1_op abcd x id ia ib ic 13 12ul 14 in let abcd = round1_op abcd x ic id ia ib 14 17ul 15 in let abcd = round1_op abcd x ib ic id ia 15 22ul 16 in abcd [@"opaque_to_smt"] let round1 = round1_aux
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
abcd: Spec.MD5.abcd_t -> x: Spec.MD5.x_t -> a: Spec.MD5.abcd_idx -> b: Spec.MD5.abcd_idx -> c: Spec.MD5.abcd_idx -> d: Spec.MD5.abcd_idx -> k: Spec.MD5.x_idx -> s: Spec.MD5.rotate_idx -> i: Spec.MD5.t_idx -> Spec.MD5.abcd_t
Prims.Tot
[ "total" ]
[]
[ "Spec.MD5.round_op_gen", "Spec.MD5.g" ]
[]
false
false
false
true
false
let round2_op =
round_op_gen g
false
Spec.MD5.fst
Spec.MD5.round2
val round2 : abcd: Spec.MD5.abcd_t -> x: Spec.MD5.x_t -> Spec.MD5.abcd_t
let round2 = round2_aux
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 23, "end_line": 200, "start_col": 0, "start_line": 200 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4 let x_idx = (n: nat { n < 16 } ) let x_t = Seq.lseq uint32 16 let t_idx = (n: nat { 1 <= n /\ n <= 64 } ) inline_for_extraction let rotate_idx = rotval U32 let round_op_gen_aux (f: (uint32 -> uint32 -> uint32 -> Tot uint32)) (abcd: abcd_t) (x: x_t) (a b c d: abcd_idx) (k: x_idx) (s: rotate_idx) (i: t_idx) : Tot abcd_t = let va = Seq.index abcd a in let vb = Seq.index abcd b in let vc = Seq.index abcd c in let vd = Seq.index abcd d in Seq.upd abcd a (vb +. ((va +. f vb vc vd +. Seq.index x k +. Seq.index t (i - 1)) <<<. s)) [@"opaque_to_smt"] let round_op_gen = round_op_gen_aux (* Round 1 *) let round1_op = round_op_gen f let ia : abcd_idx = 0 let ib : abcd_idx = 1 let ic : abcd_idx = 2 let id : abcd_idx = 3 let round1_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round1_op abcd x ia ib ic id 0 7ul 1 in let abcd = round1_op abcd x id ia ib ic 1 12ul 2 in let abcd = round1_op abcd x ic id ia ib 2 17ul 3 in let abcd = round1_op abcd x ib ic id ia 3 22ul 4 in let abcd = round1_op abcd x ia ib ic id 4 7ul 5 in let abcd = round1_op abcd x id ia ib ic 5 12ul 6 in let abcd = round1_op abcd x ic id ia ib 6 17ul 7 in let abcd = round1_op abcd x ib ic id ia 7 22ul 8 in let abcd = round1_op abcd x ia ib ic id 8 7ul 9 in let abcd = round1_op abcd x id ia ib ic 9 12ul 10 in let abcd = round1_op abcd x ic id ia ib 10 17ul 11 in let abcd = round1_op abcd x ib ic id ia 11 22ul 12 in let abcd = round1_op abcd x ia ib ic id 12 7ul 13 in let abcd = round1_op abcd x id ia ib ic 13 12ul 14 in let abcd = round1_op abcd x ic id ia ib 14 17ul 15 in let abcd = round1_op abcd x ib ic id ia 15 22ul 16 in abcd [@"opaque_to_smt"] let round1 = round1_aux let round2_op = round_op_gen g let round2_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round2_op abcd x ia ib ic id 1 5ul 17 in let abcd = round2_op abcd x id ia ib ic 6 9ul 18 in let abcd = round2_op abcd x ic id ia ib 11 14ul 19 in let abcd = round2_op abcd x ib ic id ia 0 20ul 20 in let abcd = round2_op abcd x ia ib ic id 5 5ul 21 in let abcd = round2_op abcd x id ia ib ic 10 9ul 22 in let abcd = round2_op abcd x ic id ia ib 15 14ul 23 in let abcd = round2_op abcd x ib ic id ia 4 20ul 24 in let abcd = round2_op abcd x ia ib ic id 9 5ul 25 in let abcd = round2_op abcd x id ia ib ic 14 9ul 26 in let abcd = round2_op abcd x ic id ia ib 3 14ul 27 in let abcd = round2_op abcd x ib ic id ia 8 20ul 28 in let abcd = round2_op abcd x ia ib ic id 13 5ul 29 in let abcd = round2_op abcd x id ia ib ic 2 9ul 30 in let abcd = round2_op abcd x ic id ia ib 7 14ul 31 in let abcd = round2_op abcd x ib ic id ia 12 20ul 32 in abcd
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
abcd: Spec.MD5.abcd_t -> x: Spec.MD5.x_t -> Spec.MD5.abcd_t
Prims.Tot
[ "total" ]
[]
[ "Spec.MD5.round2_aux" ]
[]
false
false
false
true
false
let round2 =
round2_aux
false
Spec.MD5.fst
Spec.MD5.round3_op
val round3_op : abcd: Spec.MD5.abcd_t -> x: Spec.MD5.x_t -> a: Spec.MD5.abcd_idx -> b: Spec.MD5.abcd_idx -> c: Spec.MD5.abcd_idx -> d: Spec.MD5.abcd_idx -> k: Spec.MD5.x_idx -> s: Spec.MD5.rotate_idx -> i: Spec.MD5.t_idx -> Spec.MD5.abcd_t
let round3_op = round_op_gen h
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 30, "end_line": 202, "start_col": 0, "start_line": 202 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4 let x_idx = (n: nat { n < 16 } ) let x_t = Seq.lseq uint32 16 let t_idx = (n: nat { 1 <= n /\ n <= 64 } ) inline_for_extraction let rotate_idx = rotval U32 let round_op_gen_aux (f: (uint32 -> uint32 -> uint32 -> Tot uint32)) (abcd: abcd_t) (x: x_t) (a b c d: abcd_idx) (k: x_idx) (s: rotate_idx) (i: t_idx) : Tot abcd_t = let va = Seq.index abcd a in let vb = Seq.index abcd b in let vc = Seq.index abcd c in let vd = Seq.index abcd d in Seq.upd abcd a (vb +. ((va +. f vb vc vd +. Seq.index x k +. Seq.index t (i - 1)) <<<. s)) [@"opaque_to_smt"] let round_op_gen = round_op_gen_aux (* Round 1 *) let round1_op = round_op_gen f let ia : abcd_idx = 0 let ib : abcd_idx = 1 let ic : abcd_idx = 2 let id : abcd_idx = 3 let round1_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round1_op abcd x ia ib ic id 0 7ul 1 in let abcd = round1_op abcd x id ia ib ic 1 12ul 2 in let abcd = round1_op abcd x ic id ia ib 2 17ul 3 in let abcd = round1_op abcd x ib ic id ia 3 22ul 4 in let abcd = round1_op abcd x ia ib ic id 4 7ul 5 in let abcd = round1_op abcd x id ia ib ic 5 12ul 6 in let abcd = round1_op abcd x ic id ia ib 6 17ul 7 in let abcd = round1_op abcd x ib ic id ia 7 22ul 8 in let abcd = round1_op abcd x ia ib ic id 8 7ul 9 in let abcd = round1_op abcd x id ia ib ic 9 12ul 10 in let abcd = round1_op abcd x ic id ia ib 10 17ul 11 in let abcd = round1_op abcd x ib ic id ia 11 22ul 12 in let abcd = round1_op abcd x ia ib ic id 12 7ul 13 in let abcd = round1_op abcd x id ia ib ic 13 12ul 14 in let abcd = round1_op abcd x ic id ia ib 14 17ul 15 in let abcd = round1_op abcd x ib ic id ia 15 22ul 16 in abcd [@"opaque_to_smt"] let round1 = round1_aux let round2_op = round_op_gen g let round2_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round2_op abcd x ia ib ic id 1 5ul 17 in let abcd = round2_op abcd x id ia ib ic 6 9ul 18 in let abcd = round2_op abcd x ic id ia ib 11 14ul 19 in let abcd = round2_op abcd x ib ic id ia 0 20ul 20 in let abcd = round2_op abcd x ia ib ic id 5 5ul 21 in let abcd = round2_op abcd x id ia ib ic 10 9ul 22 in let abcd = round2_op abcd x ic id ia ib 15 14ul 23 in let abcd = round2_op abcd x ib ic id ia 4 20ul 24 in let abcd = round2_op abcd x ia ib ic id 9 5ul 25 in let abcd = round2_op abcd x id ia ib ic 14 9ul 26 in let abcd = round2_op abcd x ic id ia ib 3 14ul 27 in let abcd = round2_op abcd x ib ic id ia 8 20ul 28 in let abcd = round2_op abcd x ia ib ic id 13 5ul 29 in let abcd = round2_op abcd x id ia ib ic 2 9ul 30 in let abcd = round2_op abcd x ic id ia ib 7 14ul 31 in let abcd = round2_op abcd x ib ic id ia 12 20ul 32 in abcd [@"opaque_to_smt"] let round2 = round2_aux
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
abcd: Spec.MD5.abcd_t -> x: Spec.MD5.x_t -> a: Spec.MD5.abcd_idx -> b: Spec.MD5.abcd_idx -> c: Spec.MD5.abcd_idx -> d: Spec.MD5.abcd_idx -> k: Spec.MD5.x_idx -> s: Spec.MD5.rotate_idx -> i: Spec.MD5.t_idx -> Spec.MD5.abcd_t
Prims.Tot
[ "total" ]
[]
[ "Spec.MD5.round_op_gen", "Spec.MD5.h" ]
[]
false
false
false
true
false
let round3_op =
round_op_gen h
false
Spec.MD5.fst
Spec.MD5.round3
val round3 : abcd: Spec.MD5.abcd_t -> x: Spec.MD5.x_t -> Spec.MD5.abcd_t
let round3 = round3_aux
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 23, "end_line": 228, "start_col": 0, "start_line": 228 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4 let x_idx = (n: nat { n < 16 } ) let x_t = Seq.lseq uint32 16 let t_idx = (n: nat { 1 <= n /\ n <= 64 } ) inline_for_extraction let rotate_idx = rotval U32 let round_op_gen_aux (f: (uint32 -> uint32 -> uint32 -> Tot uint32)) (abcd: abcd_t) (x: x_t) (a b c d: abcd_idx) (k: x_idx) (s: rotate_idx) (i: t_idx) : Tot abcd_t = let va = Seq.index abcd a in let vb = Seq.index abcd b in let vc = Seq.index abcd c in let vd = Seq.index abcd d in Seq.upd abcd a (vb +. ((va +. f vb vc vd +. Seq.index x k +. Seq.index t (i - 1)) <<<. s)) [@"opaque_to_smt"] let round_op_gen = round_op_gen_aux (* Round 1 *) let round1_op = round_op_gen f let ia : abcd_idx = 0 let ib : abcd_idx = 1 let ic : abcd_idx = 2 let id : abcd_idx = 3 let round1_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round1_op abcd x ia ib ic id 0 7ul 1 in let abcd = round1_op abcd x id ia ib ic 1 12ul 2 in let abcd = round1_op abcd x ic id ia ib 2 17ul 3 in let abcd = round1_op abcd x ib ic id ia 3 22ul 4 in let abcd = round1_op abcd x ia ib ic id 4 7ul 5 in let abcd = round1_op abcd x id ia ib ic 5 12ul 6 in let abcd = round1_op abcd x ic id ia ib 6 17ul 7 in let abcd = round1_op abcd x ib ic id ia 7 22ul 8 in let abcd = round1_op abcd x ia ib ic id 8 7ul 9 in let abcd = round1_op abcd x id ia ib ic 9 12ul 10 in let abcd = round1_op abcd x ic id ia ib 10 17ul 11 in let abcd = round1_op abcd x ib ic id ia 11 22ul 12 in let abcd = round1_op abcd x ia ib ic id 12 7ul 13 in let abcd = round1_op abcd x id ia ib ic 13 12ul 14 in let abcd = round1_op abcd x ic id ia ib 14 17ul 15 in let abcd = round1_op abcd x ib ic id ia 15 22ul 16 in abcd [@"opaque_to_smt"] let round1 = round1_aux let round2_op = round_op_gen g let round2_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round2_op abcd x ia ib ic id 1 5ul 17 in let abcd = round2_op abcd x id ia ib ic 6 9ul 18 in let abcd = round2_op abcd x ic id ia ib 11 14ul 19 in let abcd = round2_op abcd x ib ic id ia 0 20ul 20 in let abcd = round2_op abcd x ia ib ic id 5 5ul 21 in let abcd = round2_op abcd x id ia ib ic 10 9ul 22 in let abcd = round2_op abcd x ic id ia ib 15 14ul 23 in let abcd = round2_op abcd x ib ic id ia 4 20ul 24 in let abcd = round2_op abcd x ia ib ic id 9 5ul 25 in let abcd = round2_op abcd x id ia ib ic 14 9ul 26 in let abcd = round2_op abcd x ic id ia ib 3 14ul 27 in let abcd = round2_op abcd x ib ic id ia 8 20ul 28 in let abcd = round2_op abcd x ia ib ic id 13 5ul 29 in let abcd = round2_op abcd x id ia ib ic 2 9ul 30 in let abcd = round2_op abcd x ic id ia ib 7 14ul 31 in let abcd = round2_op abcd x ib ic id ia 12 20ul 32 in abcd [@"opaque_to_smt"] let round2 = round2_aux let round3_op = round_op_gen h let round3_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round3_op abcd x ia ib ic id 5 4ul 33 in let abcd = round3_op abcd x id ia ib ic 8 11ul 34 in let abcd = round3_op abcd x ic id ia ib 11 16ul 35 in let abcd = round3_op abcd x ib ic id ia 14 23ul 36 in let abcd = round3_op abcd x ia ib ic id 1 4ul 37 in let abcd = round3_op abcd x id ia ib ic 4 11ul 38 in let abcd = round3_op abcd x ic id ia ib 7 16ul 39 in let abcd = round3_op abcd x ib ic id ia 10 23ul 40 in let abcd = round3_op abcd x ia ib ic id 13 4ul 41 in let abcd = round3_op abcd x id ia ib ic 0 11ul 42 in let abcd = round3_op abcd x ic id ia ib 3 16ul 43 in let abcd = round3_op abcd x ib ic id ia 6 23ul 44 in let abcd = round3_op abcd x ia ib ic id 9 4ul 45 in let abcd = round3_op abcd x id ia ib ic 12 11ul 46 in let abcd = round3_op abcd x ic id ia ib 15 16ul 47 in let abcd = round3_op abcd x ib ic id ia 2 23ul 48 in abcd
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
abcd: Spec.MD5.abcd_t -> x: Spec.MD5.x_t -> Spec.MD5.abcd_t
Prims.Tot
[ "total" ]
[]
[ "Spec.MD5.round3_aux" ]
[]
false
false
false
true
false
let round3 =
round3_aux
false
Spec.MD5.fst
Spec.MD5.rounds
val rounds : abcd: Spec.MD5.abcd_t -> x: Spec.MD5.x_t -> Spec.MD5.abcd_t
let rounds = rounds_aux
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 23, "end_line": 266, "start_col": 0, "start_line": 266 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4 let x_idx = (n: nat { n < 16 } ) let x_t = Seq.lseq uint32 16 let t_idx = (n: nat { 1 <= n /\ n <= 64 } ) inline_for_extraction let rotate_idx = rotval U32 let round_op_gen_aux (f: (uint32 -> uint32 -> uint32 -> Tot uint32)) (abcd: abcd_t) (x: x_t) (a b c d: abcd_idx) (k: x_idx) (s: rotate_idx) (i: t_idx) : Tot abcd_t = let va = Seq.index abcd a in let vb = Seq.index abcd b in let vc = Seq.index abcd c in let vd = Seq.index abcd d in Seq.upd abcd a (vb +. ((va +. f vb vc vd +. Seq.index x k +. Seq.index t (i - 1)) <<<. s)) [@"opaque_to_smt"] let round_op_gen = round_op_gen_aux (* Round 1 *) let round1_op = round_op_gen f let ia : abcd_idx = 0 let ib : abcd_idx = 1 let ic : abcd_idx = 2 let id : abcd_idx = 3 let round1_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round1_op abcd x ia ib ic id 0 7ul 1 in let abcd = round1_op abcd x id ia ib ic 1 12ul 2 in let abcd = round1_op abcd x ic id ia ib 2 17ul 3 in let abcd = round1_op abcd x ib ic id ia 3 22ul 4 in let abcd = round1_op abcd x ia ib ic id 4 7ul 5 in let abcd = round1_op abcd x id ia ib ic 5 12ul 6 in let abcd = round1_op abcd x ic id ia ib 6 17ul 7 in let abcd = round1_op abcd x ib ic id ia 7 22ul 8 in let abcd = round1_op abcd x ia ib ic id 8 7ul 9 in let abcd = round1_op abcd x id ia ib ic 9 12ul 10 in let abcd = round1_op abcd x ic id ia ib 10 17ul 11 in let abcd = round1_op abcd x ib ic id ia 11 22ul 12 in let abcd = round1_op abcd x ia ib ic id 12 7ul 13 in let abcd = round1_op abcd x id ia ib ic 13 12ul 14 in let abcd = round1_op abcd x ic id ia ib 14 17ul 15 in let abcd = round1_op abcd x ib ic id ia 15 22ul 16 in abcd [@"opaque_to_smt"] let round1 = round1_aux let round2_op = round_op_gen g let round2_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round2_op abcd x ia ib ic id 1 5ul 17 in let abcd = round2_op abcd x id ia ib ic 6 9ul 18 in let abcd = round2_op abcd x ic id ia ib 11 14ul 19 in let abcd = round2_op abcd x ib ic id ia 0 20ul 20 in let abcd = round2_op abcd x ia ib ic id 5 5ul 21 in let abcd = round2_op abcd x id ia ib ic 10 9ul 22 in let abcd = round2_op abcd x ic id ia ib 15 14ul 23 in let abcd = round2_op abcd x ib ic id ia 4 20ul 24 in let abcd = round2_op abcd x ia ib ic id 9 5ul 25 in let abcd = round2_op abcd x id ia ib ic 14 9ul 26 in let abcd = round2_op abcd x ic id ia ib 3 14ul 27 in let abcd = round2_op abcd x ib ic id ia 8 20ul 28 in let abcd = round2_op abcd x ia ib ic id 13 5ul 29 in let abcd = round2_op abcd x id ia ib ic 2 9ul 30 in let abcd = round2_op abcd x ic id ia ib 7 14ul 31 in let abcd = round2_op abcd x ib ic id ia 12 20ul 32 in abcd [@"opaque_to_smt"] let round2 = round2_aux let round3_op = round_op_gen h let round3_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round3_op abcd x ia ib ic id 5 4ul 33 in let abcd = round3_op abcd x id ia ib ic 8 11ul 34 in let abcd = round3_op abcd x ic id ia ib 11 16ul 35 in let abcd = round3_op abcd x ib ic id ia 14 23ul 36 in let abcd = round3_op abcd x ia ib ic id 1 4ul 37 in let abcd = round3_op abcd x id ia ib ic 4 11ul 38 in let abcd = round3_op abcd x ic id ia ib 7 16ul 39 in let abcd = round3_op abcd x ib ic id ia 10 23ul 40 in let abcd = round3_op abcd x ia ib ic id 13 4ul 41 in let abcd = round3_op abcd x id ia ib ic 0 11ul 42 in let abcd = round3_op abcd x ic id ia ib 3 16ul 43 in let abcd = round3_op abcd x ib ic id ia 6 23ul 44 in let abcd = round3_op abcd x ia ib ic id 9 4ul 45 in let abcd = round3_op abcd x id ia ib ic 12 11ul 46 in let abcd = round3_op abcd x ic id ia ib 15 16ul 47 in let abcd = round3_op abcd x ib ic id ia 2 23ul 48 in abcd [@"opaque_to_smt"] let round3 = round3_aux let round4_op = round_op_gen i let round4_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round4_op abcd x ia ib ic id 0 6ul 49 in let abcd = round4_op abcd x id ia ib ic 7 10ul 50 in let abcd = round4_op abcd x ic id ia ib 14 15ul 51 in let abcd = round4_op abcd x ib ic id ia 5 21ul 52 in let abcd = round4_op abcd x ia ib ic id 12 6ul 53 in let abcd = round4_op abcd x id ia ib ic 3 10ul 54 in let abcd = round4_op abcd x ic id ia ib 10 15ul 55 in let abcd = round4_op abcd x ib ic id ia 1 21ul 56 in let abcd = round4_op abcd x ia ib ic id 8 6ul 57 in let abcd = round4_op abcd x id ia ib ic 15 10ul 58 in let abcd = round4_op abcd x ic id ia ib 6 15ul 59 in let abcd = round4_op abcd x ib ic id ia 13 21ul 60 in let abcd = round4_op abcd x ia ib ic id 4 6ul 61 in let abcd = round4_op abcd x id ia ib ic 11 10ul 62 in let abcd = round4_op abcd x ic id ia ib 2 15ul 63 in let abcd = round4_op abcd x ib ic id ia 9 21ul 64 in abcd [@"opaque_to_smt"] let round4 = round4_aux let rounds_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round1 abcd x in let abcd = round2 abcd x in let abcd = round3 abcd x in let abcd = round4 abcd x in abcd
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
abcd: Spec.MD5.abcd_t -> x: Spec.MD5.x_t -> Spec.MD5.abcd_t
Prims.Tot
[ "total" ]
[]
[ "Spec.MD5.rounds_aux" ]
[]
false
false
false
true
false
let rounds =
rounds_aux
false
Spec.MD5.fst
Spec.MD5.round4
val round4 : abcd: Spec.MD5.abcd_t -> x: Spec.MD5.x_t -> Spec.MD5.abcd_t
let round4 = round4_aux
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 23, "end_line": 256, "start_col": 0, "start_line": 256 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4 let x_idx = (n: nat { n < 16 } ) let x_t = Seq.lseq uint32 16 let t_idx = (n: nat { 1 <= n /\ n <= 64 } ) inline_for_extraction let rotate_idx = rotval U32 let round_op_gen_aux (f: (uint32 -> uint32 -> uint32 -> Tot uint32)) (abcd: abcd_t) (x: x_t) (a b c d: abcd_idx) (k: x_idx) (s: rotate_idx) (i: t_idx) : Tot abcd_t = let va = Seq.index abcd a in let vb = Seq.index abcd b in let vc = Seq.index abcd c in let vd = Seq.index abcd d in Seq.upd abcd a (vb +. ((va +. f vb vc vd +. Seq.index x k +. Seq.index t (i - 1)) <<<. s)) [@"opaque_to_smt"] let round_op_gen = round_op_gen_aux (* Round 1 *) let round1_op = round_op_gen f let ia : abcd_idx = 0 let ib : abcd_idx = 1 let ic : abcd_idx = 2 let id : abcd_idx = 3 let round1_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round1_op abcd x ia ib ic id 0 7ul 1 in let abcd = round1_op abcd x id ia ib ic 1 12ul 2 in let abcd = round1_op abcd x ic id ia ib 2 17ul 3 in let abcd = round1_op abcd x ib ic id ia 3 22ul 4 in let abcd = round1_op abcd x ia ib ic id 4 7ul 5 in let abcd = round1_op abcd x id ia ib ic 5 12ul 6 in let abcd = round1_op abcd x ic id ia ib 6 17ul 7 in let abcd = round1_op abcd x ib ic id ia 7 22ul 8 in let abcd = round1_op abcd x ia ib ic id 8 7ul 9 in let abcd = round1_op abcd x id ia ib ic 9 12ul 10 in let abcd = round1_op abcd x ic id ia ib 10 17ul 11 in let abcd = round1_op abcd x ib ic id ia 11 22ul 12 in let abcd = round1_op abcd x ia ib ic id 12 7ul 13 in let abcd = round1_op abcd x id ia ib ic 13 12ul 14 in let abcd = round1_op abcd x ic id ia ib 14 17ul 15 in let abcd = round1_op abcd x ib ic id ia 15 22ul 16 in abcd [@"opaque_to_smt"] let round1 = round1_aux let round2_op = round_op_gen g let round2_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round2_op abcd x ia ib ic id 1 5ul 17 in let abcd = round2_op abcd x id ia ib ic 6 9ul 18 in let abcd = round2_op abcd x ic id ia ib 11 14ul 19 in let abcd = round2_op abcd x ib ic id ia 0 20ul 20 in let abcd = round2_op abcd x ia ib ic id 5 5ul 21 in let abcd = round2_op abcd x id ia ib ic 10 9ul 22 in let abcd = round2_op abcd x ic id ia ib 15 14ul 23 in let abcd = round2_op abcd x ib ic id ia 4 20ul 24 in let abcd = round2_op abcd x ia ib ic id 9 5ul 25 in let abcd = round2_op abcd x id ia ib ic 14 9ul 26 in let abcd = round2_op abcd x ic id ia ib 3 14ul 27 in let abcd = round2_op abcd x ib ic id ia 8 20ul 28 in let abcd = round2_op abcd x ia ib ic id 13 5ul 29 in let abcd = round2_op abcd x id ia ib ic 2 9ul 30 in let abcd = round2_op abcd x ic id ia ib 7 14ul 31 in let abcd = round2_op abcd x ib ic id ia 12 20ul 32 in abcd [@"opaque_to_smt"] let round2 = round2_aux let round3_op = round_op_gen h let round3_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round3_op abcd x ia ib ic id 5 4ul 33 in let abcd = round3_op abcd x id ia ib ic 8 11ul 34 in let abcd = round3_op abcd x ic id ia ib 11 16ul 35 in let abcd = round3_op abcd x ib ic id ia 14 23ul 36 in let abcd = round3_op abcd x ia ib ic id 1 4ul 37 in let abcd = round3_op abcd x id ia ib ic 4 11ul 38 in let abcd = round3_op abcd x ic id ia ib 7 16ul 39 in let abcd = round3_op abcd x ib ic id ia 10 23ul 40 in let abcd = round3_op abcd x ia ib ic id 13 4ul 41 in let abcd = round3_op abcd x id ia ib ic 0 11ul 42 in let abcd = round3_op abcd x ic id ia ib 3 16ul 43 in let abcd = round3_op abcd x ib ic id ia 6 23ul 44 in let abcd = round3_op abcd x ia ib ic id 9 4ul 45 in let abcd = round3_op abcd x id ia ib ic 12 11ul 46 in let abcd = round3_op abcd x ic id ia ib 15 16ul 47 in let abcd = round3_op abcd x ib ic id ia 2 23ul 48 in abcd [@"opaque_to_smt"] let round3 = round3_aux let round4_op = round_op_gen i let round4_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round4_op abcd x ia ib ic id 0 6ul 49 in let abcd = round4_op abcd x id ia ib ic 7 10ul 50 in let abcd = round4_op abcd x ic id ia ib 14 15ul 51 in let abcd = round4_op abcd x ib ic id ia 5 21ul 52 in let abcd = round4_op abcd x ia ib ic id 12 6ul 53 in let abcd = round4_op abcd x id ia ib ic 3 10ul 54 in let abcd = round4_op abcd x ic id ia ib 10 15ul 55 in let abcd = round4_op abcd x ib ic id ia 1 21ul 56 in let abcd = round4_op abcd x ia ib ic id 8 6ul 57 in let abcd = round4_op abcd x id ia ib ic 15 10ul 58 in let abcd = round4_op abcd x ic id ia ib 6 15ul 59 in let abcd = round4_op abcd x ib ic id ia 13 21ul 60 in let abcd = round4_op abcd x ia ib ic id 4 6ul 61 in let abcd = round4_op abcd x id ia ib ic 11 10ul 62 in let abcd = round4_op abcd x ic id ia ib 2 15ul 63 in let abcd = round4_op abcd x ib ic id ia 9 21ul 64 in abcd
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
abcd: Spec.MD5.abcd_t -> x: Spec.MD5.x_t -> Spec.MD5.abcd_t
Prims.Tot
[ "total" ]
[]
[ "Spec.MD5.round4_aux" ]
[]
false
false
false
true
false
let round4 =
round4_aux
false
Spec.MD5.fst
Spec.MD5.round4_op
val round4_op : abcd: Spec.MD5.abcd_t -> x: Spec.MD5.x_t -> a: Spec.MD5.abcd_idx -> b: Spec.MD5.abcd_idx -> c: Spec.MD5.abcd_idx -> d: Spec.MD5.abcd_idx -> k: Spec.MD5.x_idx -> s: Spec.MD5.rotate_idx -> i: Spec.MD5.t_idx -> Spec.MD5.abcd_t
let round4_op = round_op_gen i
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 30, "end_line": 230, "start_col": 0, "start_line": 230 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4 let x_idx = (n: nat { n < 16 } ) let x_t = Seq.lseq uint32 16 let t_idx = (n: nat { 1 <= n /\ n <= 64 } ) inline_for_extraction let rotate_idx = rotval U32 let round_op_gen_aux (f: (uint32 -> uint32 -> uint32 -> Tot uint32)) (abcd: abcd_t) (x: x_t) (a b c d: abcd_idx) (k: x_idx) (s: rotate_idx) (i: t_idx) : Tot abcd_t = let va = Seq.index abcd a in let vb = Seq.index abcd b in let vc = Seq.index abcd c in let vd = Seq.index abcd d in Seq.upd abcd a (vb +. ((va +. f vb vc vd +. Seq.index x k +. Seq.index t (i - 1)) <<<. s)) [@"opaque_to_smt"] let round_op_gen = round_op_gen_aux (* Round 1 *) let round1_op = round_op_gen f let ia : abcd_idx = 0 let ib : abcd_idx = 1 let ic : abcd_idx = 2 let id : abcd_idx = 3 let round1_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round1_op abcd x ia ib ic id 0 7ul 1 in let abcd = round1_op abcd x id ia ib ic 1 12ul 2 in let abcd = round1_op abcd x ic id ia ib 2 17ul 3 in let abcd = round1_op abcd x ib ic id ia 3 22ul 4 in let abcd = round1_op abcd x ia ib ic id 4 7ul 5 in let abcd = round1_op abcd x id ia ib ic 5 12ul 6 in let abcd = round1_op abcd x ic id ia ib 6 17ul 7 in let abcd = round1_op abcd x ib ic id ia 7 22ul 8 in let abcd = round1_op abcd x ia ib ic id 8 7ul 9 in let abcd = round1_op abcd x id ia ib ic 9 12ul 10 in let abcd = round1_op abcd x ic id ia ib 10 17ul 11 in let abcd = round1_op abcd x ib ic id ia 11 22ul 12 in let abcd = round1_op abcd x ia ib ic id 12 7ul 13 in let abcd = round1_op abcd x id ia ib ic 13 12ul 14 in let abcd = round1_op abcd x ic id ia ib 14 17ul 15 in let abcd = round1_op abcd x ib ic id ia 15 22ul 16 in abcd [@"opaque_to_smt"] let round1 = round1_aux let round2_op = round_op_gen g let round2_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round2_op abcd x ia ib ic id 1 5ul 17 in let abcd = round2_op abcd x id ia ib ic 6 9ul 18 in let abcd = round2_op abcd x ic id ia ib 11 14ul 19 in let abcd = round2_op abcd x ib ic id ia 0 20ul 20 in let abcd = round2_op abcd x ia ib ic id 5 5ul 21 in let abcd = round2_op abcd x id ia ib ic 10 9ul 22 in let abcd = round2_op abcd x ic id ia ib 15 14ul 23 in let abcd = round2_op abcd x ib ic id ia 4 20ul 24 in let abcd = round2_op abcd x ia ib ic id 9 5ul 25 in let abcd = round2_op abcd x id ia ib ic 14 9ul 26 in let abcd = round2_op abcd x ic id ia ib 3 14ul 27 in let abcd = round2_op abcd x ib ic id ia 8 20ul 28 in let abcd = round2_op abcd x ia ib ic id 13 5ul 29 in let abcd = round2_op abcd x id ia ib ic 2 9ul 30 in let abcd = round2_op abcd x ic id ia ib 7 14ul 31 in let abcd = round2_op abcd x ib ic id ia 12 20ul 32 in abcd [@"opaque_to_smt"] let round2 = round2_aux let round3_op = round_op_gen h let round3_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round3_op abcd x ia ib ic id 5 4ul 33 in let abcd = round3_op abcd x id ia ib ic 8 11ul 34 in let abcd = round3_op abcd x ic id ia ib 11 16ul 35 in let abcd = round3_op abcd x ib ic id ia 14 23ul 36 in let abcd = round3_op abcd x ia ib ic id 1 4ul 37 in let abcd = round3_op abcd x id ia ib ic 4 11ul 38 in let abcd = round3_op abcd x ic id ia ib 7 16ul 39 in let abcd = round3_op abcd x ib ic id ia 10 23ul 40 in let abcd = round3_op abcd x ia ib ic id 13 4ul 41 in let abcd = round3_op abcd x id ia ib ic 0 11ul 42 in let abcd = round3_op abcd x ic id ia ib 3 16ul 43 in let abcd = round3_op abcd x ib ic id ia 6 23ul 44 in let abcd = round3_op abcd x ia ib ic id 9 4ul 45 in let abcd = round3_op abcd x id ia ib ic 12 11ul 46 in let abcd = round3_op abcd x ic id ia ib 15 16ul 47 in let abcd = round3_op abcd x ib ic id ia 2 23ul 48 in abcd [@"opaque_to_smt"] let round3 = round3_aux
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
abcd: Spec.MD5.abcd_t -> x: Spec.MD5.x_t -> a: Spec.MD5.abcd_idx -> b: Spec.MD5.abcd_idx -> c: Spec.MD5.abcd_idx -> d: Spec.MD5.abcd_idx -> k: Spec.MD5.x_idx -> s: Spec.MD5.rotate_idx -> i: Spec.MD5.t_idx -> Spec.MD5.abcd_t
Prims.Tot
[ "total" ]
[]
[ "Spec.MD5.round_op_gen", "Spec.MD5.i" ]
[]
false
false
false
true
false
let round4_op =
round_op_gen i
false
Spec.MD5.fst
Spec.MD5.rounds_aux
val rounds_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t
val rounds_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t
let rounds_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round1 abcd x in let abcd = round2 abcd x in let abcd = round3 abcd x in let abcd = round4 abcd x in abcd
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 6, "end_line": 263, "start_col": 0, "start_line": 258 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4 let x_idx = (n: nat { n < 16 } ) let x_t = Seq.lseq uint32 16 let t_idx = (n: nat { 1 <= n /\ n <= 64 } ) inline_for_extraction let rotate_idx = rotval U32 let round_op_gen_aux (f: (uint32 -> uint32 -> uint32 -> Tot uint32)) (abcd: abcd_t) (x: x_t) (a b c d: abcd_idx) (k: x_idx) (s: rotate_idx) (i: t_idx) : Tot abcd_t = let va = Seq.index abcd a in let vb = Seq.index abcd b in let vc = Seq.index abcd c in let vd = Seq.index abcd d in Seq.upd abcd a (vb +. ((va +. f vb vc vd +. Seq.index x k +. Seq.index t (i - 1)) <<<. s)) [@"opaque_to_smt"] let round_op_gen = round_op_gen_aux (* Round 1 *) let round1_op = round_op_gen f let ia : abcd_idx = 0 let ib : abcd_idx = 1 let ic : abcd_idx = 2 let id : abcd_idx = 3 let round1_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round1_op abcd x ia ib ic id 0 7ul 1 in let abcd = round1_op abcd x id ia ib ic 1 12ul 2 in let abcd = round1_op abcd x ic id ia ib 2 17ul 3 in let abcd = round1_op abcd x ib ic id ia 3 22ul 4 in let abcd = round1_op abcd x ia ib ic id 4 7ul 5 in let abcd = round1_op abcd x id ia ib ic 5 12ul 6 in let abcd = round1_op abcd x ic id ia ib 6 17ul 7 in let abcd = round1_op abcd x ib ic id ia 7 22ul 8 in let abcd = round1_op abcd x ia ib ic id 8 7ul 9 in let abcd = round1_op abcd x id ia ib ic 9 12ul 10 in let abcd = round1_op abcd x ic id ia ib 10 17ul 11 in let abcd = round1_op abcd x ib ic id ia 11 22ul 12 in let abcd = round1_op abcd x ia ib ic id 12 7ul 13 in let abcd = round1_op abcd x id ia ib ic 13 12ul 14 in let abcd = round1_op abcd x ic id ia ib 14 17ul 15 in let abcd = round1_op abcd x ib ic id ia 15 22ul 16 in abcd [@"opaque_to_smt"] let round1 = round1_aux let round2_op = round_op_gen g let round2_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round2_op abcd x ia ib ic id 1 5ul 17 in let abcd = round2_op abcd x id ia ib ic 6 9ul 18 in let abcd = round2_op abcd x ic id ia ib 11 14ul 19 in let abcd = round2_op abcd x ib ic id ia 0 20ul 20 in let abcd = round2_op abcd x ia ib ic id 5 5ul 21 in let abcd = round2_op abcd x id ia ib ic 10 9ul 22 in let abcd = round2_op abcd x ic id ia ib 15 14ul 23 in let abcd = round2_op abcd x ib ic id ia 4 20ul 24 in let abcd = round2_op abcd x ia ib ic id 9 5ul 25 in let abcd = round2_op abcd x id ia ib ic 14 9ul 26 in let abcd = round2_op abcd x ic id ia ib 3 14ul 27 in let abcd = round2_op abcd x ib ic id ia 8 20ul 28 in let abcd = round2_op abcd x ia ib ic id 13 5ul 29 in let abcd = round2_op abcd x id ia ib ic 2 9ul 30 in let abcd = round2_op abcd x ic id ia ib 7 14ul 31 in let abcd = round2_op abcd x ib ic id ia 12 20ul 32 in abcd [@"opaque_to_smt"] let round2 = round2_aux let round3_op = round_op_gen h let round3_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round3_op abcd x ia ib ic id 5 4ul 33 in let abcd = round3_op abcd x id ia ib ic 8 11ul 34 in let abcd = round3_op abcd x ic id ia ib 11 16ul 35 in let abcd = round3_op abcd x ib ic id ia 14 23ul 36 in let abcd = round3_op abcd x ia ib ic id 1 4ul 37 in let abcd = round3_op abcd x id ia ib ic 4 11ul 38 in let abcd = round3_op abcd x ic id ia ib 7 16ul 39 in let abcd = round3_op abcd x ib ic id ia 10 23ul 40 in let abcd = round3_op abcd x ia ib ic id 13 4ul 41 in let abcd = round3_op abcd x id ia ib ic 0 11ul 42 in let abcd = round3_op abcd x ic id ia ib 3 16ul 43 in let abcd = round3_op abcd x ib ic id ia 6 23ul 44 in let abcd = round3_op abcd x ia ib ic id 9 4ul 45 in let abcd = round3_op abcd x id ia ib ic 12 11ul 46 in let abcd = round3_op abcd x ic id ia ib 15 16ul 47 in let abcd = round3_op abcd x ib ic id ia 2 23ul 48 in abcd [@"opaque_to_smt"] let round3 = round3_aux let round4_op = round_op_gen i let round4_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round4_op abcd x ia ib ic id 0 6ul 49 in let abcd = round4_op abcd x id ia ib ic 7 10ul 50 in let abcd = round4_op abcd x ic id ia ib 14 15ul 51 in let abcd = round4_op abcd x ib ic id ia 5 21ul 52 in let abcd = round4_op abcd x ia ib ic id 12 6ul 53 in let abcd = round4_op abcd x id ia ib ic 3 10ul 54 in let abcd = round4_op abcd x ic id ia ib 10 15ul 55 in let abcd = round4_op abcd x ib ic id ia 1 21ul 56 in let abcd = round4_op abcd x ia ib ic id 8 6ul 57 in let abcd = round4_op abcd x id ia ib ic 15 10ul 58 in let abcd = round4_op abcd x ic id ia ib 6 15ul 59 in let abcd = round4_op abcd x ib ic id ia 13 21ul 60 in let abcd = round4_op abcd x ia ib ic id 4 6ul 61 in let abcd = round4_op abcd x id ia ib ic 11 10ul 62 in let abcd = round4_op abcd x ic id ia ib 2 15ul 63 in let abcd = round4_op abcd x ib ic id ia 9 21ul 64 in abcd [@"opaque_to_smt"] let round4 = round4_aux
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
abcd: Spec.MD5.abcd_t -> x: Spec.MD5.x_t -> Spec.MD5.abcd_t
Prims.Tot
[ "total" ]
[]
[ "Spec.MD5.abcd_t", "Spec.MD5.x_t", "Spec.MD5.round4", "Spec.MD5.round3", "Spec.MD5.round2", "Spec.MD5.round1" ]
[]
false
false
false
true
false
let rounds_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t =
let abcd = round1 abcd x in let abcd = round2 abcd x in let abcd = round3 abcd x in let abcd = round4 abcd x in abcd
false
Spec.MD5.fst
Spec.MD5.t
val t:Seq.lseq uint32 64
val t:Seq.lseq uint32 64
let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 27, "end_line": 115, "start_col": 0, "start_line": 113 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
FStar.Seq.Properties.lseq (Lib.IntTypes.int_t Lib.IntTypes.U32 Lib.IntTypes.SEC) 64
Prims.Tot
[ "total" ]
[]
[ "FStar.Seq.Base.seq_of_list", "Lib.IntTypes.int_t", "Lib.IntTypes.U32", "Lib.IntTypes.SEC", "Spec.MD5.t_as_list", "Prims.unit", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.int", "FStar.List.Tot.Base.length" ]
[]
false
false
false
false
false
let t:Seq.lseq uint32 64 =
assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list
false
Spec.MD5.fst
Spec.MD5.overwrite
val overwrite : abcd: Spec.MD5.abcd_t -> a': Lib.IntTypes.uint32 -> b': Lib.IntTypes.uint32 -> c': Lib.IntTypes.uint32 -> d': Lib.IntTypes.uint32 -> Spec.MD5.abcd_t
let overwrite = overwrite_aux
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 29, "end_line": 276, "start_col": 0, "start_line": 276 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4 let x_idx = (n: nat { n < 16 } ) let x_t = Seq.lseq uint32 16 let t_idx = (n: nat { 1 <= n /\ n <= 64 } ) inline_for_extraction let rotate_idx = rotval U32 let round_op_gen_aux (f: (uint32 -> uint32 -> uint32 -> Tot uint32)) (abcd: abcd_t) (x: x_t) (a b c d: abcd_idx) (k: x_idx) (s: rotate_idx) (i: t_idx) : Tot abcd_t = let va = Seq.index abcd a in let vb = Seq.index abcd b in let vc = Seq.index abcd c in let vd = Seq.index abcd d in Seq.upd abcd a (vb +. ((va +. f vb vc vd +. Seq.index x k +. Seq.index t (i - 1)) <<<. s)) [@"opaque_to_smt"] let round_op_gen = round_op_gen_aux (* Round 1 *) let round1_op = round_op_gen f let ia : abcd_idx = 0 let ib : abcd_idx = 1 let ic : abcd_idx = 2 let id : abcd_idx = 3 let round1_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round1_op abcd x ia ib ic id 0 7ul 1 in let abcd = round1_op abcd x id ia ib ic 1 12ul 2 in let abcd = round1_op abcd x ic id ia ib 2 17ul 3 in let abcd = round1_op abcd x ib ic id ia 3 22ul 4 in let abcd = round1_op abcd x ia ib ic id 4 7ul 5 in let abcd = round1_op abcd x id ia ib ic 5 12ul 6 in let abcd = round1_op abcd x ic id ia ib 6 17ul 7 in let abcd = round1_op abcd x ib ic id ia 7 22ul 8 in let abcd = round1_op abcd x ia ib ic id 8 7ul 9 in let abcd = round1_op abcd x id ia ib ic 9 12ul 10 in let abcd = round1_op abcd x ic id ia ib 10 17ul 11 in let abcd = round1_op abcd x ib ic id ia 11 22ul 12 in let abcd = round1_op abcd x ia ib ic id 12 7ul 13 in let abcd = round1_op abcd x id ia ib ic 13 12ul 14 in let abcd = round1_op abcd x ic id ia ib 14 17ul 15 in let abcd = round1_op abcd x ib ic id ia 15 22ul 16 in abcd [@"opaque_to_smt"] let round1 = round1_aux let round2_op = round_op_gen g let round2_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round2_op abcd x ia ib ic id 1 5ul 17 in let abcd = round2_op abcd x id ia ib ic 6 9ul 18 in let abcd = round2_op abcd x ic id ia ib 11 14ul 19 in let abcd = round2_op abcd x ib ic id ia 0 20ul 20 in let abcd = round2_op abcd x ia ib ic id 5 5ul 21 in let abcd = round2_op abcd x id ia ib ic 10 9ul 22 in let abcd = round2_op abcd x ic id ia ib 15 14ul 23 in let abcd = round2_op abcd x ib ic id ia 4 20ul 24 in let abcd = round2_op abcd x ia ib ic id 9 5ul 25 in let abcd = round2_op abcd x id ia ib ic 14 9ul 26 in let abcd = round2_op abcd x ic id ia ib 3 14ul 27 in let abcd = round2_op abcd x ib ic id ia 8 20ul 28 in let abcd = round2_op abcd x ia ib ic id 13 5ul 29 in let abcd = round2_op abcd x id ia ib ic 2 9ul 30 in let abcd = round2_op abcd x ic id ia ib 7 14ul 31 in let abcd = round2_op abcd x ib ic id ia 12 20ul 32 in abcd [@"opaque_to_smt"] let round2 = round2_aux let round3_op = round_op_gen h let round3_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round3_op abcd x ia ib ic id 5 4ul 33 in let abcd = round3_op abcd x id ia ib ic 8 11ul 34 in let abcd = round3_op abcd x ic id ia ib 11 16ul 35 in let abcd = round3_op abcd x ib ic id ia 14 23ul 36 in let abcd = round3_op abcd x ia ib ic id 1 4ul 37 in let abcd = round3_op abcd x id ia ib ic 4 11ul 38 in let abcd = round3_op abcd x ic id ia ib 7 16ul 39 in let abcd = round3_op abcd x ib ic id ia 10 23ul 40 in let abcd = round3_op abcd x ia ib ic id 13 4ul 41 in let abcd = round3_op abcd x id ia ib ic 0 11ul 42 in let abcd = round3_op abcd x ic id ia ib 3 16ul 43 in let abcd = round3_op abcd x ib ic id ia 6 23ul 44 in let abcd = round3_op abcd x ia ib ic id 9 4ul 45 in let abcd = round3_op abcd x id ia ib ic 12 11ul 46 in let abcd = round3_op abcd x ic id ia ib 15 16ul 47 in let abcd = round3_op abcd x ib ic id ia 2 23ul 48 in abcd [@"opaque_to_smt"] let round3 = round3_aux let round4_op = round_op_gen i let round4_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round4_op abcd x ia ib ic id 0 6ul 49 in let abcd = round4_op abcd x id ia ib ic 7 10ul 50 in let abcd = round4_op abcd x ic id ia ib 14 15ul 51 in let abcd = round4_op abcd x ib ic id ia 5 21ul 52 in let abcd = round4_op abcd x ia ib ic id 12 6ul 53 in let abcd = round4_op abcd x id ia ib ic 3 10ul 54 in let abcd = round4_op abcd x ic id ia ib 10 15ul 55 in let abcd = round4_op abcd x ib ic id ia 1 21ul 56 in let abcd = round4_op abcd x ia ib ic id 8 6ul 57 in let abcd = round4_op abcd x id ia ib ic 15 10ul 58 in let abcd = round4_op abcd x ic id ia ib 6 15ul 59 in let abcd = round4_op abcd x ib ic id ia 13 21ul 60 in let abcd = round4_op abcd x ia ib ic id 4 6ul 61 in let abcd = round4_op abcd x id ia ib ic 11 10ul 62 in let abcd = round4_op abcd x ic id ia ib 2 15ul 63 in let abcd = round4_op abcd x ib ic id ia 9 21ul 64 in abcd [@"opaque_to_smt"] let round4 = round4_aux let rounds_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round1 abcd x in let abcd = round2 abcd x in let abcd = round3 abcd x in let abcd = round4 abcd x in abcd [@"opaque_to_smt"] let rounds = rounds_aux let overwrite_aux (abcd: abcd_t) (a' b' c' d' : uint32) : Tot abcd_t = let abcd : abcd_t = Seq.upd abcd ia a' in let abcd : abcd_t = Seq.upd abcd ib b' in let abcd : abcd_t = Seq.upd abcd ic c' in let abcd : abcd_t = Seq.upd abcd id d' in abcd
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
abcd: Spec.MD5.abcd_t -> a': Lib.IntTypes.uint32 -> b': Lib.IntTypes.uint32 -> c': Lib.IntTypes.uint32 -> d': Lib.IntTypes.uint32 -> Spec.MD5.abcd_t
Prims.Tot
[ "total" ]
[]
[ "Spec.MD5.overwrite_aux" ]
[]
false
false
false
true
false
let overwrite =
overwrite_aux
false
Vale.AES.X64.GCMdecryptOpt.fst
Vale.AES.X64.GCMdecryptOpt.va_lemma_Gcm_blocks
val va_lemma_Gcm_blocks : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> offset:int -> auth_b:buffer128 -> abytes_b:buffer128 -> in128x6_b:buffer128 -> out128x6_b:buffer128 -> in128_b:buffer128 -> out128_b:buffer128 -> inout_b:buffer128 -> iv_b:buffer128 -> scratch_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gcm_blocks alg offset) va_s0 /\ va_get_ok va_s0 /\ (let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0) in let (in128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) in let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack va_s0) in let (len128x6:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) in let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack va_s0) in let (out128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) in let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack va_s0) in let (inout_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) in let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack va_s0) in let (h_LE:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 0 va_s0)) in sse_enabled /\ movbe_enabled /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) auth_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 7 va_s0) abytes_ptr abytes_b 1 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8 va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 6 va_s0) in128x6_ptr in128x6_b len128x6 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 6 va_s0) out128x6_ptr out128x6_b len128x6 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) in128_ptr in128_b len128 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) out128_ptr out128_b len128 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) inout_ptr inout_b 1 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0) hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_disjoints128 iv_b ([keys_b; scratch_b; in128x6_b; out128x6_b; hkeys_b; in128_b; out128_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 scratch_b ([keys_b; in128x6_b; out128x6_b; in128_b; out128_b; inout_b; hkeys_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128x6_b ([keys_b; hkeys_b; in128_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128_b ([keys_b; hkeys_b; out128x6_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 inout_b ([keys_b; hkeys_b; out128x6_b; out128_b]) /\ (Vale.X64.Decls.buffers_disjoint128 in128x6_b out128x6_b \/ in128x6_b == out128x6_b) /\ (Vale.X64.Decls.buffers_disjoint128 in128_b out128_b \/ in128_b == out128_b) /\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ in128x6_ptr + 16 `op_Multiply` len128x6 < pow2_64 /\ out128x6_ptr + 16 `op_Multiply` len128x6 < pow2_64 /\ in128_ptr + 16 `op_Multiply` len128 < pow2_64 /\ out128_ptr + 16 `op_Multiply` len128 < pow2_64 /\ inout_ptr + 16 < pow2_64 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 auth_b == va_get_reg64 rRdx va_s0 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 abytes_b == 1 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128x6_b == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out128x6_b /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out128_b /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128x6_b == len128x6 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b == len128 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 inout_b == 1 /\ plain_num_bytes < pow2_32 /\ va_get_reg64 rRsi va_s0 < pow2_32 /\ va_get_reg64 rR9 va_s0 + 32 < pow2_64 /\ Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint128 keys_b (va_get_mem_heaplet 0 va_s0) + 128 < pow2_64 /\ len128x6 `op_Modulus` 6 == 0 /\ (len128x6 > 0 ==> len128x6 >= 6) /\ 12 + len128x6 + 6 < pow2_32 /\ (va_mul_nat len128x6 (128 `op_Division` 8) + va_mul_nat len128 (128 `op_Division` 8) <= plain_num_bytes /\ plain_num_bytes < va_mul_nat len128x6 (128 `op_Division` 8) + va_mul_nat len128 (128 `op_Division` 8) + 128 `op_Division` 8) /\ (va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) <= va_get_reg64 rRsi va_s0 /\ va_get_reg64 rRsi va_s0 < va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) + 128 `op_Division` 8) /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.AES_s.aes_encrypt_LE alg key (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0)))))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0) in let (in128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) in let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack va_s0) in let (len128x6:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) in let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack va_s0) in let (out128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) in let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack va_s0) in let (inout_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) in let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack va_s0) in let (h_LE:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 0 va_s0)) in Vale.X64.Decls.modifies_buffer128 out128_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.X64.Decls.modifies_buffer128 iv_b (va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) /\ Vale.X64.Decls.modifies_buffer128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) /\ Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.X64.Decls.modifies_buffer128 out128x6_b (va_get_mem_heaplet 6 va_s0) (va_get_mem_heaplet 6 va_sM) /\ plain_num_bytes < pow2_32 /\ va_get_reg64 rRsi va_s0 < pow2_32 /\ (let iv_BE = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_s0) in let (ctr_BE_1:quad32) = iv_BE in let (ctr_BE_2:quad32) = Vale.AES.GCTR_s.inc32 iv_BE 1 in let (plain_in:(seq quad32)) = (if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128 `op_Division` 8) then FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) else FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b)) in let (cipher_out:(seq quad32)) = (if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128 `op_Division` 8) then FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out128_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) else FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out128_b)) in let (cipher_bound:nat) = (if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128 `op_Division` 8) then (len128x6 + len128 + 1) else (len128x6 + len128)) in Vale.AES.GCTR.gctr_partial alg cipher_bound plain_in cipher_out key ctr_BE_2 /\ (let (length_quad:quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (Vale.Def.Types_s.insert_nat64 (Vale.Def.Types_s.insert_nat64 (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0) (8 `op_Multiply` va_get_reg64 rRsi va_s0) 1) (8 `op_Multiply` plain_num_bytes) 0) in let (raw_auth_quads:(seq quad32)) = (if (va_get_reg64 rRsi va_s0 > va_get_reg64 rRdx va_s0 `op_Multiply` 128 `op_Division` 8) then FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) auth_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 7 va_s0) abytes_b) else Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) auth_b) in let (auth_input_bytes:(seq nat8)) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads) 0 (va_get_reg64 rRsi va_s0) in let (padded_auth_bytes:(seq nat8)) = Vale.AES.GCTR_s.pad_to_128_bits auth_input_bytes in let (auth_quad_seq:(seq quad32)) = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_auth_bytes in let (raw_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32 (FStar.Seq.Base.append #quad32 auth_quad_seq (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b) in let (total_bytes:nat) = FStar.Seq.Base.length #quad32 auth_quad_seq `op_Multiply` 16 + plain_num_bytes in let (raw_quad_seq:(seq quad32)) = (if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128 `op_Division` 8) then (let (ab:(seq nat8)) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes (FStar.Seq.Base.append #quad32 raw_quad_seq (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b))) 0 total_bytes in let (pb:(seq nat8)) = Vale.AES.GCTR_s.pad_to_128_bits ab in Vale.Def.Types_s.le_bytes_to_seq_quad32 pb) else raw_quad_seq) in let (auth_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32 raw_quad_seq (FStar.Seq.Base.create #quad32 1 length_quad) in va_get_xmm 8 va_sM == Vale.AES.GCTR_s.gctr_encrypt_block ctr_BE_1 (Vale.AES.GHash_s.ghash_LE h_LE auth_quad_seq) alg key 0))) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 6 va_sM (va_update_mem_heaplet 5 va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM (va_update_mem_heaplet 1 va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))))))))))))))))))
val va_lemma_Gcm_blocks : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> offset:int -> auth_b:buffer128 -> abytes_b:buffer128 -> in128x6_b:buffer128 -> out128x6_b:buffer128 -> in128_b:buffer128 -> out128_b:buffer128 -> inout_b:buffer128 -> iv_b:buffer128 -> scratch_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gcm_blocks alg offset) va_s0 /\ va_get_ok va_s0 /\ (let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0) in let (in128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) in let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack va_s0) in let (len128x6:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) in let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack va_s0) in let (out128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) in let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack va_s0) in let (inout_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) in let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack va_s0) in let (h_LE:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 0 va_s0)) in sse_enabled /\ movbe_enabled /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) auth_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 7 va_s0) abytes_ptr abytes_b 1 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8 va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 6 va_s0) in128x6_ptr in128x6_b len128x6 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 6 va_s0) out128x6_ptr out128x6_b len128x6 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) in128_ptr in128_b len128 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) out128_ptr out128_b len128 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) inout_ptr inout_b 1 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0) hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_disjoints128 iv_b ([keys_b; scratch_b; in128x6_b; out128x6_b; hkeys_b; in128_b; out128_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 scratch_b ([keys_b; in128x6_b; out128x6_b; in128_b; out128_b; inout_b; hkeys_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128x6_b ([keys_b; hkeys_b; in128_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128_b ([keys_b; hkeys_b; out128x6_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 inout_b ([keys_b; hkeys_b; out128x6_b; out128_b]) /\ (Vale.X64.Decls.buffers_disjoint128 in128x6_b out128x6_b \/ in128x6_b == out128x6_b) /\ (Vale.X64.Decls.buffers_disjoint128 in128_b out128_b \/ in128_b == out128_b) /\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ in128x6_ptr + 16 `op_Multiply` len128x6 < pow2_64 /\ out128x6_ptr + 16 `op_Multiply` len128x6 < pow2_64 /\ in128_ptr + 16 `op_Multiply` len128 < pow2_64 /\ out128_ptr + 16 `op_Multiply` len128 < pow2_64 /\ inout_ptr + 16 < pow2_64 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 auth_b == va_get_reg64 rRdx va_s0 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 abytes_b == 1 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128x6_b == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out128x6_b /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out128_b /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128x6_b == len128x6 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b == len128 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 inout_b == 1 /\ plain_num_bytes < pow2_32 /\ va_get_reg64 rRsi va_s0 < pow2_32 /\ va_get_reg64 rR9 va_s0 + 32 < pow2_64 /\ Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint128 keys_b (va_get_mem_heaplet 0 va_s0) + 128 < pow2_64 /\ len128x6 `op_Modulus` 6 == 0 /\ (len128x6 > 0 ==> len128x6 >= 6) /\ 12 + len128x6 + 6 < pow2_32 /\ (va_mul_nat len128x6 (128 `op_Division` 8) + va_mul_nat len128 (128 `op_Division` 8) <= plain_num_bytes /\ plain_num_bytes < va_mul_nat len128x6 (128 `op_Division` 8) + va_mul_nat len128 (128 `op_Division` 8) + 128 `op_Division` 8) /\ (va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) <= va_get_reg64 rRsi va_s0 /\ va_get_reg64 rRsi va_s0 < va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) + 128 `op_Division` 8) /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.AES_s.aes_encrypt_LE alg key (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0)))))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0) in let (in128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) in let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack va_s0) in let (len128x6:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) in let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack va_s0) in let (out128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) in let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack va_s0) in let (inout_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) in let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack va_s0) in let (h_LE:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 0 va_s0)) in Vale.X64.Decls.modifies_buffer128 out128_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.X64.Decls.modifies_buffer128 iv_b (va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) /\ Vale.X64.Decls.modifies_buffer128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) /\ Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.X64.Decls.modifies_buffer128 out128x6_b (va_get_mem_heaplet 6 va_s0) (va_get_mem_heaplet 6 va_sM) /\ plain_num_bytes < pow2_32 /\ va_get_reg64 rRsi va_s0 < pow2_32 /\ (let iv_BE = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_s0) in let (ctr_BE_1:quad32) = iv_BE in let (ctr_BE_2:quad32) = Vale.AES.GCTR_s.inc32 iv_BE 1 in let (plain_in:(seq quad32)) = (if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128 `op_Division` 8) then FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) else FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b)) in let (cipher_out:(seq quad32)) = (if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128 `op_Division` 8) then FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out128_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) else FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out128_b)) in let (cipher_bound:nat) = (if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128 `op_Division` 8) then (len128x6 + len128 + 1) else (len128x6 + len128)) in Vale.AES.GCTR.gctr_partial alg cipher_bound plain_in cipher_out key ctr_BE_2 /\ (let (length_quad:quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (Vale.Def.Types_s.insert_nat64 (Vale.Def.Types_s.insert_nat64 (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0) (8 `op_Multiply` va_get_reg64 rRsi va_s0) 1) (8 `op_Multiply` plain_num_bytes) 0) in let (raw_auth_quads:(seq quad32)) = (if (va_get_reg64 rRsi va_s0 > va_get_reg64 rRdx va_s0 `op_Multiply` 128 `op_Division` 8) then FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) auth_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 7 va_s0) abytes_b) else Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) auth_b) in let (auth_input_bytes:(seq nat8)) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads) 0 (va_get_reg64 rRsi va_s0) in let (padded_auth_bytes:(seq nat8)) = Vale.AES.GCTR_s.pad_to_128_bits auth_input_bytes in let (auth_quad_seq:(seq quad32)) = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_auth_bytes in let (raw_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32 (FStar.Seq.Base.append #quad32 auth_quad_seq (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b) in let (total_bytes:nat) = FStar.Seq.Base.length #quad32 auth_quad_seq `op_Multiply` 16 + plain_num_bytes in let (raw_quad_seq:(seq quad32)) = (if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128 `op_Division` 8) then (let (ab:(seq nat8)) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes (FStar.Seq.Base.append #quad32 raw_quad_seq (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b))) 0 total_bytes in let (pb:(seq nat8)) = Vale.AES.GCTR_s.pad_to_128_bits ab in Vale.Def.Types_s.le_bytes_to_seq_quad32 pb) else raw_quad_seq) in let (auth_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32 raw_quad_seq (FStar.Seq.Base.create #quad32 1 length_quad) in va_get_xmm 8 va_sM == Vale.AES.GCTR_s.gctr_encrypt_block ctr_BE_1 (Vale.AES.GHash_s.ghash_LE h_LE auth_quad_seq) alg key 0))) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 6 va_sM (va_update_mem_heaplet 5 va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM (va_update_mem_heaplet 1 va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))))))))))))))))))
let va_lemma_Gcm_blocks va_b0 va_s0 alg offset auth_b abytes_b in128x6_b out128x6_b in128_b out128_b inout_b iv_b scratch_b key round_keys keys_b hkeys_b = let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Gcm_blocks va_mods alg offset auth_b abytes_b in128x6_b out128x6_b in128_b out128_b inout_b iv_b scratch_b key round_keys keys_b hkeys_b in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_blocks alg offset) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 283 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_get_ok va_sM) /\ (let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0) in let (in128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) in let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack va_s0) in let (len128x6:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) in let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack va_s0) in let (out128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) in let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack va_s0) in let (inout_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) in let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack va_s0) in let (h_LE:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 0 va_s0)) in label va_range1 "***** POSTCONDITION NOT MET AT line 396 column 56 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (Vale.X64.Decls.modifies_buffer128 out128_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 397 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (Vale.X64.Decls.modifies_buffer128 iv_b (va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 398 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (Vale.X64.Decls.modifies_buffer128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 399 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 400 column 58 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (Vale.X64.Decls.modifies_buffer128 out128x6_b (va_get_mem_heaplet 6 va_s0) (va_get_mem_heaplet 6 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 403 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (plain_num_bytes < pow2_32) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 404 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_get_reg64 rRsi va_s0 < pow2_32) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 406 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let iv_BE = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 408 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let (ctr_BE_1:quad32) = iv_BE in label va_range1 "***** POSTCONDITION NOT MET AT line 409 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let (ctr_BE_2:quad32) = Vale.AES.GCTR_s.inc32 iv_BE 1 in label va_range1 "***** POSTCONDITION NOT MET AT line 412 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let (plain_in:(seq quad32)) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128 `op_Division` 8) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b)) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b)) in label va_range1 "***** POSTCONDITION NOT MET AT line 421 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let (cipher_out:(seq quad32)) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128 `op_Division` 8) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out128_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b)) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out128_b)) in label va_range1 "***** POSTCONDITION NOT MET AT line 430 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let (cipher_bound:nat) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128 `op_Division` 8) (fun _ -> len128x6 + len128 + 1) (fun _ -> len128x6 + len128) in label va_range1 "***** POSTCONDITION NOT MET AT line 434 column 77 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (Vale.AES.GCTR.gctr_partial alg cipher_bound plain_in cipher_out key ctr_BE_2) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 438 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let (length_quad:quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (Vale.Def.Types_s.insert_nat64 (Vale.Def.Types_s.insert_nat64 (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0) (8 `op_Multiply` va_get_reg64 rRsi va_s0) 1) (8 `op_Multiply` plain_num_bytes) 0) in label va_range1 "***** POSTCONDITION NOT MET AT line 440 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let (raw_auth_quads:(seq quad32)) = va_if (va_get_reg64 rRsi va_s0 > va_get_reg64 rRdx va_s0 `op_Multiply` 128 `op_Division` 8) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) auth_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 7 va_s0) abytes_b)) (fun _ -> Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) auth_b) in label va_range1 "***** POSTCONDITION NOT MET AT line 444 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let (auth_input_bytes:(seq nat8)) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads) 0 (va_get_reg64 rRsi va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 445 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let (padded_auth_bytes:(seq nat8)) = Vale.AES.GCTR_s.pad_to_128_bits auth_input_bytes in label va_range1 "***** POSTCONDITION NOT MET AT line 446 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let (auth_quad_seq:(seq quad32)) = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_auth_bytes in label va_range1 "***** POSTCONDITION NOT MET AT line 448 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let (raw_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32 (FStar.Seq.Base.append #quad32 auth_quad_seq (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b) in label va_range1 "***** POSTCONDITION NOT MET AT line 452 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let (total_bytes:nat) = FStar.Seq.Base.length #quad32 auth_quad_seq `op_Multiply` 16 + plain_num_bytes in label va_range1 "***** POSTCONDITION NOT MET AT line 453 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let (raw_quad_seq:(seq quad32)) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128 `op_Division` 8) (fun _ -> let (ab:(seq nat8)) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes (FStar.Seq.Base.append #quad32 raw_quad_seq (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b))) 0 total_bytes in let (pb:(seq nat8)) = Vale.AES.GCTR_s.pad_to_128_bits ab in Vale.Def.Types_s.le_bytes_to_seq_quad32 pb) (fun _ -> raw_quad_seq) in label va_range1 "***** POSTCONDITION NOT MET AT line 460 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let (auth_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32 raw_quad_seq (FStar.Seq.Base.create #quad32 1 length_quad) in label va_range1 "***** POSTCONDITION NOT MET AT line 461 column 106 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_get_xmm 8 va_sM == Vale.AES.GCTR_s.gctr_encrypt_block ctr_BE_1 (Vale.AES.GHash_s.ghash_LE h_LE auth_quad_seq) alg key 0)))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM)
{ "file_name": "obj/Vale.AES.X64.GCMdecryptOpt.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 16, "end_line": 1117, "start_col": 0, "start_line": 987 }
module Vale.AES.X64.GCMdecryptOpt open Vale.Def.Prop_s open Vale.Def.Opaque_s open FStar.Seq open Vale.Def.Words_s open Vale.Def.Words.Seq_s open Vale.Def.Types_s open Vale.Arch.Types open Vale.Arch.HeapImpl open Vale.AES.AES_s open Vale.AES.GCTR_s open Vale.AES.GCTR open Vale.AES.GCM open Vale.AES.GHash_s open Vale.AES.GHash open Vale.AES.GCM_s open Vale.AES.X64.AES open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.Poly1305.Math open Vale.AES.GCM_helpers open Vale.AES.X64.GHash open Vale.AES.X64.GCTR open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.Stack_i open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsVector open Vale.X64.InsStack open Vale.X64.InsAes open Vale.X64.QuickCode open Vale.X64.QuickCodes open Vale.AES.X64.GF128_Mul open Vale.X64.Stack open Vale.X64.CPU_Features_s open Vale.Math.Poly2.Bits_s open Vale.AES.X64.AESopt open Vale.AES.X64.AESGCM open Vale.AES.X64.AESopt2 open Vale.Lib.Meta open Vale.AES.X64.GCMencryptOpt open Vale.AES.OptPublic open Vale.Lib.Basic #reset-options "--z3rlimit 20 --max_ifuel 0" //-- Gcm_extra_bytes val va_code_Gcm_extra_bytes : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gcm_extra_bytes alg = (va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_Ghash_extra_bytes ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_CCons (va_code_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_CCons (va_code_AESEncryptBlock alg) (va_CCons (va_code_Pxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret) (va_CNil ())))))))))) val va_codegen_success_Gcm_extra_bytes : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gcm_extra_bytes alg = (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Ghash_extra_bytes ()) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_pbool_and (va_codegen_success_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_pbool_and (va_codegen_success_AESEncryptBlock alg) (va_pbool_and (va_codegen_success_Pxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret) (va_ttrue ()))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Gcm_extra_bytes (va_mods:va_mods_t) (alg:algorithm) (inout_b:buffer128) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat) (old_hash:quad32) (completed_quads:(seq quad32)) (h_LE:quad32) : (va_quickCode unit (va_code_Gcm_extra_bytes alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (len:(va_int_range 1 1)) = 1 in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 188 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRax) 0 Secret inout_b 0) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 189 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (fun (va_s:va_state) _ -> let (hash_input:quad32) = va_get_xmm 0 va_s in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 193 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Ghash_extra_bytes hkeys_b total_bytes old_hash h_LE completed_quads) (fun (va_s:va_state) _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 194 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (FStar.Seq.Base.equal #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s) inout_b) (FStar.Seq.Base.create #quad32 1 hash_input)) (let (snap:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s) inout_b in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 198 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 199 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 200 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_AESEncryptBlock alg (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 11 va_s)) key round_keys keys_b) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (fun (_:unit) -> Vale.AES.AES_s.aes_encrypt_LE_reveal ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 204 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Pxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 205 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret inout_b 0) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 207 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (fun (_:unit) -> Vale.AES.GCTR.gctr_partial_reveal ()) (va_QEmpty (())))))))))))))) val va_lemma_Gcm_extra_bytes : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> inout_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> total_bytes:nat -> old_hash:quad32 -> completed_quads:(seq quad32) -> h_LE:quad32 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gcm_extra_bytes alg) va_s0 /\ va_get_ok va_s0 /\ (let (len:(va_int_range 1 1)) = 1 in sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b inout_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b inout_b /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) (va_get_reg64 rRax va_s0) inout_b len (va_get_mem_layout va_s0) Secret /\ len == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 inout_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ va_get_xmm 8 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental0 h_LE old_hash completed_quads) /\ FStar.Seq.Base.length #quad32 completed_quads == total_bytes `op_Division` 16 /\ total_bytes < 16 `op_Multiply` FStar.Seq.Base.length #quad32 completed_quads + 16 /\ va_get_reg64 rR10 va_s0 == total_bytes `op_Modulus` 16 /\ total_bytes `op_Modulus` 16 =!= 0 /\ (0 < total_bytes /\ total_bytes < 16 `op_Multiply` Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes) /\ 16 `op_Multiply` (Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes - 1) < total_bytes))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let (len:(va_int_range 1 1)) = 1 in Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.AES.GCTR.gctr_partial alg len (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0) /\ (let raw_quads = FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) in let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in let padded_bytes = Vale.AES.GCTR_s.pad_to_128_bits input_bytes in let input_quads = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in l_and (FStar.Seq.Base.length #Vale.Def.Types_s.quad32 input_quads > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads))) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 5 va_sM (va_update_xmm 10 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRcx va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Gcm_extra_bytes va_b0 va_s0 alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash completed_quads h_LE = let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Gcm_extra_bytes va_mods alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash completed_quads h_LE in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_extra_bytes alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 121 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_get_ok va_sM) /\ (let (len:(va_int_range 1 1)) = 1 in label va_range1 "***** POSTCONDITION NOT MET AT line 174 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 177 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (Vale.AES.GCTR.gctr_partial alg len (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let raw_quads = FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) in label va_range1 "***** POSTCONDITION NOT MET AT line 181 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in label va_range1 "***** POSTCONDITION NOT MET AT line 182 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let padded_bytes = Vale.AES.GCTR_s.pad_to_128_bits input_bytes in label va_range1 "***** POSTCONDITION NOT MET AT line 183 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let input_quads = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in label va_range1 "***** POSTCONDITION NOT MET AT line 186 column 59 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (l_and (FStar.Seq.Base.length #Vale.Def.Types_s.quad32 input_quads > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads)))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Gcm_extra_bytes (alg:algorithm) (inout_b:buffer128) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat) (old_hash:quad32) (completed_quads:(seq quad32)) (h_LE:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (let (len:(va_int_range 1 1)) = 1 in sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b inout_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b inout_b /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) (va_get_reg64 rRax va_s0) inout_b len (va_get_mem_layout va_s0) Secret /\ len == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 inout_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ va_get_xmm 8 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental0 h_LE old_hash completed_quads) /\ FStar.Seq.Base.length #quad32 completed_quads == total_bytes `op_Division` 16 /\ total_bytes < 16 `op_Multiply` FStar.Seq.Base.length #quad32 completed_quads + 16 /\ va_get_reg64 rR10 va_s0 == total_bytes `op_Modulus` 16 /\ total_bytes `op_Modulus` 16 =!= 0 /\ (0 < total_bytes /\ total_bytes < 16 `op_Multiply` Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes) /\ 16 `op_Multiply` (Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes - 1) < total_bytes) /\ (forall (va_x_mem:vale_heap) (va_x_rcx:nat64) (va_x_r11:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm10:quad32) (va_x_heap5:vale_heap) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 5 va_x_heap5 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRcx va_x_rcx (va_upd_mem va_x_mem va_s0)))))))))))))) in va_get_ok va_sM /\ (let (len:(va_int_range 1 1)) = 1 in Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.AES.GCTR.gctr_partial alg len (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0) /\ (let raw_quads = FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) in let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in let padded_bytes = Vale.AES.GCTR_s.pad_to_128_bits input_bytes in let input_quads = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in l_and (FStar.Seq.Base.length #Vale.Def.Types_s.quad32 input_quads > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads))) ==> va_k va_sM (()))) val va_wpProof_Gcm_extra_bytes : alg:algorithm -> inout_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> total_bytes:nat -> old_hash:quad32 -> completed_quads:(seq quad32) -> h_LE:quad32 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash completed_quads h_LE va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_extra_bytes alg) ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash completed_quads h_LE va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gcm_extra_bytes (va_code_Gcm_extra_bytes alg) va_s0 alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash completed_quads h_LE in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 5 va_sM (va_update_xmm 10 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRcx va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Gcm_extra_bytes (alg:algorithm) (inout_b:buffer128) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat) (old_hash:quad32) (completed_quads:(seq quad32)) (h_LE:quad32) : (va_quickCode unit (va_code_Gcm_extra_bytes alg)) = (va_QProc (va_code_Gcm_extra_bytes alg) ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_mem]) (va_wp_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash completed_quads h_LE) (va_wpProof_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash completed_quads h_LE)) //-- //-- Gcm_blocks128 val va_code_Gcm_blocks128 : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gcm_blocks128 alg = (va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax)) (va_CCons (va_code_Ghash_buffer ()) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRbx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR12)) (va_CCons (va_code_Gctr_blocks128 alg) (va_CNil ()))))))))) val va_codegen_success_Gcm_blocks128 : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gcm_blocks128 alg = (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax)) (va_pbool_and (va_codegen_success_Ghash_buffer ()) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR12)) (va_pbool_and (va_codegen_success_Gctr_blocks128 alg) (va_ttrue ())))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Gcm_blocks128 (va_mods:va_mods_t) (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (h_LE:quad32) : (va_quickCode unit (va_code_Gcm_blocks128 alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 274 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 275 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 276 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 277 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Ghash_buffer hkeys_b in_b h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_old_s))) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 278 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRbx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 279 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR12)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 280 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Gctr_blocks128 alg in_b out_b key round_keys keys_b) (va_QEmpty (())))))))))) val va_lemma_Gcm_blocks128 : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> h_LE:quad32 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gcm_blocks128 alg) va_s0 /\ va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b out_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b out_b /\ (Vale.X64.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRax va_s0) in_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) out_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRax va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ l_and (Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out_b) (Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b < pow2_32) /\ va_get_reg64 rRdx va_s0 == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ va_get_reg64 rRdx va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0) Secret))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key (va_get_xmm 11 va_s0) /\ va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0) (va_get_reg64 rRdx va_s0) /\ (va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM == va_get_xmm 8 va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) /\ (va_get_reg64 rRdx va_s0 > 0 ==> l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==> FStar.Seq.Base.length #Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)))) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 1 va_sM (va_update_xmm 10 va_sM (va_update_xmm 11 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRbx va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Gcm_blocks128 va_b0 va_s0 alg in_b out_b key round_keys keys_b hkeys_b h_LE = let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Gcm_blocks128 va_mods alg in_b out_b key round_keys keys_b hkeys_b h_LE in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_blocks128 alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 210 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 255 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 261 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key (va_get_xmm 11 va_s0)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 262 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0) (va_get_reg64 rRdx va_s0)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 265 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM == va_get_xmm 8 va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 267 column 131 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_get_reg64 rRdx va_s0 > 0 ==> l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==> FStar.Seq.Base.length #Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Gcm_blocks128 (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (h_LE:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b out_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b out_b /\ (Vale.X64.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRax va_s0) in_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) out_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRax va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ l_and (Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out_b) (Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b < pow2_32) /\ va_get_reg64 rRdx va_s0 == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ va_get_reg64 rRdx va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0) Secret) /\ (forall (va_x_mem:vale_heap) (va_x_rbx:nat64) (va_x_rdi:nat64) (va_x_r11:nat64) (va_x_r10:nat64) (va_x_rdx:nat64) (va_x_r12:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm11:quad32) (va_x_xmm10:quad32) (va_x_heap1:vale_heap) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rR10 va_x_r10 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRdi va_x_rdi (va_upd_reg64 rRbx va_x_rbx (va_upd_mem va_x_mem va_s0))))))))))))))))))) in va_get_ok va_sM /\ (Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key (va_get_xmm 11 va_s0) /\ va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0) (va_get_reg64 rRdx va_s0) /\ (va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM == va_get_xmm 8 va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) /\ (va_get_reg64 rRdx va_s0 > 0 ==> l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==> FStar.Seq.Base.length #Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)))) ==> va_k va_sM (()))) val va_wpProof_Gcm_blocks128 : alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> h_LE:quad32 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_blocks128 alg) ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gcm_blocks128 (va_code_Gcm_blocks128 alg) va_s0 alg in_b out_b key round_keys keys_b hkeys_b h_LE in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 1 va_sM (va_update_xmm 10 va_sM (va_update_xmm 11 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRbx va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Gcm_blocks128 (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (h_LE:quad32) : (va_quickCode unit (va_code_Gcm_blocks128 alg)) = (va_QProc (va_code_Gcm_blocks128 alg) ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_mem]) (va_wp_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE) (va_wpProof_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE)) //-- //-- Gcm_blocks #push-options "--z3rlimit 1000" val va_code_Gcm_blocks : alg:algorithm -> offset:int -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gcm_blocks alg offset = (va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR13) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_AddLea64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rR9) (va_const_opr64 32)) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRbx) (va_op_reg_opr64_reg64 rRsp) (offset + 0)) (va_CCons (va_code_Gcm_blocks_auth ()) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 8)) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRsi) (va_op_reg_opr64_reg64 rRsp) (offset + 16)) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp) (offset + 24)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR13)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 2) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rR8) 0 Public) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 0 Secret) (va_CCons (va_code_Load_one_lsb (va_op_xmm_xmm 10)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 10)) (va_CCons (va_code_AES_GCM_decrypt_6mult alg) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 11) (va_op_reg_opr64_reg64 rRbp) 32 Secret) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp) (offset + 32)) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 40)) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp) (offset + 48)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_InitPshufbMask (va_op_xmm_xmm 9) (va_op_reg_opr64_reg64 rR12)) (va_CCons (va_code_Pshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 9)) (va_CCons (va_code_Gcm_blocks128 alg) (va_CCons (va_code_Stack_lemma ()) (va_CCons (va_code_Add64 (va_op_dst_opr64_reg64 rR14) (va_opr_code_Stack (va_op_reg64_reg64 rRsp) (offset + 24) Public)) (va_CCons (va_code_IMul64 (va_op_dst_opr64_reg64 rR14) (va_const_opr64 16)) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rRsp) (offset + 64)) (va_CCons (va_IfElse (va_cmp_gt (va_op_cmp_reg64 rR13) (va_op_cmp_reg64 rR14)) (va_Block (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp) (offset + 56)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rR13)) (va_CCons (va_code_And64 (va_op_dst_opr64_reg64 rR10) (va_const_opr64 15)) (va_CCons (va_code_Gcm_extra_bytes alg) (va_CCons (va_Block (va_CNil ())) (va_CNil ()))))))) (va_Block (va_CNil ()))) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_Gcm_make_length_quad ()) (va_CCons (va_code_Ghash_register ()) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRbp) 0 Secret) (va_CCons (va_code_Gctr_register alg) (va_CCons (va_Block (va_CNil ())) (va_CNil ())))))))))))))))))))))))))))))))))))) val va_codegen_success_Gcm_blocks : alg:algorithm -> offset:int -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gcm_blocks alg offset = (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR13) (va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_AddLea64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rR9) (va_const_opr64 32)) (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRbx) (va_op_reg_opr64_reg64 rRsp) (offset + 0)) (va_pbool_and (va_codegen_success_Gcm_blocks_auth ()) (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 8)) (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRsi) (va_op_reg_opr64_reg64 rRsp) (offset + 16)) (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp) (offset + 24)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 2) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rR8) 0 Public) (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 0 Secret) (va_pbool_and (va_codegen_success_Load_one_lsb (va_op_xmm_xmm 10)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 10)) (va_pbool_and (va_codegen_success_AES_GCM_decrypt_6mult alg) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 11) (va_op_reg_opr64_reg64 rRbp) 32 Secret) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp) (offset + 32)) (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 40)) (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp) (offset + 48)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_InitPshufbMask (va_op_xmm_xmm 9) (va_op_reg_opr64_reg64 rR12)) (va_pbool_and (va_codegen_success_Pshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 9)) (va_pbool_and (va_codegen_success_Gcm_blocks128 alg) (va_pbool_and (va_codegen_success_Stack_lemma ()) (va_pbool_and (va_codegen_success_Add64 (va_op_dst_opr64_reg64 rR14) (va_opr_code_Stack (va_op_reg64_reg64 rRsp) (offset + 24) Public)) (va_pbool_and (va_codegen_success_IMul64 (va_op_dst_opr64_reg64 rR14) (va_const_opr64 16)) (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rRsp) (offset + 64)) (va_pbool_and (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp) (offset + 56)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_And64 (va_op_dst_opr64_reg64 rR10) (va_const_opr64 15)) (va_codegen_success_Gcm_extra_bytes alg)))) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Gcm_make_length_quad ()) (va_pbool_and (va_codegen_success_Ghash_register ()) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRbp) 0 Secret) (va_pbool_and (va_codegen_success_Gctr_register alg) (va_ttrue ())))))))))))))))))))))))))))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Gcm_blocks (va_mods:va_mods_t) (alg:algorithm) (offset:int) (auth_b:buffer128) (abytes_b:buffer128) (in128x6_b:buffer128) (out128x6_b:buffer128) (in128_b:buffer128) (out128_b:buffer128) (inout_b:buffer128) (iv_b:buffer128) (scratch_b:buffer128) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) : (va_quickCode unit (va_code_Gcm_blocks alg offset)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 0) (va_get_stack va_s) in let (in128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 8) (va_get_stack va_s) in let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 16) (va_get_stack va_s) in let (len128x6:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 24) (va_get_stack va_s) in let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 32) (va_get_stack va_s) in let (out128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 40) (va_get_stack va_s) in let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 48) (va_get_stack va_s) in let (inout_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 56) (va_get_stack va_s) in let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 64) (va_get_stack va_s) in let (h_LE:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 0 va_old_s)) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 463 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR13) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 464 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_AddLea64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rR9) (va_const_opr64 32)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 465 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load64_stack (va_op_dst_opr64_reg64 rRbx) (va_op_reg_opr64_reg64 rRsp) (offset + 0)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 466 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Gcm_blocks_auth auth_b abytes_b hkeys_b h_LE) (fun (va_s:va_state) (auth_quad_seq:(seq quad32)) -> let (y_0:quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0 in let (y_auth_bytes:quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 473 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 8)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 474 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load64_stack (va_op_dst_opr64_reg64 rRsi) (va_op_reg_opr64_reg64 rRsp) (offset + 16)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 475 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp) (offset + 24)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 476 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR13)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 477 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (fun (va_s:va_state) _ -> let (iv_BE:Vale.X64.Decls.quad32) = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_old_s) in let (ctr_BE_1:quad32) = iv_BE in let (ctr_BE_2:quad32) = Vale.AES.GCTR_s.inc32 iv_BE 1 in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 483 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 2) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rR8) 0 Public iv_b 0) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 485 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 0 Secret scratch_b 0) (fun (va_s:va_state) _ -> let (j0:quad32) = va_get_xmm 1 va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 487 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load_one_lsb (va_op_xmm_xmm 10)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 489 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 10)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 491 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_AES_GCM_decrypt_6mult alg h_LE iv_b in128x6_b out128x6_b scratch_b key round_keys keys_b hkeys_b) (fun (va_s:va_state) _ -> let (y_cipher128x6:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s) in let (auth_in:(seq quad32)) = auth_quad_seq in let (va_arg138:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b in let (va_arg137:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = auth_in in let (va_arg136:Vale.Def.Types_s.quad32) = y_auth_bytes in let (va_arg135:Vale.Def.Types_s.quad32) = y_0 in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 494 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (fun (_:unit) -> Vale.AES.GHash.lemma_ghash_incremental0_append h_LE va_arg135 va_arg136 y_cipher128x6 va_arg137 va_arg138) (let auth_in = FStar.Seq.Base.append #quad32 auth_in (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 498 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 11) (va_op_reg_opr64_reg64 rRbp) 32 Secret scratch_b 2) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 499 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 500 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp) (offset + 32)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 501 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 40)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 502 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp) (offset + 48)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 503 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 504 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_InitPshufbMask (va_op_xmm_xmm 9) (va_op_reg_opr64_reg64 rR12)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 505 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Pshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 9)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 506 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Gcm_blocks128 alg in128_b out128_b key round_keys keys_b hkeys_b h_LE) (fun (va_s:va_state) _ -> let (y_cipher128:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s) in let (va_arg134:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in128_b in let (va_arg133:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = auth_in in let (va_arg132:Vale.Def.Types_s.quad32) = y_0 in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 508 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (fun (_:unit) -> Vale.AES.GHash.lemma_ghash_incremental0_append h_LE va_arg132 y_cipher128x6 y_cipher128 va_arg133 va_arg134) (let auth_in = FStar.Seq.Base.append #quad32 auth_in (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in128_b) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 512 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Stack_lemma (va_op_reg64_reg64 rRsp) (offset + 24) Public) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 512 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Add64 (va_op_dst_opr64_reg64 rR14) (va_opr_code_Stack (va_op_reg64_reg64 rRsp) (offset + 24) Public)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 513 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_IMul64 (va_op_dst_opr64_reg64 rR14) (va_const_opr64 16)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 514 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load64_stack (va_op_dst_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rRsp) (offset + 64)) (fun (va_s:va_state) _ -> let (y_inout:Vale.Def.Types_s.quad32) = y_cipher128 in let (plain_byte_seq:(seq quad32)) = empty_seq_quad32 in let (cipher_byte_seq:(seq quad32)) = empty_seq_quad32 in let (va_arg131:Vale.Def.Types_s.quad32) = va_get_xmm 11 va_s in let (va_arg130:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = key in let (va_arg129:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = cipher_byte_seq in let (va_arg128:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = plain_byte_seq in let (va_arg127:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 519 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (fun (_:unit) -> Vale.AES.GCTR.gctr_partial_opaque_init va_arg127 va_arg128 va_arg129 va_arg130 va_arg131) (let (total_bytes:(va_int_at_least 0)) = FStar.Seq.Base.length #quad32 auth_quad_seq `op_Multiply` 16 + plain_num_bytes in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 523 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_qIf va_mods (Cmp_gt (va_op_cmp_reg64 rR13) (va_op_cmp_reg64 rR14)) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 525 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp) (offset + 56)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 526 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rR13)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 527 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (fun (_:unit) -> Vale.Poly1305.Math.lemma_poly_bits64 ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 528 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_And64 (va_op_dst_opr64_reg64 rR10) (va_const_opr64 15)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 532 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes y_0 auth_in h_LE) (fun (va_s:va_state) _ -> let y_inout = Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s) in let (raw_auth_quads:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.append #quad32 auth_in (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_old_s) inout_b) in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 536 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let (j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908 j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907)))) Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads) 0 total_bytes) (fun _ -> let (auth_input_bytes:(FStar.Seq.Base.seq Vale.Def.Types_s.nat8)) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads) 0 total_bytes in let (padded_auth_bytes:(FStar.Seq.Base.seq Vale.Def.Types_s.nat8)) = Vale.AES.GCTR_s.pad_to_128_bits auth_input_bytes in let auth_in = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_auth_bytes in let plain_byte_seq = Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_old_s) inout_b in let cipher_byte_seq = Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s) inout_b in va_QEmpty ((auth_in, cipher_byte_seq, plain_byte_seq, y_inout)))))))))) (qblock va_mods (fun (va_s:va_state) -> va_QEmpty ((auth_in, cipher_byte_seq, plain_byte_seq, y_inout))))) (fun (va_s:va_state) va_g -> let ((auth_in:(seq quad32)), (cipher_byte_seq:(seq quad32)), (plain_byte_seq:(seq quad32)), (y_inout:Vale.Def.Types_s.quad32)) = va_g in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 547 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64 rR15)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 548 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Gcm_make_length_quad ()) (fun (va_s:va_state) _ -> let (length_quad32:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s) in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 551 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Ghash_register hkeys_b h_LE y_inout) (fun (va_s:va_state) _ -> let (y_final:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 554 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRbp) 0 Secret scratch_b 0) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 557 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Gctr_register alg key round_keys keys_b) (fun (va_s:va_state) _ -> let (va_arg126:Vale.Def.Types_s.quad32) = va_get_xmm 8 va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 560 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (fun (_:unit) -> Vale.Arch.Types.le_seq_quad32_to_bytes_of_singleton va_arg126) (va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 561 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ((fun (icb_BE_677:Vale.Def.Types_s.quad32) (plain_LE_678:Vale.Def.Types_s.quad32) (alg_679:Vale.AES.AES_common_s.algorithm) (key_680:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) (i_681:Prims.int) -> Vale.AES.AES_s.is_aes_key_LE alg_679 key_680) j0 y_final alg key 0) (fun _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 561 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_get_xmm 8 va_s == Vale.AES.GCTR_s.gctr_encrypt_block j0 y_final alg key 0) (let (plain128:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) = FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in128_b) in let (cipher128:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) = FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) in128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s) in128_b) in va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 566 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (FStar.Seq.Base.length #quad32 plain_byte_seq == 0 ==> FStar.Seq.Base.equal #Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 plain128 plain_byte_seq) plain128) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 567 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (FStar.Seq.Base.length #quad32 cipher_byte_seq == 0 ==> FStar.Seq.Base.equal #Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 cipher128 cipher_byte_seq) cipher128) (let (va_arg125:Vale.Def.Types_s.quad32) = Vale.AES.GCTR.inc32lite ctr_BE_2 len128x6 in let (va_arg124:Vale.Def.Types_s.quad32) = ctr_BE_2 in let (va_arg123:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = key in let (va_arg122:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s) out128_b in let (va_arg121:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in128_b in let (va_arg120:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) out128x6_b in let (va_arg119:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b in let (va_arg118:Prims.nat) = len128 in let (va_arg117:Prims.nat) = len128x6 in let (va_arg116:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 569 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (fun (_:unit) -> Vale.AES.GCTR.lemma_gctr_partial_append va_arg116 va_arg117 va_arg118 va_arg119 va_arg120 va_arg121 va_arg122 va_arg123 va_arg124 va_arg125) (let (va_arg115:Vale.Def.Types_s.quad32) = Vale.AES.GCTR.inc32lite (Vale.AES.GCTR.inc32lite ctr_BE_2 len128x6) len128 in let (va_arg114:Vale.Def.Types_s.quad32) = ctr_BE_2 in let (va_arg113:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = key in let (va_arg112:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = cipher_byte_seq in let (va_arg111:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = plain_byte_seq in let (va_arg110:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s) out128_b) in let (va_arg109:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in128_b) in let (va_arg108:Prims.nat) = FStar.Seq.Base.length #quad32 plain_byte_seq in let (va_arg107:Prims.nat) = len128x6 + len128 in let (va_arg106:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 575 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (fun (_:unit) -> Vale.AES.GCTR.lemma_gctr_partial_append va_arg106 va_arg107 va_arg108 va_arg109 va_arg110 va_arg111 va_arg112 va_arg113 va_arg114 va_arg115) (let (va_arg105:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = auth_in in let (va_arg104:Vale.Def.Types_s.quad32) = y_0 in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 583 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (fun (_:unit) -> Vale.AES.GHash.lemma_hash_append2 h_LE va_arg104 y_inout y_final va_arg105 length_quad32) (let auth_in = FStar.Seq.Base.append #quad32 auth_in (FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1 length_quad32) in let (va_arg103:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = auth_in in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 585 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (fun (_:unit) -> Vale.AES.GHash.ghash_incremental_to_ghash h_LE va_arg103) (va_QEmpty (())))))))))))))))))))))))))))))))))))))))))))))))) val va_lemma_Gcm_blocks : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> offset:int -> auth_b:buffer128 -> abytes_b:buffer128 -> in128x6_b:buffer128 -> out128x6_b:buffer128 -> in128_b:buffer128 -> out128_b:buffer128 -> inout_b:buffer128 -> iv_b:buffer128 -> scratch_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gcm_blocks alg offset) va_s0 /\ va_get_ok va_s0 /\ (let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0) in let (in128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) in let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack va_s0) in let (len128x6:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) in let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack va_s0) in let (out128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) in let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack va_s0) in let (inout_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) in let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack va_s0) in let (h_LE:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 0 va_s0)) in sse_enabled /\ movbe_enabled /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) auth_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 7 va_s0) abytes_ptr abytes_b 1 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8 va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 6 va_s0) in128x6_ptr in128x6_b len128x6 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 6 va_s0) out128x6_ptr out128x6_b len128x6 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) in128_ptr in128_b len128 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) out128_ptr out128_b len128 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) inout_ptr inout_b 1 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0) hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_disjoints128 iv_b ([keys_b; scratch_b; in128x6_b; out128x6_b; hkeys_b; in128_b; out128_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 scratch_b ([keys_b; in128x6_b; out128x6_b; in128_b; out128_b; inout_b; hkeys_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128x6_b ([keys_b; hkeys_b; in128_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128_b ([keys_b; hkeys_b; out128x6_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 inout_b ([keys_b; hkeys_b; out128x6_b; out128_b]) /\ (Vale.X64.Decls.buffers_disjoint128 in128x6_b out128x6_b \/ in128x6_b == out128x6_b) /\ (Vale.X64.Decls.buffers_disjoint128 in128_b out128_b \/ in128_b == out128_b) /\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ in128x6_ptr + 16 `op_Multiply` len128x6 < pow2_64 /\ out128x6_ptr + 16 `op_Multiply` len128x6 < pow2_64 /\ in128_ptr + 16 `op_Multiply` len128 < pow2_64 /\ out128_ptr + 16 `op_Multiply` len128 < pow2_64 /\ inout_ptr + 16 < pow2_64 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 auth_b == va_get_reg64 rRdx va_s0 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 abytes_b == 1 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128x6_b == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out128x6_b /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out128_b /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128x6_b == len128x6 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b == len128 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 inout_b == 1 /\ plain_num_bytes < pow2_32 /\ va_get_reg64 rRsi va_s0 < pow2_32 /\ va_get_reg64 rR9 va_s0 + 32 < pow2_64 /\ Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint128 keys_b (va_get_mem_heaplet 0 va_s0) + 128 < pow2_64 /\ len128x6 `op_Modulus` 6 == 0 /\ (len128x6 > 0 ==> len128x6 >= 6) /\ 12 + len128x6 + 6 < pow2_32 /\ (va_mul_nat len128x6 (128 `op_Division` 8) + va_mul_nat len128 (128 `op_Division` 8) <= plain_num_bytes /\ plain_num_bytes < va_mul_nat len128x6 (128 `op_Division` 8) + va_mul_nat len128 (128 `op_Division` 8) + 128 `op_Division` 8) /\ (va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) <= va_get_reg64 rRsi va_s0 /\ va_get_reg64 rRsi va_s0 < va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) + 128 `op_Division` 8) /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rRcx va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.AES_s.aes_encrypt_LE alg key (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0)))))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0) in let (in128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) in let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack va_s0) in let (len128x6:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) in let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack va_s0) in let (out128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) in let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack va_s0) in let (inout_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) in let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack va_s0) in let (h_LE:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 0 va_s0)) in Vale.X64.Decls.modifies_buffer128 out128_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.X64.Decls.modifies_buffer128 iv_b (va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) /\ Vale.X64.Decls.modifies_buffer128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) /\ Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.X64.Decls.modifies_buffer128 out128x6_b (va_get_mem_heaplet 6 va_s0) (va_get_mem_heaplet 6 va_sM) /\ plain_num_bytes < pow2_32 /\ va_get_reg64 rRsi va_s0 < pow2_32 /\ (let iv_BE = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_s0) in let (ctr_BE_1:quad32) = iv_BE in let (ctr_BE_2:quad32) = Vale.AES.GCTR_s.inc32 iv_BE 1 in let (plain_in:(seq quad32)) = (if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128 `op_Division` 8) then FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) else FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b)) in let (cipher_out:(seq quad32)) = (if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128 `op_Division` 8) then FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out128_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) else FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out128_b)) in let (cipher_bound:nat) = (if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128 `op_Division` 8) then (len128x6 + len128 + 1) else (len128x6 + len128)) in Vale.AES.GCTR.gctr_partial alg cipher_bound plain_in cipher_out key ctr_BE_2 /\ (let (length_quad:quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (Vale.Def.Types_s.insert_nat64 (Vale.Def.Types_s.insert_nat64 (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0) (8 `op_Multiply` va_get_reg64 rRsi va_s0) 1) (8 `op_Multiply` plain_num_bytes) 0) in let (raw_auth_quads:(seq quad32)) = (if (va_get_reg64 rRsi va_s0 > va_get_reg64 rRdx va_s0 `op_Multiply` 128 `op_Division` 8) then FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) auth_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 7 va_s0) abytes_b) else Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) auth_b) in let (auth_input_bytes:(seq nat8)) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads) 0 (va_get_reg64 rRsi va_s0) in let (padded_auth_bytes:(seq nat8)) = Vale.AES.GCTR_s.pad_to_128_bits auth_input_bytes in let (auth_quad_seq:(seq quad32)) = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_auth_bytes in let (raw_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32 (FStar.Seq.Base.append #quad32 auth_quad_seq (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b) in let (total_bytes:nat) = FStar.Seq.Base.length #quad32 auth_quad_seq `op_Multiply` 16 + plain_num_bytes in let (raw_quad_seq:(seq quad32)) = (if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128 `op_Division` 8) then (let (ab:(seq nat8)) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes (FStar.Seq.Base.append #quad32 raw_quad_seq (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b))) 0 total_bytes in let (pb:(seq nat8)) = Vale.AES.GCTR_s.pad_to_128_bits ab in Vale.Def.Types_s.le_bytes_to_seq_quad32 pb) else raw_quad_seq) in let (auth_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32 raw_quad_seq (FStar.Seq.Base.create #quad32 1 length_quad) in va_get_xmm 8 va_sM == Vale.AES.GCTR_s.gctr_encrypt_block ctr_BE_1 (Vale.AES.GHash_s.ghash_LE h_LE auth_quad_seq) alg key 0))) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 6 va_sM (va_update_mem_heaplet 5 va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM (va_update_mem_heaplet 1 va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))))))))))))))))))
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Stack.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsVector.fsti.checked", "Vale.X64.InsStack.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.InsAes.fsti.checked", "Vale.X64.Flags.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Poly1305.Math.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Lib.Meta.fsti.checked", "Vale.Lib.Basic.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.AES.X64.GHash.fsti.checked", "Vale.AES.X64.GF128_Mul.fsti.checked", "Vale.AES.X64.GCTR.fsti.checked", "Vale.AES.X64.GCMencryptOpt.fsti.checked", "Vale.AES.X64.AESopt2.fsti.checked", "Vale.AES.X64.AESopt.fsti.checked", "Vale.AES.X64.AESGCM.fsti.checked", "Vale.AES.X64.AES.fsti.checked", "Vale.AES.OptPublic.fsti.checked", "Vale.AES.GHash_s.fst.checked", "Vale.AES.GHash.fsti.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "Vale.AES.GCTR_s.fst.checked", "Vale.AES.GCTR.fsti.checked", "Vale.AES.GCM_s.fst.checked", "Vale.AES.GCM_helpers.fsti.checked", "Vale.AES.GCM.fsti.checked", "Vale.AES.AES_s.fst.checked", "Vale.AES.AES_common_s.fst.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.X64.GCMdecryptOpt.fst" }
[ { "abbrev": false, "full_module": "Vale.Lib.Basic", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.OptPublic", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.GCMencryptOpt", "short_module": null }, { "abbrev": false, "full_module": "Vale.Lib.Meta", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.AESopt2", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.AESGCM", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.AESopt", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Stack", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.GF128_Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsAes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.GCTR", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.GHash", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCM_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.Poly1305.Math", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCM_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCM", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCTR", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCTR_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.AES_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.OptPublic", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.GCMencryptOpt", "short_module": null }, { "abbrev": false, "full_module": "Vale.Lib.Meta", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.AESopt2", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.AESGCM", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.AESopt", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Stack", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.GF128_Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsAes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.GCTR", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.GHash", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCM_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.Poly1305.Math", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCM_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCM", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCTR", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCTR_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.AES_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 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": 1000, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_b0: Vale.X64.Decls.va_code -> va_s0: Vale.X64.Decls.va_state -> alg: Vale.AES.AES_common_s.algorithm -> offset: Prims.int -> auth_b: Vale.X64.Memory.buffer128 -> abytes_b: Vale.X64.Memory.buffer128 -> in128x6_b: Vale.X64.Memory.buffer128 -> out128x6_b: Vale.X64.Memory.buffer128 -> in128_b: Vale.X64.Memory.buffer128 -> out128_b: Vale.X64.Memory.buffer128 -> inout_b: Vale.X64.Memory.buffer128 -> iv_b: Vale.X64.Memory.buffer128 -> scratch_b: Vale.X64.Memory.buffer128 -> key: FStar.Seq.Base.seq Vale.X64.Memory.nat32 -> round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 -> keys_b: Vale.X64.Memory.buffer128 -> hkeys_b: Vale.X64.Memory.buffer128 -> Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel)
Prims.Ghost
[]
[]
[ "Vale.X64.Decls.va_code", "Vale.X64.Decls.va_state", "Vale.AES.AES_common_s.algorithm", "Prims.int", "Vale.X64.Memory.buffer128", "FStar.Seq.Base.seq", "Vale.X64.Memory.nat32", "Vale.X64.Decls.quad32", "Vale.X64.QuickCodes.fuel", "Prims.unit", "FStar.Pervasives.Native.Mktuple2", "Vale.X64.Decls.va_fuel", "Vale.X64.QuickCode.va_lemma_norm_mods", "Prims.Cons", "Vale.X64.QuickCode.mod_t", "Vale.X64.QuickCode.va_Mod_flags", "Vale.X64.QuickCode.va_Mod_mem_heaplet", "Vale.X64.QuickCode.va_Mod_xmm", "Vale.X64.QuickCode.va_Mod_reg64", "Vale.X64.Machine_s.rR15", "Vale.X64.Machine_s.rR14", "Vale.X64.Machine_s.rR13", "Vale.X64.Machine_s.rR12", "Vale.X64.Machine_s.rR11", "Vale.X64.Machine_s.rR10", "Vale.X64.Machine_s.rR9", "Vale.X64.Machine_s.rR8", "Vale.X64.Machine_s.rRbp", "Vale.X64.Machine_s.rRsi", "Vale.X64.Machine_s.rRdi", "Vale.X64.Machine_s.rRdx", "Vale.X64.Machine_s.rRcx", "Vale.X64.Machine_s.rRbx", "Vale.X64.Machine_s.rRax", "Vale.X64.QuickCode.va_Mod_ok", "Vale.X64.QuickCode.va_Mod_mem", "Prims.Nil", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.list", "Vale.X64.QuickCode.__proj__QProc__item__mods", "Vale.AES.X64.GCMdecryptOpt.va_code_Gcm_blocks", "FStar.Pervasives.Native.tuple2", "FStar.Pervasives.Native.tuple3", "Vale.X64.State.vale_state", "Vale.X64.QuickCodes.va_wp_sound_code_norm", "Prims.l_and", "Vale.X64.QuickCodes.label", "Vale.X64.QuickCodes.va_range1", "Prims.b2t", "Vale.X64.Decls.va_get_ok", "Vale.X64.Decls.modifies_buffer128", "Vale.X64.Decls.va_get_mem_heaplet", "Prims.op_LessThan", "Vale.X64.Machine_s.pow2_32", "Vale.X64.Decls.va_get_reg64", "Vale.AES.GCTR.gctr_partial", "Vale.Def.Types_s.quad32", "Vale.X64.Decls.va_get_xmm", "Vale.AES.GCTR_s.gctr_encrypt_block", "Vale.AES.GHash_s.ghash_LE", "FStar.Seq.Base.append", "FStar.Seq.Base.create", "Vale.X64.Decls.va_if", "Prims.op_GreaterThan", "Prims.op_Division", "Prims.op_Multiply", "Prims.op_Addition", "Vale.Def.Types_s.le_bytes_to_seq_quad32", "Vale.Def.Words_s.nat8", "Vale.AES.GCTR_s.pad_to_128_bits", "FStar.Seq.Base.slice", "Vale.Def.Types_s.nat8", "Vale.Def.Types_s.le_seq_quad32_to_bytes", "Vale.X64.Decls.s128", "Prims.l_not", "Prims.nat", "FStar.Seq.Base.length", "Vale.Def.Types_s.reverse_bytes_quad32", "Vale.Def.Types_s.insert_nat64", "Vale.Def.Words_s.Mkfour", "Vale.Def.Types_s.nat32", "Vale.AES.GCTR_s.inc32", "Vale.X64.Decls.buffer128_read", "Vale.Def.Words_s.nat64", "Vale.X64.Stack_i.load_stack64", "Vale.X64.Machine_s.rRsp", "Vale.X64.Decls.va_get_stack", "Vale.X64.QuickCode.quickCode", "Vale.AES.X64.GCMdecryptOpt.va_qcode_Gcm_blocks" ]
[]
false
false
false
false
false
let va_lemma_Gcm_blocks va_b0 va_s0 alg offset auth_b abytes_b in128x6_b out128x6_b in128_b out128_b inout_b iv_b scratch_b key round_keys keys_b hkeys_b =
let va_mods:va_mods_t = [ va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem ] in let va_qc = va_qcode_Gcm_blocks va_mods alg offset auth_b abytes_b in128x6_b out128x6_b in128_b out128_b inout_b iv_b scratch_b key round_keys keys_b hkeys_b in let va_sM, va_fM, va_g = va_wp_sound_code_norm (va_code_Gcm_blocks alg offset) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 283 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_get_ok va_sM) /\ (let abytes_ptr:Vale.X64.Memory.nat64 = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0) in let in128x6_ptr:Vale.X64.Memory.nat64 = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) in let out128x6_ptr:Vale.X64.Memory.nat64 = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack va_s0) in let len128x6:Vale.X64.Memory.nat64 = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) in let in128_ptr:Vale.X64.Memory.nat64 = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack va_s0) in let out128_ptr:Vale.X64.Memory.nat64 = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) in let len128:Vale.X64.Memory.nat64 = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack va_s0) in let inout_ptr:Vale.X64.Memory.nat64 = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) in let plain_num_bytes:Vale.X64.Memory.nat64 = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack va_s0) in let h_LE:Vale.Def.Types_s.quad32 = Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 0 va_s0)) in label va_range1 "***** POSTCONDITION NOT MET AT line 396 column 56 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (Vale.X64.Decls.modifies_buffer128 out128_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 397 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (Vale.X64.Decls.modifies_buffer128 iv_b (va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 398 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (Vale.X64.Decls.modifies_buffer128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 399 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 400 column 58 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (Vale.X64.Decls.modifies_buffer128 out128x6_b (va_get_mem_heaplet 6 va_s0) (va_get_mem_heaplet 6 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 403 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (plain_num_bytes < pow2_32) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 404 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_get_reg64 rRsi va_s0 < pow2_32) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 406 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let iv_BE = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 408 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let ctr_BE_1:quad32 = iv_BE in label va_range1 "***** POSTCONDITION NOT MET AT line 409 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let ctr_BE_2:quad32 = Vale.AES.GCTR_s.inc32 iv_BE 1 in label va_range1 "***** POSTCONDITION NOT MET AT line 412 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let plain_in:(seq quad32) = va_if (plain_num_bytes > ((len128x6 + len128) `op_Multiply` 128) `op_Division` 8) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b)) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b)) in label va_range1 "***** POSTCONDITION NOT MET AT line 421 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let cipher_out:(seq quad32) = va_if (plain_num_bytes > ((len128x6 + len128) `op_Multiply` 128) `op_Division` 8) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out128_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b)) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) out128x6_b ) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out128_b)) in label va_range1 "***** POSTCONDITION NOT MET AT line 430 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let cipher_bound:nat = va_if (plain_num_bytes > ((len128x6 + len128) `op_Multiply` 128) `op_Division` 8) (fun _ -> len128x6 + len128 + 1) (fun _ -> len128x6 + len128) in label va_range1 "***** POSTCONDITION NOT MET AT line 434 column 77 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (Vale.AES.GCTR.gctr_partial alg cipher_bound plain_in cipher_out key ctr_BE_2) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 438 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let length_quad:quad32 = Vale.Def.Types_s.reverse_bytes_quad32 (Vale.Def.Types_s.insert_nat64 (Vale.Def.Types_s.insert_nat64 (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0) (8 `op_Multiply` (va_get_reg64 rRsi va_s0)) 1) (8 `op_Multiply` plain_num_bytes) 0) in label va_range1 "***** POSTCONDITION NOT MET AT line 440 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let raw_auth_quads:(seq quad32) = va_if (va_get_reg64 rRsi va_s0 > ((va_get_reg64 rRdx va_s0) `op_Multiply` 128) `op_Division` 8) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0 ) auth_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 7 va_s0 ) abytes_b)) (fun _ -> Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) auth_b) in label va_range1 "***** POSTCONDITION NOT MET AT line 444 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let auth_input_bytes:(seq nat8) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads ) 0 (va_get_reg64 rRsi va_s0) in label va_range1 "***** POSTCONDITION NOT MET AT line 445 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let padded_auth_bytes:(seq nat8) = Vale.AES.GCTR_s.pad_to_128_bits auth_input_bytes in label va_range1 "***** POSTCONDITION NOT MET AT line 446 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let auth_quad_seq:(seq quad32) = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_auth_bytes in label va_range1 "***** POSTCONDITION NOT MET AT line 448 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let raw_quad_seq:(seq quad32) = FStar.Seq.Base.append #quad32 (FStar.Seq.Base.append #quad32 auth_quad_seq (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b) in label va_range1 "***** POSTCONDITION NOT MET AT line 452 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let total_bytes:nat = (FStar.Seq.Base.length #quad32 auth_quad_seq) `op_Multiply` 16 + plain_num_bytes in label va_range1 "***** POSTCONDITION NOT MET AT line 453 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let raw_quad_seq:(seq quad32) = va_if (plain_num_bytes > ((len128x6 + len128) `op_Multiply` 128) `op_Division` 8) (fun _ -> let ab:(seq nat8) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes (FStar.Seq.Base.append #quad32 raw_quad_seq (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b))) 0 total_bytes in let pb:(seq nat8) = Vale.AES.GCTR_s.pad_to_128_bits ab in Vale.Def.Types_s.le_bytes_to_seq_quad32 pb) (fun _ -> raw_quad_seq) in label va_range1 "***** POSTCONDITION NOT MET AT line 460 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let auth_quad_seq:(seq quad32) = FStar.Seq.Base.append #quad32 raw_quad_seq (FStar.Seq.Base.create #quad32 1 length_quad) in label va_range1 "***** POSTCONDITION NOT MET AT line 461 column 106 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_get_xmm 8 va_sM == Vale.AES.GCTR_s.gctr_encrypt_block ctr_BE_1 (Vale.AES.GHash_s.ghash_LE h_LE auth_quad_seq) alg key 0)))))))))))))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([ va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem ]) va_sM va_s0; (va_sM, va_fM)
false
Spec.MD5.fst
Spec.MD5.init
val init: init_t MD5
val init: init_t MD5
let init : words_state MD5 = Seq.seq_of_list init_as_list
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 57, "end_line": 18, "start_col": 0, "start_line": 18 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ]
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Spec.Hash.Definitions.init_t Spec.Hash.Definitions.MD5
Prims.Tot
[ "total" ]
[]
[ "FStar.Seq.Base.seq_of_list", "Lib.IntTypes.int_t", "Lib.IntTypes.U32", "Lib.IntTypes.SEC", "Spec.MD5.init_as_list", "Spec.Hash.Definitions.words_state", "Spec.Hash.Definitions.MD5" ]
[]
false
false
false
true
false
let init:words_state MD5 =
Seq.seq_of_list init_as_list
false
Spec.MD5.fst
Spec.MD5.round_op_gen_aux
val round_op_gen_aux (f: (uint32 -> uint32 -> uint32 -> Tot uint32)) (abcd: abcd_t) (x: x_t) (a b c d: abcd_idx) (k: x_idx) (s: rotate_idx) (i: t_idx) : Tot abcd_t
val round_op_gen_aux (f: (uint32 -> uint32 -> uint32 -> Tot uint32)) (abcd: abcd_t) (x: x_t) (a b c d: abcd_idx) (k: x_idx) (s: rotate_idx) (i: t_idx) : Tot abcd_t
let round_op_gen_aux (f: (uint32 -> uint32 -> uint32 -> Tot uint32)) (abcd: abcd_t) (x: x_t) (a b c d: abcd_idx) (k: x_idx) (s: rotate_idx) (i: t_idx) : Tot abcd_t = let va = Seq.index abcd a in let vb = Seq.index abcd b in let vc = Seq.index abcd c in let vd = Seq.index abcd d in Seq.upd abcd a (vb +. ((va +. f vb vc vd +. Seq.index x k +. Seq.index t (i - 1)) <<<. s))
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 92, "end_line": 134, "start_col": 0, "start_line": 129 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4 let x_idx = (n: nat { n < 16 } ) let x_t = Seq.lseq uint32 16 let t_idx = (n: nat { 1 <= n /\ n <= 64 } ) inline_for_extraction let rotate_idx = rotval U32
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
f: (_: Lib.IntTypes.uint32 -> _: Lib.IntTypes.uint32 -> _: Lib.IntTypes.uint32 -> Lib.IntTypes.uint32) -> abcd: Spec.MD5.abcd_t -> x: Spec.MD5.x_t -> a: Spec.MD5.abcd_idx -> b: Spec.MD5.abcd_idx -> c: Spec.MD5.abcd_idx -> d: Spec.MD5.abcd_idx -> k: Spec.MD5.x_idx -> s: Spec.MD5.rotate_idx -> i: Spec.MD5.t_idx -> Spec.MD5.abcd_t
Prims.Tot
[ "total" ]
[]
[ "Lib.IntTypes.uint32", "Spec.MD5.abcd_t", "Spec.MD5.x_t", "Spec.MD5.abcd_idx", "Spec.MD5.x_idx", "Spec.MD5.rotate_idx", "Spec.MD5.t_idx", "FStar.Seq.Base.upd", "Lib.IntTypes.op_Plus_Dot", "Lib.IntTypes.U32", "Lib.IntTypes.SEC", "Lib.IntTypes.op_Less_Less_Less_Dot", "FStar.Seq.Base.index", "Lib.IntTypes.int_t", "Spec.MD5.t", "Prims.op_Subtraction" ]
[]
false
false
false
true
false
let round_op_gen_aux (f: (uint32 -> uint32 -> uint32 -> Tot uint32)) (abcd: abcd_t) (x: x_t) (a b c d: abcd_idx) (k: x_idx) (s: rotate_idx) (i: t_idx) : Tot abcd_t =
let va = Seq.index abcd a in let vb = Seq.index abcd b in let vc = Seq.index abcd c in let vd = Seq.index abcd d in Seq.upd abcd a (vb +. ((va +. f vb vc vd +. Seq.index x k +. Seq.index t (i - 1)) <<<. s))
false
Spec.MD5.fst
Spec.MD5.init_as_list
val init_as_list:list uint32
val init_as_list:list uint32
let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ]
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 1, "end_line": 16, "start_col": 0, "start_line": 11 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *)
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Prims.list (Lib.IntTypes.int_t Lib.IntTypes.U32 Lib.IntTypes.SEC)
Prims.Tot
[ "total" ]
[]
[ "Prims.Cons", "Lib.IntTypes.int_t", "Lib.IntTypes.U32", "Lib.IntTypes.SEC", "Lib.IntTypes.u32", "Prims.Nil" ]
[]
false
false
false
true
false
let init_as_list:list uint32 =
[u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476]
false
Vale.X64.Stack_i.fst
Vale.X64.Stack_i.vale_stack
val vale_stack : Type u#0
val vale_stack : Type u#0
let vale_stack = BS.machine_stack
{ "file_name": "vale/code/arch/x64/Vale.X64.Stack_i.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 33, "end_line": 6, "start_col": 0, "start_line": 6 }
module Vale.X64.Stack_i open FStar.Mul module BS = Vale.X64.Machine_Semantics_s
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.Lib.Set.fsti.checked", "Vale.Arch.MachineHeap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Vale.X64.Stack_i.fst" }
[ { "abbrev": false, "full_module": "Vale.Arch.MachineHeap", "short_module": null }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Type0
Prims.Tot
[ "total" ]
[]
[ "Vale.X64.Machine_Semantics_s.machine_stack" ]
[]
false
false
false
true
true
let vale_stack =
BS.machine_stack
false
Vale.X64.Stack_i.fst
Vale.X64.Stack_i.load_stack64
val load_stack64 (ptr:int) (h:vale_stack) : GTot nat64
val load_stack64 (ptr:int) (h:vale_stack) : GTot nat64
let load_stack64 i st = BS.eval_stack i st
{ "file_name": "vale/code/arch/x64/Vale.X64.Stack_i.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 42, "end_line": 9, "start_col": 0, "start_line": 9 }
module Vale.X64.Stack_i open FStar.Mul module BS = Vale.X64.Machine_Semantics_s open Vale.Arch.MachineHeap let vale_stack = BS.machine_stack
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.Lib.Set.fsti.checked", "Vale.Arch.MachineHeap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Vale.X64.Stack_i.fst" }
[ { "abbrev": false, "full_module": "Vale.Arch.MachineHeap", "short_module": null }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
ptr: Prims.int -> h: Vale.X64.Stack_i.vale_stack -> Prims.GTot Vale.X64.Memory.nat64
Prims.GTot
[ "sometrivial" ]
[]
[ "Prims.int", "Vale.X64.Stack_i.vale_stack", "Vale.X64.Machine_Semantics_s.eval_stack", "Vale.X64.Memory.nat64" ]
[]
false
false
false
false
false
let load_stack64 i st =
BS.eval_stack i st
false
Vale.X64.Stack_i.fst
Vale.X64.Stack_i.valid_src_stack64
val valid_src_stack64 (ptr:int) (h:vale_stack) : GTot bool
val valid_src_stack64 (ptr:int) (h:vale_stack) : GTot bool
let valid_src_stack64 i st = BS.valid_src_stack64 i st
{ "file_name": "vale/code/arch/x64/Vale.X64.Stack_i.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 54, "end_line": 8, "start_col": 0, "start_line": 8 }
module Vale.X64.Stack_i open FStar.Mul module BS = Vale.X64.Machine_Semantics_s open Vale.Arch.MachineHeap let vale_stack = BS.machine_stack
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.Lib.Set.fsti.checked", "Vale.Arch.MachineHeap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Vale.X64.Stack_i.fst" }
[ { "abbrev": false, "full_module": "Vale.Arch.MachineHeap", "short_module": null }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
ptr: Prims.int -> h: Vale.X64.Stack_i.vale_stack -> Prims.GTot Prims.bool
Prims.GTot
[ "sometrivial" ]
[]
[ "Prims.int", "Vale.X64.Stack_i.vale_stack", "Vale.X64.Machine_Semantics_s.valid_src_stack64", "Prims.bool" ]
[]
false
false
false
false
false
let valid_src_stack64 i st =
BS.valid_src_stack64 i st
false
Hacl.NaCl.fst
Hacl.NaCl.crypto_box_detached
val crypto_box_detached: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h sk /\ live h pk /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (let tag_cipher = SB.box_detached (as_seq h0 sk) (as_seq h0 pk) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m) in match r with | 0ul -> Some? tag_cipher /\ (let (tag_s, cipher_s) = Some?.v tag_cipher in (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == (tag_s, cipher_s)) | _ -> None? tag_cipher))
val crypto_box_detached: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h sk /\ live h pk /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (let tag_cipher = SB.box_detached (as_seq h0 sk) (as_seq h0 pk) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m) in match r with | 0ul -> Some? tag_cipher /\ (let (tag_s, cipher_s) = Some?.v tag_cipher in (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == (tag_s, cipher_s)) | _ -> None? tag_cipher))
let crypto_box_detached c tag m mlen n pk sk = Hacl.Impl.Box.box_detached mlen c tag sk pk n m
{ "file_name": "code/nacl-box/Hacl.NaCl.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 49, "end_line": 207, "start_col": 0, "start_line": 206 }
module Hacl.NaCl open FStar.HyperStack.All open FStar.HyperStack open FStar.Mul open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module SB = Spec.Box module SS = Spec.SecretBox #set-options "--max_fuel 50 --max_fuel 0 --max_ifuel 0" [@@ Comment "Encrypt a message with a key and nonce. Note: `c` and `m` can point to the same memory for in-place encryption. @param c Pointer to `mlen` bytes where the ciphertext is written to. @param tag Pointer to 16 (tag length) bytes where the authentication tag is written to. @param m Pointer to `mlen` bytes where the message is read from. @param mlen Length of message. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_detached: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == SS.secretbox_detached (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_secretbox_detached c tag m mlen n k = Hacl.Impl.SecretBox.secretbox_detached mlen c tag k n m; 0ul [@@ Comment "Verify and decrypt a ciphertext produced with `Hacl_NaCl_crypto_secretbox_detached`. Note: `m` and `c` can point to the same memory for in-place decryption. @param m Pointer to `mlen` bytes where the message is written to. @param c Pointer to `mlen` bytes where the ciphertext is read from. @param tag Pointer to 16 (tag length) bytes where the authentication tag is read from. @param mlen Length of message (and ciphertext). @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_open_detached: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SS.secretbox_open_detached (as_seq h0 k) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg)) let crypto_secretbox_open_detached m c tag mlen n k = Hacl.Impl.SecretBox.secretbox_open_detached mlen m k n c tag [@@ Comment "Encrypt a message with a key and nonce. @param c Pointer to 16 (tag length) + `mlen` bytes where the ciphertext is written to. @param m Pointer to `mlen` bytes where the message is read from. @param mlen Length of message. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_easy: c:buffer uint8 -> m:buffer uint8 -> mlen:size_t{length c = v mlen + 16 /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 c h0 h1 /\ as_seq #MUT #uint8 #(mlen +! 16ul) h1 c == SS.secretbox_easy (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_secretbox_easy c m mlen n k = Hacl.Impl.SecretBox.secretbox_easy mlen c k n m; 0ul #set-options "--z3rlimit 100" [@@ Comment "Verify and decrypt a ciphertext produced with `crypto_secretbox_easy`. @param m Pointer to `mlen` bytes where the message is written to. @param c Pointer to `clen` bytes where the ciphertext is read from. The authentication tag must be included. @param clen Length of ciphertext. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_open_easy: m:buffer uint8 -> c:buffer uint8 -> clen:size_t{length c = v clen /\ v clen = length m + 16} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint m n /\ disjoint c n) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SS.secretbox_open_easy (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #clen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #(clen -! 16ul) h1 m == Some?.v msg | _ -> None? msg)) let crypto_secretbox_open_easy m c clen n k = Hacl.Impl.SecretBox.secretbox_open_easy (clen -! 16ul) m k n c [@@ Comment "Compute a shared secret key given a public key and secret key. @param k Pointer to 32 (`crypto_box_BEFORENMBYTES`) bytes of memory where the shared secret is written to. @param pk Pointer to 32 bytes of memory where **their** public key is read from. @param sk Pointer to 32 bytes of memory where **my** secret key is read from."] val crypto_box_beforenm: k:lbuffer uint8 32ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h k /\ live h pk /\ live h sk /\ disjoint k pk /\ disjoint k sk) (ensures fun h0 r h1 -> modifies1 k h0 h1 /\ (let key = SB.box_beforenm (as_seq h0 pk) (as_seq h0 sk) in match r with | 0ul -> Some? key /\ as_seq h1 k == Some?.v key | _ -> None? key)) let crypto_box_beforenm k pk sk = Hacl.Impl.Box.box_beforenm k pk sk [@@ Comment "See `crypto_box_detached`."] val crypto_box_detached_afternm: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == SB.box_detached_afternm (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_box_detached_afternm c tag m mlen n k = Hacl.Impl.Box.box_detached_afternm mlen c tag k n m [@@ Comment "Encrypt a message using the recipient's public key, the sender's secret key, and a nonce. @param c Pointer to `mlen` bytes of memory where the ciphertext is written to. @param tag Pointer to 16 (tag length) bytes of memory where the authentication tag is written to. @param m Pointer to `mlen` bytes of memory where the message is read from. @param mlen Length of the message. @param n Pointer to 24 (`crypto_box_NONCEBYTES`) bytes of memory where the nonce is read from. @param pk Pointer to 32 bytes of memory where **their** public key is read from. @param sk Pointer to 32 bytes of memory where **my** secret key is read from."] val crypto_box_detached: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h sk /\ live h pk /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (let tag_cipher = SB.box_detached (as_seq h0 sk) (as_seq h0 pk) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m) in match r with | 0ul -> Some? tag_cipher /\ (let (tag_s, cipher_s) = Some?.v tag_cipher in (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == (tag_s, cipher_s)) | _ -> None? tag_cipher))
{ "checked_file": "/", "dependencies": [ "Spec.SecretBox.fst.checked", "Spec.Box.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.SecretBox.fst.checked", "Hacl.Impl.Box.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.NaCl.fst" }
[ { "abbrev": true, "full_module": "Spec.SecretBox", "short_module": "SS" }, { "abbrev": true, "full_module": "Spec.Box", "short_module": "SB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
c: Lib.Buffer.buffer Lib.IntTypes.uint8 -> tag: Lib.Buffer.lbuffer Lib.IntTypes.uint8 16ul -> m: Lib.Buffer.buffer Lib.IntTypes.uint8 -> mlen: Lib.IntTypes.size_t {Lib.Buffer.length c = Lib.IntTypes.v mlen /\ Lib.Buffer.length m = Lib.IntTypes.v mlen} -> n: Lib.Buffer.lbuffer Lib.IntTypes.uint8 24ul -> pk: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul -> sk: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul -> FStar.HyperStack.ST.Stack Lib.IntTypes.size_t
FStar.HyperStack.ST.Stack
[]
[]
[ "Lib.Buffer.buffer", "Lib.IntTypes.uint8", "Lib.Buffer.lbuffer", "FStar.UInt32.__uint_to_t", "Lib.IntTypes.size_t", "Prims.l_and", "Prims.b2t", "Prims.op_Equality", "Prims.int", "Prims.l_or", "Prims.op_GreaterThanOrEqual", "Lib.IntTypes.range", "Lib.IntTypes.U32", "Lib.Buffer.length", "Lib.Buffer.MUT", "Lib.IntTypes.v", "Lib.IntTypes.PUB", "Hacl.Impl.Box.box_detached" ]
[]
false
true
false
false
false
let crypto_box_detached c tag m mlen n pk sk =
Hacl.Impl.Box.box_detached mlen c tag sk pk n m
false
Vale.X64.Stack_i.fst
Vale.X64.Stack_i.valid_src_stack128
val valid_src_stack128 (ptr:int) (h:vale_stack) : GTot bool
val valid_src_stack128 (ptr:int) (h:vale_stack) : GTot bool
let valid_src_stack128 i st = BS.valid_src_stack128 i st
{ "file_name": "vale/code/arch/x64/Vale.X64.Stack_i.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 56, "end_line": 13, "start_col": 0, "start_line": 13 }
module Vale.X64.Stack_i open FStar.Mul module BS = Vale.X64.Machine_Semantics_s open Vale.Arch.MachineHeap let vale_stack = BS.machine_stack let valid_src_stack64 i st = BS.valid_src_stack64 i st let load_stack64 i st = BS.eval_stack i st let store_stack64 i v h = BS.update_stack64' i v h let free_stack64 start finish h = BS.free_stack' start finish h
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.Lib.Set.fsti.checked", "Vale.Arch.MachineHeap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Vale.X64.Stack_i.fst" }
[ { "abbrev": false, "full_module": "Vale.Arch.MachineHeap", "short_module": null }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
ptr: Prims.int -> h: Vale.X64.Stack_i.vale_stack -> Prims.GTot Prims.bool
Prims.GTot
[ "sometrivial" ]
[]
[ "Prims.int", "Vale.X64.Stack_i.vale_stack", "Vale.X64.Machine_Semantics_s.valid_src_stack128", "Prims.bool" ]
[]
false
false
false
false
false
let valid_src_stack128 i st =
BS.valid_src_stack128 i st
false
Spec.MD5.fst
Spec.MD5.t_as_list
val t_as_list:list uint32
val t_as_list:list uint32
let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ]
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 1, "end_line": 109, "start_col": 0, "start_line": 41 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *)
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Prims.list (Lib.IntTypes.int_t Lib.IntTypes.U32 Lib.IntTypes.SEC)
Prims.Tot
[ "total" ]
[]
[ "Prims.Cons", "Lib.IntTypes.int_t", "Lib.IntTypes.U32", "Lib.IntTypes.SEC", "Lib.IntTypes.u32", "Prims.Nil" ]
[]
false
false
false
true
false
let t_as_list:list uint32 =
[ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391 ]
false
Hacl.NaCl.fst
Hacl.NaCl.crypto_secretbox_open_detached
val crypto_secretbox_open_detached: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SS.secretbox_open_detached (as_seq h0 k) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg))
val crypto_secretbox_open_detached: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SS.secretbox_open_detached (as_seq h0 k) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg))
let crypto_secretbox_open_detached m c tag mlen n k = Hacl.Impl.SecretBox.secretbox_open_detached mlen m k n c tag
{ "file_name": "code/nacl-box/Hacl.NaCl.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 62, "end_line": 78, "start_col": 0, "start_line": 77 }
module Hacl.NaCl open FStar.HyperStack.All open FStar.HyperStack open FStar.Mul open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module SB = Spec.Box module SS = Spec.SecretBox #set-options "--max_fuel 50 --max_fuel 0 --max_ifuel 0" [@@ Comment "Encrypt a message with a key and nonce. Note: `c` and `m` can point to the same memory for in-place encryption. @param c Pointer to `mlen` bytes where the ciphertext is written to. @param tag Pointer to 16 (tag length) bytes where the authentication tag is written to. @param m Pointer to `mlen` bytes where the message is read from. @param mlen Length of message. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_detached: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == SS.secretbox_detached (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_secretbox_detached c tag m mlen n k = Hacl.Impl.SecretBox.secretbox_detached mlen c tag k n m; 0ul [@@ Comment "Verify and decrypt a ciphertext produced with `Hacl_NaCl_crypto_secretbox_detached`. Note: `m` and `c` can point to the same memory for in-place decryption. @param m Pointer to `mlen` bytes where the message is written to. @param c Pointer to `mlen` bytes where the ciphertext is read from. @param tag Pointer to 16 (tag length) bytes where the authentication tag is read from. @param mlen Length of message (and ciphertext). @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_open_detached: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SS.secretbox_open_detached (as_seq h0 k) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg))
{ "checked_file": "/", "dependencies": [ "Spec.SecretBox.fst.checked", "Spec.Box.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.SecretBox.fst.checked", "Hacl.Impl.Box.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.NaCl.fst" }
[ { "abbrev": true, "full_module": "Spec.SecretBox", "short_module": "SS" }, { "abbrev": true, "full_module": "Spec.Box", "short_module": "SB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
m: Lib.Buffer.buffer Lib.IntTypes.uint8 -> c: Lib.Buffer.buffer Lib.IntTypes.uint8 -> tag: Lib.Buffer.lbuffer Lib.IntTypes.uint8 16ul -> mlen: Lib.IntTypes.size_t {Lib.Buffer.length c = Lib.IntTypes.v mlen /\ Lib.Buffer.length m = Lib.IntTypes.v mlen} -> n: Lib.Buffer.lbuffer Lib.IntTypes.uint8 24ul -> k: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul -> FStar.HyperStack.ST.Stack Lib.IntTypes.size_t
FStar.HyperStack.ST.Stack
[]
[]
[ "Lib.Buffer.buffer", "Lib.IntTypes.uint8", "Lib.Buffer.lbuffer", "FStar.UInt32.__uint_to_t", "Lib.IntTypes.size_t", "Prims.l_and", "Prims.b2t", "Prims.op_Equality", "Prims.int", "Prims.l_or", "Prims.op_GreaterThanOrEqual", "Lib.IntTypes.range", "Lib.IntTypes.U32", "Lib.Buffer.length", "Lib.Buffer.MUT", "Lib.IntTypes.v", "Lib.IntTypes.PUB", "Hacl.Impl.SecretBox.secretbox_open_detached" ]
[]
false
true
false
false
false
let crypto_secretbox_open_detached m c tag mlen n k =
Hacl.Impl.SecretBox.secretbox_open_detached mlen m k n c tag
false
Vale.X64.Stack_i.fst
Vale.X64.Stack_i.store_stack128
val store_stack128 (ptr:int) (v:quad32) (h:vale_stack) : GTot vale_stack
val store_stack128 (ptr:int) (v:quad32) (h:vale_stack) : GTot vale_stack
let store_stack128 i v h = BS.update_stack128' i v h
{ "file_name": "vale/code/arch/x64/Vale.X64.Stack_i.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 52, "end_line": 15, "start_col": 0, "start_line": 15 }
module Vale.X64.Stack_i open FStar.Mul module BS = Vale.X64.Machine_Semantics_s open Vale.Arch.MachineHeap let vale_stack = BS.machine_stack let valid_src_stack64 i st = BS.valid_src_stack64 i st let load_stack64 i st = BS.eval_stack i st let store_stack64 i v h = BS.update_stack64' i v h let free_stack64 start finish h = BS.free_stack' start finish h let valid_src_stack128 i st = BS.valid_src_stack128 i st
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.Lib.Set.fsti.checked", "Vale.Arch.MachineHeap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Vale.X64.Stack_i.fst" }
[ { "abbrev": false, "full_module": "Vale.Arch.MachineHeap", "short_module": null }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
ptr: Prims.int -> v: Vale.X64.Memory.quad32 -> h: Vale.X64.Stack_i.vale_stack -> Prims.GTot Vale.X64.Stack_i.vale_stack
Prims.GTot
[ "sometrivial" ]
[]
[ "Prims.int", "Vale.X64.Memory.quad32", "Vale.X64.Stack_i.vale_stack", "Vale.X64.Machine_Semantics_s.update_stack128'" ]
[]
false
false
false
false
false
let store_stack128 i v h =
BS.update_stack128' i v h
false
Vale.X64.Stack_i.fst
Vale.X64.Stack_i.store_stack64
val store_stack64 (ptr:int) (v:nat64) (h:vale_stack) : GTot vale_stack
val store_stack64 (ptr:int) (v:nat64) (h:vale_stack) : GTot vale_stack
let store_stack64 i v h = BS.update_stack64' i v h
{ "file_name": "vale/code/arch/x64/Vale.X64.Stack_i.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 50, "end_line": 10, "start_col": 0, "start_line": 10 }
module Vale.X64.Stack_i open FStar.Mul module BS = Vale.X64.Machine_Semantics_s open Vale.Arch.MachineHeap let vale_stack = BS.machine_stack let valid_src_stack64 i st = BS.valid_src_stack64 i st
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.Lib.Set.fsti.checked", "Vale.Arch.MachineHeap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Vale.X64.Stack_i.fst" }
[ { "abbrev": false, "full_module": "Vale.Arch.MachineHeap", "short_module": null }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
ptr: Prims.int -> v: Vale.X64.Memory.nat64 -> h: Vale.X64.Stack_i.vale_stack -> Prims.GTot Vale.X64.Stack_i.vale_stack
Prims.GTot
[ "sometrivial" ]
[]
[ "Prims.int", "Vale.X64.Memory.nat64", "Vale.X64.Stack_i.vale_stack", "Vale.X64.Machine_Semantics_s.update_stack64'" ]
[]
false
false
false
false
false
let store_stack64 i v h =
BS.update_stack64' i v h
false
Spec.MD5.fst
Spec.MD5.round2_aux
val round2_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t
val round2_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t
let round2_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round2_op abcd x ia ib ic id 1 5ul 17 in let abcd = round2_op abcd x id ia ib ic 6 9ul 18 in let abcd = round2_op abcd x ic id ia ib 11 14ul 19 in let abcd = round2_op abcd x ib ic id ia 0 20ul 20 in let abcd = round2_op abcd x ia ib ic id 5 5ul 21 in let abcd = round2_op abcd x id ia ib ic 10 9ul 22 in let abcd = round2_op abcd x ic id ia ib 15 14ul 23 in let abcd = round2_op abcd x ib ic id ia 4 20ul 24 in let abcd = round2_op abcd x ia ib ic id 9 5ul 25 in let abcd = round2_op abcd x id ia ib ic 14 9ul 26 in let abcd = round2_op abcd x ic id ia ib 3 14ul 27 in let abcd = round2_op abcd x ib ic id ia 8 20ul 28 in let abcd = round2_op abcd x ia ib ic id 13 5ul 29 in let abcd = round2_op abcd x id ia ib ic 2 9ul 30 in let abcd = round2_op abcd x ic id ia ib 7 14ul 31 in let abcd = round2_op abcd x ib ic id ia 12 20ul 32 in abcd
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 6, "end_line": 197, "start_col": 0, "start_line": 176 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4 let x_idx = (n: nat { n < 16 } ) let x_t = Seq.lseq uint32 16 let t_idx = (n: nat { 1 <= n /\ n <= 64 } ) inline_for_extraction let rotate_idx = rotval U32 let round_op_gen_aux (f: (uint32 -> uint32 -> uint32 -> Tot uint32)) (abcd: abcd_t) (x: x_t) (a b c d: abcd_idx) (k: x_idx) (s: rotate_idx) (i: t_idx) : Tot abcd_t = let va = Seq.index abcd a in let vb = Seq.index abcd b in let vc = Seq.index abcd c in let vd = Seq.index abcd d in Seq.upd abcd a (vb +. ((va +. f vb vc vd +. Seq.index x k +. Seq.index t (i - 1)) <<<. s)) [@"opaque_to_smt"] let round_op_gen = round_op_gen_aux (* Round 1 *) let round1_op = round_op_gen f let ia : abcd_idx = 0 let ib : abcd_idx = 1 let ic : abcd_idx = 2 let id : abcd_idx = 3 let round1_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round1_op abcd x ia ib ic id 0 7ul 1 in let abcd = round1_op abcd x id ia ib ic 1 12ul 2 in let abcd = round1_op abcd x ic id ia ib 2 17ul 3 in let abcd = round1_op abcd x ib ic id ia 3 22ul 4 in let abcd = round1_op abcd x ia ib ic id 4 7ul 5 in let abcd = round1_op abcd x id ia ib ic 5 12ul 6 in let abcd = round1_op abcd x ic id ia ib 6 17ul 7 in let abcd = round1_op abcd x ib ic id ia 7 22ul 8 in let abcd = round1_op abcd x ia ib ic id 8 7ul 9 in let abcd = round1_op abcd x id ia ib ic 9 12ul 10 in let abcd = round1_op abcd x ic id ia ib 10 17ul 11 in let abcd = round1_op abcd x ib ic id ia 11 22ul 12 in let abcd = round1_op abcd x ia ib ic id 12 7ul 13 in let abcd = round1_op abcd x id ia ib ic 13 12ul 14 in let abcd = round1_op abcd x ic id ia ib 14 17ul 15 in let abcd = round1_op abcd x ib ic id ia 15 22ul 16 in abcd [@"opaque_to_smt"] let round1 = round1_aux let round2_op = round_op_gen g
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
abcd: Spec.MD5.abcd_t -> x: Spec.MD5.x_t -> Spec.MD5.abcd_t
Prims.Tot
[ "total" ]
[]
[ "Spec.MD5.abcd_t", "Spec.MD5.x_t", "Spec.MD5.round2_op", "Spec.MD5.ib", "Spec.MD5.ic", "Spec.MD5.id", "Spec.MD5.ia", "FStar.UInt32.__uint_to_t" ]
[]
false
false
false
true
false
let round2_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t =
let abcd = round2_op abcd x ia ib ic id 1 5ul 17 in let abcd = round2_op abcd x id ia ib ic 6 9ul 18 in let abcd = round2_op abcd x ic id ia ib 11 14ul 19 in let abcd = round2_op abcd x ib ic id ia 0 20ul 20 in let abcd = round2_op abcd x ia ib ic id 5 5ul 21 in let abcd = round2_op abcd x id ia ib ic 10 9ul 22 in let abcd = round2_op abcd x ic id ia ib 15 14ul 23 in let abcd = round2_op abcd x ib ic id ia 4 20ul 24 in let abcd = round2_op abcd x ia ib ic id 9 5ul 25 in let abcd = round2_op abcd x id ia ib ic 14 9ul 26 in let abcd = round2_op abcd x ic id ia ib 3 14ul 27 in let abcd = round2_op abcd x ib ic id ia 8 20ul 28 in let abcd = round2_op abcd x ia ib ic id 13 5ul 29 in let abcd = round2_op abcd x id ia ib ic 2 9ul 30 in let abcd = round2_op abcd x ic id ia ib 7 14ul 31 in let abcd = round2_op abcd x ib ic id ia 12 20ul 32 in abcd
false
Spec.MD5.fst
Spec.MD5.round1_aux
val round1_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t
val round1_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t
let round1_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round1_op abcd x ia ib ic id 0 7ul 1 in let abcd = round1_op abcd x id ia ib ic 1 12ul 2 in let abcd = round1_op abcd x ic id ia ib 2 17ul 3 in let abcd = round1_op abcd x ib ic id ia 3 22ul 4 in let abcd = round1_op abcd x ia ib ic id 4 7ul 5 in let abcd = round1_op abcd x id ia ib ic 5 12ul 6 in let abcd = round1_op abcd x ic id ia ib 6 17ul 7 in let abcd = round1_op abcd x ib ic id ia 7 22ul 8 in let abcd = round1_op abcd x ia ib ic id 8 7ul 9 in let abcd = round1_op abcd x id ia ib ic 9 12ul 10 in let abcd = round1_op abcd x ic id ia ib 10 17ul 11 in let abcd = round1_op abcd x ib ic id ia 11 22ul 12 in let abcd = round1_op abcd x ia ib ic id 12 7ul 13 in let abcd = round1_op abcd x id ia ib ic 13 12ul 14 in let abcd = round1_op abcd x ic id ia ib 14 17ul 15 in let abcd = round1_op abcd x ib ic id ia 15 22ul 16 in abcd
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 6, "end_line": 169, "start_col": 0, "start_line": 148 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4 let x_idx = (n: nat { n < 16 } ) let x_t = Seq.lseq uint32 16 let t_idx = (n: nat { 1 <= n /\ n <= 64 } ) inline_for_extraction let rotate_idx = rotval U32 let round_op_gen_aux (f: (uint32 -> uint32 -> uint32 -> Tot uint32)) (abcd: abcd_t) (x: x_t) (a b c d: abcd_idx) (k: x_idx) (s: rotate_idx) (i: t_idx) : Tot abcd_t = let va = Seq.index abcd a in let vb = Seq.index abcd b in let vc = Seq.index abcd c in let vd = Seq.index abcd d in Seq.upd abcd a (vb +. ((va +. f vb vc vd +. Seq.index x k +. Seq.index t (i - 1)) <<<. s)) [@"opaque_to_smt"] let round_op_gen = round_op_gen_aux (* Round 1 *) let round1_op = round_op_gen f let ia : abcd_idx = 0 let ib : abcd_idx = 1 let ic : abcd_idx = 2 let id : abcd_idx = 3
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
abcd: Spec.MD5.abcd_t -> x: Spec.MD5.x_t -> Spec.MD5.abcd_t
Prims.Tot
[ "total" ]
[]
[ "Spec.MD5.abcd_t", "Spec.MD5.x_t", "Spec.MD5.round1_op", "Spec.MD5.ib", "Spec.MD5.ic", "Spec.MD5.id", "Spec.MD5.ia", "FStar.UInt32.__uint_to_t" ]
[]
false
false
false
true
false
let round1_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t =
let abcd = round1_op abcd x ia ib ic id 0 7ul 1 in let abcd = round1_op abcd x id ia ib ic 1 12ul 2 in let abcd = round1_op abcd x ic id ia ib 2 17ul 3 in let abcd = round1_op abcd x ib ic id ia 3 22ul 4 in let abcd = round1_op abcd x ia ib ic id 4 7ul 5 in let abcd = round1_op abcd x id ia ib ic 5 12ul 6 in let abcd = round1_op abcd x ic id ia ib 6 17ul 7 in let abcd = round1_op abcd x ib ic id ia 7 22ul 8 in let abcd = round1_op abcd x ia ib ic id 8 7ul 9 in let abcd = round1_op abcd x id ia ib ic 9 12ul 10 in let abcd = round1_op abcd x ic id ia ib 10 17ul 11 in let abcd = round1_op abcd x ib ic id ia 11 22ul 12 in let abcd = round1_op abcd x ia ib ic id 12 7ul 13 in let abcd = round1_op abcd x id ia ib ic 13 12ul 14 in let abcd = round1_op abcd x ic id ia ib 14 17ul 15 in let abcd = round1_op abcd x ib ic id ia 15 22ul 16 in abcd
false
Vale.X64.Stack_i.fst
Vale.X64.Stack_i.load_stack128
val load_stack128 (ptr:int) (h:vale_stack) : GTot quad32
val load_stack128 (ptr:int) (h:vale_stack) : GTot quad32
let load_stack128 i st = BS.eval_stack128 i st
{ "file_name": "vale/code/arch/x64/Vale.X64.Stack_i.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 46, "end_line": 14, "start_col": 0, "start_line": 14 }
module Vale.X64.Stack_i open FStar.Mul module BS = Vale.X64.Machine_Semantics_s open Vale.Arch.MachineHeap let vale_stack = BS.machine_stack let valid_src_stack64 i st = BS.valid_src_stack64 i st let load_stack64 i st = BS.eval_stack i st let store_stack64 i v h = BS.update_stack64' i v h let free_stack64 start finish h = BS.free_stack' start finish h
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.Lib.Set.fsti.checked", "Vale.Arch.MachineHeap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Vale.X64.Stack_i.fst" }
[ { "abbrev": false, "full_module": "Vale.Arch.MachineHeap", "short_module": null }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
ptr: Prims.int -> h: Vale.X64.Stack_i.vale_stack -> Prims.GTot Vale.X64.Memory.quad32
Prims.GTot
[ "sometrivial" ]
[]
[ "Prims.int", "Vale.X64.Stack_i.vale_stack", "Vale.X64.Machine_Semantics_s.eval_stack128", "Vale.X64.Memory.quad32" ]
[]
false
false
false
false
false
let load_stack128 i st =
BS.eval_stack128 i st
false
Vale.X64.Stack_i.fst
Vale.X64.Stack_i.init_rsp
val init_rsp (h:vale_stack) : (n:nat64{n >= 4096})
val init_rsp (h:vale_stack) : (n:nat64{n >= 4096})
let init_rsp h = h.BS.initial_rsp
{ "file_name": "vale/code/arch/x64/Vale.X64.Stack_i.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 33, "end_line": 17, "start_col": 0, "start_line": 17 }
module Vale.X64.Stack_i open FStar.Mul module BS = Vale.X64.Machine_Semantics_s open Vale.Arch.MachineHeap let vale_stack = BS.machine_stack let valid_src_stack64 i st = BS.valid_src_stack64 i st let load_stack64 i st = BS.eval_stack i st let store_stack64 i v h = BS.update_stack64' i v h let free_stack64 start finish h = BS.free_stack' start finish h let valid_src_stack128 i st = BS.valid_src_stack128 i st let load_stack128 i st = BS.eval_stack128 i st let store_stack128 i v h = BS.update_stack128' i v h
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.Lib.Set.fsti.checked", "Vale.Arch.MachineHeap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Vale.X64.Stack_i.fst" }
[ { "abbrev": false, "full_module": "Vale.Arch.MachineHeap", "short_module": null }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
h: Vale.X64.Stack_i.vale_stack -> n: Vale.X64.Memory.nat64{n >= 4096}
Prims.Tot
[ "total" ]
[]
[ "Vale.X64.Stack_i.vale_stack", "Vale.X64.Machine_Semantics_s.__proj__Machine_stack__item__initial_rsp", "Vale.X64.Memory.nat64", "Prims.b2t", "Prims.op_GreaterThanOrEqual" ]
[]
false
false
false
false
false
let init_rsp h =
h.BS.initial_rsp
false
Vale.X64.Stack_i.fst
Vale.X64.Stack_i.free_stack64
val free_stack64 (start:int) (finish:int) (h:vale_stack) : GTot vale_stack
val free_stack64 (start:int) (finish:int) (h:vale_stack) : GTot vale_stack
let free_stack64 start finish h = BS.free_stack' start finish h
{ "file_name": "vale/code/arch/x64/Vale.X64.Stack_i.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 63, "end_line": 11, "start_col": 0, "start_line": 11 }
module Vale.X64.Stack_i open FStar.Mul module BS = Vale.X64.Machine_Semantics_s open Vale.Arch.MachineHeap let vale_stack = BS.machine_stack let valid_src_stack64 i st = BS.valid_src_stack64 i st let load_stack64 i st = BS.eval_stack i st
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.Lib.Set.fsti.checked", "Vale.Arch.MachineHeap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Vale.X64.Stack_i.fst" }
[ { "abbrev": false, "full_module": "Vale.Arch.MachineHeap", "short_module": null }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
start: Prims.int -> finish: Prims.int -> h: Vale.X64.Stack_i.vale_stack -> Prims.GTot Vale.X64.Stack_i.vale_stack
Prims.GTot
[ "sometrivial" ]
[]
[ "Prims.int", "Vale.X64.Stack_i.vale_stack", "Vale.X64.Machine_Semantics_s.free_stack'" ]
[]
false
false
false
false
false
let free_stack64 start finish h =
BS.free_stack' start finish h
false
Hacl.NaCl.fst
Hacl.NaCl.crypto_box_beforenm
val crypto_box_beforenm: k:lbuffer uint8 32ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h k /\ live h pk /\ live h sk /\ disjoint k pk /\ disjoint k sk) (ensures fun h0 r h1 -> modifies1 k h0 h1 /\ (let key = SB.box_beforenm (as_seq h0 pk) (as_seq h0 sk) in match r with | 0ul -> Some? key /\ as_seq h1 k == Some?.v key | _ -> None? key))
val crypto_box_beforenm: k:lbuffer uint8 32ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h k /\ live h pk /\ live h sk /\ disjoint k pk /\ disjoint k sk) (ensures fun h0 r h1 -> modifies1 k h0 h1 /\ (let key = SB.box_beforenm (as_seq h0 pk) (as_seq h0 sk) in match r with | 0ul -> Some? key /\ as_seq h1 k == Some?.v key | _ -> None? key))
let crypto_box_beforenm k pk sk = Hacl.Impl.Box.box_beforenm k pk sk
{ "file_name": "code/nacl-box/Hacl.NaCl.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 36, "end_line": 155, "start_col": 0, "start_line": 154 }
module Hacl.NaCl open FStar.HyperStack.All open FStar.HyperStack open FStar.Mul open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module SB = Spec.Box module SS = Spec.SecretBox #set-options "--max_fuel 50 --max_fuel 0 --max_ifuel 0" [@@ Comment "Encrypt a message with a key and nonce. Note: `c` and `m` can point to the same memory for in-place encryption. @param c Pointer to `mlen` bytes where the ciphertext is written to. @param tag Pointer to 16 (tag length) bytes where the authentication tag is written to. @param m Pointer to `mlen` bytes where the message is read from. @param mlen Length of message. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_detached: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == SS.secretbox_detached (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_secretbox_detached c tag m mlen n k = Hacl.Impl.SecretBox.secretbox_detached mlen c tag k n m; 0ul [@@ Comment "Verify and decrypt a ciphertext produced with `Hacl_NaCl_crypto_secretbox_detached`. Note: `m` and `c` can point to the same memory for in-place decryption. @param m Pointer to `mlen` bytes where the message is written to. @param c Pointer to `mlen` bytes where the ciphertext is read from. @param tag Pointer to 16 (tag length) bytes where the authentication tag is read from. @param mlen Length of message (and ciphertext). @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_open_detached: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SS.secretbox_open_detached (as_seq h0 k) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg)) let crypto_secretbox_open_detached m c tag mlen n k = Hacl.Impl.SecretBox.secretbox_open_detached mlen m k n c tag [@@ Comment "Encrypt a message with a key and nonce. @param c Pointer to 16 (tag length) + `mlen` bytes where the ciphertext is written to. @param m Pointer to `mlen` bytes where the message is read from. @param mlen Length of message. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_easy: c:buffer uint8 -> m:buffer uint8 -> mlen:size_t{length c = v mlen + 16 /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 c h0 h1 /\ as_seq #MUT #uint8 #(mlen +! 16ul) h1 c == SS.secretbox_easy (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_secretbox_easy c m mlen n k = Hacl.Impl.SecretBox.secretbox_easy mlen c k n m; 0ul #set-options "--z3rlimit 100" [@@ Comment "Verify and decrypt a ciphertext produced with `crypto_secretbox_easy`. @param m Pointer to `mlen` bytes where the message is written to. @param c Pointer to `clen` bytes where the ciphertext is read from. The authentication tag must be included. @param clen Length of ciphertext. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_open_easy: m:buffer uint8 -> c:buffer uint8 -> clen:size_t{length c = v clen /\ v clen = length m + 16} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint m n /\ disjoint c n) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SS.secretbox_open_easy (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #clen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #(clen -! 16ul) h1 m == Some?.v msg | _ -> None? msg)) let crypto_secretbox_open_easy m c clen n k = Hacl.Impl.SecretBox.secretbox_open_easy (clen -! 16ul) m k n c [@@ Comment "Compute a shared secret key given a public key and secret key. @param k Pointer to 32 (`crypto_box_BEFORENMBYTES`) bytes of memory where the shared secret is written to. @param pk Pointer to 32 bytes of memory where **their** public key is read from. @param sk Pointer to 32 bytes of memory where **my** secret key is read from."] val crypto_box_beforenm: k:lbuffer uint8 32ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h k /\ live h pk /\ live h sk /\ disjoint k pk /\ disjoint k sk) (ensures fun h0 r h1 -> modifies1 k h0 h1 /\ (let key = SB.box_beforenm (as_seq h0 pk) (as_seq h0 sk) in match r with | 0ul -> Some? key /\ as_seq h1 k == Some?.v key | _ -> None? key))
{ "checked_file": "/", "dependencies": [ "Spec.SecretBox.fst.checked", "Spec.Box.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.SecretBox.fst.checked", "Hacl.Impl.Box.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.NaCl.fst" }
[ { "abbrev": true, "full_module": "Spec.SecretBox", "short_module": "SS" }, { "abbrev": true, "full_module": "Spec.Box", "short_module": "SB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
k: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul -> pk: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul -> sk: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul -> FStar.HyperStack.ST.Stack Lib.IntTypes.size_t
FStar.HyperStack.ST.Stack
[]
[]
[ "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "FStar.UInt32.__uint_to_t", "Hacl.Impl.Box.box_beforenm", "Lib.IntTypes.size_t" ]
[]
false
true
false
false
false
let crypto_box_beforenm k pk sk =
Hacl.Impl.Box.box_beforenm k pk sk
false
Spec.MD5.fst
Spec.MD5.round4_aux
val round4_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t
val round4_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t
let round4_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round4_op abcd x ia ib ic id 0 6ul 49 in let abcd = round4_op abcd x id ia ib ic 7 10ul 50 in let abcd = round4_op abcd x ic id ia ib 14 15ul 51 in let abcd = round4_op abcd x ib ic id ia 5 21ul 52 in let abcd = round4_op abcd x ia ib ic id 12 6ul 53 in let abcd = round4_op abcd x id ia ib ic 3 10ul 54 in let abcd = round4_op abcd x ic id ia ib 10 15ul 55 in let abcd = round4_op abcd x ib ic id ia 1 21ul 56 in let abcd = round4_op abcd x ia ib ic id 8 6ul 57 in let abcd = round4_op abcd x id ia ib ic 15 10ul 58 in let abcd = round4_op abcd x ic id ia ib 6 15ul 59 in let abcd = round4_op abcd x ib ic id ia 13 21ul 60 in let abcd = round4_op abcd x ia ib ic id 4 6ul 61 in let abcd = round4_op abcd x id ia ib ic 11 10ul 62 in let abcd = round4_op abcd x ic id ia ib 2 15ul 63 in let abcd = round4_op abcd x ib ic id ia 9 21ul 64 in abcd
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 6, "end_line": 253, "start_col": 0, "start_line": 232 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4 let x_idx = (n: nat { n < 16 } ) let x_t = Seq.lseq uint32 16 let t_idx = (n: nat { 1 <= n /\ n <= 64 } ) inline_for_extraction let rotate_idx = rotval U32 let round_op_gen_aux (f: (uint32 -> uint32 -> uint32 -> Tot uint32)) (abcd: abcd_t) (x: x_t) (a b c d: abcd_idx) (k: x_idx) (s: rotate_idx) (i: t_idx) : Tot abcd_t = let va = Seq.index abcd a in let vb = Seq.index abcd b in let vc = Seq.index abcd c in let vd = Seq.index abcd d in Seq.upd abcd a (vb +. ((va +. f vb vc vd +. Seq.index x k +. Seq.index t (i - 1)) <<<. s)) [@"opaque_to_smt"] let round_op_gen = round_op_gen_aux (* Round 1 *) let round1_op = round_op_gen f let ia : abcd_idx = 0 let ib : abcd_idx = 1 let ic : abcd_idx = 2 let id : abcd_idx = 3 let round1_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round1_op abcd x ia ib ic id 0 7ul 1 in let abcd = round1_op abcd x id ia ib ic 1 12ul 2 in let abcd = round1_op abcd x ic id ia ib 2 17ul 3 in let abcd = round1_op abcd x ib ic id ia 3 22ul 4 in let abcd = round1_op abcd x ia ib ic id 4 7ul 5 in let abcd = round1_op abcd x id ia ib ic 5 12ul 6 in let abcd = round1_op abcd x ic id ia ib 6 17ul 7 in let abcd = round1_op abcd x ib ic id ia 7 22ul 8 in let abcd = round1_op abcd x ia ib ic id 8 7ul 9 in let abcd = round1_op abcd x id ia ib ic 9 12ul 10 in let abcd = round1_op abcd x ic id ia ib 10 17ul 11 in let abcd = round1_op abcd x ib ic id ia 11 22ul 12 in let abcd = round1_op abcd x ia ib ic id 12 7ul 13 in let abcd = round1_op abcd x id ia ib ic 13 12ul 14 in let abcd = round1_op abcd x ic id ia ib 14 17ul 15 in let abcd = round1_op abcd x ib ic id ia 15 22ul 16 in abcd [@"opaque_to_smt"] let round1 = round1_aux let round2_op = round_op_gen g let round2_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round2_op abcd x ia ib ic id 1 5ul 17 in let abcd = round2_op abcd x id ia ib ic 6 9ul 18 in let abcd = round2_op abcd x ic id ia ib 11 14ul 19 in let abcd = round2_op abcd x ib ic id ia 0 20ul 20 in let abcd = round2_op abcd x ia ib ic id 5 5ul 21 in let abcd = round2_op abcd x id ia ib ic 10 9ul 22 in let abcd = round2_op abcd x ic id ia ib 15 14ul 23 in let abcd = round2_op abcd x ib ic id ia 4 20ul 24 in let abcd = round2_op abcd x ia ib ic id 9 5ul 25 in let abcd = round2_op abcd x id ia ib ic 14 9ul 26 in let abcd = round2_op abcd x ic id ia ib 3 14ul 27 in let abcd = round2_op abcd x ib ic id ia 8 20ul 28 in let abcd = round2_op abcd x ia ib ic id 13 5ul 29 in let abcd = round2_op abcd x id ia ib ic 2 9ul 30 in let abcd = round2_op abcd x ic id ia ib 7 14ul 31 in let abcd = round2_op abcd x ib ic id ia 12 20ul 32 in abcd [@"opaque_to_smt"] let round2 = round2_aux let round3_op = round_op_gen h let round3_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round3_op abcd x ia ib ic id 5 4ul 33 in let abcd = round3_op abcd x id ia ib ic 8 11ul 34 in let abcd = round3_op abcd x ic id ia ib 11 16ul 35 in let abcd = round3_op abcd x ib ic id ia 14 23ul 36 in let abcd = round3_op abcd x ia ib ic id 1 4ul 37 in let abcd = round3_op abcd x id ia ib ic 4 11ul 38 in let abcd = round3_op abcd x ic id ia ib 7 16ul 39 in let abcd = round3_op abcd x ib ic id ia 10 23ul 40 in let abcd = round3_op abcd x ia ib ic id 13 4ul 41 in let abcd = round3_op abcd x id ia ib ic 0 11ul 42 in let abcd = round3_op abcd x ic id ia ib 3 16ul 43 in let abcd = round3_op abcd x ib ic id ia 6 23ul 44 in let abcd = round3_op abcd x ia ib ic id 9 4ul 45 in let abcd = round3_op abcd x id ia ib ic 12 11ul 46 in let abcd = round3_op abcd x ic id ia ib 15 16ul 47 in let abcd = round3_op abcd x ib ic id ia 2 23ul 48 in abcd [@"opaque_to_smt"] let round3 = round3_aux let round4_op = round_op_gen i
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
abcd: Spec.MD5.abcd_t -> x: Spec.MD5.x_t -> Spec.MD5.abcd_t
Prims.Tot
[ "total" ]
[]
[ "Spec.MD5.abcd_t", "Spec.MD5.x_t", "Spec.MD5.round4_op", "Spec.MD5.ib", "Spec.MD5.ic", "Spec.MD5.id", "Spec.MD5.ia", "FStar.UInt32.__uint_to_t" ]
[]
false
false
false
true
false
let round4_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t =
let abcd = round4_op abcd x ia ib ic id 0 6ul 49 in let abcd = round4_op abcd x id ia ib ic 7 10ul 50 in let abcd = round4_op abcd x ic id ia ib 14 15ul 51 in let abcd = round4_op abcd x ib ic id ia 5 21ul 52 in let abcd = round4_op abcd x ia ib ic id 12 6ul 53 in let abcd = round4_op abcd x id ia ib ic 3 10ul 54 in let abcd = round4_op abcd x ic id ia ib 10 15ul 55 in let abcd = round4_op abcd x ib ic id ia 1 21ul 56 in let abcd = round4_op abcd x ia ib ic id 8 6ul 57 in let abcd = round4_op abcd x id ia ib ic 15 10ul 58 in let abcd = round4_op abcd x ic id ia ib 6 15ul 59 in let abcd = round4_op abcd x ib ic id ia 13 21ul 60 in let abcd = round4_op abcd x ia ib ic id 4 6ul 61 in let abcd = round4_op abcd x id ia ib ic 11 10ul 62 in let abcd = round4_op abcd x ic id ia ib 2 15ul 63 in let abcd = round4_op abcd x ib ic id ia 9 21ul 64 in abcd
false
Spec.MD5.fst
Spec.MD5.overwrite_aux
val overwrite_aux (abcd: abcd_t) (a' b' c' d': uint32) : Tot abcd_t
val overwrite_aux (abcd: abcd_t) (a' b' c' d': uint32) : Tot abcd_t
let overwrite_aux (abcd: abcd_t) (a' b' c' d' : uint32) : Tot abcd_t = let abcd : abcd_t = Seq.upd abcd ia a' in let abcd : abcd_t = Seq.upd abcd ib b' in let abcd : abcd_t = Seq.upd abcd ic c' in let abcd : abcd_t = Seq.upd abcd id d' in abcd
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 6, "end_line": 273, "start_col": 0, "start_line": 268 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4 let x_idx = (n: nat { n < 16 } ) let x_t = Seq.lseq uint32 16 let t_idx = (n: nat { 1 <= n /\ n <= 64 } ) inline_for_extraction let rotate_idx = rotval U32 let round_op_gen_aux (f: (uint32 -> uint32 -> uint32 -> Tot uint32)) (abcd: abcd_t) (x: x_t) (a b c d: abcd_idx) (k: x_idx) (s: rotate_idx) (i: t_idx) : Tot abcd_t = let va = Seq.index abcd a in let vb = Seq.index abcd b in let vc = Seq.index abcd c in let vd = Seq.index abcd d in Seq.upd abcd a (vb +. ((va +. f vb vc vd +. Seq.index x k +. Seq.index t (i - 1)) <<<. s)) [@"opaque_to_smt"] let round_op_gen = round_op_gen_aux (* Round 1 *) let round1_op = round_op_gen f let ia : abcd_idx = 0 let ib : abcd_idx = 1 let ic : abcd_idx = 2 let id : abcd_idx = 3 let round1_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round1_op abcd x ia ib ic id 0 7ul 1 in let abcd = round1_op abcd x id ia ib ic 1 12ul 2 in let abcd = round1_op abcd x ic id ia ib 2 17ul 3 in let abcd = round1_op abcd x ib ic id ia 3 22ul 4 in let abcd = round1_op abcd x ia ib ic id 4 7ul 5 in let abcd = round1_op abcd x id ia ib ic 5 12ul 6 in let abcd = round1_op abcd x ic id ia ib 6 17ul 7 in let abcd = round1_op abcd x ib ic id ia 7 22ul 8 in let abcd = round1_op abcd x ia ib ic id 8 7ul 9 in let abcd = round1_op abcd x id ia ib ic 9 12ul 10 in let abcd = round1_op abcd x ic id ia ib 10 17ul 11 in let abcd = round1_op abcd x ib ic id ia 11 22ul 12 in let abcd = round1_op abcd x ia ib ic id 12 7ul 13 in let abcd = round1_op abcd x id ia ib ic 13 12ul 14 in let abcd = round1_op abcd x ic id ia ib 14 17ul 15 in let abcd = round1_op abcd x ib ic id ia 15 22ul 16 in abcd [@"opaque_to_smt"] let round1 = round1_aux let round2_op = round_op_gen g let round2_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round2_op abcd x ia ib ic id 1 5ul 17 in let abcd = round2_op abcd x id ia ib ic 6 9ul 18 in let abcd = round2_op abcd x ic id ia ib 11 14ul 19 in let abcd = round2_op abcd x ib ic id ia 0 20ul 20 in let abcd = round2_op abcd x ia ib ic id 5 5ul 21 in let abcd = round2_op abcd x id ia ib ic 10 9ul 22 in let abcd = round2_op abcd x ic id ia ib 15 14ul 23 in let abcd = round2_op abcd x ib ic id ia 4 20ul 24 in let abcd = round2_op abcd x ia ib ic id 9 5ul 25 in let abcd = round2_op abcd x id ia ib ic 14 9ul 26 in let abcd = round2_op abcd x ic id ia ib 3 14ul 27 in let abcd = round2_op abcd x ib ic id ia 8 20ul 28 in let abcd = round2_op abcd x ia ib ic id 13 5ul 29 in let abcd = round2_op abcd x id ia ib ic 2 9ul 30 in let abcd = round2_op abcd x ic id ia ib 7 14ul 31 in let abcd = round2_op abcd x ib ic id ia 12 20ul 32 in abcd [@"opaque_to_smt"] let round2 = round2_aux let round3_op = round_op_gen h let round3_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round3_op abcd x ia ib ic id 5 4ul 33 in let abcd = round3_op abcd x id ia ib ic 8 11ul 34 in let abcd = round3_op abcd x ic id ia ib 11 16ul 35 in let abcd = round3_op abcd x ib ic id ia 14 23ul 36 in let abcd = round3_op abcd x ia ib ic id 1 4ul 37 in let abcd = round3_op abcd x id ia ib ic 4 11ul 38 in let abcd = round3_op abcd x ic id ia ib 7 16ul 39 in let abcd = round3_op abcd x ib ic id ia 10 23ul 40 in let abcd = round3_op abcd x ia ib ic id 13 4ul 41 in let abcd = round3_op abcd x id ia ib ic 0 11ul 42 in let abcd = round3_op abcd x ic id ia ib 3 16ul 43 in let abcd = round3_op abcd x ib ic id ia 6 23ul 44 in let abcd = round3_op abcd x ia ib ic id 9 4ul 45 in let abcd = round3_op abcd x id ia ib ic 12 11ul 46 in let abcd = round3_op abcd x ic id ia ib 15 16ul 47 in let abcd = round3_op abcd x ib ic id ia 2 23ul 48 in abcd [@"opaque_to_smt"] let round3 = round3_aux let round4_op = round_op_gen i let round4_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round4_op abcd x ia ib ic id 0 6ul 49 in let abcd = round4_op abcd x id ia ib ic 7 10ul 50 in let abcd = round4_op abcd x ic id ia ib 14 15ul 51 in let abcd = round4_op abcd x ib ic id ia 5 21ul 52 in let abcd = round4_op abcd x ia ib ic id 12 6ul 53 in let abcd = round4_op abcd x id ia ib ic 3 10ul 54 in let abcd = round4_op abcd x ic id ia ib 10 15ul 55 in let abcd = round4_op abcd x ib ic id ia 1 21ul 56 in let abcd = round4_op abcd x ia ib ic id 8 6ul 57 in let abcd = round4_op abcd x id ia ib ic 15 10ul 58 in let abcd = round4_op abcd x ic id ia ib 6 15ul 59 in let abcd = round4_op abcd x ib ic id ia 13 21ul 60 in let abcd = round4_op abcd x ia ib ic id 4 6ul 61 in let abcd = round4_op abcd x id ia ib ic 11 10ul 62 in let abcd = round4_op abcd x ic id ia ib 2 15ul 63 in let abcd = round4_op abcd x ib ic id ia 9 21ul 64 in abcd [@"opaque_to_smt"] let round4 = round4_aux let rounds_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round1 abcd x in let abcd = round2 abcd x in let abcd = round3 abcd x in let abcd = round4 abcd x in abcd [@"opaque_to_smt"] let rounds = rounds_aux
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
abcd: Spec.MD5.abcd_t -> a': Lib.IntTypes.uint32 -> b': Lib.IntTypes.uint32 -> c': Lib.IntTypes.uint32 -> d': Lib.IntTypes.uint32 -> Spec.MD5.abcd_t
Prims.Tot
[ "total" ]
[]
[ "Spec.MD5.abcd_t", "Lib.IntTypes.uint32", "FStar.Seq.Base.upd", "Spec.MD5.id", "Spec.MD5.ic", "Spec.MD5.ib", "Spec.MD5.ia" ]
[]
false
false
false
true
false
let overwrite_aux (abcd: abcd_t) (a' b' c' d': uint32) : Tot abcd_t =
let abcd:abcd_t = Seq.upd abcd ia a' in let abcd:abcd_t = Seq.upd abcd ib b' in let abcd:abcd_t = Seq.upd abcd ic c' in let abcd:abcd_t = Seq.upd abcd id d' in abcd
false
Vale.X64.Stack_i.fst
Vale.X64.Stack_i.valid_taint_stack64
val valid_taint_stack64 (ptr:int) (t:taint) (stackTaint:memtaint) : GTot prop0
val valid_taint_stack64 (ptr:int) (t:taint) (stackTaint:memtaint) : GTot prop0
let valid_taint_stack64 ptr t stackTaint = Map.sel stackTaint ptr = t && Map.sel stackTaint (ptr + 1) = t && Map.sel stackTaint (ptr + 2) = t && Map.sel stackTaint (ptr + 3) = t && Map.sel stackTaint (ptr + 4) = t && Map.sel stackTaint (ptr + 5) = t && Map.sel stackTaint (ptr + 6) = t && Map.sel stackTaint (ptr + 7) = t
{ "file_name": "vale/code/arch/x64/Vale.X64.Stack_i.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 34, "end_line": 81, "start_col": 0, "start_line": 73 }
module Vale.X64.Stack_i open FStar.Mul module BS = Vale.X64.Machine_Semantics_s open Vale.Arch.MachineHeap let vale_stack = BS.machine_stack let valid_src_stack64 i st = BS.valid_src_stack64 i st let load_stack64 i st = BS.eval_stack i st let store_stack64 i v h = BS.update_stack64' i v h let free_stack64 start finish h = BS.free_stack' start finish h let valid_src_stack128 i st = BS.valid_src_stack128 i st let load_stack128 i st = BS.eval_stack128 i st let store_stack128 i v h = BS.update_stack128' i v h let init_rsp h = h.BS.initial_rsp (* Lemmas *) #push-options "--z3rlimit 40" let lemma_store_stack_same_valid64 ptr v h i = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; BS.update_heap64_reveal () let lemma_free_stack_same_valid64 start finish ptr h = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; let BS.Machine_stack _ mem = h in let domain = Map.domain mem in Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish) let lemma_store_new_valid64 ptr v h = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; BS.update_heap64_reveal () #pop-options let lemma_correct_store_load_stack64 ptr v h = let BS.Machine_stack _ mem = h in correct_update_get64 ptr v mem let lemma_frame_store_load_stack64 ptr v h i = let BS.Machine_stack _ mem = h in frame_update_heap64 ptr v mem; BS.get_heap_val64_reveal () let lemma_free_stack_same_load64 start finish ptr h = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; let BS.Machine_stack _ mem = h in let domain = Map.domain mem in Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish); BS.get_heap_val64_reveal () let lemma_compose_free_stack64 start inter finish h = let BS.Machine_stack _ mem = h in let domain = Map.domain mem in let map_restr = Map.restrict (Vale.Lib.Set.remove_between domain start inter) mem in let restrict = Map.domain map_restr in let BS.Machine_stack _ mem1 = free_stack64 inter finish (free_stack64 start inter h) in let BS.Machine_stack _ mem2 = free_stack64 start finish h in let aux (i:int) : Lemma (Map.contains mem1 i = Map.contains mem2 i /\ Map.sel mem1 i = Map.sel mem2 i) = Vale.Lib.Set.remove_between_reveal domain start inter i; Vale.Lib.Set.remove_between_reveal restrict inter finish i; Vale.Lib.Set.remove_between_reveal domain start finish i; Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start inter) mem i; Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between restrict inter finish) map_restr i; Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start finish) mem i in Classical.forall_intro aux; assert (Map.equal mem1 mem2) let lemma_same_init_rsp_free_stack64 start finish h = () let lemma_same_init_rsp_store_stack64 ptr v h = ()
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.Lib.Set.fsti.checked", "Vale.Arch.MachineHeap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Vale.X64.Stack_i.fst" }
[ { "abbrev": false, "full_module": "Vale.Arch.MachineHeap", "short_module": null }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
ptr: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> stackTaint: Vale.X64.Memory.memtaint -> Prims.GTot Vale.Def.Prop_s.prop0
Prims.GTot
[ "sometrivial" ]
[]
[ "Prims.int", "Vale.Arch.HeapTypes_s.taint", "Vale.X64.Memory.memtaint", "Prims.b2t", "Prims.op_AmpAmp", "Prims.op_Equality", "FStar.Map.sel", "Prims.op_Addition", "Vale.Def.Prop_s.prop0" ]
[]
false
false
false
false
false
let valid_taint_stack64 ptr t stackTaint =
Map.sel stackTaint ptr = t && Map.sel stackTaint (ptr + 1) = t && Map.sel stackTaint (ptr + 2) = t && Map.sel stackTaint (ptr + 3) = t && Map.sel stackTaint (ptr + 4) = t && Map.sel stackTaint (ptr + 5) = t && Map.sel stackTaint (ptr + 6) = t && Map.sel stackTaint (ptr + 7) = t
false
Vale.X64.Stack_i.fst
Vale.X64.Stack_i.valid_taint_stack128
val valid_taint_stack128 (ptr:int) (t:taint) (stackTaint:memtaint) : GTot prop0
val valid_taint_stack128 (ptr:int) (t:taint) (stackTaint:memtaint) : GTot prop0
let valid_taint_stack128 ptr t stackTaint = valid_taint_stack64 ptr t stackTaint /\ valid_taint_stack64 (ptr + 8) t stackTaint
{ "file_name": "vale/code/arch/x64/Vale.X64.Stack_i.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 84, "end_line": 84, "start_col": 0, "start_line": 83 }
module Vale.X64.Stack_i open FStar.Mul module BS = Vale.X64.Machine_Semantics_s open Vale.Arch.MachineHeap let vale_stack = BS.machine_stack let valid_src_stack64 i st = BS.valid_src_stack64 i st let load_stack64 i st = BS.eval_stack i st let store_stack64 i v h = BS.update_stack64' i v h let free_stack64 start finish h = BS.free_stack' start finish h let valid_src_stack128 i st = BS.valid_src_stack128 i st let load_stack128 i st = BS.eval_stack128 i st let store_stack128 i v h = BS.update_stack128' i v h let init_rsp h = h.BS.initial_rsp (* Lemmas *) #push-options "--z3rlimit 40" let lemma_store_stack_same_valid64 ptr v h i = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; BS.update_heap64_reveal () let lemma_free_stack_same_valid64 start finish ptr h = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; let BS.Machine_stack _ mem = h in let domain = Map.domain mem in Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish) let lemma_store_new_valid64 ptr v h = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; BS.update_heap64_reveal () #pop-options let lemma_correct_store_load_stack64 ptr v h = let BS.Machine_stack _ mem = h in correct_update_get64 ptr v mem let lemma_frame_store_load_stack64 ptr v h i = let BS.Machine_stack _ mem = h in frame_update_heap64 ptr v mem; BS.get_heap_val64_reveal () let lemma_free_stack_same_load64 start finish ptr h = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; let BS.Machine_stack _ mem = h in let domain = Map.domain mem in Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish); BS.get_heap_val64_reveal () let lemma_compose_free_stack64 start inter finish h = let BS.Machine_stack _ mem = h in let domain = Map.domain mem in let map_restr = Map.restrict (Vale.Lib.Set.remove_between domain start inter) mem in let restrict = Map.domain map_restr in let BS.Machine_stack _ mem1 = free_stack64 inter finish (free_stack64 start inter h) in let BS.Machine_stack _ mem2 = free_stack64 start finish h in let aux (i:int) : Lemma (Map.contains mem1 i = Map.contains mem2 i /\ Map.sel mem1 i = Map.sel mem2 i) = Vale.Lib.Set.remove_between_reveal domain start inter i; Vale.Lib.Set.remove_between_reveal restrict inter finish i; Vale.Lib.Set.remove_between_reveal domain start finish i; Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start inter) mem i; Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between restrict inter finish) map_restr i; Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start finish) mem i in Classical.forall_intro aux; assert (Map.equal mem1 mem2) let lemma_same_init_rsp_free_stack64 start finish h = () let lemma_same_init_rsp_store_stack64 ptr v h = () let valid_taint_stack64 ptr t stackTaint = Map.sel stackTaint ptr = t && Map.sel stackTaint (ptr + 1) = t && Map.sel stackTaint (ptr + 2) = t && Map.sel stackTaint (ptr + 3) = t && Map.sel stackTaint (ptr + 4) = t && Map.sel stackTaint (ptr + 5) = t && Map.sel stackTaint (ptr + 6) = t && Map.sel stackTaint (ptr + 7) = t
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.Lib.Set.fsti.checked", "Vale.Arch.MachineHeap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Vale.X64.Stack_i.fst" }
[ { "abbrev": false, "full_module": "Vale.Arch.MachineHeap", "short_module": null }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
ptr: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> stackTaint: Vale.X64.Memory.memtaint -> Prims.GTot Vale.Def.Prop_s.prop0
Prims.GTot
[ "sometrivial" ]
[]
[ "Prims.int", "Vale.Arch.HeapTypes_s.taint", "Vale.X64.Memory.memtaint", "Prims.l_and", "Vale.X64.Stack_i.valid_taint_stack64", "Prims.op_Addition", "Vale.Def.Prop_s.prop0" ]
[]
false
false
false
false
false
let valid_taint_stack128 ptr t stackTaint =
valid_taint_stack64 ptr t stackTaint /\ valid_taint_stack64 (ptr + 8) t stackTaint
false
Vale.X64.Stack_i.fst
Vale.X64.Stack_i.store_taint_stack64
val store_taint_stack64 (ptr:int) (t:taint) (stackTaint:memtaint) : GTot memtaint
val store_taint_stack64 (ptr:int) (t:taint) (stackTaint:memtaint) : GTot memtaint
let store_taint_stack64 ptr t stackTaint = BS.update_n ptr 8 stackTaint t
{ "file_name": "vale/code/arch/x64/Vale.X64.Stack_i.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 73, "end_line": 86, "start_col": 0, "start_line": 86 }
module Vale.X64.Stack_i open FStar.Mul module BS = Vale.X64.Machine_Semantics_s open Vale.Arch.MachineHeap let vale_stack = BS.machine_stack let valid_src_stack64 i st = BS.valid_src_stack64 i st let load_stack64 i st = BS.eval_stack i st let store_stack64 i v h = BS.update_stack64' i v h let free_stack64 start finish h = BS.free_stack' start finish h let valid_src_stack128 i st = BS.valid_src_stack128 i st let load_stack128 i st = BS.eval_stack128 i st let store_stack128 i v h = BS.update_stack128' i v h let init_rsp h = h.BS.initial_rsp (* Lemmas *) #push-options "--z3rlimit 40" let lemma_store_stack_same_valid64 ptr v h i = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; BS.update_heap64_reveal () let lemma_free_stack_same_valid64 start finish ptr h = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; let BS.Machine_stack _ mem = h in let domain = Map.domain mem in Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish) let lemma_store_new_valid64 ptr v h = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; BS.update_heap64_reveal () #pop-options let lemma_correct_store_load_stack64 ptr v h = let BS.Machine_stack _ mem = h in correct_update_get64 ptr v mem let lemma_frame_store_load_stack64 ptr v h i = let BS.Machine_stack _ mem = h in frame_update_heap64 ptr v mem; BS.get_heap_val64_reveal () let lemma_free_stack_same_load64 start finish ptr h = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; let BS.Machine_stack _ mem = h in let domain = Map.domain mem in Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish); BS.get_heap_val64_reveal () let lemma_compose_free_stack64 start inter finish h = let BS.Machine_stack _ mem = h in let domain = Map.domain mem in let map_restr = Map.restrict (Vale.Lib.Set.remove_between domain start inter) mem in let restrict = Map.domain map_restr in let BS.Machine_stack _ mem1 = free_stack64 inter finish (free_stack64 start inter h) in let BS.Machine_stack _ mem2 = free_stack64 start finish h in let aux (i:int) : Lemma (Map.contains mem1 i = Map.contains mem2 i /\ Map.sel mem1 i = Map.sel mem2 i) = Vale.Lib.Set.remove_between_reveal domain start inter i; Vale.Lib.Set.remove_between_reveal restrict inter finish i; Vale.Lib.Set.remove_between_reveal domain start finish i; Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start inter) mem i; Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between restrict inter finish) map_restr i; Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start finish) mem i in Classical.forall_intro aux; assert (Map.equal mem1 mem2) let lemma_same_init_rsp_free_stack64 start finish h = () let lemma_same_init_rsp_store_stack64 ptr v h = () let valid_taint_stack64 ptr t stackTaint = Map.sel stackTaint ptr = t && Map.sel stackTaint (ptr + 1) = t && Map.sel stackTaint (ptr + 2) = t && Map.sel stackTaint (ptr + 3) = t && Map.sel stackTaint (ptr + 4) = t && Map.sel stackTaint (ptr + 5) = t && Map.sel stackTaint (ptr + 6) = t && Map.sel stackTaint (ptr + 7) = t let valid_taint_stack128 ptr t stackTaint = valid_taint_stack64 ptr t stackTaint /\ valid_taint_stack64 (ptr + 8) t stackTaint
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.Lib.Set.fsti.checked", "Vale.Arch.MachineHeap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Vale.X64.Stack_i.fst" }
[ { "abbrev": false, "full_module": "Vale.Arch.MachineHeap", "short_module": null }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
ptr: Prims.int -> t: Vale.Arch.HeapTypes_s.taint -> stackTaint: Vale.X64.Memory.memtaint -> Prims.GTot Vale.X64.Memory.memtaint
Prims.GTot
[ "sometrivial" ]
[]
[ "Prims.int", "Vale.Arch.HeapTypes_s.taint", "Vale.X64.Memory.memtaint", "Vale.X64.Machine_Semantics_s.update_n" ]
[]
false
false
false
false
false
let store_taint_stack64 ptr t stackTaint =
BS.update_n ptr 8 stackTaint t
false
Spec.MD5.fst
Spec.MD5.round3_aux
val round3_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t
val round3_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t
let round3_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round3_op abcd x ia ib ic id 5 4ul 33 in let abcd = round3_op abcd x id ia ib ic 8 11ul 34 in let abcd = round3_op abcd x ic id ia ib 11 16ul 35 in let abcd = round3_op abcd x ib ic id ia 14 23ul 36 in let abcd = round3_op abcd x ia ib ic id 1 4ul 37 in let abcd = round3_op abcd x id ia ib ic 4 11ul 38 in let abcd = round3_op abcd x ic id ia ib 7 16ul 39 in let abcd = round3_op abcd x ib ic id ia 10 23ul 40 in let abcd = round3_op abcd x ia ib ic id 13 4ul 41 in let abcd = round3_op abcd x id ia ib ic 0 11ul 42 in let abcd = round3_op abcd x ic id ia ib 3 16ul 43 in let abcd = round3_op abcd x ib ic id ia 6 23ul 44 in let abcd = round3_op abcd x ia ib ic id 9 4ul 45 in let abcd = round3_op abcd x id ia ib ic 12 11ul 46 in let abcd = round3_op abcd x ic id ia ib 15 16ul 47 in let abcd = round3_op abcd x ib ic id ia 2 23ul 48 in abcd
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 6, "end_line": 225, "start_col": 0, "start_line": 204 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4 let x_idx = (n: nat { n < 16 } ) let x_t = Seq.lseq uint32 16 let t_idx = (n: nat { 1 <= n /\ n <= 64 } ) inline_for_extraction let rotate_idx = rotval U32 let round_op_gen_aux (f: (uint32 -> uint32 -> uint32 -> Tot uint32)) (abcd: abcd_t) (x: x_t) (a b c d: abcd_idx) (k: x_idx) (s: rotate_idx) (i: t_idx) : Tot abcd_t = let va = Seq.index abcd a in let vb = Seq.index abcd b in let vc = Seq.index abcd c in let vd = Seq.index abcd d in Seq.upd abcd a (vb +. ((va +. f vb vc vd +. Seq.index x k +. Seq.index t (i - 1)) <<<. s)) [@"opaque_to_smt"] let round_op_gen = round_op_gen_aux (* Round 1 *) let round1_op = round_op_gen f let ia : abcd_idx = 0 let ib : abcd_idx = 1 let ic : abcd_idx = 2 let id : abcd_idx = 3 let round1_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round1_op abcd x ia ib ic id 0 7ul 1 in let abcd = round1_op abcd x id ia ib ic 1 12ul 2 in let abcd = round1_op abcd x ic id ia ib 2 17ul 3 in let abcd = round1_op abcd x ib ic id ia 3 22ul 4 in let abcd = round1_op abcd x ia ib ic id 4 7ul 5 in let abcd = round1_op abcd x id ia ib ic 5 12ul 6 in let abcd = round1_op abcd x ic id ia ib 6 17ul 7 in let abcd = round1_op abcd x ib ic id ia 7 22ul 8 in let abcd = round1_op abcd x ia ib ic id 8 7ul 9 in let abcd = round1_op abcd x id ia ib ic 9 12ul 10 in let abcd = round1_op abcd x ic id ia ib 10 17ul 11 in let abcd = round1_op abcd x ib ic id ia 11 22ul 12 in let abcd = round1_op abcd x ia ib ic id 12 7ul 13 in let abcd = round1_op abcd x id ia ib ic 13 12ul 14 in let abcd = round1_op abcd x ic id ia ib 14 17ul 15 in let abcd = round1_op abcd x ib ic id ia 15 22ul 16 in abcd [@"opaque_to_smt"] let round1 = round1_aux let round2_op = round_op_gen g let round2_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round2_op abcd x ia ib ic id 1 5ul 17 in let abcd = round2_op abcd x id ia ib ic 6 9ul 18 in let abcd = round2_op abcd x ic id ia ib 11 14ul 19 in let abcd = round2_op abcd x ib ic id ia 0 20ul 20 in let abcd = round2_op abcd x ia ib ic id 5 5ul 21 in let abcd = round2_op abcd x id ia ib ic 10 9ul 22 in let abcd = round2_op abcd x ic id ia ib 15 14ul 23 in let abcd = round2_op abcd x ib ic id ia 4 20ul 24 in let abcd = round2_op abcd x ia ib ic id 9 5ul 25 in let abcd = round2_op abcd x id ia ib ic 14 9ul 26 in let abcd = round2_op abcd x ic id ia ib 3 14ul 27 in let abcd = round2_op abcd x ib ic id ia 8 20ul 28 in let abcd = round2_op abcd x ia ib ic id 13 5ul 29 in let abcd = round2_op abcd x id ia ib ic 2 9ul 30 in let abcd = round2_op abcd x ic id ia ib 7 14ul 31 in let abcd = round2_op abcd x ib ic id ia 12 20ul 32 in abcd [@"opaque_to_smt"] let round2 = round2_aux let round3_op = round_op_gen h
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
abcd: Spec.MD5.abcd_t -> x: Spec.MD5.x_t -> Spec.MD5.abcd_t
Prims.Tot
[ "total" ]
[]
[ "Spec.MD5.abcd_t", "Spec.MD5.x_t", "Spec.MD5.round3_op", "Spec.MD5.ib", "Spec.MD5.ic", "Spec.MD5.id", "Spec.MD5.ia", "FStar.UInt32.__uint_to_t" ]
[]
false
false
false
true
false
let round3_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t =
let abcd = round3_op abcd x ia ib ic id 5 4ul 33 in let abcd = round3_op abcd x id ia ib ic 8 11ul 34 in let abcd = round3_op abcd x ic id ia ib 11 16ul 35 in let abcd = round3_op abcd x ib ic id ia 14 23ul 36 in let abcd = round3_op abcd x ia ib ic id 1 4ul 37 in let abcd = round3_op abcd x id ia ib ic 4 11ul 38 in let abcd = round3_op abcd x ic id ia ib 7 16ul 39 in let abcd = round3_op abcd x ib ic id ia 10 23ul 40 in let abcd = round3_op abcd x ia ib ic id 13 4ul 41 in let abcd = round3_op abcd x id ia ib ic 0 11ul 42 in let abcd = round3_op abcd x ic id ia ib 3 16ul 43 in let abcd = round3_op abcd x ib ic id ia 6 23ul 44 in let abcd = round3_op abcd x ia ib ic id 9 4ul 45 in let abcd = round3_op abcd x id ia ib ic 12 11ul 46 in let abcd = round3_op abcd x ic id ia ib 15 16ul 47 in let abcd = round3_op abcd x ib ic id ia 2 23ul 48 in abcd
false
Hacl.NaCl.fst
Hacl.NaCl.crypto_box_open_detached
val crypto_box_open_detached: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h pk /\ live h sk /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SB.box_open_detached (as_seq h0 pk) (as_seq h0 sk) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg))
val crypto_box_open_detached: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h pk /\ live h sk /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SB.box_open_detached (as_seq h0 pk) (as_seq h0 sk) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg))
let crypto_box_open_detached m c tag mlen n pk sk = Hacl.Impl.Box.box_open_detached mlen m pk sk n c tag
{ "file_name": "code/nacl-box/Hacl.NaCl.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 54, "end_line": 262, "start_col": 0, "start_line": 261 }
module Hacl.NaCl open FStar.HyperStack.All open FStar.HyperStack open FStar.Mul open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module SB = Spec.Box module SS = Spec.SecretBox #set-options "--max_fuel 50 --max_fuel 0 --max_ifuel 0" [@@ Comment "Encrypt a message with a key and nonce. Note: `c` and `m` can point to the same memory for in-place encryption. @param c Pointer to `mlen` bytes where the ciphertext is written to. @param tag Pointer to 16 (tag length) bytes where the authentication tag is written to. @param m Pointer to `mlen` bytes where the message is read from. @param mlen Length of message. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_detached: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == SS.secretbox_detached (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_secretbox_detached c tag m mlen n k = Hacl.Impl.SecretBox.secretbox_detached mlen c tag k n m; 0ul [@@ Comment "Verify and decrypt a ciphertext produced with `Hacl_NaCl_crypto_secretbox_detached`. Note: `m` and `c` can point to the same memory for in-place decryption. @param m Pointer to `mlen` bytes where the message is written to. @param c Pointer to `mlen` bytes where the ciphertext is read from. @param tag Pointer to 16 (tag length) bytes where the authentication tag is read from. @param mlen Length of message (and ciphertext). @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_open_detached: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SS.secretbox_open_detached (as_seq h0 k) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg)) let crypto_secretbox_open_detached m c tag mlen n k = Hacl.Impl.SecretBox.secretbox_open_detached mlen m k n c tag [@@ Comment "Encrypt a message with a key and nonce. @param c Pointer to 16 (tag length) + `mlen` bytes where the ciphertext is written to. @param m Pointer to `mlen` bytes where the message is read from. @param mlen Length of message. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_easy: c:buffer uint8 -> m:buffer uint8 -> mlen:size_t{length c = v mlen + 16 /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 c h0 h1 /\ as_seq #MUT #uint8 #(mlen +! 16ul) h1 c == SS.secretbox_easy (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_secretbox_easy c m mlen n k = Hacl.Impl.SecretBox.secretbox_easy mlen c k n m; 0ul #set-options "--z3rlimit 100" [@@ Comment "Verify and decrypt a ciphertext produced with `crypto_secretbox_easy`. @param m Pointer to `mlen` bytes where the message is written to. @param c Pointer to `clen` bytes where the ciphertext is read from. The authentication tag must be included. @param clen Length of ciphertext. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_open_easy: m:buffer uint8 -> c:buffer uint8 -> clen:size_t{length c = v clen /\ v clen = length m + 16} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint m n /\ disjoint c n) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SS.secretbox_open_easy (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #clen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #(clen -! 16ul) h1 m == Some?.v msg | _ -> None? msg)) let crypto_secretbox_open_easy m c clen n k = Hacl.Impl.SecretBox.secretbox_open_easy (clen -! 16ul) m k n c [@@ Comment "Compute a shared secret key given a public key and secret key. @param k Pointer to 32 (`crypto_box_BEFORENMBYTES`) bytes of memory where the shared secret is written to. @param pk Pointer to 32 bytes of memory where **their** public key is read from. @param sk Pointer to 32 bytes of memory where **my** secret key is read from."] val crypto_box_beforenm: k:lbuffer uint8 32ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h k /\ live h pk /\ live h sk /\ disjoint k pk /\ disjoint k sk) (ensures fun h0 r h1 -> modifies1 k h0 h1 /\ (let key = SB.box_beforenm (as_seq h0 pk) (as_seq h0 sk) in match r with | 0ul -> Some? key /\ as_seq h1 k == Some?.v key | _ -> None? key)) let crypto_box_beforenm k pk sk = Hacl.Impl.Box.box_beforenm k pk sk [@@ Comment "See `crypto_box_detached`."] val crypto_box_detached_afternm: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == SB.box_detached_afternm (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_box_detached_afternm c tag m mlen n k = Hacl.Impl.Box.box_detached_afternm mlen c tag k n m [@@ Comment "Encrypt a message using the recipient's public key, the sender's secret key, and a nonce. @param c Pointer to `mlen` bytes of memory where the ciphertext is written to. @param tag Pointer to 16 (tag length) bytes of memory where the authentication tag is written to. @param m Pointer to `mlen` bytes of memory where the message is read from. @param mlen Length of the message. @param n Pointer to 24 (`crypto_box_NONCEBYTES`) bytes of memory where the nonce is read from. @param pk Pointer to 32 bytes of memory where **their** public key is read from. @param sk Pointer to 32 bytes of memory where **my** secret key is read from."] val crypto_box_detached: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h sk /\ live h pk /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (let tag_cipher = SB.box_detached (as_seq h0 sk) (as_seq h0 pk) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m) in match r with | 0ul -> Some? tag_cipher /\ (let (tag_s, cipher_s) = Some?.v tag_cipher in (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == (tag_s, cipher_s)) | _ -> None? tag_cipher)) let crypto_box_detached c tag m mlen n pk sk = Hacl.Impl.Box.box_detached mlen c tag sk pk n m [@@ Comment "See `crypto_box_open_detached`."] val crypto_box_open_detached_afternm: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SB.box_open_detached_afternm (as_seq h0 k) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg)) let crypto_box_open_detached_afternm m c tag mlen n k = Hacl.Impl.Box.box_open_detached_afternm mlen m k n c tag [@@ Comment "Verify and decrypt a ciphertext produced by `crypto_box_detached`. @param m Pointer to `mlen` bytes of memory where the decrypted message is written to. @param c Pointer to `mlen` bytes of memory where the ciphertext is read from. Note: the ciphertext must include the tag. @param tag Pointer to 16 (tag length) bytes of memory where the authentication tag is read from. @param mlen Length of the message (and ciphertext). @param n Pointer to 24 (`crypto_box_NONCEBYTES`) bytes of memory where the nonce is read from. @param pk Pointer to 32 bytes of memory where the public key of the sender is read from. @param sk Pointer to 32 bytes of memory where the secret key of the recipient is read from."] val crypto_box_open_detached: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h pk /\ live h sk /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SB.box_open_detached (as_seq h0 pk) (as_seq h0 sk) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg))
{ "checked_file": "/", "dependencies": [ "Spec.SecretBox.fst.checked", "Spec.Box.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.SecretBox.fst.checked", "Hacl.Impl.Box.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.NaCl.fst" }
[ { "abbrev": true, "full_module": "Spec.SecretBox", "short_module": "SS" }, { "abbrev": true, "full_module": "Spec.Box", "short_module": "SB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
m: Lib.Buffer.buffer Lib.IntTypes.uint8 -> c: Lib.Buffer.buffer Lib.IntTypes.uint8 -> tag: Lib.Buffer.lbuffer Lib.IntTypes.uint8 16ul -> mlen: Lib.IntTypes.size_t {Lib.Buffer.length c = Lib.IntTypes.v mlen /\ Lib.Buffer.length m = Lib.IntTypes.v mlen} -> n: Lib.Buffer.lbuffer Lib.IntTypes.uint8 24ul -> pk: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul -> sk: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul -> FStar.HyperStack.ST.Stack Lib.IntTypes.size_t
FStar.HyperStack.ST.Stack
[]
[]
[ "Lib.Buffer.buffer", "Lib.IntTypes.uint8", "Lib.Buffer.lbuffer", "FStar.UInt32.__uint_to_t", "Lib.IntTypes.size_t", "Prims.l_and", "Prims.b2t", "Prims.op_Equality", "Prims.int", "Prims.l_or", "Prims.op_GreaterThanOrEqual", "Lib.IntTypes.range", "Lib.IntTypes.U32", "Lib.Buffer.length", "Lib.Buffer.MUT", "Lib.IntTypes.v", "Lib.IntTypes.PUB", "Hacl.Impl.Box.box_open_detached" ]
[]
false
true
false
false
false
let crypto_box_open_detached m c tag mlen n pk sk =
Hacl.Impl.Box.box_open_detached mlen m pk sk n c tag
false
Spec.MD5.fst
Spec.MD5.update
val update: update_t MD5
val update: update_t MD5
let update = update_aux
{ "file_name": "specs/Spec.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 23, "end_line": 293, "start_col": 0, "start_line": 293 }
module Spec.MD5 (* Source: https://tools.ietf.org/html/rfc1321 *) open Lib.IntTypes open Spec.Hash.Definitions (* Section 3.3 *) inline_for_extraction let init_as_list : list uint32 = [ u32 0x67452301; u32 0xefcdab89; u32 0x98badcfe; u32 0x10325476; ] let init : words_state MD5 = Seq.seq_of_list init_as_list (* Section 3.4 *) inline_for_extraction let f (x y z: uint32) : Tot uint32 = (x &. y) |. ((~. x) &. z) inline_for_extraction let g (x y z: uint32) : Tot uint32 = (x &. z) |. (y &. (~. z)) inline_for_extraction let h (x y z: uint32) : Tot uint32 = x ^. y ^. z inline_for_extraction let i (x y z: uint32) : Tot uint32 = y ^. (x |. ~. z) (* Table T: specified in 3.4, defined in Appendix A.3, function MD5Transform *) inline_for_extraction let t_as_list : list uint32 = [ u32 0xd76aa478; u32 0xe8c7b756; u32 0x242070db; u32 0xc1bdceee; u32 0xf57c0faf; u32 0x4787c62a; u32 0xa8304613; u32 0xfd469501; u32 0x698098d8; u32 0x8b44f7af; u32 0xffff5bb1; u32 0x895cd7be; u32 0x6b901122; u32 0xfd987193; u32 0xa679438e; u32 0x49b40821; u32 0xf61e2562; u32 0xc040b340; u32 0x265e5a51; u32 0xe9b6c7aa; u32 0xd62f105d; u32 0x02441453; u32 0xd8a1e681; u32 0xe7d3fbc8; u32 0x21e1cde6; u32 0xc33707d6; u32 0xf4d50d87; u32 0x455a14ed; u32 0xa9e3e905; u32 0xfcefa3f8; u32 0x676f02d9; u32 0x8d2a4c8a; u32 0xfffa3942; u32 0x8771f681; u32 0x6d9d6122; u32 0xfde5380c; u32 0xa4beea44; u32 0x4bdecfa9; u32 0xf6bb4b60; u32 0xbebfbc70; u32 0x289b7ec6; u32 0xeaa127fa; u32 0xd4ef3085; u32 0x4881d05; u32 0xd9d4d039; u32 0xe6db99e5; u32 0x1fa27cf8; u32 0xc4ac5665; u32 0xf4292244; u32 0x432aff97; u32 0xab9423a7; u32 0xfc93a039; u32 0x655b59c3; u32 0x8f0ccc92; u32 0xffeff47d; u32 0x85845dd1; u32 0x6fa87e4f; u32 0xfe2ce6e0; u32 0xa3014314; u32 0x4e0811a1; u32 0xf7537e82; u32 0xbd3af235; u32 0x2ad7d2bb; u32 0xeb86d391; ] module L = FStar.List.Tot let t : Seq.lseq uint32 64 = assert_norm (L.length t_as_list == 64); Seq.seq_of_list t_as_list let abcd_idx = (n: nat { n < 4 } ) let abcd_t = Seq.lseq uint32 4 let x_idx = (n: nat { n < 16 } ) let x_t = Seq.lseq uint32 16 let t_idx = (n: nat { 1 <= n /\ n <= 64 } ) inline_for_extraction let rotate_idx = rotval U32 let round_op_gen_aux (f: (uint32 -> uint32 -> uint32 -> Tot uint32)) (abcd: abcd_t) (x: x_t) (a b c d: abcd_idx) (k: x_idx) (s: rotate_idx) (i: t_idx) : Tot abcd_t = let va = Seq.index abcd a in let vb = Seq.index abcd b in let vc = Seq.index abcd c in let vd = Seq.index abcd d in Seq.upd abcd a (vb +. ((va +. f vb vc vd +. Seq.index x k +. Seq.index t (i - 1)) <<<. s)) [@"opaque_to_smt"] let round_op_gen = round_op_gen_aux (* Round 1 *) let round1_op = round_op_gen f let ia : abcd_idx = 0 let ib : abcd_idx = 1 let ic : abcd_idx = 2 let id : abcd_idx = 3 let round1_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round1_op abcd x ia ib ic id 0 7ul 1 in let abcd = round1_op abcd x id ia ib ic 1 12ul 2 in let abcd = round1_op abcd x ic id ia ib 2 17ul 3 in let abcd = round1_op abcd x ib ic id ia 3 22ul 4 in let abcd = round1_op abcd x ia ib ic id 4 7ul 5 in let abcd = round1_op abcd x id ia ib ic 5 12ul 6 in let abcd = round1_op abcd x ic id ia ib 6 17ul 7 in let abcd = round1_op abcd x ib ic id ia 7 22ul 8 in let abcd = round1_op abcd x ia ib ic id 8 7ul 9 in let abcd = round1_op abcd x id ia ib ic 9 12ul 10 in let abcd = round1_op abcd x ic id ia ib 10 17ul 11 in let abcd = round1_op abcd x ib ic id ia 11 22ul 12 in let abcd = round1_op abcd x ia ib ic id 12 7ul 13 in let abcd = round1_op abcd x id ia ib ic 13 12ul 14 in let abcd = round1_op abcd x ic id ia ib 14 17ul 15 in let abcd = round1_op abcd x ib ic id ia 15 22ul 16 in abcd [@"opaque_to_smt"] let round1 = round1_aux let round2_op = round_op_gen g let round2_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round2_op abcd x ia ib ic id 1 5ul 17 in let abcd = round2_op abcd x id ia ib ic 6 9ul 18 in let abcd = round2_op abcd x ic id ia ib 11 14ul 19 in let abcd = round2_op abcd x ib ic id ia 0 20ul 20 in let abcd = round2_op abcd x ia ib ic id 5 5ul 21 in let abcd = round2_op abcd x id ia ib ic 10 9ul 22 in let abcd = round2_op abcd x ic id ia ib 15 14ul 23 in let abcd = round2_op abcd x ib ic id ia 4 20ul 24 in let abcd = round2_op abcd x ia ib ic id 9 5ul 25 in let abcd = round2_op abcd x id ia ib ic 14 9ul 26 in let abcd = round2_op abcd x ic id ia ib 3 14ul 27 in let abcd = round2_op abcd x ib ic id ia 8 20ul 28 in let abcd = round2_op abcd x ia ib ic id 13 5ul 29 in let abcd = round2_op abcd x id ia ib ic 2 9ul 30 in let abcd = round2_op abcd x ic id ia ib 7 14ul 31 in let abcd = round2_op abcd x ib ic id ia 12 20ul 32 in abcd [@"opaque_to_smt"] let round2 = round2_aux let round3_op = round_op_gen h let round3_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round3_op abcd x ia ib ic id 5 4ul 33 in let abcd = round3_op abcd x id ia ib ic 8 11ul 34 in let abcd = round3_op abcd x ic id ia ib 11 16ul 35 in let abcd = round3_op abcd x ib ic id ia 14 23ul 36 in let abcd = round3_op abcd x ia ib ic id 1 4ul 37 in let abcd = round3_op abcd x id ia ib ic 4 11ul 38 in let abcd = round3_op abcd x ic id ia ib 7 16ul 39 in let abcd = round3_op abcd x ib ic id ia 10 23ul 40 in let abcd = round3_op abcd x ia ib ic id 13 4ul 41 in let abcd = round3_op abcd x id ia ib ic 0 11ul 42 in let abcd = round3_op abcd x ic id ia ib 3 16ul 43 in let abcd = round3_op abcd x ib ic id ia 6 23ul 44 in let abcd = round3_op abcd x ia ib ic id 9 4ul 45 in let abcd = round3_op abcd x id ia ib ic 12 11ul 46 in let abcd = round3_op abcd x ic id ia ib 15 16ul 47 in let abcd = round3_op abcd x ib ic id ia 2 23ul 48 in abcd [@"opaque_to_smt"] let round3 = round3_aux let round4_op = round_op_gen i let round4_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round4_op abcd x ia ib ic id 0 6ul 49 in let abcd = round4_op abcd x id ia ib ic 7 10ul 50 in let abcd = round4_op abcd x ic id ia ib 14 15ul 51 in let abcd = round4_op abcd x ib ic id ia 5 21ul 52 in let abcd = round4_op abcd x ia ib ic id 12 6ul 53 in let abcd = round4_op abcd x id ia ib ic 3 10ul 54 in let abcd = round4_op abcd x ic id ia ib 10 15ul 55 in let abcd = round4_op abcd x ib ic id ia 1 21ul 56 in let abcd = round4_op abcd x ia ib ic id 8 6ul 57 in let abcd = round4_op abcd x id ia ib ic 15 10ul 58 in let abcd = round4_op abcd x ic id ia ib 6 15ul 59 in let abcd = round4_op abcd x ib ic id ia 13 21ul 60 in let abcd = round4_op abcd x ia ib ic id 4 6ul 61 in let abcd = round4_op abcd x id ia ib ic 11 10ul 62 in let abcd = round4_op abcd x ic id ia ib 2 15ul 63 in let abcd = round4_op abcd x ib ic id ia 9 21ul 64 in abcd [@"opaque_to_smt"] let round4 = round4_aux let rounds_aux (abcd: abcd_t) (x: x_t) : Tot abcd_t = let abcd = round1 abcd x in let abcd = round2 abcd x in let abcd = round3 abcd x in let abcd = round4 abcd x in abcd [@"opaque_to_smt"] let rounds = rounds_aux let overwrite_aux (abcd: abcd_t) (a' b' c' d' : uint32) : Tot abcd_t = let abcd : abcd_t = Seq.upd abcd ia a' in let abcd : abcd_t = Seq.upd abcd ib b' in let abcd : abcd_t = Seq.upd abcd ic c' in let abcd : abcd_t = Seq.upd abcd id d' in abcd [@"opaque_to_smt"] let overwrite = overwrite_aux let update_aux (abcd:words_state MD5) x : Tot (words_state MD5) = let x = words_of_bytes MD5 #16 x in let aa = Seq.index abcd ia in let bb = Seq.index abcd ib in let cc = Seq.index abcd ic in let dd = Seq.index abcd id in // let aabbccdd = abcd in let abcd = rounds abcd x in overwrite abcd (Seq.index abcd ia +. aa) (Seq.index abcd ib +. bb) (Seq.index abcd ic +. cc) (Seq.index abcd id +. dd)
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "prims.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": true, "source_file": "Spec.MD5.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Spec.Hash.Definitions.update_t Spec.Hash.Definitions.MD5
Prims.Tot
[ "total" ]
[]
[ "Spec.MD5.update_aux" ]
[]
false
false
false
true
false
let update =
update_aux
false
Hacl.NaCl.fst
Hacl.NaCl.crypto_box_open_detached_afternm
val crypto_box_open_detached_afternm: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SB.box_open_detached_afternm (as_seq h0 k) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg))
val crypto_box_open_detached_afternm: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SB.box_open_detached_afternm (as_seq h0 k) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg))
let crypto_box_open_detached_afternm m c tag mlen n k = Hacl.Impl.Box.box_open_detached_afternm mlen m k n c tag
{ "file_name": "code/nacl-box/Hacl.NaCl.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 58, "end_line": 230, "start_col": 0, "start_line": 229 }
module Hacl.NaCl open FStar.HyperStack.All open FStar.HyperStack open FStar.Mul open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module SB = Spec.Box module SS = Spec.SecretBox #set-options "--max_fuel 50 --max_fuel 0 --max_ifuel 0" [@@ Comment "Encrypt a message with a key and nonce. Note: `c` and `m` can point to the same memory for in-place encryption. @param c Pointer to `mlen` bytes where the ciphertext is written to. @param tag Pointer to 16 (tag length) bytes where the authentication tag is written to. @param m Pointer to `mlen` bytes where the message is read from. @param mlen Length of message. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_detached: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == SS.secretbox_detached (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_secretbox_detached c tag m mlen n k = Hacl.Impl.SecretBox.secretbox_detached mlen c tag k n m; 0ul [@@ Comment "Verify and decrypt a ciphertext produced with `Hacl_NaCl_crypto_secretbox_detached`. Note: `m` and `c` can point to the same memory for in-place decryption. @param m Pointer to `mlen` bytes where the message is written to. @param c Pointer to `mlen` bytes where the ciphertext is read from. @param tag Pointer to 16 (tag length) bytes where the authentication tag is read from. @param mlen Length of message (and ciphertext). @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_open_detached: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SS.secretbox_open_detached (as_seq h0 k) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg)) let crypto_secretbox_open_detached m c tag mlen n k = Hacl.Impl.SecretBox.secretbox_open_detached mlen m k n c tag [@@ Comment "Encrypt a message with a key and nonce. @param c Pointer to 16 (tag length) + `mlen` bytes where the ciphertext is written to. @param m Pointer to `mlen` bytes where the message is read from. @param mlen Length of message. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_easy: c:buffer uint8 -> m:buffer uint8 -> mlen:size_t{length c = v mlen + 16 /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 c h0 h1 /\ as_seq #MUT #uint8 #(mlen +! 16ul) h1 c == SS.secretbox_easy (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_secretbox_easy c m mlen n k = Hacl.Impl.SecretBox.secretbox_easy mlen c k n m; 0ul #set-options "--z3rlimit 100" [@@ Comment "Verify and decrypt a ciphertext produced with `crypto_secretbox_easy`. @param m Pointer to `mlen` bytes where the message is written to. @param c Pointer to `clen` bytes where the ciphertext is read from. The authentication tag must be included. @param clen Length of ciphertext. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_open_easy: m:buffer uint8 -> c:buffer uint8 -> clen:size_t{length c = v clen /\ v clen = length m + 16} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint m n /\ disjoint c n) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SS.secretbox_open_easy (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #clen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #(clen -! 16ul) h1 m == Some?.v msg | _ -> None? msg)) let crypto_secretbox_open_easy m c clen n k = Hacl.Impl.SecretBox.secretbox_open_easy (clen -! 16ul) m k n c [@@ Comment "Compute a shared secret key given a public key and secret key. @param k Pointer to 32 (`crypto_box_BEFORENMBYTES`) bytes of memory where the shared secret is written to. @param pk Pointer to 32 bytes of memory where **their** public key is read from. @param sk Pointer to 32 bytes of memory where **my** secret key is read from."] val crypto_box_beforenm: k:lbuffer uint8 32ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h k /\ live h pk /\ live h sk /\ disjoint k pk /\ disjoint k sk) (ensures fun h0 r h1 -> modifies1 k h0 h1 /\ (let key = SB.box_beforenm (as_seq h0 pk) (as_seq h0 sk) in match r with | 0ul -> Some? key /\ as_seq h1 k == Some?.v key | _ -> None? key)) let crypto_box_beforenm k pk sk = Hacl.Impl.Box.box_beforenm k pk sk [@@ Comment "See `crypto_box_detached`."] val crypto_box_detached_afternm: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == SB.box_detached_afternm (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_box_detached_afternm c tag m mlen n k = Hacl.Impl.Box.box_detached_afternm mlen c tag k n m [@@ Comment "Encrypt a message using the recipient's public key, the sender's secret key, and a nonce. @param c Pointer to `mlen` bytes of memory where the ciphertext is written to. @param tag Pointer to 16 (tag length) bytes of memory where the authentication tag is written to. @param m Pointer to `mlen` bytes of memory where the message is read from. @param mlen Length of the message. @param n Pointer to 24 (`crypto_box_NONCEBYTES`) bytes of memory where the nonce is read from. @param pk Pointer to 32 bytes of memory where **their** public key is read from. @param sk Pointer to 32 bytes of memory where **my** secret key is read from."] val crypto_box_detached: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h sk /\ live h pk /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (let tag_cipher = SB.box_detached (as_seq h0 sk) (as_seq h0 pk) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m) in match r with | 0ul -> Some? tag_cipher /\ (let (tag_s, cipher_s) = Some?.v tag_cipher in (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == (tag_s, cipher_s)) | _ -> None? tag_cipher)) let crypto_box_detached c tag m mlen n pk sk = Hacl.Impl.Box.box_detached mlen c tag sk pk n m [@@ Comment "See `crypto_box_open_detached`."] val crypto_box_open_detached_afternm: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SB.box_open_detached_afternm (as_seq h0 k) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg))
{ "checked_file": "/", "dependencies": [ "Spec.SecretBox.fst.checked", "Spec.Box.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.SecretBox.fst.checked", "Hacl.Impl.Box.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.NaCl.fst" }
[ { "abbrev": true, "full_module": "Spec.SecretBox", "short_module": "SS" }, { "abbrev": true, "full_module": "Spec.Box", "short_module": "SB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
m: Lib.Buffer.buffer Lib.IntTypes.uint8 -> c: Lib.Buffer.buffer Lib.IntTypes.uint8 -> tag: Lib.Buffer.lbuffer Lib.IntTypes.uint8 16ul -> mlen: Lib.IntTypes.size_t {Lib.Buffer.length c = Lib.IntTypes.v mlen /\ Lib.Buffer.length m = Lib.IntTypes.v mlen} -> n: Lib.Buffer.lbuffer Lib.IntTypes.uint8 24ul -> k: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul -> FStar.HyperStack.ST.Stack Lib.IntTypes.size_t
FStar.HyperStack.ST.Stack
[]
[]
[ "Lib.Buffer.buffer", "Lib.IntTypes.uint8", "Lib.Buffer.lbuffer", "FStar.UInt32.__uint_to_t", "Lib.IntTypes.size_t", "Prims.l_and", "Prims.b2t", "Prims.op_Equality", "Prims.int", "Prims.l_or", "Prims.op_GreaterThanOrEqual", "Lib.IntTypes.range", "Lib.IntTypes.U32", "Lib.Buffer.length", "Lib.Buffer.MUT", "Lib.IntTypes.v", "Lib.IntTypes.PUB", "Hacl.Impl.Box.box_open_detached_afternm" ]
[]
false
true
false
false
false
let crypto_box_open_detached_afternm m c tag mlen n k =
Hacl.Impl.Box.box_open_detached_afternm mlen m k n c tag
false
Hacl.NaCl.fst
Hacl.NaCl.crypto_secretbox_detached
val crypto_secretbox_detached: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == SS.secretbox_detached (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m))
val crypto_secretbox_detached: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == SS.secretbox_detached (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m))
let crypto_secretbox_detached c tag m mlen n k = Hacl.Impl.SecretBox.secretbox_detached mlen c tag k n m; 0ul
{ "file_name": "code/nacl-box/Hacl.NaCl.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 5, "end_line": 46, "start_col": 0, "start_line": 44 }
module Hacl.NaCl open FStar.HyperStack.All open FStar.HyperStack open FStar.Mul open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module SB = Spec.Box module SS = Spec.SecretBox #set-options "--max_fuel 50 --max_fuel 0 --max_ifuel 0" [@@ Comment "Encrypt a message with a key and nonce. Note: `c` and `m` can point to the same memory for in-place encryption. @param c Pointer to `mlen` bytes where the ciphertext is written to. @param tag Pointer to 16 (tag length) bytes where the authentication tag is written to. @param m Pointer to `mlen` bytes where the message is read from. @param mlen Length of message. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_detached: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == SS.secretbox_detached (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m))
{ "checked_file": "/", "dependencies": [ "Spec.SecretBox.fst.checked", "Spec.Box.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.SecretBox.fst.checked", "Hacl.Impl.Box.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.NaCl.fst" }
[ { "abbrev": true, "full_module": "Spec.SecretBox", "short_module": "SS" }, { "abbrev": true, "full_module": "Spec.Box", "short_module": "SB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
c: Lib.Buffer.buffer Lib.IntTypes.uint8 -> tag: Lib.Buffer.lbuffer Lib.IntTypes.uint8 16ul -> m: Lib.Buffer.buffer Lib.IntTypes.uint8 -> mlen: Lib.IntTypes.size_t {Lib.Buffer.length c = Lib.IntTypes.v mlen /\ Lib.Buffer.length m = Lib.IntTypes.v mlen} -> n: Lib.Buffer.lbuffer Lib.IntTypes.uint8 24ul -> k: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul -> FStar.HyperStack.ST.Stack Lib.IntTypes.size_t
FStar.HyperStack.ST.Stack
[]
[]
[ "Lib.Buffer.buffer", "Lib.IntTypes.uint8", "Lib.Buffer.lbuffer", "FStar.UInt32.__uint_to_t", "Lib.IntTypes.size_t", "Prims.l_and", "Prims.b2t", "Prims.op_Equality", "Prims.int", "Prims.l_or", "Prims.op_GreaterThanOrEqual", "Lib.IntTypes.range", "Lib.IntTypes.U32", "Lib.Buffer.length", "Lib.Buffer.MUT", "Lib.IntTypes.v", "Lib.IntTypes.PUB", "Prims.unit", "Hacl.Impl.SecretBox.secretbox_detached" ]
[]
false
true
false
false
false
let crypto_secretbox_detached c tag m mlen n k =
Hacl.Impl.SecretBox.secretbox_detached mlen c tag k n m; 0ul
false
Vale.X64.Stack_i.fst
Vale.X64.Stack_i.lemma_correct_store_load_stack64
val lemma_correct_store_load_stack64 (ptr:int) (v:nat64) (h:vale_stack) : Lemma (load_stack64 ptr (store_stack64 ptr v h) == v) [SMTPat (load_stack64 ptr (store_stack64 ptr v h))]
val lemma_correct_store_load_stack64 (ptr:int) (v:nat64) (h:vale_stack) : Lemma (load_stack64 ptr (store_stack64 ptr v h) == v) [SMTPat (load_stack64 ptr (store_stack64 ptr v h))]
let lemma_correct_store_load_stack64 ptr v h = let BS.Machine_stack _ mem = h in correct_update_get64 ptr v mem
{ "file_name": "vale/code/arch/x64/Vale.X64.Stack_i.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 32, "end_line": 38, "start_col": 0, "start_line": 36 }
module Vale.X64.Stack_i open FStar.Mul module BS = Vale.X64.Machine_Semantics_s open Vale.Arch.MachineHeap let vale_stack = BS.machine_stack let valid_src_stack64 i st = BS.valid_src_stack64 i st let load_stack64 i st = BS.eval_stack i st let store_stack64 i v h = BS.update_stack64' i v h let free_stack64 start finish h = BS.free_stack' start finish h let valid_src_stack128 i st = BS.valid_src_stack128 i st let load_stack128 i st = BS.eval_stack128 i st let store_stack128 i v h = BS.update_stack128' i v h let init_rsp h = h.BS.initial_rsp (* Lemmas *) #push-options "--z3rlimit 40" let lemma_store_stack_same_valid64 ptr v h i = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; BS.update_heap64_reveal () let lemma_free_stack_same_valid64 start finish ptr h = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; let BS.Machine_stack _ mem = h in let domain = Map.domain mem in Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish) let lemma_store_new_valid64 ptr v h = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; BS.update_heap64_reveal () #pop-options
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.Lib.Set.fsti.checked", "Vale.Arch.MachineHeap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Vale.X64.Stack_i.fst" }
[ { "abbrev": false, "full_module": "Vale.Arch.MachineHeap", "short_module": null }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
ptr: Prims.int -> v: Vale.X64.Memory.nat64 -> h: Vale.X64.Stack_i.vale_stack -> FStar.Pervasives.Lemma (ensures Vale.X64.Stack_i.load_stack64 ptr (Vale.X64.Stack_i.store_stack64 ptr v h) == v) [SMTPat (Vale.X64.Stack_i.load_stack64 ptr (Vale.X64.Stack_i.store_stack64 ptr v h))]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.int", "Vale.X64.Memory.nat64", "Vale.X64.Stack_i.vale_stack", "Vale.Def.Types_s.nat64", "Prims.b2t", "Prims.op_GreaterThanOrEqual", "FStar.Map.t", "Vale.Def.Types_s.nat8", "Vale.Arch.MachineHeap.correct_update_get64", "Prims.unit" ]
[]
false
false
true
false
false
let lemma_correct_store_load_stack64 ptr v h =
let BS.Machine_stack _ mem = h in correct_update_get64 ptr v mem
false
Vale.X64.Stack_i.fst
Vale.X64.Stack_i.lemma_free_stack_same_valid64
val lemma_free_stack_same_valid64 (start:int) (finish:int) (ptr:int) (h:vale_stack) : Lemma (requires valid_src_stack64 ptr h /\ (ptr >= finish \/ ptr + 8 <= start)) (ensures valid_src_stack64 ptr (free_stack64 start finish h)) [SMTPat (valid_src_stack64 ptr (free_stack64 start finish h))]
val lemma_free_stack_same_valid64 (start:int) (finish:int) (ptr:int) (h:vale_stack) : Lemma (requires valid_src_stack64 ptr h /\ (ptr >= finish \/ ptr + 8 <= start)) (ensures valid_src_stack64 ptr (free_stack64 start finish h)) [SMTPat (valid_src_stack64 ptr (free_stack64 start finish h))]
let lemma_free_stack_same_valid64 start finish ptr h = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; let BS.Machine_stack _ mem = h in let domain = Map.domain mem in Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
{ "file_name": "vale/code/arch/x64/Vale.X64.Stack_i.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 81, "end_line": 29, "start_col": 0, "start_line": 25 }
module Vale.X64.Stack_i open FStar.Mul module BS = Vale.X64.Machine_Semantics_s open Vale.Arch.MachineHeap let vale_stack = BS.machine_stack let valid_src_stack64 i st = BS.valid_src_stack64 i st let load_stack64 i st = BS.eval_stack i st let store_stack64 i v h = BS.update_stack64' i v h let free_stack64 start finish h = BS.free_stack' start finish h let valid_src_stack128 i st = BS.valid_src_stack128 i st let load_stack128 i st = BS.eval_stack128 i st let store_stack128 i v h = BS.update_stack128' i v h let init_rsp h = h.BS.initial_rsp (* Lemmas *) #push-options "--z3rlimit 40" let lemma_store_stack_same_valid64 ptr v h i = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; BS.update_heap64_reveal ()
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.Lib.Set.fsti.checked", "Vale.Arch.MachineHeap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Vale.X64.Stack_i.fst" }
[ { "abbrev": false, "full_module": "Vale.Arch.MachineHeap", "short_module": null }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 40, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
start: Prims.int -> finish: Prims.int -> ptr: Prims.int -> h: Vale.X64.Stack_i.vale_stack -> FStar.Pervasives.Lemma (requires Vale.X64.Stack_i.valid_src_stack64 ptr h /\ (ptr >= finish \/ ptr + 8 <= start)) (ensures Vale.X64.Stack_i.valid_src_stack64 ptr (Vale.X64.Stack_i.free_stack64 start finish h) ) [ SMTPat (Vale.X64.Stack_i.valid_src_stack64 ptr (Vale.X64.Stack_i.free_stack64 start finish h)) ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.int", "Vale.X64.Stack_i.vale_stack", "Vale.Def.Types_s.nat64", "Prims.b2t", "Prims.op_GreaterThanOrEqual", "FStar.Map.t", "Vale.Def.Types_s.nat8", "FStar.Classical.forall_intro", "Prims.l_and", "Prims.l_imp", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "Prims.op_Negation", "FStar.Set.mem", "Vale.Lib.Set.remove_between", "Prims.l_or", "Prims.op_Equality", "Prims.bool", "Vale.Lib.Set.remove_between_reveal", "FStar.Set.set", "FStar.Map.domain", "Prims.unit", "FStar.Pervasives.reveal_opaque", "Vale.Arch.MachineHeap_s.machine_heap", "Vale.Arch.MachineHeap_s.valid_addr64" ]
[]
false
false
true
false
false
let lemma_free_stack_same_valid64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; let BS.Machine_stack _ mem = h in let domain = Map.domain mem in Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
false
Vale.X64.Stack_i.fst
Vale.X64.Stack_i.lemma_free_stack_same_load64
val lemma_free_stack_same_load64 (start:int) (finish:int) (ptr:int) (h:vale_stack) : Lemma (requires valid_src_stack64 ptr h /\ (ptr >= finish \/ ptr + 8 <= start)) (ensures load_stack64 ptr h == load_stack64 ptr (free_stack64 start finish h)) [SMTPat (load_stack64 ptr (free_stack64 start finish h))]
val lemma_free_stack_same_load64 (start:int) (finish:int) (ptr:int) (h:vale_stack) : Lemma (requires valid_src_stack64 ptr h /\ (ptr >= finish \/ ptr + 8 <= start)) (ensures load_stack64 ptr h == load_stack64 ptr (free_stack64 start finish h)) [SMTPat (load_stack64 ptr (free_stack64 start finish h))]
let lemma_free_stack_same_load64 start finish ptr h = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; let BS.Machine_stack _ mem = h in let domain = Map.domain mem in Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish); BS.get_heap_val64_reveal ()
{ "file_name": "vale/code/arch/x64/Vale.X64.Stack_i.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 29, "end_line": 50, "start_col": 0, "start_line": 45 }
module Vale.X64.Stack_i open FStar.Mul module BS = Vale.X64.Machine_Semantics_s open Vale.Arch.MachineHeap let vale_stack = BS.machine_stack let valid_src_stack64 i st = BS.valid_src_stack64 i st let load_stack64 i st = BS.eval_stack i st let store_stack64 i v h = BS.update_stack64' i v h let free_stack64 start finish h = BS.free_stack' start finish h let valid_src_stack128 i st = BS.valid_src_stack128 i st let load_stack128 i st = BS.eval_stack128 i st let store_stack128 i v h = BS.update_stack128' i v h let init_rsp h = h.BS.initial_rsp (* Lemmas *) #push-options "--z3rlimit 40" let lemma_store_stack_same_valid64 ptr v h i = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; BS.update_heap64_reveal () let lemma_free_stack_same_valid64 start finish ptr h = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; let BS.Machine_stack _ mem = h in let domain = Map.domain mem in Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish) let lemma_store_new_valid64 ptr v h = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; BS.update_heap64_reveal () #pop-options let lemma_correct_store_load_stack64 ptr v h = let BS.Machine_stack _ mem = h in correct_update_get64 ptr v mem let lemma_frame_store_load_stack64 ptr v h i = let BS.Machine_stack _ mem = h in frame_update_heap64 ptr v mem; BS.get_heap_val64_reveal ()
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.Lib.Set.fsti.checked", "Vale.Arch.MachineHeap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Vale.X64.Stack_i.fst" }
[ { "abbrev": false, "full_module": "Vale.Arch.MachineHeap", "short_module": null }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
start: Prims.int -> finish: Prims.int -> ptr: Prims.int -> h: Vale.X64.Stack_i.vale_stack -> FStar.Pervasives.Lemma (requires Vale.X64.Stack_i.valid_src_stack64 ptr h /\ (ptr >= finish \/ ptr + 8 <= start)) (ensures Vale.X64.Stack_i.load_stack64 ptr h == Vale.X64.Stack_i.load_stack64 ptr (Vale.X64.Stack_i.free_stack64 start finish h)) [SMTPat (Vale.X64.Stack_i.load_stack64 ptr (Vale.X64.Stack_i.free_stack64 start finish h))]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.int", "Vale.X64.Stack_i.vale_stack", "Vale.Def.Types_s.nat64", "Prims.b2t", "Prims.op_GreaterThanOrEqual", "FStar.Map.t", "Vale.Def.Types_s.nat8", "Vale.Arch.MachineHeap_s.get_heap_val64_reveal", "Prims.unit", "FStar.Classical.forall_intro", "Prims.l_and", "Prims.l_imp", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "Prims.op_Negation", "FStar.Set.mem", "Vale.Lib.Set.remove_between", "Prims.l_or", "Prims.op_Equality", "Prims.bool", "Vale.Lib.Set.remove_between_reveal", "FStar.Set.set", "FStar.Map.domain", "FStar.Pervasives.reveal_opaque", "Vale.Arch.MachineHeap_s.machine_heap", "Vale.Arch.MachineHeap_s.valid_addr64" ]
[]
false
false
true
false
false
let lemma_free_stack_same_load64 start finish ptr h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; let BS.Machine_stack _ mem = h in let domain = Map.domain mem in Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish); BS.get_heap_val64_reveal ()
false
Vale.AES.X64.GCMdecryptOpt.fst
Vale.AES.X64.GCMdecryptOpt.va_qcode_Gcm_blocks
val va_qcode_Gcm_blocks (va_mods: va_mods_t) (alg: algorithm) (offset: int) (auth_b abytes_b in128x6_b out128x6_b in128_b out128_b inout_b iv_b scratch_b: buffer128) (key: (seq nat32)) (round_keys: (seq quad32)) (keys_b hkeys_b: buffer128) : (va_quickCode unit (va_code_Gcm_blocks alg offset))
val va_qcode_Gcm_blocks (va_mods: va_mods_t) (alg: algorithm) (offset: int) (auth_b abytes_b in128x6_b out128x6_b in128_b out128_b inout_b iv_b scratch_b: buffer128) (key: (seq nat32)) (round_keys: (seq quad32)) (keys_b hkeys_b: buffer128) : (va_quickCode unit (va_code_Gcm_blocks alg offset))
let va_qcode_Gcm_blocks (va_mods:va_mods_t) (alg:algorithm) (offset:int) (auth_b:buffer128) (abytes_b:buffer128) (in128x6_b:buffer128) (out128x6_b:buffer128) (in128_b:buffer128) (out128_b:buffer128) (inout_b:buffer128) (iv_b:buffer128) (scratch_b:buffer128) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) : (va_quickCode unit (va_code_Gcm_blocks alg offset)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 0) (va_get_stack va_s) in let (in128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 8) (va_get_stack va_s) in let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 16) (va_get_stack va_s) in let (len128x6:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 24) (va_get_stack va_s) in let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 32) (va_get_stack va_s) in let (out128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 40) (va_get_stack va_s) in let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 48) (va_get_stack va_s) in let (inout_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 56) (va_get_stack va_s) in let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 64) (va_get_stack va_s) in let (h_LE:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 0 va_old_s)) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 463 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR13) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 464 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_AddLea64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rR9) (va_const_opr64 32)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 465 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load64_stack (va_op_dst_opr64_reg64 rRbx) (va_op_reg_opr64_reg64 rRsp) (offset + 0)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 466 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Gcm_blocks_auth auth_b abytes_b hkeys_b h_LE) (fun (va_s:va_state) (auth_quad_seq:(seq quad32)) -> let (y_0:quad32) = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0 in let (y_auth_bytes:quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 473 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 8)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 474 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load64_stack (va_op_dst_opr64_reg64 rRsi) (va_op_reg_opr64_reg64 rRsp) (offset + 16)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 475 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp) (offset + 24)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 476 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR13)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 477 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (fun (va_s:va_state) _ -> let (iv_BE:Vale.X64.Decls.quad32) = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_old_s) in let (ctr_BE_1:quad32) = iv_BE in let (ctr_BE_2:quad32) = Vale.AES.GCTR_s.inc32 iv_BE 1 in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 483 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 2) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rR8) 0 Public iv_b 0) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 485 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 0 Secret scratch_b 0) (fun (va_s:va_state) _ -> let (j0:quad32) = va_get_xmm 1 va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 487 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load_one_lsb (va_op_xmm_xmm 10)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 489 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 10)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 491 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_AES_GCM_decrypt_6mult alg h_LE iv_b in128x6_b out128x6_b scratch_b key round_keys keys_b hkeys_b) (fun (va_s:va_state) _ -> let (y_cipher128x6:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s) in let (auth_in:(seq quad32)) = auth_quad_seq in let (va_arg138:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b in let (va_arg137:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = auth_in in let (va_arg136:Vale.Def.Types_s.quad32) = y_auth_bytes in let (va_arg135:Vale.Def.Types_s.quad32) = y_0 in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 494 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (fun (_:unit) -> Vale.AES.GHash.lemma_ghash_incremental0_append h_LE va_arg135 va_arg136 y_cipher128x6 va_arg137 va_arg138) (let auth_in = FStar.Seq.Base.append #quad32 auth_in (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 498 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 11) (va_op_reg_opr64_reg64 rRbp) 32 Secret scratch_b 2) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 499 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 500 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp) (offset + 32)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 501 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 40)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 502 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp) (offset + 48)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 503 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 504 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_InitPshufbMask (va_op_xmm_xmm 9) (va_op_reg_opr64_reg64 rR12)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 505 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Pshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 9)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 506 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Gcm_blocks128 alg in128_b out128_b key round_keys keys_b hkeys_b h_LE) (fun (va_s:va_state) _ -> let (y_cipher128:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s) in let (va_arg134:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in128_b in let (va_arg133:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = auth_in in let (va_arg132:Vale.Def.Types_s.quad32) = y_0 in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 508 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (fun (_:unit) -> Vale.AES.GHash.lemma_ghash_incremental0_append h_LE va_arg132 y_cipher128x6 y_cipher128 va_arg133 va_arg134) (let auth_in = FStar.Seq.Base.append #quad32 auth_in (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in128_b) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 512 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Stack_lemma (va_op_reg64_reg64 rRsp) (offset + 24) Public) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 512 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Add64 (va_op_dst_opr64_reg64 rR14) (va_opr_code_Stack (va_op_reg64_reg64 rRsp) (offset + 24) Public)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 513 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_IMul64 (va_op_dst_opr64_reg64 rR14) (va_const_opr64 16)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 514 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load64_stack (va_op_dst_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rRsp) (offset + 64)) (fun (va_s:va_state) _ -> let (y_inout:Vale.Def.Types_s.quad32) = y_cipher128 in let (plain_byte_seq:(seq quad32)) = empty_seq_quad32 in let (cipher_byte_seq:(seq quad32)) = empty_seq_quad32 in let (va_arg131:Vale.Def.Types_s.quad32) = va_get_xmm 11 va_s in let (va_arg130:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = key in let (va_arg129:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = cipher_byte_seq in let (va_arg128:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = plain_byte_seq in let (va_arg127:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 519 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (fun (_:unit) -> Vale.AES.GCTR.gctr_partial_opaque_init va_arg127 va_arg128 va_arg129 va_arg130 va_arg131) (let (total_bytes:(va_int_at_least 0)) = FStar.Seq.Base.length #quad32 auth_quad_seq `op_Multiply` 16 + plain_num_bytes in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 523 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_qIf va_mods (Cmp_gt (va_op_cmp_reg64 rR13) (va_op_cmp_reg64 rR14)) (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 525 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp) (offset + 56)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 526 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rR13)) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 527 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (fun (_:unit) -> Vale.Poly1305.Math.lemma_poly_bits64 ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 528 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_And64 (va_op_dst_opr64_reg64 rR10) (va_const_opr64 15)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 532 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes y_0 auth_in h_LE) (fun (va_s:va_state) _ -> let y_inout = Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s) in let (raw_auth_quads:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.append #quad32 auth_in (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_old_s) inout_b) in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 536 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let (j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908 j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907)))) Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads) 0 total_bytes) (fun _ -> let (auth_input_bytes:(FStar.Seq.Base.seq Vale.Def.Types_s.nat8)) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads) 0 total_bytes in let (padded_auth_bytes:(FStar.Seq.Base.seq Vale.Def.Types_s.nat8)) = Vale.AES.GCTR_s.pad_to_128_bits auth_input_bytes in let auth_in = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_auth_bytes in let plain_byte_seq = Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_old_s) inout_b in let cipher_byte_seq = Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s) inout_b in va_QEmpty ((auth_in, cipher_byte_seq, plain_byte_seq, y_inout)))))))))) (qblock va_mods (fun (va_s:va_state) -> va_QEmpty ((auth_in, cipher_byte_seq, plain_byte_seq, y_inout))))) (fun (va_s:va_state) va_g -> let ((auth_in:(seq quad32)), (cipher_byte_seq:(seq quad32)), (plain_byte_seq:(seq quad32)), (y_inout:Vale.Def.Types_s.quad32)) = va_g in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 547 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64 rR15)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 548 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Gcm_make_length_quad ()) (fun (va_s:va_state) _ -> let (length_quad32:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0 va_s) in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 551 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Ghash_register hkeys_b h_LE y_inout) (fun (va_s:va_state) _ -> let (y_final:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 554 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRbp) 0 Secret scratch_b 0) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 557 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Gctr_register alg key round_keys keys_b) (fun (va_s:va_state) _ -> let (va_arg126:Vale.Def.Types_s.quad32) = va_get_xmm 8 va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 560 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (fun (_:unit) -> Vale.Arch.Types.le_seq_quad32_to_bytes_of_singleton va_arg126) (va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 561 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ((fun (icb_BE_677:Vale.Def.Types_s.quad32) (plain_LE_678:Vale.Def.Types_s.quad32) (alg_679:Vale.AES.AES_common_s.algorithm) (key_680:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) (i_681:Prims.int) -> Vale.AES.AES_s.is_aes_key_LE alg_679 key_680) j0 y_final alg key 0) (fun _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 561 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_get_xmm 8 va_s == Vale.AES.GCTR_s.gctr_encrypt_block j0 y_final alg key 0) (let (plain128:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) = FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in128_b) in let (cipher128:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) = FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) in128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s) in128_b) in va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 566 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (FStar.Seq.Base.length #quad32 plain_byte_seq == 0 ==> FStar.Seq.Base.equal #Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 plain128 plain_byte_seq) plain128) (va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 567 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (FStar.Seq.Base.length #quad32 cipher_byte_seq == 0 ==> FStar.Seq.Base.equal #Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 cipher128 cipher_byte_seq) cipher128) (let (va_arg125:Vale.Def.Types_s.quad32) = Vale.AES.GCTR.inc32lite ctr_BE_2 len128x6 in let (va_arg124:Vale.Def.Types_s.quad32) = ctr_BE_2 in let (va_arg123:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = key in let (va_arg122:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s) out128_b in let (va_arg121:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in128_b in let (va_arg120:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) out128x6_b in let (va_arg119:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b in let (va_arg118:Prims.nat) = len128 in let (va_arg117:Prims.nat) = len128x6 in let (va_arg116:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 569 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (fun (_:unit) -> Vale.AES.GCTR.lemma_gctr_partial_append va_arg116 va_arg117 va_arg118 va_arg119 va_arg120 va_arg121 va_arg122 va_arg123 va_arg124 va_arg125) (let (va_arg115:Vale.Def.Types_s.quad32) = Vale.AES.GCTR.inc32lite (Vale.AES.GCTR.inc32lite ctr_BE_2 len128x6) len128 in let (va_arg114:Vale.Def.Types_s.quad32) = ctr_BE_2 in let (va_arg113:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = key in let (va_arg112:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = cipher_byte_seq in let (va_arg111:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = plain_byte_seq in let (va_arg110:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s) out128_b) in let (va_arg109:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in128_b) in let (va_arg108:Prims.nat) = FStar.Seq.Base.length #quad32 plain_byte_seq in let (va_arg107:Prims.nat) = len128x6 + len128 in let (va_arg106:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 575 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (fun (_:unit) -> Vale.AES.GCTR.lemma_gctr_partial_append va_arg106 va_arg107 va_arg108 va_arg109 va_arg110 va_arg111 va_arg112 va_arg113 va_arg114 va_arg115) (let (va_arg105:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = auth_in in let (va_arg104:Vale.Def.Types_s.quad32) = y_0 in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 583 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (fun (_:unit) -> Vale.AES.GHash.lemma_hash_append2 h_LE va_arg104 y_inout y_final va_arg105 length_quad32) (let auth_in = FStar.Seq.Base.append #quad32 auth_in (FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1 length_quad32) in let (va_arg103:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = auth_in in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 585 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (fun (_:unit) -> Vale.AES.GHash.ghash_incremental_to_ghash h_LE va_arg103) (va_QEmpty (()))))))))))))))))))))))))))))))))))))))))))))))))
{ "file_name": "obj/Vale.AES.X64.GCMdecryptOpt.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 55, "end_line": 823, "start_col": 0, "start_line": 584 }
module Vale.AES.X64.GCMdecryptOpt open Vale.Def.Prop_s open Vale.Def.Opaque_s open FStar.Seq open Vale.Def.Words_s open Vale.Def.Words.Seq_s open Vale.Def.Types_s open Vale.Arch.Types open Vale.Arch.HeapImpl open Vale.AES.AES_s open Vale.AES.GCTR_s open Vale.AES.GCTR open Vale.AES.GCM open Vale.AES.GHash_s open Vale.AES.GHash open Vale.AES.GCM_s open Vale.AES.X64.AES open Vale.AES.GF128_s open Vale.AES.GF128 open Vale.Poly1305.Math open Vale.AES.GCM_helpers open Vale.AES.X64.GHash open Vale.AES.X64.GCTR open Vale.X64.Machine_s open Vale.X64.Memory open Vale.X64.Stack_i open Vale.X64.State open Vale.X64.Decls open Vale.X64.InsBasic open Vale.X64.InsMem open Vale.X64.InsVector open Vale.X64.InsStack open Vale.X64.InsAes open Vale.X64.QuickCode open Vale.X64.QuickCodes open Vale.AES.X64.GF128_Mul open Vale.X64.Stack open Vale.X64.CPU_Features_s open Vale.Math.Poly2.Bits_s open Vale.AES.X64.AESopt open Vale.AES.X64.AESGCM open Vale.AES.X64.AESopt2 open Vale.Lib.Meta open Vale.AES.X64.GCMencryptOpt open Vale.AES.OptPublic open Vale.Lib.Basic #reset-options "--z3rlimit 20 --max_ifuel 0" //-- Gcm_extra_bytes val va_code_Gcm_extra_bytes : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gcm_extra_bytes alg = (va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_Ghash_extra_bytes ()) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_CCons (va_code_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_CCons (va_code_AESEncryptBlock alg) (va_CCons (va_code_Pxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret) (va_CNil ())))))))))) val va_codegen_success_Gcm_extra_bytes : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gcm_extra_bytes alg = (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Ghash_extra_bytes ()) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_pbool_and (va_codegen_success_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_pbool_and (va_codegen_success_AESEncryptBlock alg) (va_pbool_and (va_codegen_success_Pxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret) (va_ttrue ()))))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Gcm_extra_bytes (va_mods:va_mods_t) (alg:algorithm) (inout_b:buffer128) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat) (old_hash:quad32) (completed_quads:(seq quad32)) (h_LE:quad32) : (va_quickCode unit (va_code_Gcm_extra_bytes alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (len:(va_int_range 1 1)) = 1 in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 188 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRax) 0 Secret inout_b 0) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 189 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (fun (va_s:va_state) _ -> let (hash_input:quad32) = va_get_xmm 0 va_s in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 193 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Ghash_extra_bytes hkeys_b total_bytes old_hash h_LE completed_quads) (fun (va_s:va_state) _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 194 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (FStar.Seq.Base.equal #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s) inout_b) (FStar.Seq.Base.create #quad32 1 hash_input)) (let (snap:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s) inout_b in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 198 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 199 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (fun (va_s:va_state) _ -> va_QBind va_range1 "***** PRECONDITION NOT MET AT line 200 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_AESEncryptBlock alg (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 11 va_s)) key round_keys keys_b) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (fun (_:unit) -> Vale.AES.AES_s.aes_encrypt_LE_reveal ()) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 204 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Pxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 205 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret inout_b 0) (fun (va_s:va_state) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 207 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (fun (_:unit) -> Vale.AES.GCTR.gctr_partial_reveal ()) (va_QEmpty (())))))))))))))) val va_lemma_Gcm_extra_bytes : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> inout_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> total_bytes:nat -> old_hash:quad32 -> completed_quads:(seq quad32) -> h_LE:quad32 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gcm_extra_bytes alg) va_s0 /\ va_get_ok va_s0 /\ (let (len:(va_int_range 1 1)) = 1 in sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b inout_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b inout_b /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) (va_get_reg64 rRax va_s0) inout_b len (va_get_mem_layout va_s0) Secret /\ len == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 inout_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ va_get_xmm 8 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental0 h_LE old_hash completed_quads) /\ FStar.Seq.Base.length #quad32 completed_quads == total_bytes `op_Division` 16 /\ total_bytes < 16 `op_Multiply` FStar.Seq.Base.length #quad32 completed_quads + 16 /\ va_get_reg64 rR10 va_s0 == total_bytes `op_Modulus` 16 /\ total_bytes `op_Modulus` 16 =!= 0 /\ (0 < total_bytes /\ total_bytes < 16 `op_Multiply` Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes) /\ 16 `op_Multiply` (Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes - 1) < total_bytes))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (let (len:(va_int_range 1 1)) = 1 in Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.AES.GCTR.gctr_partial alg len (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0) /\ (let raw_quads = FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) in let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in let padded_bytes = Vale.AES.GCTR_s.pad_to_128_bits input_bytes in let input_quads = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in l_and (FStar.Seq.Base.length #Vale.Def.Types_s.quad32 input_quads > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads))) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 5 va_sM (va_update_xmm 10 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRcx va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Gcm_extra_bytes va_b0 va_s0 alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash completed_quads h_LE = let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Gcm_extra_bytes va_mods alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash completed_quads h_LE in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_extra_bytes alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 121 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_get_ok va_sM) /\ (let (len:(va_int_range 1 1)) = 1 in label va_range1 "***** POSTCONDITION NOT MET AT line 174 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 177 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (Vale.AES.GCTR.gctr_partial alg len (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let raw_quads = FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) in label va_range1 "***** POSTCONDITION NOT MET AT line 181 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in label va_range1 "***** POSTCONDITION NOT MET AT line 182 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let padded_bytes = Vale.AES.GCTR_s.pad_to_128_bits input_bytes in label va_range1 "***** POSTCONDITION NOT MET AT line 183 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (let input_quads = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in label va_range1 "***** POSTCONDITION NOT MET AT line 186 column 59 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (l_and (FStar.Seq.Base.length #Vale.Def.Types_s.quad32 input_quads > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads)))))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Gcm_extra_bytes (alg:algorithm) (inout_b:buffer128) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat) (old_hash:quad32) (completed_quads:(seq quad32)) (h_LE:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (let (len:(va_int_range 1 1)) = 1 in sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b inout_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b inout_b /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) (va_get_reg64 rRax va_s0) inout_b len (va_get_mem_layout va_s0) Secret /\ len == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 inout_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ va_get_xmm 8 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental0 h_LE old_hash completed_quads) /\ FStar.Seq.Base.length #quad32 completed_quads == total_bytes `op_Division` 16 /\ total_bytes < 16 `op_Multiply` FStar.Seq.Base.length #quad32 completed_quads + 16 /\ va_get_reg64 rR10 va_s0 == total_bytes `op_Modulus` 16 /\ total_bytes `op_Modulus` 16 =!= 0 /\ (0 < total_bytes /\ total_bytes < 16 `op_Multiply` Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes) /\ 16 `op_Multiply` (Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes - 1) < total_bytes) /\ (forall (va_x_mem:vale_heap) (va_x_rcx:nat64) (va_x_r11:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm10:quad32) (va_x_heap5:vale_heap) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 5 va_x_heap5 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRcx va_x_rcx (va_upd_mem va_x_mem va_s0)))))))))))))) in va_get_ok va_sM /\ (let (len:(va_int_range 1 1)) = 1 in Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.AES.GCTR.gctr_partial alg len (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0) /\ (let raw_quads = FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) in let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in let padded_bytes = Vale.AES.GCTR_s.pad_to_128_bits input_bytes in let input_quads = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in l_and (FStar.Seq.Base.length #Vale.Def.Types_s.quad32 input_quads > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads))) ==> va_k va_sM (()))) val va_wpProof_Gcm_extra_bytes : alg:algorithm -> inout_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> total_bytes:nat -> old_hash:quad32 -> completed_quads:(seq quad32) -> h_LE:quad32 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash completed_quads h_LE va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_extra_bytes alg) ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash completed_quads h_LE va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gcm_extra_bytes (va_code_Gcm_extra_bytes alg) va_s0 alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash completed_quads h_LE in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 5 va_sM (va_update_xmm 10 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRcx va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Gcm_extra_bytes (alg:algorithm) (inout_b:buffer128) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat) (old_hash:quad32) (completed_quads:(seq quad32)) (h_LE:quad32) : (va_quickCode unit (va_code_Gcm_extra_bytes alg)) = (va_QProc (va_code_Gcm_extra_bytes alg) ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_mem]) (va_wp_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash completed_quads h_LE) (va_wpProof_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash completed_quads h_LE)) //-- //-- Gcm_blocks128 val va_code_Gcm_blocks128 : alg:algorithm -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gcm_blocks128 alg = (va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax)) (va_CCons (va_code_Ghash_buffer ()) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRbx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR12)) (va_CCons (va_code_Gctr_blocks128 alg) (va_CNil ()))))))))) val va_codegen_success_Gcm_blocks128 : alg:algorithm -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gcm_blocks128 alg = (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax)) (va_pbool_and (va_codegen_success_Ghash_buffer ()) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR12)) (va_pbool_and (va_codegen_success_Gctr_blocks128 alg) (va_ttrue ())))))))) [@ "opaque_to_smt" va_qattr] let va_qcode_Gcm_blocks128 (va_mods:va_mods_t) (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (h_LE:quad32) : (va_quickCode unit (va_code_Gcm_blocks128 alg)) = (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 274 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 275 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 276 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 277 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Ghash_buffer hkeys_b in_b h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_old_s))) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 278 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRbx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 279 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR12)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 280 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Gctr_blocks128 alg in_b out_b key round_keys keys_b) (va_QEmpty (())))))))))) val va_lemma_Gcm_blocks128 : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> h_LE:quad32 -> Ghost (va_state & va_fuel) (requires (va_require_total va_b0 (va_code_Gcm_blocks128 alg) va_s0 /\ va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b out_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b out_b /\ (Vale.X64.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRax va_s0) in_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) out_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRax va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ l_and (Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out_b) (Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b < pow2_32) /\ va_get_reg64 rRdx va_s0 == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ va_get_reg64 rRdx va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0) Secret))) (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key (va_get_xmm 11 va_s0) /\ va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0) (va_get_reg64 rRdx va_s0) /\ (va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM == va_get_xmm 8 va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) /\ (va_get_reg64 rRdx va_s0 > 0 ==> l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==> FStar.Seq.Base.length #Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)))) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 1 va_sM (va_update_xmm 10 va_sM (va_update_xmm 11 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRbx va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))) [@"opaque_to_smt"] let va_lemma_Gcm_blocks128 va_b0 va_s0 alg in_b out_b key round_keys keys_b hkeys_b h_LE = let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem] in let va_qc = va_qcode_Gcm_blocks128 va_mods alg in_b out_b key round_keys keys_b hkeys_b h_LE in let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_blocks128 alg) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1 "***** POSTCONDITION NOT MET AT line 210 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_get_ok va_sM) /\ (label va_range1 "***** POSTCONDITION NOT MET AT line 255 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 261 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key (va_get_xmm 11 va_s0)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 262 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0) (va_get_reg64 rRdx va_s0)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 265 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM == va_get_xmm 8 va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) /\ label va_range1 "***** POSTCONDITION NOT MET AT line 267 column 131 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_get_reg64 rRdx va_s0 > 0 ==> l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==> FStar.Seq.Base.length #Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b))))) in assert_norm (va_qc.mods == va_mods); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem]) va_sM va_s0; (va_sM, va_fM) [@ va_qattr] let va_wp_Gcm_blocks128 (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (h_LE:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 = (va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b out_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b out_b /\ (Vale.X64.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRax va_s0) in_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) out_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRax va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ l_and (Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out_b) (Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b < pow2_32) /\ va_get_reg64 rRdx va_s0 == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ va_get_reg64 rRdx va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0) Secret) /\ (forall (va_x_mem:vale_heap) (va_x_rbx:nat64) (va_x_rdi:nat64) (va_x_r11:nat64) (va_x_r10:nat64) (va_x_rdx:nat64) (va_x_r12:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm11:quad32) (va_x_xmm10:quad32) (va_x_heap1:vale_heap) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rR10 va_x_r10 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRdi va_x_rdi (va_upd_reg64 rRbx va_x_rbx (va_upd_mem va_x_mem va_s0))))))))))))))))))) in va_get_ok va_sM /\ (Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key (va_get_xmm 11 va_s0) /\ va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0) (va_get_reg64 rRdx va_s0) /\ (va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM == va_get_xmm 8 va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) /\ (va_get_reg64 rRdx va_s0 > 0 ==> l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==> FStar.Seq.Base.length #Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)))) ==> va_k va_sM (()))) val va_wpProof_Gcm_blocks128 : alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> h_LE:quad32 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0) -> Ghost (va_state & va_fuel & unit) (requires (va_t_require va_s0 /\ va_wp_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE va_s0 va_k)) (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_blocks128 alg) ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) [@"opaque_to_smt"] let va_wpProof_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE va_s0 va_k = let (va_sM, va_f0) = va_lemma_Gcm_blocks128 (va_code_Gcm_blocks128 alg) va_s0 alg in_b out_b key round_keys keys_b hkeys_b h_LE in va_lemma_upd_update va_sM; assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 1 va_sM (va_update_xmm 10 va_sM (va_update_xmm 11 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRbx va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))); va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_mem]) va_sM va_s0; let va_g = () in (va_sM, va_f0, va_g) [@ "opaque_to_smt" va_qattr] let va_quick_Gcm_blocks128 (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (h_LE:quad32) : (va_quickCode unit (va_code_Gcm_blocks128 alg)) = (va_QProc (va_code_Gcm_blocks128 alg) ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_mem]) (va_wp_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE) (va_wpProof_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE)) //-- //-- Gcm_blocks #push-options "--z3rlimit 1000" val va_code_Gcm_blocks : alg:algorithm -> offset:int -> Tot va_code [@ "opaque_to_smt" va_qattr] let va_code_Gcm_blocks alg offset = (va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR13) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_AddLea64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rR9) (va_const_opr64 32)) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRbx) (va_op_reg_opr64_reg64 rRsp) (offset + 0)) (va_CCons (va_code_Gcm_blocks_auth ()) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 8)) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRsi) (va_op_reg_opr64_reg64 rRsp) (offset + 16)) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp) (offset + 24)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR13)) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 2) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rR8) 0 Public) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 0 Secret) (va_CCons (va_code_Load_one_lsb (va_op_xmm_xmm 10)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 10)) (va_CCons (va_code_AES_GCM_decrypt_6mult alg) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 11) (va_op_reg_opr64_reg64 rRbp) 32 Secret) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp) (offset + 32)) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 40)) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp) (offset + 48)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_InitPshufbMask (va_op_xmm_xmm 9) (va_op_reg_opr64_reg64 rR12)) (va_CCons (va_code_Pshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 9)) (va_CCons (va_code_Gcm_blocks128 alg) (va_CCons (va_code_Stack_lemma ()) (va_CCons (va_code_Add64 (va_op_dst_opr64_reg64 rR14) (va_opr_code_Stack (va_op_reg64_reg64 rRsp) (offset + 24) Public)) (va_CCons (va_code_IMul64 (va_op_dst_opr64_reg64 rR14) (va_const_opr64 16)) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rRsp) (offset + 64)) (va_CCons (va_IfElse (va_cmp_gt (va_op_cmp_reg64 rR13) (va_op_cmp_reg64 rR14)) (va_Block (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp) (offset + 56)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rR13)) (va_CCons (va_code_And64 (va_op_dst_opr64_reg64 rR10) (va_const_opr64 15)) (va_CCons (va_code_Gcm_extra_bytes alg) (va_CCons (va_Block (va_CNil ())) (va_CNil ()))))))) (va_Block (va_CNil ()))) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64 rR15)) (va_CCons (va_code_Gcm_make_length_quad ()) (va_CCons (va_code_Ghash_register ()) (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRbp) 0 Secret) (va_CCons (va_code_Gctr_register alg) (va_CCons (va_Block (va_CNil ())) (va_CNil ())))))))))))))))))))))))))))))))))))) val va_codegen_success_Gcm_blocks : alg:algorithm -> offset:int -> Tot va_pbool [@ "opaque_to_smt" va_qattr] let va_codegen_success_Gcm_blocks alg offset = (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR13) (va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_AddLea64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rR9) (va_const_opr64 32)) (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRbx) (va_op_reg_opr64_reg64 rRsp) (offset + 0)) (va_pbool_and (va_codegen_success_Gcm_blocks_auth ()) (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 8)) (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRsi) (va_op_reg_opr64_reg64 rRsp) (offset + 16)) (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp) (offset + 24)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 2) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rR8) 0 Public) (va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 0 Secret) (va_pbool_and (va_codegen_success_Load_one_lsb (va_op_xmm_xmm 10)) (va_pbool_and (va_codegen_success_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 10)) (va_pbool_and (va_codegen_success_AES_GCM_decrypt_6mult alg) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 11) (va_op_reg_opr64_reg64 rRbp) 32 Secret) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx)) (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp) (offset + 32)) (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 40)) (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp) (offset + 48)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_InitPshufbMask (va_op_xmm_xmm 9) (va_op_reg_opr64_reg64 rR12)) (va_pbool_and (va_codegen_success_Pshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 9)) (va_pbool_and (va_codegen_success_Gcm_blocks128 alg) (va_pbool_and (va_codegen_success_Stack_lemma ()) (va_pbool_and (va_codegen_success_Add64 (va_op_dst_opr64_reg64 rR14) (va_opr_code_Stack (va_op_reg64_reg64 rRsp) (offset + 24) Public)) (va_pbool_and (va_codegen_success_IMul64 (va_op_dst_opr64_reg64 rR14) (va_const_opr64 16)) (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rRsp) (offset + 64)) (va_pbool_and (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp) (offset + 56)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_And64 (va_op_dst_opr64_reg64 rR10) (va_const_opr64 15)) (va_codegen_success_Gcm_extra_bytes alg)))) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64 rR15)) (va_pbool_and (va_codegen_success_Gcm_make_length_quad ()) (va_pbool_and (va_codegen_success_Ghash_register ()) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRbp) 0 Secret) (va_pbool_and (va_codegen_success_Gctr_register alg) (va_ttrue ()))))))))))))))))))))))))))))))))))
{ "checked_file": "/", "dependencies": [ "Vale.X64.State.fsti.checked", "Vale.X64.Stack_i.fsti.checked", "Vale.X64.Stack.fsti.checked", "Vale.X64.QuickCodes.fsti.checked", "Vale.X64.QuickCode.fst.checked", "Vale.X64.Memory.fsti.checked", "Vale.X64.Machine_s.fst.checked", "Vale.X64.InsVector.fsti.checked", "Vale.X64.InsStack.fsti.checked", "Vale.X64.InsMem.fsti.checked", "Vale.X64.InsBasic.fsti.checked", "Vale.X64.InsAes.fsti.checked", "Vale.X64.Flags.fsti.checked", "Vale.X64.Decls.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Poly1305.Math.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Lib.Meta.fsti.checked", "Vale.Lib.Basic.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.Types.fsti.checked", "Vale.Arch.HeapImpl.fsti.checked", "Vale.AES.X64.GHash.fsti.checked", "Vale.AES.X64.GF128_Mul.fsti.checked", "Vale.AES.X64.GCTR.fsti.checked", "Vale.AES.X64.GCMencryptOpt.fsti.checked", "Vale.AES.X64.AESopt2.fsti.checked", "Vale.AES.X64.AESopt.fsti.checked", "Vale.AES.X64.AESGCM.fsti.checked", "Vale.AES.X64.AES.fsti.checked", "Vale.AES.OptPublic.fsti.checked", "Vale.AES.GHash_s.fst.checked", "Vale.AES.GHash.fsti.checked", "Vale.AES.GF128_s.fsti.checked", "Vale.AES.GF128.fsti.checked", "Vale.AES.GCTR_s.fst.checked", "Vale.AES.GCTR.fsti.checked", "Vale.AES.GCM_s.fst.checked", "Vale.AES.GCM_helpers.fsti.checked", "Vale.AES.GCM.fsti.checked", "Vale.AES.AES_s.fst.checked", "Vale.AES.AES_common_s.fst.checked", "prims.fst.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.X64.GCMdecryptOpt.fst" }
[ { "abbrev": false, "full_module": "Vale.Lib.Basic", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.OptPublic", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.GCMencryptOpt", "short_module": null }, { "abbrev": false, "full_module": "Vale.Lib.Meta", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.AESopt2", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.AESGCM", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.AESopt", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Stack", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.GF128_Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsAes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.GCTR", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.GHash", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCM_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.Poly1305.Math", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCM_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCM", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCTR", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCTR_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.AES_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.OptPublic", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.GCMencryptOpt", "short_module": null }, { "abbrev": false, "full_module": "Vale.Lib.Meta", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.AESopt2", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.AESGCM", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.AESopt", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Stack", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.GF128_Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCodes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.QuickCode", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsAes", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsStack", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsVector", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsMem", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.InsBasic", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Decls", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.State", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Stack_i", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.GCTR", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.GHash", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCM_helpers", "short_module": null }, { "abbrev": false, "full_module": "Vale.Poly1305.Math", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GF128_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64.AES", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCM_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GHash_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCM", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCTR", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.GCTR_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.AES_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.HeapImpl", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.AES.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 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": 1000, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
va_mods: Vale.X64.QuickCode.va_mods_t -> alg: Vale.AES.AES_common_s.algorithm -> offset: Prims.int -> auth_b: Vale.X64.Memory.buffer128 -> abytes_b: Vale.X64.Memory.buffer128 -> in128x6_b: Vale.X64.Memory.buffer128 -> out128x6_b: Vale.X64.Memory.buffer128 -> in128_b: Vale.X64.Memory.buffer128 -> out128_b: Vale.X64.Memory.buffer128 -> inout_b: Vale.X64.Memory.buffer128 -> iv_b: Vale.X64.Memory.buffer128 -> scratch_b: Vale.X64.Memory.buffer128 -> key: FStar.Seq.Base.seq Vale.X64.Memory.nat32 -> round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 -> keys_b: Vale.X64.Memory.buffer128 -> hkeys_b: Vale.X64.Memory.buffer128 -> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.AES.X64.GCMdecryptOpt.va_code_Gcm_blocks alg offset)
Prims.Tot
[ "total" ]
[]
[ "Vale.X64.QuickCode.va_mods_t", "Vale.AES.AES_common_s.algorithm", "Prims.int", "Vale.X64.Memory.buffer128", "FStar.Seq.Base.seq", "Vale.X64.Memory.nat32", "Vale.X64.Decls.quad32", "Vale.X64.QuickCodes.qblock", "Prims.unit", "Prims.Cons", "Vale.X64.Decls.va_code", "Vale.X64.InsBasic.va_code_Mov64", "Vale.X64.Decls.va_op_dst_opr64_reg64", "Vale.X64.Machine_s.rR13", "Vale.X64.Decls.va_op_opr64_reg64", "Vale.X64.Machine_s.rRcx", "Vale.X64.InsBasic.va_code_AddLea64", "Vale.X64.Machine_s.rR9", "Vale.X64.Decls.va_const_opr64", "Vale.X64.InsStack.va_code_Load64_stack", "Vale.X64.Machine_s.rRbx", "Vale.X64.Decls.va_op_reg_opr64_reg64", "Vale.X64.Machine_s.rRsp", "Prims.op_Addition", "Vale.AES.X64.GCMencryptOpt.va_code_Gcm_blocks_auth", "Vale.X64.Machine_s.rRdi", "Vale.X64.Machine_s.rRsi", "Vale.X64.Machine_s.rRdx", "Vale.X64.InsVector.va_code_Mov128", "Vale.X64.Decls.va_op_xmm_xmm", "Vale.X64.InsVector.va_code_Load128_buffer", "Vale.X64.Decls.va_op_heaplet_mem_heaplet", "Vale.X64.Machine_s.rR8", "Vale.Arch.HeapTypes_s.Public", "Vale.X64.InsVector.va_code_Store128_buffer", "Vale.X64.Machine_s.rRbp", "Vale.Arch.HeapTypes_s.Secret", "Vale.AES.X64.AESopt.va_code_Load_one_lsb", "Vale.X64.InsVector.va_code_VPaddd", "Vale.AES.X64.AESGCM.va_code_AES_GCM_decrypt_6mult", "Vale.X64.Machine_s.rRax", "Vale.X64.Machine_s.rR14", "Vale.X64.InsVector.va_code_InitPshufbMask", "Vale.X64.Machine_s.rR12", "Vale.X64.InsVector.va_code_Pshufb", "Vale.AES.X64.GCMdecryptOpt.va_code_Gcm_blocks128", "Vale.X64.InsStack.va_code_Stack_lemma", "Vale.X64.InsBasic.va_code_Add64", "Vale.X64.Decls.va_opr_code_Stack", "Vale.X64.Decls.va_op_reg64_reg64", "Vale.X64.InsBasic.va_code_IMul64", "Vale.X64.Machine_s.IfElse", "Vale.X64.Decls.ins", "Vale.X64.Decls.ocmp", "Vale.X64.QuickCodes.cmp_to_ocmp", "Vale.X64.QuickCodes.Cmp_gt", "Vale.X64.Decls.va_op_cmp_reg64", "Vale.X64.QuickCodes.block", "Vale.X64.Machine_s.rR10", "Vale.X64.InsBasic.va_code_And64", "Vale.AES.X64.GCMdecryptOpt.va_code_Gcm_extra_bytes", "Vale.X64.Machine_s.Block", "Prims.Nil", "Vale.X64.Machine_s.precode", "Vale.X64.Machine_s.rR11", "Vale.X64.Machine_s.rR15", "Vale.AES.X64.GCMencryptOpt.va_code_Gcm_make_length_quad", "Vale.AES.X64.AESopt2.va_code_Ghash_register", "Vale.AES.X64.GCMencryptOpt.va_code_Gctr_register", "Vale.X64.Decls.va_state", "Vale.X64.QuickCodes.va_QSeq", "Vale.X64.QuickCodes.va_range1", "Vale.X64.InsBasic.va_quick_Mov64", "Vale.X64.InsBasic.va_quick_AddLea64", "Vale.X64.InsStack.va_quick_Load64_stack", "Vale.X64.QuickCodes.va_QBind", "Vale.AES.X64.GCMencryptOpt.va_quick_Gcm_blocks_auth", "Vale.X64.InsVector.va_quick_Mov128", "Vale.X64.InsVector.va_quick_Load128_buffer", "Vale.X64.InsVector.va_quick_Store128_buffer", "Vale.AES.X64.AESopt.va_quick_Load_one_lsb", "Vale.X64.InsVector.va_quick_VPaddd", "Vale.AES.X64.AESGCM.va_quick_AES_GCM_decrypt_6mult", "Vale.X64.QuickCodes.va_qPURE", "Prims.pure_post", "Prims.l_and", "Prims.b2t", "Prims.op_Equality", "Vale.Def.Types_s.quad32", "Vale.AES.GHash.ghash_incremental0", "Prims.l_Forall", "Prims.l_imp", "FStar.Seq.Base.op_At_Bar", "Vale.AES.GHash.lemma_ghash_incremental0_append", "Vale.X64.InsVector.va_quick_InitPshufbMask", "Vale.X64.InsVector.va_quick_Pshufb", "Vale.AES.X64.GCMdecryptOpt.va_quick_Gcm_blocks128", "Vale.X64.InsStack.va_quick_Stack_lemma", "Vale.X64.InsBasic.va_quick_Add64", "Vale.X64.InsBasic.va_quick_IMul64", "Vale.AES.AES_s.is_aes_key_LE", "Vale.AES.GCTR.gctr_partial", "Vale.AES.GCTR.gctr_partial_opaque_init", "FStar.Pervasives.Native.tuple4", "Vale.X64.QuickCodes.va_qIf", "Prims.l_True", "Vale.Def.Words_s.nat64", "Prims.eq2", "Vale.Def.Types_s.ishr", "Prims.op_Division", "Vale.Def.Types_s.iand", "Prims.op_Modulus", "Prims.op_Multiply", "Prims.op_LessThan", "Vale.Poly1305.Math.lemma_poly_bits64", "Vale.X64.InsBasic.va_quick_And64", "Vale.AES.X64.GCMdecryptOpt.va_quick_Gcm_extra_bytes", "Vale.X64.QuickCodes.va_qAssertSquash", "Prims.op_AmpAmp", "Prims.op_LessThanOrEqual", "FStar.Seq.Base.length", "Vale.Def.Types_s.nat8", "Vale.Def.Types_s.le_seq_quad32_to_bytes", "Prims.nat", "Prims.squash", "Vale.X64.QuickCodes.va_QEmpty", "FStar.Pervasives.Native.Mktuple4", "Vale.X64.Decls.s128", "Vale.X64.Decls.va_get_mem_heaplet", "Vale.Def.Types_s.le_bytes_to_seq_quad32", "Vale.Def.Words_s.nat8", "Vale.AES.GCTR_s.pad_to_128_bits", "FStar.Seq.Base.slice", "Vale.X64.QuickCodes.quickCodes", "FStar.Seq.Base.append", "Vale.Def.Types_s.reverse_bytes_quad32", "Vale.X64.Decls.va_get_xmm", "Vale.AES.X64.GCMencryptOpt.va_quick_Gcm_make_length_quad", "Vale.AES.X64.AESopt2.va_quick_Ghash_register", "Vale.AES.X64.GCMencryptOpt.va_quick_Gctr_register", "Vale.Def.Types_s.le_quad32_to_bytes", "FStar.Seq.Base.create", "Vale.Arch.Types.le_seq_quad32_to_bytes_of_singleton", "Vale.X64.QuickCodes.va_qAssert", "Vale.AES.GCTR_s.gctr_encrypt_block", "FStar.Seq.Base.equal", "Vale.AES.GCTR_s.inc32", "Vale.AES.GCTR.lemma_gctr_partial_append", "Vale.AES.GHash.ghash_incremental", "Vale.AES.GHash.lemma_hash_append2", "Prims.op_GreaterThan", "Vale.Def.Words_s.Mkfour", "Vale.Def.Words_s.nat32", "Vale.AES.GHash_s.ghash_LE", "Vale.AES.GHash.ghash_incremental_to_ghash", "Vale.AES.GCTR.inc32lite", "Vale.X64.Decls.va_int_at_least", "Vale.AES.GCTR.empty_seq_quad32", "Vale.X64.Decls.buffer128_read", "Vale.Def.Types_s.nat32", "Vale.X64.Stack_i.load_stack64", "Vale.X64.Decls.va_get_reg64", "Vale.X64.Decls.va_get_stack", "Vale.X64.State.vale_state", "Vale.X64.QuickCode.va_quickCode", "Vale.AES.X64.GCMdecryptOpt.va_code_Gcm_blocks" ]
[]
false
false
false
false
false
let va_qcode_Gcm_blocks (va_mods: va_mods_t) (alg: algorithm) (offset: int) (auth_b abytes_b in128x6_b out128x6_b in128_b out128_b inout_b iv_b scratch_b: buffer128) (key: (seq nat32)) (round_keys: (seq quad32)) (keys_b hkeys_b: buffer128) : (va_quickCode unit (va_code_Gcm_blocks alg offset)) =
(qblock va_mods (fun (va_s: va_state) -> let va_old_s:va_state = va_s in let abytes_ptr:Vale.X64.Memory.nat64 = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 0) (va_get_stack va_s) in let in128x6_ptr:Vale.X64.Memory.nat64 = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 8) (va_get_stack va_s) in let out128x6_ptr:Vale.X64.Memory.nat64 = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 16) (va_get_stack va_s) in let len128x6:Vale.X64.Memory.nat64 = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 24) (va_get_stack va_s) in let in128_ptr:Vale.X64.Memory.nat64 = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 32) (va_get_stack va_s) in let out128_ptr:Vale.X64.Memory.nat64 = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 40) (va_get_stack va_s) in let len128:Vale.X64.Memory.nat64 = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 48) (va_get_stack va_s) in let inout_ptr:Vale.X64.Memory.nat64 = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 56) (va_get_stack va_s) in let plain_num_bytes:Vale.X64.Memory.nat64 = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 64) (va_get_stack va_s) in let h_LE:Vale.Def.Types_s.quad32 = Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 0 va_old_s)) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 463 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR13) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 464 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_AddLea64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rR9) (va_const_opr64 32)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 465 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load64_stack (va_op_dst_opr64_reg64 rRbx) (va_op_reg_opr64_reg64 rRsp) (offset + 0)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 466 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Gcm_blocks_auth auth_b abytes_b hkeys_b h_LE) (fun (va_s: va_state) (auth_quad_seq: (seq quad32)) -> let y_0:quad32 = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0 in let y_auth_bytes:quad32 = Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 473 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 8)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 474 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load64_stack (va_op_dst_opr64_reg64 rRsi) (va_op_reg_opr64_reg64 rRsp) (offset + 16)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 475 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp) (offset + 24)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 476 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR13)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 477 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (fun (va_s: va_state) _ -> let iv_BE:Vale.X64.Decls.quad32 = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_old_s) in let ctr_BE_1:quad32 = iv_BE in let ctr_BE_2:quad32 = Vale.AES.GCTR_s.inc32 iv_BE 1 in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 483 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 2) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rR8) 0 Public iv_b 0) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 485 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 0 Secret scratch_b 0) (fun (va_s: va_state) _ -> let j0:quad32 = va_get_xmm 1 va_s in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 487 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load_one_lsb (va_op_xmm_xmm 10 )) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 489 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 10)) (va_QBind va_range1 "***** PRECONDITION NOT MET AT line 491 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_AES_GCM_decrypt_6mult alg h_LE iv_b in128x6_b out128x6_b scratch_b key round_keys keys_b hkeys_b) (fun (va_s: va_state) _ -> let y_cipher128x6:Vale.Def.Types_s.quad32 = Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s) in let auth_in:(seq quad32) = auth_quad_seq in let va_arg138:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32) = Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b in let va_arg137:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32) = auth_in in let va_arg136:Vale.Def.Types_s.quad32 = y_auth_bytes in let va_arg135:Vale.Def.Types_s.quad32 = y_0 in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 494 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (fun (_: unit) -> Vale.AES.GHash.lemma_ghash_incremental0_append h_LE va_arg135 va_arg136 y_cipher128x6 va_arg137 va_arg138) (let auth_in = FStar.Seq.Base.append #quad32 auth_in (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 498 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 11) (va_op_reg_opr64_reg64 rRbp) 32 Secret scratch_b 2) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 499 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 500 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp) (offset + 32)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 501 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdi ) (va_op_reg_opr64_reg64 rRsp ) (offset + 40)) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 502 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdx ) (va_op_reg_opr64_reg64 rRsp ) (offset + 48 )) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 503 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" (va_quick_Mov64 ( va_op_dst_opr64_reg64 rR14 ) ( va_op_opr64_reg64 rRdx ) ) (va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 504 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( va_quick_InitPshufbMask ( va_op_xmm_xmm 9 ) ( va_op_reg_opr64_reg64 rR12 ) ) ( va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 505 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( va_quick_Pshufb ( va_op_xmm_xmm 11 ) ( va_op_xmm_xmm 9 ) ) ( va_QBind va_range1 "***** PRECONDITION NOT MET AT line 506 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( va_quick_Gcm_blocks128 alg in128_b out128_b key round_keys keys_b hkeys_b h_LE ) ( fun ( va_s: va_state ) _ -> let y_cipher128:Vale.Def.Types_s.quad32 = Vale.Def.Types_s.reverse_bytes_quad32 ( va_get_xmm 8 va_s ) in let va_arg134:( FStar.Seq.Base.seq Vale.Def.Types_s.quad32 ) = Vale.X64.Decls.s128 ( va_get_mem_heaplet 1 va_old_s ) in128_b in let va_arg133:( FStar.Seq.Base.seq Vale.Def.Types_s.quad32 ) = auth_in in let va_arg132:Vale.Def.Types_s.quad32 = y_0 in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 508 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( fun ( _: unit ) -> Vale.AES.GHash.lemma_ghash_incremental0_append h_LE va_arg132 y_cipher128x6 y_cipher128 va_arg133 va_arg134 ) ( let auth_in = FStar.Seq.Base.append #quad32 auth_in ( Vale.X64.Decls.s128 ( va_get_mem_heaplet 1 va_old_s ) in128_b ) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 512 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( va_quick_Stack_lemma ( va_op_reg64_reg64 rRsp ) ( offset + 24 ) Public ) ( va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 512 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( va_quick_Add64 ( va_op_dst_opr64_reg64 rR14 ) ( va_opr_code_Stack ( va_op_reg64_reg64 rRsp ) ( offset + 24 ) Public ) ) ( va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 513 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( va_quick_IMul64 ( va_op_dst_opr64_reg64 rR14 ) ( va_const_opr64 16 ) ) ( va_QBind va_range1 "***** PRECONDITION NOT MET AT line 514 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( va_quick_Load64_stack ( va_op_dst_opr64_reg64 rR13 ) ( va_op_reg_opr64_reg64 rRsp ) ( offset + 64 ) ) ( fun ( va_s: va_state ) _ -> let y_inout:Vale.Def.Types_s.quad32 = y_cipher128 in let plain_byte_seq:( seq quad32 ) = empty_seq_quad32 in let cipher_byte_seq:( seq quad32 ) = empty_seq_quad32 in let va_arg131:Vale.Def.Types_s.quad32 = va_get_xmm 11 va_s in let va_arg130:( FStar.Seq.Base.seq Vale.Def.Types_s.nat32 ) = key in let va_arg129:( FStar.Seq.Base.seq Vale.Def.Types_s.quad32 ) = cipher_byte_seq in let va_arg128:( FStar.Seq.Base.seq Vale.Def.Types_s.quad32 ) = plain_byte_seq in let va_arg127:Vale.AES.AES_common_s.algorithm = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 519 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( fun ( _: unit ) -> Vale.AES.GCTR.gctr_partial_opaque_init va_arg127 va_arg128 va_arg129 va_arg130 va_arg131 ) ( let total_bytes:( va_int_at_least 0 ) = ( FStar.Seq.Base.length #quad32 auth_quad_seq ) `op_Multiply` 16 + plain_num_bytes in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 523 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( va_qIf va_mods ( Cmp_gt ( va_op_cmp_reg64 rR13 ) ( va_op_cmp_reg64 rR14 ) ) ( qblock va_mods ( fun ( va_s: va_state ) -> va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 525 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( va_quick_Load64_stack ( va_op_dst_opr64_reg64 rRax ) ( va_op_reg_opr64_reg64 rRsp ) ( offset + 56 ) ) ( va_QBind va_range1 "***** PRECONDITION NOT MET AT line 526 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( va_quick_Mov64 ( va_op_dst_opr64_reg64 rR10 ) ( va_op_opr64_reg64 rR13 ) ) ( fun ( va_s: va_state ) _ -> va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 527 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( fun ( _: unit ) -> Vale.Poly1305.Math.lemma_poly_bits64 () ) ( va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 528 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( va_quick_And64 ( va_op_dst_opr64_reg64 rR10 ) ( va_const_opr64 15 ) ) ( va_QBind va_range1 "***** PRECONDITION NOT MET AT line 532 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( va_quick_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes y_0 auth_in h_LE ) ( fun ( va_s: va_state ) _ -> let y_inout = Vale.Def.Types_s.reverse_bytes_quad32 ( va_get_xmm 8 va_s ) in let raw_auth_quads:( FStar.Seq.Base.seq quad32 ) = FStar.Seq.Base.append #quad32 auth_in ( Vale.X64.Decls.s128 ( va_get_mem_heaplet 5 va_old_s ) inout_b ) in va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 536 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( ( fun a_1906 ( s_1907: ( FStar.Seq.Base.seq a_1906 ) ) ( i_1908: Prims.nat ) ( j_1909: Prims.nat ) -> let j_1869:Prims.nat = j_1909 in Prims.b2t ( Prims.op_AmpAmp ( Prims.op_LessThanOrEqual i_1908 j_1869 ) ( Prims.op_LessThanOrEqual j_1869 ( FStar.Seq.Base.length #a_1906 s_1907 ) ) ) ) Vale.Def.Types_s.nat8 ( Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads ) 0 total_bytes ) ( fun _ -> let auth_input_bytes:( FStar.Seq.Base.seq Vale.Def.Types_s.nat8 ) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 ( Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads ) 0 total_bytes in let padded_auth_bytes:( FStar.Seq.Base.seq Vale.Def.Types_s.nat8 ) = Vale.AES.GCTR_s.pad_to_128_bits auth_input_bytes in let auth_in = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_auth_bytes in let plain_byte_seq = Vale.X64.Decls.s128 ( va_get_mem_heaplet 5 va_old_s ) inout_b in let cipher_byte_seq = Vale.X64.Decls.s128 ( va_get_mem_heaplet 5 va_s ) inout_b in va_QEmpty ( ( auth_in, cipher_byte_seq, plain_byte_seq, y_inout ) ) ) ) ) ) ) ) ) ) ( qblock va_mods ( fun ( va_s: va_state ) -> va_QEmpty ( ( auth_in, cipher_byte_seq, plain_byte_seq, y_inout ) ) ) ) ) ( fun ( va_s: va_state ) va_g -> let ( auth_in: ( seq quad32 ) ), ( cipher_byte_seq: ( seq quad32 ) ), ( plain_byte_seq: ( seq quad32 ) ), ( y_inout: Vale.Def.Types_s.quad32 ) = va_g in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 547 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( va_quick_Mov64 ( va_op_dst_opr64_reg64 rR11 ) ( va_op_opr64_reg64 rR15 ) ) ( va_QBind va_range1 "***** PRECONDITION NOT MET AT line 548 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( va_quick_Gcm_make_length_quad () ) ( fun ( va_s: va_state ) _ -> let length_quad32:Vale.Def.Types_s.quad32 = Vale.Def.Types_s.reverse_bytes_quad32 ( va_get_xmm 0 va_s ) in va_QBind va_range1 "***** PRECONDITION NOT MET AT line 551 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( va_quick_Ghash_register hkeys_b h_LE y_inout ) ( fun ( va_s: va_state ) _ -> let y_final:Vale.Def.Types_s.quad32 = Vale.Def.Types_s.reverse_bytes_quad32 ( va_get_xmm 8 va_s ) in va_QSeq va_range1 "***** PRECONDITION NOT MET AT line 554 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( va_quick_Load128_buffer ( va_op_heaplet_mem_heaplet 3 ) ( va_op_xmm_xmm 0 ) ( va_op_reg_opr64_reg64 rRbp ) 0 Secret scratch_b 0 ) ( va_QBind va_range1 "***** PRECONDITION NOT MET AT line 557 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( va_quick_Gctr_register alg key round_keys keys_b ) ( fun ( va_s: va_state ) _ -> let va_arg126:Vale.Def.Types_s.quad32 = va_get_xmm 8 va_s in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 560 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( fun ( _: unit ) -> Vale.Arch.Types.le_seq_quad32_to_bytes_of_singleton va_arg126 ) ( va_qAssertSquash va_range1 "***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 561 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( ( fun ( icb_BE_677: Vale.Def.Types_s.quad32 ) ( plain_LE_678: Vale.Def.Types_s.quad32 ) ( alg_679: Vale.AES.AES_common_s.algorithm ) ( key_680: ( FStar.Seq.Base.seq Vale.Def.Types_s.nat32 ) ) ( i_681: Prims.int ) -> Vale.AES.AES_s.is_aes_key_LE alg_679 key_680 ) j0 y_final alg key 0 ) ( fun _ -> va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 561 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( va_get_xmm 8 va_s == Vale.AES.GCTR_s.gctr_encrypt_block j0 y_final alg key 0 ) ( let plain128:( FStar.Seq.Base.seq Vale.X64.Decls.quad32 ) = FStar.Seq.Base.append #Vale.X64.Decls.quad32 ( Vale.X64.Decls.s128 ( va_get_mem_heaplet 6 va_old_s ) in128x6_b ) ( Vale.X64.Decls.s128 ( va_get_mem_heaplet 1 va_old_s ) in128_b ) in let cipher128:( FStar.Seq.Base.seq Vale.X64.Decls.quad32 ) = FStar.Seq.Base.append #Vale.X64.Decls.quad32 ( Vale.X64.Decls.s128 ( va_get_mem_heaplet 6 va_s ) in128x6_b ) ( Vale.X64.Decls.s128 ( va_get_mem_heaplet 1 va_s ) in128_b ) in va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 566 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( FStar.Seq.Base.length #quad32 plain_byte_seq == 0 ==> FStar.Seq.Base.equal #Vale.X64.Decls.quad32 ( FStar.Seq.Base.append #Vale.X64.Decls.quad32 plain128 plain_byte_seq ) plain128 ) ( va_qAssert va_range1 "***** PRECONDITION NOT MET AT line 567 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( FStar.Seq.Base.length #quad32 cipher_byte_seq == 0 ==> FStar.Seq.Base.equal #Vale.X64.Decls.quad32 ( FStar.Seq.Base.append #Vale.X64.Decls.quad32 cipher128 cipher_byte_seq ) cipher128 ) ( let va_arg125:Vale.Def.Types_s.quad32 = Vale.AES.GCTR.inc32lite ctr_BE_2 len128x6 in let va_arg124:Vale.Def.Types_s.quad32 = ctr_BE_2 in let va_arg123:( FStar.Seq.Base.seq Vale.Def.Types_s.nat32 ) = key in let va_arg122:( FStar.Seq.Base.seq Vale.Def.Types_s.quad32 ) = Vale.X64.Decls.s128 ( va_get_mem_heaplet 1 va_s ) out128_b in let va_arg121:( FStar.Seq.Base.seq Vale.Def.Types_s.quad32 ) = Vale.X64.Decls.s128 ( va_get_mem_heaplet 1 va_old_s ) in128_b in let va_arg120:( FStar.Seq.Base.seq Vale.Def.Types_s.quad32 ) = Vale.X64.Decls.s128 ( va_get_mem_heaplet 6 va_s ) out128x6_b in let va_arg119:( FStar.Seq.Base.seq Vale.Def.Types_s.quad32 ) = Vale.X64.Decls.s128 ( va_get_mem_heaplet 6 va_old_s ) in128x6_b in let va_arg118:Prims.nat = len128 in let va_arg117:Prims.nat = len128x6 in let va_arg116:Vale.AES.AES_common_s.algorithm = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 569 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( fun ( _: unit ) -> Vale.AES.GCTR.lemma_gctr_partial_append va_arg116 va_arg117 va_arg118 va_arg119 va_arg120 va_arg121 va_arg122 va_arg123 va_arg124 va_arg125 ) ( let va_arg115:Vale.Def.Types_s.quad32 = Vale.AES.GCTR.inc32lite ( Vale.AES.GCTR.inc32lite ctr_BE_2 len128x6 ) len128 in let va_arg114:Vale.Def.Types_s.quad32 = ctr_BE_2 in let va_arg113:( FStar.Seq.Base.seq Vale.Def.Types_s.nat32 ) = key in let va_arg112:( FStar.Seq.Base.seq Vale.Def.Types_s.quad32 ) = cipher_byte_seq in let va_arg111:( FStar.Seq.Base.seq Vale.Def.Types_s.quad32 ) = plain_byte_seq in let va_arg110:( FStar.Seq.Base.seq Vale.Def.Types_s.quad32 ) = FStar.Seq.Base.append #Vale.X64.Decls.quad32 ( Vale.X64.Decls.s128 ( va_get_mem_heaplet 6 va_s ) out128x6_b ) ( Vale.X64.Decls.s128 ( va_get_mem_heaplet 1 va_s ) out128_b ) in let va_arg109:( FStar.Seq.Base.seq Vale.Def.Types_s.quad32 ) = FStar.Seq.Base.append #Vale.X64.Decls.quad32 ( Vale.X64.Decls.s128 ( va_get_mem_heaplet 6 va_old_s ) in128x6_b ) ( Vale.X64.Decls.s128 ( va_get_mem_heaplet 1 va_old_s ) in128_b ) in let va_arg108:Prims.nat = FStar.Seq.Base.length #quad32 plain_byte_seq in let va_arg107:Prims.nat = len128x6 + len128 in let va_arg106:Vale.AES.AES_common_s.algorithm = alg in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 575 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( fun ( _: unit ) -> Vale.AES.GCTR.lemma_gctr_partial_append va_arg106 va_arg107 va_arg108 va_arg109 va_arg110 va_arg111 va_arg112 va_arg113 va_arg114 va_arg115 ) ( let va_arg105:( FStar.Seq.Base.seq Vale.Def.Types_s.quad32 ) = auth_in in let va_arg104:Vale.Def.Types_s.quad32 = y_0 in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 583 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( fun ( _: unit ) -> Vale.AES.GHash.lemma_hash_append2 h_LE va_arg104 y_inout y_final va_arg105 length_quad32 ) ( let auth_in = FStar.Seq.Base.append #quad32 auth_in ( FStar.Seq.Base.create #Vale.Def.Types_s.quad32 1 length_quad32 ) in let va_arg103:( FStar.Seq.Base.seq Vale.Def.Types_s.quad32 ) = auth_in in va_qPURE va_range1 "***** PRECONDITION NOT MET AT line 585 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****" ( fun ( _: unit ) -> Vale.AES.GHash.ghash_incremental_to_ghash h_LE va_arg103 ) ( va_QEmpty ( () ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )) )))))))))) )))))))))))
false
Hacl.NaCl.fst
Hacl.NaCl.crypto_box_easy_afternm
val crypto_box_easy_afternm: c:buffer uint8 -> m:buffer uint8 -> mlen:size_t{length c = v mlen + 16 /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 c h0 h1 /\ as_seq #MUT #uint8 #(mlen +! 16ul) h1 c == SB.box_easy_afternm (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m))
val crypto_box_easy_afternm: c:buffer uint8 -> m:buffer uint8 -> mlen:size_t{length c = v mlen + 16 /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 c h0 h1 /\ as_seq #MUT #uint8 #(mlen +! 16ul) h1 c == SB.box_easy_afternm (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m))
let crypto_box_easy_afternm c m mlen n k = Hacl.Impl.Box.box_easy_afternm mlen c k n m
{ "file_name": "code/nacl-box/Hacl.NaCl.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 45, "end_line": 281, "start_col": 0, "start_line": 280 }
module Hacl.NaCl open FStar.HyperStack.All open FStar.HyperStack open FStar.Mul open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module SB = Spec.Box module SS = Spec.SecretBox #set-options "--max_fuel 50 --max_fuel 0 --max_ifuel 0" [@@ Comment "Encrypt a message with a key and nonce. Note: `c` and `m` can point to the same memory for in-place encryption. @param c Pointer to `mlen` bytes where the ciphertext is written to. @param tag Pointer to 16 (tag length) bytes where the authentication tag is written to. @param m Pointer to `mlen` bytes where the message is read from. @param mlen Length of message. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_detached: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == SS.secretbox_detached (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_secretbox_detached c tag m mlen n k = Hacl.Impl.SecretBox.secretbox_detached mlen c tag k n m; 0ul [@@ Comment "Verify and decrypt a ciphertext produced with `Hacl_NaCl_crypto_secretbox_detached`. Note: `m` and `c` can point to the same memory for in-place decryption. @param m Pointer to `mlen` bytes where the message is written to. @param c Pointer to `mlen` bytes where the ciphertext is read from. @param tag Pointer to 16 (tag length) bytes where the authentication tag is read from. @param mlen Length of message (and ciphertext). @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_open_detached: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SS.secretbox_open_detached (as_seq h0 k) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg)) let crypto_secretbox_open_detached m c tag mlen n k = Hacl.Impl.SecretBox.secretbox_open_detached mlen m k n c tag [@@ Comment "Encrypt a message with a key and nonce. @param c Pointer to 16 (tag length) + `mlen` bytes where the ciphertext is written to. @param m Pointer to `mlen` bytes where the message is read from. @param mlen Length of message. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_easy: c:buffer uint8 -> m:buffer uint8 -> mlen:size_t{length c = v mlen + 16 /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 c h0 h1 /\ as_seq #MUT #uint8 #(mlen +! 16ul) h1 c == SS.secretbox_easy (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_secretbox_easy c m mlen n k = Hacl.Impl.SecretBox.secretbox_easy mlen c k n m; 0ul #set-options "--z3rlimit 100" [@@ Comment "Verify and decrypt a ciphertext produced with `crypto_secretbox_easy`. @param m Pointer to `mlen` bytes where the message is written to. @param c Pointer to `clen` bytes where the ciphertext is read from. The authentication tag must be included. @param clen Length of ciphertext. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_open_easy: m:buffer uint8 -> c:buffer uint8 -> clen:size_t{length c = v clen /\ v clen = length m + 16} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint m n /\ disjoint c n) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SS.secretbox_open_easy (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #clen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #(clen -! 16ul) h1 m == Some?.v msg | _ -> None? msg)) let crypto_secretbox_open_easy m c clen n k = Hacl.Impl.SecretBox.secretbox_open_easy (clen -! 16ul) m k n c [@@ Comment "Compute a shared secret key given a public key and secret key. @param k Pointer to 32 (`crypto_box_BEFORENMBYTES`) bytes of memory where the shared secret is written to. @param pk Pointer to 32 bytes of memory where **their** public key is read from. @param sk Pointer to 32 bytes of memory where **my** secret key is read from."] val crypto_box_beforenm: k:lbuffer uint8 32ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h k /\ live h pk /\ live h sk /\ disjoint k pk /\ disjoint k sk) (ensures fun h0 r h1 -> modifies1 k h0 h1 /\ (let key = SB.box_beforenm (as_seq h0 pk) (as_seq h0 sk) in match r with | 0ul -> Some? key /\ as_seq h1 k == Some?.v key | _ -> None? key)) let crypto_box_beforenm k pk sk = Hacl.Impl.Box.box_beforenm k pk sk [@@ Comment "See `crypto_box_detached`."] val crypto_box_detached_afternm: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == SB.box_detached_afternm (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_box_detached_afternm c tag m mlen n k = Hacl.Impl.Box.box_detached_afternm mlen c tag k n m [@@ Comment "Encrypt a message using the recipient's public key, the sender's secret key, and a nonce. @param c Pointer to `mlen` bytes of memory where the ciphertext is written to. @param tag Pointer to 16 (tag length) bytes of memory where the authentication tag is written to. @param m Pointer to `mlen` bytes of memory where the message is read from. @param mlen Length of the message. @param n Pointer to 24 (`crypto_box_NONCEBYTES`) bytes of memory where the nonce is read from. @param pk Pointer to 32 bytes of memory where **their** public key is read from. @param sk Pointer to 32 bytes of memory where **my** secret key is read from."] val crypto_box_detached: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h sk /\ live h pk /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (let tag_cipher = SB.box_detached (as_seq h0 sk) (as_seq h0 pk) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m) in match r with | 0ul -> Some? tag_cipher /\ (let (tag_s, cipher_s) = Some?.v tag_cipher in (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == (tag_s, cipher_s)) | _ -> None? tag_cipher)) let crypto_box_detached c tag m mlen n pk sk = Hacl.Impl.Box.box_detached mlen c tag sk pk n m [@@ Comment "See `crypto_box_open_detached`."] val crypto_box_open_detached_afternm: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SB.box_open_detached_afternm (as_seq h0 k) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg)) let crypto_box_open_detached_afternm m c tag mlen n k = Hacl.Impl.Box.box_open_detached_afternm mlen m k n c tag [@@ Comment "Verify and decrypt a ciphertext produced by `crypto_box_detached`. @param m Pointer to `mlen` bytes of memory where the decrypted message is written to. @param c Pointer to `mlen` bytes of memory where the ciphertext is read from. Note: the ciphertext must include the tag. @param tag Pointer to 16 (tag length) bytes of memory where the authentication tag is read from. @param mlen Length of the message (and ciphertext). @param n Pointer to 24 (`crypto_box_NONCEBYTES`) bytes of memory where the nonce is read from. @param pk Pointer to 32 bytes of memory where the public key of the sender is read from. @param sk Pointer to 32 bytes of memory where the secret key of the recipient is read from."] val crypto_box_open_detached: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h pk /\ live h sk /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SB.box_open_detached (as_seq h0 pk) (as_seq h0 sk) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg)) let crypto_box_open_detached m c tag mlen n pk sk = Hacl.Impl.Box.box_open_detached mlen m pk sk n c tag [@@ Comment "See `crypto_box_easy`."] val crypto_box_easy_afternm: c:buffer uint8 -> m:buffer uint8 -> mlen:size_t{length c = v mlen + 16 /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 c h0 h1 /\ as_seq #MUT #uint8 #(mlen +! 16ul) h1 c == SB.box_easy_afternm (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m))
{ "checked_file": "/", "dependencies": [ "Spec.SecretBox.fst.checked", "Spec.Box.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.SecretBox.fst.checked", "Hacl.Impl.Box.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.NaCl.fst" }
[ { "abbrev": true, "full_module": "Spec.SecretBox", "short_module": "SS" }, { "abbrev": true, "full_module": "Spec.Box", "short_module": "SB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
c: Lib.Buffer.buffer Lib.IntTypes.uint8 -> m: Lib.Buffer.buffer Lib.IntTypes.uint8 -> mlen: Lib.IntTypes.size_t { Lib.Buffer.length c = Lib.IntTypes.v mlen + 16 /\ Lib.Buffer.length m = Lib.IntTypes.v mlen } -> n: Lib.Buffer.lbuffer Lib.IntTypes.uint8 24ul -> k: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul -> FStar.HyperStack.ST.Stack Lib.IntTypes.size_t
FStar.HyperStack.ST.Stack
[]
[]
[ "Lib.Buffer.buffer", "Lib.IntTypes.uint8", "Lib.IntTypes.size_t", "Prims.l_and", "Prims.b2t", "Prims.op_Equality", "Prims.int", "Lib.Buffer.length", "Lib.Buffer.MUT", "Prims.op_Addition", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Prims.l_or", "Lib.IntTypes.range", "Prims.op_GreaterThanOrEqual", "Lib.Buffer.lbuffer", "FStar.UInt32.__uint_to_t", "Hacl.Impl.Box.box_easy_afternm" ]
[]
false
true
false
false
false
let crypto_box_easy_afternm c m mlen n k =
Hacl.Impl.Box.box_easy_afternm mlen c k n m
false
Vale.X64.Stack_i.fst
Vale.X64.Stack_i.lemma_frame_store_load_stack64
val lemma_frame_store_load_stack64 (ptr:int) (v:nat64) (h:vale_stack) (i:int) : Lemma (requires valid_src_stack64 i h /\ (i >= ptr + 8 \/ i + 8 <= ptr)) (ensures (load_stack64 i (store_stack64 ptr v h) == load_stack64 i h)) [SMTPat (load_stack64 i (store_stack64 ptr v h))]
val lemma_frame_store_load_stack64 (ptr:int) (v:nat64) (h:vale_stack) (i:int) : Lemma (requires valid_src_stack64 i h /\ (i >= ptr + 8 \/ i + 8 <= ptr)) (ensures (load_stack64 i (store_stack64 ptr v h) == load_stack64 i h)) [SMTPat (load_stack64 i (store_stack64 ptr v h))]
let lemma_frame_store_load_stack64 ptr v h i = let BS.Machine_stack _ mem = h in frame_update_heap64 ptr v mem; BS.get_heap_val64_reveal ()
{ "file_name": "vale/code/arch/x64/Vale.X64.Stack_i.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 29, "end_line": 43, "start_col": 0, "start_line": 40 }
module Vale.X64.Stack_i open FStar.Mul module BS = Vale.X64.Machine_Semantics_s open Vale.Arch.MachineHeap let vale_stack = BS.machine_stack let valid_src_stack64 i st = BS.valid_src_stack64 i st let load_stack64 i st = BS.eval_stack i st let store_stack64 i v h = BS.update_stack64' i v h let free_stack64 start finish h = BS.free_stack' start finish h let valid_src_stack128 i st = BS.valid_src_stack128 i st let load_stack128 i st = BS.eval_stack128 i st let store_stack128 i v h = BS.update_stack128' i v h let init_rsp h = h.BS.initial_rsp (* Lemmas *) #push-options "--z3rlimit 40" let lemma_store_stack_same_valid64 ptr v h i = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; BS.update_heap64_reveal () let lemma_free_stack_same_valid64 start finish ptr h = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; let BS.Machine_stack _ mem = h in let domain = Map.domain mem in Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish) let lemma_store_new_valid64 ptr v h = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; BS.update_heap64_reveal () #pop-options let lemma_correct_store_load_stack64 ptr v h = let BS.Machine_stack _ mem = h in correct_update_get64 ptr v mem
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.Lib.Set.fsti.checked", "Vale.Arch.MachineHeap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Vale.X64.Stack_i.fst" }
[ { "abbrev": false, "full_module": "Vale.Arch.MachineHeap", "short_module": null }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
ptr: Prims.int -> v: Vale.X64.Memory.nat64 -> h: Vale.X64.Stack_i.vale_stack -> i: Prims.int -> FStar.Pervasives.Lemma (requires Vale.X64.Stack_i.valid_src_stack64 i h /\ (i >= ptr + 8 \/ i + 8 <= ptr)) (ensures Vale.X64.Stack_i.load_stack64 i (Vale.X64.Stack_i.store_stack64 ptr v h) == Vale.X64.Stack_i.load_stack64 i h) [SMTPat (Vale.X64.Stack_i.load_stack64 i (Vale.X64.Stack_i.store_stack64 ptr v h))]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.int", "Vale.X64.Memory.nat64", "Vale.X64.Stack_i.vale_stack", "Vale.Def.Types_s.nat64", "Prims.b2t", "Prims.op_GreaterThanOrEqual", "FStar.Map.t", "Vale.Def.Types_s.nat8", "Vale.Arch.MachineHeap_s.get_heap_val64_reveal", "Prims.unit", "Vale.Arch.MachineHeap.frame_update_heap64" ]
[]
false
false
true
false
false
let lemma_frame_store_load_stack64 ptr v h i =
let BS.Machine_stack _ mem = h in frame_update_heap64 ptr v mem; BS.get_heap_val64_reveal ()
false
Vale.X64.Stack_i.fst
Vale.X64.Stack_i.lemma_store_stack_same_valid64
val lemma_store_stack_same_valid64 (ptr:int) (v:nat64) (h:vale_stack) (i:int) : Lemma (requires valid_src_stack64 i h /\ (i >= ptr + 8 \/ i + 8 <= ptr)) (ensures valid_src_stack64 i (store_stack64 ptr v h)) [SMTPat (valid_src_stack64 i (store_stack64 ptr v h))]
val lemma_store_stack_same_valid64 (ptr:int) (v:nat64) (h:vale_stack) (i:int) : Lemma (requires valid_src_stack64 i h /\ (i >= ptr + 8 \/ i + 8 <= ptr)) (ensures valid_src_stack64 i (store_stack64 ptr v h)) [SMTPat (valid_src_stack64 i (store_stack64 ptr v h))]
let lemma_store_stack_same_valid64 ptr v h i = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; BS.update_heap64_reveal ()
{ "file_name": "vale/code/arch/x64/Vale.X64.Stack_i.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 28, "end_line": 23, "start_col": 0, "start_line": 21 }
module Vale.X64.Stack_i open FStar.Mul module BS = Vale.X64.Machine_Semantics_s open Vale.Arch.MachineHeap let vale_stack = BS.machine_stack let valid_src_stack64 i st = BS.valid_src_stack64 i st let load_stack64 i st = BS.eval_stack i st let store_stack64 i v h = BS.update_stack64' i v h let free_stack64 start finish h = BS.free_stack' start finish h let valid_src_stack128 i st = BS.valid_src_stack128 i st let load_stack128 i st = BS.eval_stack128 i st let store_stack128 i v h = BS.update_stack128' i v h let init_rsp h = h.BS.initial_rsp (* Lemmas *)
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.Lib.Set.fsti.checked", "Vale.Arch.MachineHeap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Vale.X64.Stack_i.fst" }
[ { "abbrev": false, "full_module": "Vale.Arch.MachineHeap", "short_module": null }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 40, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
ptr: Prims.int -> v: Vale.X64.Memory.nat64 -> h: Vale.X64.Stack_i.vale_stack -> i: Prims.int -> FStar.Pervasives.Lemma (requires Vale.X64.Stack_i.valid_src_stack64 i h /\ (i >= ptr + 8 \/ i + 8 <= ptr)) (ensures Vale.X64.Stack_i.valid_src_stack64 i (Vale.X64.Stack_i.store_stack64 ptr v h)) [SMTPat (Vale.X64.Stack_i.valid_src_stack64 i (Vale.X64.Stack_i.store_stack64 ptr v h))]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.int", "Vale.X64.Memory.nat64", "Vale.X64.Stack_i.vale_stack", "Vale.Arch.MachineHeap_s.update_heap64_reveal", "Prims.unit", "FStar.Pervasives.reveal_opaque", "Vale.Arch.MachineHeap_s.machine_heap", "Prims.bool", "Vale.Arch.MachineHeap_s.valid_addr64" ]
[]
true
false
true
false
false
let lemma_store_stack_same_valid64 ptr v h i =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; BS.update_heap64_reveal ()
false
Hacl.NaCl.fst
Hacl.NaCl.crypto_box_detached_afternm
val crypto_box_detached_afternm: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == SB.box_detached_afternm (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m))
val crypto_box_detached_afternm: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == SB.box_detached_afternm (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m))
let crypto_box_detached_afternm c tag m mlen n k = Hacl.Impl.Box.box_detached_afternm mlen c tag k n m
{ "file_name": "code/nacl-box/Hacl.NaCl.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 53, "end_line": 175, "start_col": 0, "start_line": 174 }
module Hacl.NaCl open FStar.HyperStack.All open FStar.HyperStack open FStar.Mul open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module SB = Spec.Box module SS = Spec.SecretBox #set-options "--max_fuel 50 --max_fuel 0 --max_ifuel 0" [@@ Comment "Encrypt a message with a key and nonce. Note: `c` and `m` can point to the same memory for in-place encryption. @param c Pointer to `mlen` bytes where the ciphertext is written to. @param tag Pointer to 16 (tag length) bytes where the authentication tag is written to. @param m Pointer to `mlen` bytes where the message is read from. @param mlen Length of message. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_detached: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == SS.secretbox_detached (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_secretbox_detached c tag m mlen n k = Hacl.Impl.SecretBox.secretbox_detached mlen c tag k n m; 0ul [@@ Comment "Verify and decrypt a ciphertext produced with `Hacl_NaCl_crypto_secretbox_detached`. Note: `m` and `c` can point to the same memory for in-place decryption. @param m Pointer to `mlen` bytes where the message is written to. @param c Pointer to `mlen` bytes where the ciphertext is read from. @param tag Pointer to 16 (tag length) bytes where the authentication tag is read from. @param mlen Length of message (and ciphertext). @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_open_detached: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SS.secretbox_open_detached (as_seq h0 k) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg)) let crypto_secretbox_open_detached m c tag mlen n k = Hacl.Impl.SecretBox.secretbox_open_detached mlen m k n c tag [@@ Comment "Encrypt a message with a key and nonce. @param c Pointer to 16 (tag length) + `mlen` bytes where the ciphertext is written to. @param m Pointer to `mlen` bytes where the message is read from. @param mlen Length of message. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_easy: c:buffer uint8 -> m:buffer uint8 -> mlen:size_t{length c = v mlen + 16 /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 c h0 h1 /\ as_seq #MUT #uint8 #(mlen +! 16ul) h1 c == SS.secretbox_easy (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_secretbox_easy c m mlen n k = Hacl.Impl.SecretBox.secretbox_easy mlen c k n m; 0ul #set-options "--z3rlimit 100" [@@ Comment "Verify and decrypt a ciphertext produced with `crypto_secretbox_easy`. @param m Pointer to `mlen` bytes where the message is written to. @param c Pointer to `clen` bytes where the ciphertext is read from. The authentication tag must be included. @param clen Length of ciphertext. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_open_easy: m:buffer uint8 -> c:buffer uint8 -> clen:size_t{length c = v clen /\ v clen = length m + 16} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint m n /\ disjoint c n) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SS.secretbox_open_easy (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #clen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #(clen -! 16ul) h1 m == Some?.v msg | _ -> None? msg)) let crypto_secretbox_open_easy m c clen n k = Hacl.Impl.SecretBox.secretbox_open_easy (clen -! 16ul) m k n c [@@ Comment "Compute a shared secret key given a public key and secret key. @param k Pointer to 32 (`crypto_box_BEFORENMBYTES`) bytes of memory where the shared secret is written to. @param pk Pointer to 32 bytes of memory where **their** public key is read from. @param sk Pointer to 32 bytes of memory where **my** secret key is read from."] val crypto_box_beforenm: k:lbuffer uint8 32ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h k /\ live h pk /\ live h sk /\ disjoint k pk /\ disjoint k sk) (ensures fun h0 r h1 -> modifies1 k h0 h1 /\ (let key = SB.box_beforenm (as_seq h0 pk) (as_seq h0 sk) in match r with | 0ul -> Some? key /\ as_seq h1 k == Some?.v key | _ -> None? key)) let crypto_box_beforenm k pk sk = Hacl.Impl.Box.box_beforenm k pk sk [@@ Comment "See `crypto_box_detached`."] val crypto_box_detached_afternm: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == SB.box_detached_afternm (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m))
{ "checked_file": "/", "dependencies": [ "Spec.SecretBox.fst.checked", "Spec.Box.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.SecretBox.fst.checked", "Hacl.Impl.Box.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.NaCl.fst" }
[ { "abbrev": true, "full_module": "Spec.SecretBox", "short_module": "SS" }, { "abbrev": true, "full_module": "Spec.Box", "short_module": "SB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
c: Lib.Buffer.buffer Lib.IntTypes.uint8 -> tag: Lib.Buffer.lbuffer Lib.IntTypes.uint8 16ul -> m: Lib.Buffer.buffer Lib.IntTypes.uint8 -> mlen: Lib.IntTypes.size_t {Lib.Buffer.length c = Lib.IntTypes.v mlen /\ Lib.Buffer.length m = Lib.IntTypes.v mlen} -> n: Lib.Buffer.lbuffer Lib.IntTypes.uint8 24ul -> k: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul -> FStar.HyperStack.ST.Stack Lib.IntTypes.size_t
FStar.HyperStack.ST.Stack
[]
[]
[ "Lib.Buffer.buffer", "Lib.IntTypes.uint8", "Lib.Buffer.lbuffer", "FStar.UInt32.__uint_to_t", "Lib.IntTypes.size_t", "Prims.l_and", "Prims.b2t", "Prims.op_Equality", "Prims.int", "Prims.l_or", "Prims.op_GreaterThanOrEqual", "Lib.IntTypes.range", "Lib.IntTypes.U32", "Lib.Buffer.length", "Lib.Buffer.MUT", "Lib.IntTypes.v", "Lib.IntTypes.PUB", "Hacl.Impl.Box.box_detached_afternm" ]
[]
false
true
false
false
false
let crypto_box_detached_afternm c tag m mlen n k =
Hacl.Impl.Box.box_detached_afternm mlen c tag k n m
false
Vale.X64.Stack_i.fst
Vale.X64.Stack_i.lemma_store_new_valid64
val lemma_store_new_valid64 (ptr:int) (v:nat64) (h:vale_stack) : Lemma (valid_src_stack64 ptr (store_stack64 ptr v h)) [SMTPat (valid_src_stack64 ptr (store_stack64 ptr v h))]
val lemma_store_new_valid64 (ptr:int) (v:nat64) (h:vale_stack) : Lemma (valid_src_stack64 ptr (store_stack64 ptr v h)) [SMTPat (valid_src_stack64 ptr (store_stack64 ptr v h))]
let lemma_store_new_valid64 ptr v h = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; BS.update_heap64_reveal ()
{ "file_name": "vale/code/arch/x64/Vale.X64.Stack_i.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 28, "end_line": 33, "start_col": 0, "start_line": 31 }
module Vale.X64.Stack_i open FStar.Mul module BS = Vale.X64.Machine_Semantics_s open Vale.Arch.MachineHeap let vale_stack = BS.machine_stack let valid_src_stack64 i st = BS.valid_src_stack64 i st let load_stack64 i st = BS.eval_stack i st let store_stack64 i v h = BS.update_stack64' i v h let free_stack64 start finish h = BS.free_stack' start finish h let valid_src_stack128 i st = BS.valid_src_stack128 i st let load_stack128 i st = BS.eval_stack128 i st let store_stack128 i v h = BS.update_stack128' i v h let init_rsp h = h.BS.initial_rsp (* Lemmas *) #push-options "--z3rlimit 40" let lemma_store_stack_same_valid64 ptr v h i = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; BS.update_heap64_reveal () let lemma_free_stack_same_valid64 start finish ptr h = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; let BS.Machine_stack _ mem = h in let domain = Map.domain mem in Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish)
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.Lib.Set.fsti.checked", "Vale.Arch.MachineHeap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Vale.X64.Stack_i.fst" }
[ { "abbrev": false, "full_module": "Vale.Arch.MachineHeap", "short_module": null }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 40, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
ptr: Prims.int -> v: Vale.X64.Memory.nat64 -> h: Vale.X64.Stack_i.vale_stack -> FStar.Pervasives.Lemma (ensures Vale.X64.Stack_i.valid_src_stack64 ptr (Vale.X64.Stack_i.store_stack64 ptr v h)) [SMTPat (Vale.X64.Stack_i.valid_src_stack64 ptr (Vale.X64.Stack_i.store_stack64 ptr v h))]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.int", "Vale.X64.Memory.nat64", "Vale.X64.Stack_i.vale_stack", "Vale.Arch.MachineHeap_s.update_heap64_reveal", "Prims.unit", "FStar.Pervasives.reveal_opaque", "Vale.Arch.MachineHeap_s.machine_heap", "Prims.bool", "Vale.Arch.MachineHeap_s.valid_addr64" ]
[]
true
false
true
false
false
let lemma_store_new_valid64 ptr v h =
reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; BS.update_heap64_reveal ()
false
Vale.X64.Stack_i.fst
Vale.X64.Stack_i.lemma_compose_free_stack64
val lemma_compose_free_stack64 (start:int) (inter:int) (finish:int) (h:vale_stack) : Lemma (requires start <= inter /\ inter <= finish) (ensures free_stack64 inter finish (free_stack64 start inter h) == free_stack64 start finish h) [SMTPat (free_stack64 inter finish (free_stack64 start inter h))]
val lemma_compose_free_stack64 (start:int) (inter:int) (finish:int) (h:vale_stack) : Lemma (requires start <= inter /\ inter <= finish) (ensures free_stack64 inter finish (free_stack64 start inter h) == free_stack64 start finish h) [SMTPat (free_stack64 inter finish (free_stack64 start inter h))]
let lemma_compose_free_stack64 start inter finish h = let BS.Machine_stack _ mem = h in let domain = Map.domain mem in let map_restr = Map.restrict (Vale.Lib.Set.remove_between domain start inter) mem in let restrict = Map.domain map_restr in let BS.Machine_stack _ mem1 = free_stack64 inter finish (free_stack64 start inter h) in let BS.Machine_stack _ mem2 = free_stack64 start finish h in let aux (i:int) : Lemma (Map.contains mem1 i = Map.contains mem2 i /\ Map.sel mem1 i = Map.sel mem2 i) = Vale.Lib.Set.remove_between_reveal domain start inter i; Vale.Lib.Set.remove_between_reveal restrict inter finish i; Vale.Lib.Set.remove_between_reveal domain start finish i; Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start inter) mem i; Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between restrict inter finish) map_restr i; Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start finish) mem i in Classical.forall_intro aux; assert (Map.equal mem1 mem2)
{ "file_name": "vale/code/arch/x64/Vale.X64.Stack_i.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 30, "end_line": 67, "start_col": 0, "start_line": 52 }
module Vale.X64.Stack_i open FStar.Mul module BS = Vale.X64.Machine_Semantics_s open Vale.Arch.MachineHeap let vale_stack = BS.machine_stack let valid_src_stack64 i st = BS.valid_src_stack64 i st let load_stack64 i st = BS.eval_stack i st let store_stack64 i v h = BS.update_stack64' i v h let free_stack64 start finish h = BS.free_stack' start finish h let valid_src_stack128 i st = BS.valid_src_stack128 i st let load_stack128 i st = BS.eval_stack128 i st let store_stack128 i v h = BS.update_stack128' i v h let init_rsp h = h.BS.initial_rsp (* Lemmas *) #push-options "--z3rlimit 40" let lemma_store_stack_same_valid64 ptr v h i = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; BS.update_heap64_reveal () let lemma_free_stack_same_valid64 start finish ptr h = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; let BS.Machine_stack _ mem = h in let domain = Map.domain mem in Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish) let lemma_store_new_valid64 ptr v h = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; BS.update_heap64_reveal () #pop-options let lemma_correct_store_load_stack64 ptr v h = let BS.Machine_stack _ mem = h in correct_update_get64 ptr v mem let lemma_frame_store_load_stack64 ptr v h i = let BS.Machine_stack _ mem = h in frame_update_heap64 ptr v mem; BS.get_heap_val64_reveal () let lemma_free_stack_same_load64 start finish ptr h = reveal_opaque (`%BS.valid_addr64) BS.valid_addr64; let BS.Machine_stack _ mem = h in let domain = Map.domain mem in Classical.forall_intro (Vale.Lib.Set.remove_between_reveal domain start finish); BS.get_heap_val64_reveal ()
{ "checked_file": "/", "dependencies": [ "Vale.X64.Machine_Semantics_s.fst.checked", "Vale.Lib.Set.fsti.checked", "Vale.Arch.MachineHeap.fsti.checked", "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Map.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Vale.X64.Stack_i.fst" }
[ { "abbrev": false, "full_module": "Vale.Arch.MachineHeap", "short_module": null }, { "abbrev": true, "full_module": "Vale.X64.Machine_Semantics_s", "short_module": "BS" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Memory", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
start: Prims.int -> inter: Prims.int -> finish: Prims.int -> h: Vale.X64.Stack_i.vale_stack -> FStar.Pervasives.Lemma (requires start <= inter /\ inter <= finish) (ensures Vale.X64.Stack_i.free_stack64 inter finish (Vale.X64.Stack_i.free_stack64 start inter h) == Vale.X64.Stack_i.free_stack64 start finish h) [ SMTPat (Vale.X64.Stack_i.free_stack64 inter finish (Vale.X64.Stack_i.free_stack64 start inter h)) ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.int", "Vale.X64.Stack_i.vale_stack", "Vale.Def.Types_s.nat64", "Prims.b2t", "Prims.op_GreaterThanOrEqual", "FStar.Map.t", "Vale.Def.Types_s.nat8", "Prims._assert", "FStar.Map.equal", "Prims.unit", "FStar.Classical.forall_intro", "Prims.l_and", "Prims.op_Equality", "Prims.bool", "FStar.Map.contains", "FStar.Map.sel", "Prims.l_True", "Prims.squash", "Vale.Def.Words_s.nat8", "Prims.Nil", "FStar.Pervasives.pattern", "Vale.Lib.Set.lemma_sel_restrict", "Vale.Lib.Set.remove_between", "Vale.Lib.Set.remove_between_reveal", "Vale.X64.Stack_i.free_stack64", "FStar.Set.set", "FStar.Map.domain", "FStar.Map.restrict" ]
[]
false
false
true
false
false
let lemma_compose_free_stack64 start inter finish h =
let BS.Machine_stack _ mem = h in let domain = Map.domain mem in let map_restr = Map.restrict (Vale.Lib.Set.remove_between domain start inter) mem in let restrict = Map.domain map_restr in let BS.Machine_stack _ mem1 = free_stack64 inter finish (free_stack64 start inter h) in let BS.Machine_stack _ mem2 = free_stack64 start finish h in let aux (i: int) : Lemma (Map.contains mem1 i = Map.contains mem2 i /\ Map.sel mem1 i = Map.sel mem2 i) = Vale.Lib.Set.remove_between_reveal domain start inter i; Vale.Lib.Set.remove_between_reveal restrict inter finish i; Vale.Lib.Set.remove_between_reveal domain start finish i; Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start inter) mem i; Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between restrict inter finish) map_restr i; Vale.Lib.Set.lemma_sel_restrict (Vale.Lib.Set.remove_between domain start finish) mem i in Classical.forall_intro aux; assert (Map.equal mem1 mem2)
false
Hacl.NaCl.fst
Hacl.NaCl.crypto_box_easy
val crypto_box_easy: c:buffer uint8 -> m:buffer uint8 -> mlen:size_t{length c = v mlen + 16 /\ length m = v mlen} -> n:lbuffer uint8 24ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h sk /\ live h pk /\ live h n /\ disjoint m c /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 c h0 h1 /\ (let cipher = SB.box_easy (as_seq h0 sk) (as_seq h0 pk) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m) in match r with | 0ul -> Some? cipher /\ as_seq #MUT #uint8 #(mlen +! 16ul) h1 c == Some?.v cipher | _ -> None? cipher))
val crypto_box_easy: c:buffer uint8 -> m:buffer uint8 -> mlen:size_t{length c = v mlen + 16 /\ length m = v mlen} -> n:lbuffer uint8 24ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h sk /\ live h pk /\ live h n /\ disjoint m c /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 c h0 h1 /\ (let cipher = SB.box_easy (as_seq h0 sk) (as_seq h0 pk) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m) in match r with | 0ul -> Some? cipher /\ as_seq #MUT #uint8 #(mlen +! 16ul) h1 c == Some?.v cipher | _ -> None? cipher))
let crypto_box_easy c m mlen n pk sk = Hacl.Impl.Box.box_easy mlen c sk pk n m
{ "file_name": "code/nacl-box/Hacl.NaCl.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 41, "end_line": 310, "start_col": 0, "start_line": 309 }
module Hacl.NaCl open FStar.HyperStack.All open FStar.HyperStack open FStar.Mul open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module SB = Spec.Box module SS = Spec.SecretBox #set-options "--max_fuel 50 --max_fuel 0 --max_ifuel 0" [@@ Comment "Encrypt a message with a key and nonce. Note: `c` and `m` can point to the same memory for in-place encryption. @param c Pointer to `mlen` bytes where the ciphertext is written to. @param tag Pointer to 16 (tag length) bytes where the authentication tag is written to. @param m Pointer to `mlen` bytes where the message is read from. @param mlen Length of message. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_detached: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == SS.secretbox_detached (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_secretbox_detached c tag m mlen n k = Hacl.Impl.SecretBox.secretbox_detached mlen c tag k n m; 0ul [@@ Comment "Verify and decrypt a ciphertext produced with `Hacl_NaCl_crypto_secretbox_detached`. Note: `m` and `c` can point to the same memory for in-place decryption. @param m Pointer to `mlen` bytes where the message is written to. @param c Pointer to `mlen` bytes where the ciphertext is read from. @param tag Pointer to 16 (tag length) bytes where the authentication tag is read from. @param mlen Length of message (and ciphertext). @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_open_detached: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SS.secretbox_open_detached (as_seq h0 k) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg)) let crypto_secretbox_open_detached m c tag mlen n k = Hacl.Impl.SecretBox.secretbox_open_detached mlen m k n c tag [@@ Comment "Encrypt a message with a key and nonce. @param c Pointer to 16 (tag length) + `mlen` bytes where the ciphertext is written to. @param m Pointer to `mlen` bytes where the message is read from. @param mlen Length of message. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_easy: c:buffer uint8 -> m:buffer uint8 -> mlen:size_t{length c = v mlen + 16 /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 c h0 h1 /\ as_seq #MUT #uint8 #(mlen +! 16ul) h1 c == SS.secretbox_easy (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_secretbox_easy c m mlen n k = Hacl.Impl.SecretBox.secretbox_easy mlen c k n m; 0ul #set-options "--z3rlimit 100" [@@ Comment "Verify and decrypt a ciphertext produced with `crypto_secretbox_easy`. @param m Pointer to `mlen` bytes where the message is written to. @param c Pointer to `clen` bytes where the ciphertext is read from. The authentication tag must be included. @param clen Length of ciphertext. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_open_easy: m:buffer uint8 -> c:buffer uint8 -> clen:size_t{length c = v clen /\ v clen = length m + 16} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint m n /\ disjoint c n) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SS.secretbox_open_easy (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #clen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #(clen -! 16ul) h1 m == Some?.v msg | _ -> None? msg)) let crypto_secretbox_open_easy m c clen n k = Hacl.Impl.SecretBox.secretbox_open_easy (clen -! 16ul) m k n c [@@ Comment "Compute a shared secret key given a public key and secret key. @param k Pointer to 32 (`crypto_box_BEFORENMBYTES`) bytes of memory where the shared secret is written to. @param pk Pointer to 32 bytes of memory where **their** public key is read from. @param sk Pointer to 32 bytes of memory where **my** secret key is read from."] val crypto_box_beforenm: k:lbuffer uint8 32ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h k /\ live h pk /\ live h sk /\ disjoint k pk /\ disjoint k sk) (ensures fun h0 r h1 -> modifies1 k h0 h1 /\ (let key = SB.box_beforenm (as_seq h0 pk) (as_seq h0 sk) in match r with | 0ul -> Some? key /\ as_seq h1 k == Some?.v key | _ -> None? key)) let crypto_box_beforenm k pk sk = Hacl.Impl.Box.box_beforenm k pk sk [@@ Comment "See `crypto_box_detached`."] val crypto_box_detached_afternm: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == SB.box_detached_afternm (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_box_detached_afternm c tag m mlen n k = Hacl.Impl.Box.box_detached_afternm mlen c tag k n m [@@ Comment "Encrypt a message using the recipient's public key, the sender's secret key, and a nonce. @param c Pointer to `mlen` bytes of memory where the ciphertext is written to. @param tag Pointer to 16 (tag length) bytes of memory where the authentication tag is written to. @param m Pointer to `mlen` bytes of memory where the message is read from. @param mlen Length of the message. @param n Pointer to 24 (`crypto_box_NONCEBYTES`) bytes of memory where the nonce is read from. @param pk Pointer to 32 bytes of memory where **their** public key is read from. @param sk Pointer to 32 bytes of memory where **my** secret key is read from."] val crypto_box_detached: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h sk /\ live h pk /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (let tag_cipher = SB.box_detached (as_seq h0 sk) (as_seq h0 pk) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m) in match r with | 0ul -> Some? tag_cipher /\ (let (tag_s, cipher_s) = Some?.v tag_cipher in (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == (tag_s, cipher_s)) | _ -> None? tag_cipher)) let crypto_box_detached c tag m mlen n pk sk = Hacl.Impl.Box.box_detached mlen c tag sk pk n m [@@ Comment "See `crypto_box_open_detached`."] val crypto_box_open_detached_afternm: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SB.box_open_detached_afternm (as_seq h0 k) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg)) let crypto_box_open_detached_afternm m c tag mlen n k = Hacl.Impl.Box.box_open_detached_afternm mlen m k n c tag [@@ Comment "Verify and decrypt a ciphertext produced by `crypto_box_detached`. @param m Pointer to `mlen` bytes of memory where the decrypted message is written to. @param c Pointer to `mlen` bytes of memory where the ciphertext is read from. Note: the ciphertext must include the tag. @param tag Pointer to 16 (tag length) bytes of memory where the authentication tag is read from. @param mlen Length of the message (and ciphertext). @param n Pointer to 24 (`crypto_box_NONCEBYTES`) bytes of memory where the nonce is read from. @param pk Pointer to 32 bytes of memory where the public key of the sender is read from. @param sk Pointer to 32 bytes of memory where the secret key of the recipient is read from."] val crypto_box_open_detached: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h pk /\ live h sk /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SB.box_open_detached (as_seq h0 pk) (as_seq h0 sk) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg)) let crypto_box_open_detached m c tag mlen n pk sk = Hacl.Impl.Box.box_open_detached mlen m pk sk n c tag [@@ Comment "See `crypto_box_easy`."] val crypto_box_easy_afternm: c:buffer uint8 -> m:buffer uint8 -> mlen:size_t{length c = v mlen + 16 /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 c h0 h1 /\ as_seq #MUT #uint8 #(mlen +! 16ul) h1 c == SB.box_easy_afternm (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_box_easy_afternm c m mlen n k = Hacl.Impl.Box.box_easy_afternm mlen c k n m [@@ Comment "Encrypt a message using the recipient's public key, the sender's secret key, and a nonce. @param c Pointer to 16 (tag length) + `mlen` bytes of memory where the authentication tag and ciphertext is written to. @param m Pointer to `mlen` bytes of memory where the message is read from. @param mlen Length of the message. @param n Pointer to 24 (`crypto_box_NONCEBYTES`) bytes of memory where the nonce is read from. @param pk Pointer to 32 bytes of memory where the public key of the recipient is read from. @param sk Pointer to 32 bytes of memory where the secret key of the sender is read from."] val crypto_box_easy: c:buffer uint8 -> m:buffer uint8 -> mlen:size_t{length c = v mlen + 16 /\ length m = v mlen} -> n:lbuffer uint8 24ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h sk /\ live h pk /\ live h n /\ disjoint m c /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 c h0 h1 /\ (let cipher = SB.box_easy (as_seq h0 sk) (as_seq h0 pk) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m) in match r with | 0ul -> Some? cipher /\ as_seq #MUT #uint8 #(mlen +! 16ul) h1 c == Some?.v cipher | _ -> None? cipher))
{ "checked_file": "/", "dependencies": [ "Spec.SecretBox.fst.checked", "Spec.Box.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.SecretBox.fst.checked", "Hacl.Impl.Box.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.NaCl.fst" }
[ { "abbrev": true, "full_module": "Spec.SecretBox", "short_module": "SS" }, { "abbrev": true, "full_module": "Spec.Box", "short_module": "SB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
c: Lib.Buffer.buffer Lib.IntTypes.uint8 -> m: Lib.Buffer.buffer Lib.IntTypes.uint8 -> mlen: Lib.IntTypes.size_t { Lib.Buffer.length c = Lib.IntTypes.v mlen + 16 /\ Lib.Buffer.length m = Lib.IntTypes.v mlen } -> n: Lib.Buffer.lbuffer Lib.IntTypes.uint8 24ul -> pk: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul -> sk: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul -> FStar.HyperStack.ST.Stack Lib.IntTypes.size_t
FStar.HyperStack.ST.Stack
[]
[]
[ "Lib.Buffer.buffer", "Lib.IntTypes.uint8", "Lib.IntTypes.size_t", "Prims.l_and", "Prims.b2t", "Prims.op_Equality", "Prims.int", "Lib.Buffer.length", "Lib.Buffer.MUT", "Prims.op_Addition", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Prims.l_or", "Lib.IntTypes.range", "Prims.op_GreaterThanOrEqual", "Lib.Buffer.lbuffer", "FStar.UInt32.__uint_to_t", "Hacl.Impl.Box.box_easy" ]
[]
false
true
false
false
false
let crypto_box_easy c m mlen n pk sk =
Hacl.Impl.Box.box_easy mlen c sk pk n m
false
Hacl.NaCl.fst
Hacl.NaCl.crypto_secretbox_easy
val crypto_secretbox_easy: c:buffer uint8 -> m:buffer uint8 -> mlen:size_t{length c = v mlen + 16 /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 c h0 h1 /\ as_seq #MUT #uint8 #(mlen +! 16ul) h1 c == SS.secretbox_easy (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m))
val crypto_secretbox_easy: c:buffer uint8 -> m:buffer uint8 -> mlen:size_t{length c = v mlen + 16 /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 c h0 h1 /\ as_seq #MUT #uint8 #(mlen +! 16ul) h1 c == SS.secretbox_easy (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m))
let crypto_secretbox_easy c m mlen n k = Hacl.Impl.SecretBox.secretbox_easy mlen c k n m; 0ul
{ "file_name": "code/nacl-box/Hacl.NaCl.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 5, "end_line": 104, "start_col": 0, "start_line": 102 }
module Hacl.NaCl open FStar.HyperStack.All open FStar.HyperStack open FStar.Mul open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module SB = Spec.Box module SS = Spec.SecretBox #set-options "--max_fuel 50 --max_fuel 0 --max_ifuel 0" [@@ Comment "Encrypt a message with a key and nonce. Note: `c` and `m` can point to the same memory for in-place encryption. @param c Pointer to `mlen` bytes where the ciphertext is written to. @param tag Pointer to 16 (tag length) bytes where the authentication tag is written to. @param m Pointer to `mlen` bytes where the message is read from. @param mlen Length of message. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_detached: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == SS.secretbox_detached (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_secretbox_detached c tag m mlen n k = Hacl.Impl.SecretBox.secretbox_detached mlen c tag k n m; 0ul [@@ Comment "Verify and decrypt a ciphertext produced with `Hacl_NaCl_crypto_secretbox_detached`. Note: `m` and `c` can point to the same memory for in-place decryption. @param m Pointer to `mlen` bytes where the message is written to. @param c Pointer to `mlen` bytes where the ciphertext is read from. @param tag Pointer to 16 (tag length) bytes where the authentication tag is read from. @param mlen Length of message (and ciphertext). @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_open_detached: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SS.secretbox_open_detached (as_seq h0 k) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg)) let crypto_secretbox_open_detached m c tag mlen n k = Hacl.Impl.SecretBox.secretbox_open_detached mlen m k n c tag [@@ Comment "Encrypt a message with a key and nonce. @param c Pointer to 16 (tag length) + `mlen` bytes where the ciphertext is written to. @param m Pointer to `mlen` bytes where the message is read from. @param mlen Length of message. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_easy: c:buffer uint8 -> m:buffer uint8 -> mlen:size_t{length c = v mlen + 16 /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 c h0 h1 /\ as_seq #MUT #uint8 #(mlen +! 16ul) h1 c == SS.secretbox_easy (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m))
{ "checked_file": "/", "dependencies": [ "Spec.SecretBox.fst.checked", "Spec.Box.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.SecretBox.fst.checked", "Hacl.Impl.Box.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.NaCl.fst" }
[ { "abbrev": true, "full_module": "Spec.SecretBox", "short_module": "SS" }, { "abbrev": true, "full_module": "Spec.Box", "short_module": "SB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
c: Lib.Buffer.buffer Lib.IntTypes.uint8 -> m: Lib.Buffer.buffer Lib.IntTypes.uint8 -> mlen: Lib.IntTypes.size_t { Lib.Buffer.length c = Lib.IntTypes.v mlen + 16 /\ Lib.Buffer.length m = Lib.IntTypes.v mlen } -> n: Lib.Buffer.lbuffer Lib.IntTypes.uint8 24ul -> k: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul -> FStar.HyperStack.ST.Stack Lib.IntTypes.size_t
FStar.HyperStack.ST.Stack
[]
[]
[ "Lib.Buffer.buffer", "Lib.IntTypes.uint8", "Lib.IntTypes.size_t", "Prims.l_and", "Prims.b2t", "Prims.op_Equality", "Prims.int", "Lib.Buffer.length", "Lib.Buffer.MUT", "Prims.op_Addition", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Prims.l_or", "Lib.IntTypes.range", "Prims.op_GreaterThanOrEqual", "Lib.Buffer.lbuffer", "FStar.UInt32.__uint_to_t", "Prims.unit", "Hacl.Impl.SecretBox.secretbox_easy" ]
[]
false
true
false
false
false
let crypto_secretbox_easy c m mlen n k =
Hacl.Impl.SecretBox.secretbox_easy mlen c k n m; 0ul
false
Vale.AES.Types_helpers.fst
Vale.AES.Types_helpers.lemma_BitwiseXorWithZero64
val lemma_BitwiseXorWithZero64 (n:nat64) : Lemma (ixor n 0 == n)
val lemma_BitwiseXorWithZero64 (n:nat64) : Lemma (ixor n 0 == n)
let lemma_BitwiseXorWithZero64 n = lemma_ixor_nth_all 64; lemma_zero_nth 64; lemma_equal_nth 64 (ixor n 0) n
{ "file_name": "vale/code/crypto/aes/Vale.AES.Types_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 33, "end_line": 39, "start_col": 0, "start_line": 36 }
module Vale.AES.Types_helpers open Vale.Def.Words.Seq_s open Vale.Def.Words.Four_s open Vale.Def.Types_s open Vale.Arch.Types open FStar.Seq open Vale.Arch.TypesNative let lemma_slices_le_quad32_to_bytes (q:quad32) : Lemma (ensures ( let s = le_quad32_to_bytes q in q.lo0 == four_to_nat 8 (seq_to_four_LE (slice s 0 4)) /\ q.lo1 == four_to_nat 8 (seq_to_four_LE (slice s 4 8)) /\ q.hi2 == four_to_nat 8 (seq_to_four_LE (slice s 8 12)) /\ q.hi3 == four_to_nat 8 (seq_to_four_LE (slice s 12 16)) )) = reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #nat8); reveal_opaque (`%le_quad32_to_bytes) le_quad32_to_bytes; () let lemma_slices_be_quad32_to_bytes (q:quad32) : Lemma (ensures ( let s = be_quad32_to_bytes q in q.hi3 == four_to_nat 8 (seq_to_four_BE (slice s 0 4)) /\ q.hi2 == four_to_nat 8 (seq_to_four_BE (slice s 4 8)) /\ q.lo1 == four_to_nat 8 (seq_to_four_BE (slice s 8 12)) /\ q.lo0 == four_to_nat 8 (seq_to_four_BE (slice s 12 16)) )) = reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #nat8); reveal_opaque (`%be_quad32_to_bytes) be_quad32_to_bytes; ()
{ "checked_file": "/", "dependencies": [ "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.Types_helpers.fst" }
[ { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "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 } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
n: Vale.Def.Types_s.nat64 -> FStar.Pervasives.Lemma (ensures Vale.Def.Types_s.ixor n 0 == n)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Vale.Def.Types_s.nat64", "Vale.Arch.TypesNative.lemma_equal_nth", "Vale.Def.Types_s.ixor", "Vale.Def.Words_s.pow2_64", "Prims.unit", "Vale.Arch.TypesNative.lemma_zero_nth", "Vale.Arch.TypesNative.lemma_ixor_nth_all" ]
[]
true
false
true
false
false
let lemma_BitwiseXorWithZero64 n =
lemma_ixor_nth_all 64; lemma_zero_nth 64; lemma_equal_nth 64 (ixor n 0) n
false
Hacl.P256.PrecompTable.fsti
Hacl.P256.PrecompTable.g_aff
val g_aff:S.aff_point
val g_aff:S.aff_point
let g_aff : S.aff_point = S.to_aff_point S.base_point
{ "file_name": "code/ecdsap256/Hacl.P256.PrecompTable.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 53, "end_line": 50, "start_col": 0, "start_line": 50 }
module Hacl.P256.PrecompTable open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module LE = Lib.Exponentiation.Definition module SE = Spec.Exponentiation module BE = Hacl.Impl.Exponentiation.Definitions module SPT = Hacl.Spec.PrecompBaseTable module S = Spec.P256 module SM = Hacl.Spec.P256.Montgomery open Hacl.Impl.P256.Point include Hacl.Impl.P256.Group #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract val proj_point_to_list: p:S.proj_point -> x:list uint64{FStar.List.Tot.length x = 12 /\ mk_to_p256_comm_monoid.BE.linv (Seq.seq_of_list x)} val lemma_refl: x:S.proj_point -> Lemma (S.mk_p256_concrete_ops.SE.to.SE.refl x == mk_to_p256_comm_monoid.BE.refl (Seq.seq_of_list (proj_point_to_list x))) inline_for_extraction noextract let mk_p256_precomp_base_table: SPT.mk_precomp_base_table S.proj_point U64 12ul 0ul = { SPT.concr_ops = S.mk_p256_concrete_ops; SPT.to_cm = mk_to_p256_comm_monoid; SPT.to_list = proj_point_to_list; SPT.lemma_refl = lemma_refl; } inline_for_extraction noextract let pow_point (k:nat) (p:S.aff_point) = LE.pow S.mk_p256_comm_monoid p k //----------------
{ "checked_file": "/", "dependencies": [ "Spec.P256.fst.checked", "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.Definition.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.PrecompBaseTable.fsti.checked", "Hacl.Spec.P256.Montgomery.fsti.checked", "Hacl.Impl.P256.Point.fsti.checked", "Hacl.Impl.P256.Group.fst.checked", "Hacl.Impl.Exponentiation.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.P256.PrecompTable.fsti" }
[ { "abbrev": false, "full_module": "Hacl.Impl.P256.Group", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.P256.Point", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Spec.P256.Montgomery", "short_module": "SM" }, { "abbrev": true, "full_module": "Spec.P256", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.PrecompBaseTable", "short_module": "SPT" }, { "abbrev": true, "full_module": "Hacl.Impl.Exponentiation.Definitions", "short_module": "BE" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, "full_module": "Lib.Exponentiation.Definition", "short_module": "LE" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.P256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.P256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Spec.P256.PointOps.aff_point
Prims.Tot
[ "total" ]
[]
[ "Spec.P256.PointOps.to_aff_point", "Spec.P256.PointOps.base_point" ]
[]
false
false
false
true
false
let g_aff:S.aff_point =
S.to_aff_point S.base_point
false
Hacl.NaCl.fst
Hacl.NaCl.crypto_box_open_easy
val crypto_box_open_easy: m:buffer uint8 -> c:buffer uint8 -> clen:size_t{length c = v clen /\ v clen = length m + 16} -> n:lbuffer uint8 24ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h pk /\ live h sk /\ live h n /\ disjoint m c /\ disjoint m n /\ disjoint c n) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SB.box_open_easy (as_seq h0 pk) (as_seq h0 sk) (as_seq h0 n) (as_seq #MUT #uint8 #clen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #(clen -! 16ul) h1 m == Some?.v msg | _ -> None? msg))
val crypto_box_open_easy: m:buffer uint8 -> c:buffer uint8 -> clen:size_t{length c = v clen /\ v clen = length m + 16} -> n:lbuffer uint8 24ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h pk /\ live h sk /\ live h n /\ disjoint m c /\ disjoint m n /\ disjoint c n) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SB.box_open_easy (as_seq h0 pk) (as_seq h0 sk) (as_seq h0 n) (as_seq #MUT #uint8 #clen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #(clen -! 16ul) h1 m == Some?.v msg | _ -> None? msg))
let crypto_box_open_easy m c clen n pk sk = Hacl.Impl.Box.box_open_easy (clen -! 16ul) m pk sk n c
{ "file_name": "code/nacl-box/Hacl.NaCl.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 56, "end_line": 360, "start_col": 0, "start_line": 359 }
module Hacl.NaCl open FStar.HyperStack.All open FStar.HyperStack open FStar.Mul open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module SB = Spec.Box module SS = Spec.SecretBox #set-options "--max_fuel 50 --max_fuel 0 --max_ifuel 0" [@@ Comment "Encrypt a message with a key and nonce. Note: `c` and `m` can point to the same memory for in-place encryption. @param c Pointer to `mlen` bytes where the ciphertext is written to. @param tag Pointer to 16 (tag length) bytes where the authentication tag is written to. @param m Pointer to `mlen` bytes where the message is read from. @param mlen Length of message. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_detached: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == SS.secretbox_detached (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_secretbox_detached c tag m mlen n k = Hacl.Impl.SecretBox.secretbox_detached mlen c tag k n m; 0ul [@@ Comment "Verify and decrypt a ciphertext produced with `Hacl_NaCl_crypto_secretbox_detached`. Note: `m` and `c` can point to the same memory for in-place decryption. @param m Pointer to `mlen` bytes where the message is written to. @param c Pointer to `mlen` bytes where the ciphertext is read from. @param tag Pointer to 16 (tag length) bytes where the authentication tag is read from. @param mlen Length of message (and ciphertext). @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_open_detached: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SS.secretbox_open_detached (as_seq h0 k) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg)) let crypto_secretbox_open_detached m c tag mlen n k = Hacl.Impl.SecretBox.secretbox_open_detached mlen m k n c tag [@@ Comment "Encrypt a message with a key and nonce. @param c Pointer to 16 (tag length) + `mlen` bytes where the ciphertext is written to. @param m Pointer to `mlen` bytes where the message is read from. @param mlen Length of message. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_easy: c:buffer uint8 -> m:buffer uint8 -> mlen:size_t{length c = v mlen + 16 /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 c h0 h1 /\ as_seq #MUT #uint8 #(mlen +! 16ul) h1 c == SS.secretbox_easy (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_secretbox_easy c m mlen n k = Hacl.Impl.SecretBox.secretbox_easy mlen c k n m; 0ul #set-options "--z3rlimit 100" [@@ Comment "Verify and decrypt a ciphertext produced with `crypto_secretbox_easy`. @param m Pointer to `mlen` bytes where the message is written to. @param c Pointer to `clen` bytes where the ciphertext is read from. The authentication tag must be included. @param clen Length of ciphertext. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_open_easy: m:buffer uint8 -> c:buffer uint8 -> clen:size_t{length c = v clen /\ v clen = length m + 16} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint m n /\ disjoint c n) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SS.secretbox_open_easy (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #clen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #(clen -! 16ul) h1 m == Some?.v msg | _ -> None? msg)) let crypto_secretbox_open_easy m c clen n k = Hacl.Impl.SecretBox.secretbox_open_easy (clen -! 16ul) m k n c [@@ Comment "Compute a shared secret key given a public key and secret key. @param k Pointer to 32 (`crypto_box_BEFORENMBYTES`) bytes of memory where the shared secret is written to. @param pk Pointer to 32 bytes of memory where **their** public key is read from. @param sk Pointer to 32 bytes of memory where **my** secret key is read from."] val crypto_box_beforenm: k:lbuffer uint8 32ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h k /\ live h pk /\ live h sk /\ disjoint k pk /\ disjoint k sk) (ensures fun h0 r h1 -> modifies1 k h0 h1 /\ (let key = SB.box_beforenm (as_seq h0 pk) (as_seq h0 sk) in match r with | 0ul -> Some? key /\ as_seq h1 k == Some?.v key | _ -> None? key)) let crypto_box_beforenm k pk sk = Hacl.Impl.Box.box_beforenm k pk sk [@@ Comment "See `crypto_box_detached`."] val crypto_box_detached_afternm: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == SB.box_detached_afternm (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_box_detached_afternm c tag m mlen n k = Hacl.Impl.Box.box_detached_afternm mlen c tag k n m [@@ Comment "Encrypt a message using the recipient's public key, the sender's secret key, and a nonce. @param c Pointer to `mlen` bytes of memory where the ciphertext is written to. @param tag Pointer to 16 (tag length) bytes of memory where the authentication tag is written to. @param m Pointer to `mlen` bytes of memory where the message is read from. @param mlen Length of the message. @param n Pointer to 24 (`crypto_box_NONCEBYTES`) bytes of memory where the nonce is read from. @param pk Pointer to 32 bytes of memory where **their** public key is read from. @param sk Pointer to 32 bytes of memory where **my** secret key is read from."] val crypto_box_detached: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h sk /\ live h pk /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (let tag_cipher = SB.box_detached (as_seq h0 sk) (as_seq h0 pk) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m) in match r with | 0ul -> Some? tag_cipher /\ (let (tag_s, cipher_s) = Some?.v tag_cipher in (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == (tag_s, cipher_s)) | _ -> None? tag_cipher)) let crypto_box_detached c tag m mlen n pk sk = Hacl.Impl.Box.box_detached mlen c tag sk pk n m [@@ Comment "See `crypto_box_open_detached`."] val crypto_box_open_detached_afternm: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SB.box_open_detached_afternm (as_seq h0 k) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg)) let crypto_box_open_detached_afternm m c tag mlen n k = Hacl.Impl.Box.box_open_detached_afternm mlen m k n c tag [@@ Comment "Verify and decrypt a ciphertext produced by `crypto_box_detached`. @param m Pointer to `mlen` bytes of memory where the decrypted message is written to. @param c Pointer to `mlen` bytes of memory where the ciphertext is read from. Note: the ciphertext must include the tag. @param tag Pointer to 16 (tag length) bytes of memory where the authentication tag is read from. @param mlen Length of the message (and ciphertext). @param n Pointer to 24 (`crypto_box_NONCEBYTES`) bytes of memory where the nonce is read from. @param pk Pointer to 32 bytes of memory where the public key of the sender is read from. @param sk Pointer to 32 bytes of memory where the secret key of the recipient is read from."] val crypto_box_open_detached: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h pk /\ live h sk /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SB.box_open_detached (as_seq h0 pk) (as_seq h0 sk) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg)) let crypto_box_open_detached m c tag mlen n pk sk = Hacl.Impl.Box.box_open_detached mlen m pk sk n c tag [@@ Comment "See `crypto_box_easy`."] val crypto_box_easy_afternm: c:buffer uint8 -> m:buffer uint8 -> mlen:size_t{length c = v mlen + 16 /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 c h0 h1 /\ as_seq #MUT #uint8 #(mlen +! 16ul) h1 c == SB.box_easy_afternm (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_box_easy_afternm c m mlen n k = Hacl.Impl.Box.box_easy_afternm mlen c k n m [@@ Comment "Encrypt a message using the recipient's public key, the sender's secret key, and a nonce. @param c Pointer to 16 (tag length) + `mlen` bytes of memory where the authentication tag and ciphertext is written to. @param m Pointer to `mlen` bytes of memory where the message is read from. @param mlen Length of the message. @param n Pointer to 24 (`crypto_box_NONCEBYTES`) bytes of memory where the nonce is read from. @param pk Pointer to 32 bytes of memory where the public key of the recipient is read from. @param sk Pointer to 32 bytes of memory where the secret key of the sender is read from."] val crypto_box_easy: c:buffer uint8 -> m:buffer uint8 -> mlen:size_t{length c = v mlen + 16 /\ length m = v mlen} -> n:lbuffer uint8 24ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h sk /\ live h pk /\ live h n /\ disjoint m c /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 c h0 h1 /\ (let cipher = SB.box_easy (as_seq h0 sk) (as_seq h0 pk) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m) in match r with | 0ul -> Some? cipher /\ as_seq #MUT #uint8 #(mlen +! 16ul) h1 c == Some?.v cipher | _ -> None? cipher)) let crypto_box_easy c m mlen n pk sk = Hacl.Impl.Box.box_easy mlen c sk pk n m [@@ Comment "See `crypto_box_open_easy`."] val crypto_box_open_easy_afternm: m:buffer uint8 -> c:buffer uint8 -> clen:size_t{length c = v clen /\ v clen = length m + 16} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint m n /\ disjoint c n) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SB.box_open_easy_afternm (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #clen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #(clen -! 16ul) h1 m == Some?.v msg | _ -> None? msg)) let crypto_box_open_easy_afternm m c clen n k = Hacl.Impl.Box.box_open_easy_afternm (clen -! 16ul) m k n c [@@ Comment "Verify and decrypt a ciphertext produced by `crypto_box_easy`. @param m Pointer to `clen` - 16 (tag length) bytes of memory where the decrypted message is written to. @param c Pointer to `clen` bytes of memory where the ciphertext is read from. Note: the ciphertext must include the tag. @param clen Length of the ciphertext. @param n Pointer to 24 (`crypto_box_NONCEBYTES`) bytes of memory where the nonce is read from. @param pk Pointer to 32 bytes of memory where the public key of the sender is read from. @param sk Pointer to 32 bytes of memory where the secret key of the recipient is read from."] val crypto_box_open_easy: m:buffer uint8 -> c:buffer uint8 -> clen:size_t{length c = v clen /\ v clen = length m + 16} -> n:lbuffer uint8 24ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h pk /\ live h sk /\ live h n /\ disjoint m c /\ disjoint m n /\ disjoint c n) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SB.box_open_easy (as_seq h0 pk) (as_seq h0 sk) (as_seq h0 n) (as_seq #MUT #uint8 #clen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #(clen -! 16ul) h1 m == Some?.v msg | _ -> None? msg))
{ "checked_file": "/", "dependencies": [ "Spec.SecretBox.fst.checked", "Spec.Box.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.SecretBox.fst.checked", "Hacl.Impl.Box.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.NaCl.fst" }
[ { "abbrev": true, "full_module": "Spec.SecretBox", "short_module": "SS" }, { "abbrev": true, "full_module": "Spec.Box", "short_module": "SB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
m: Lib.Buffer.buffer Lib.IntTypes.uint8 -> c: Lib.Buffer.buffer Lib.IntTypes.uint8 -> clen: Lib.IntTypes.size_t { Lib.Buffer.length c = Lib.IntTypes.v clen /\ Lib.IntTypes.v clen = Lib.Buffer.length m + 16 } -> n: Lib.Buffer.lbuffer Lib.IntTypes.uint8 24ul -> pk: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul -> sk: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul -> FStar.HyperStack.ST.Stack Lib.IntTypes.size_t
FStar.HyperStack.ST.Stack
[]
[]
[ "Lib.Buffer.buffer", "Lib.IntTypes.uint8", "Lib.IntTypes.size_t", "Prims.l_and", "Prims.b2t", "Prims.op_Equality", "Prims.int", "Prims.l_or", "Prims.op_GreaterThanOrEqual", "Lib.IntTypes.range", "Lib.IntTypes.U32", "Lib.Buffer.length", "Lib.Buffer.MUT", "Lib.IntTypes.v", "Lib.IntTypes.PUB", "Prims.op_Addition", "Lib.Buffer.lbuffer", "FStar.UInt32.__uint_to_t", "Hacl.Impl.Box.box_open_easy", "Lib.IntTypes.op_Subtraction_Bang" ]
[]
false
true
false
false
false
let crypto_box_open_easy m c clen n pk sk =
Hacl.Impl.Box.box_open_easy (clen -! 16ul) m pk sk n c
false
Hacl.P256.PrecompTable.fsti
Hacl.P256.PrecompTable.pow_point
val pow_point : k: Prims.nat -> p: Spec.P256.PointOps.aff_point -> Spec.P256.PointOps.aff_point
let pow_point (k:nat) (p:S.aff_point) = LE.pow S.mk_p256_comm_monoid p k
{ "file_name": "code/ecdsap256/Hacl.P256.PrecompTable.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 34, "end_line": 45, "start_col": 0, "start_line": 44 }
module Hacl.P256.PrecompTable open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module LE = Lib.Exponentiation.Definition module SE = Spec.Exponentiation module BE = Hacl.Impl.Exponentiation.Definitions module SPT = Hacl.Spec.PrecompBaseTable module S = Spec.P256 module SM = Hacl.Spec.P256.Montgomery open Hacl.Impl.P256.Point include Hacl.Impl.P256.Group #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract val proj_point_to_list: p:S.proj_point -> x:list uint64{FStar.List.Tot.length x = 12 /\ mk_to_p256_comm_monoid.BE.linv (Seq.seq_of_list x)} val lemma_refl: x:S.proj_point -> Lemma (S.mk_p256_concrete_ops.SE.to.SE.refl x == mk_to_p256_comm_monoid.BE.refl (Seq.seq_of_list (proj_point_to_list x))) inline_for_extraction noextract let mk_p256_precomp_base_table: SPT.mk_precomp_base_table S.proj_point U64 12ul 0ul = { SPT.concr_ops = S.mk_p256_concrete_ops; SPT.to_cm = mk_to_p256_comm_monoid; SPT.to_list = proj_point_to_list; SPT.lemma_refl = lemma_refl; }
{ "checked_file": "/", "dependencies": [ "Spec.P256.fst.checked", "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.Definition.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.PrecompBaseTable.fsti.checked", "Hacl.Spec.P256.Montgomery.fsti.checked", "Hacl.Impl.P256.Point.fsti.checked", "Hacl.Impl.P256.Group.fst.checked", "Hacl.Impl.Exponentiation.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.P256.PrecompTable.fsti" }
[ { "abbrev": false, "full_module": "Hacl.Impl.P256.Group", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.P256.Point", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Spec.P256.Montgomery", "short_module": "SM" }, { "abbrev": true, "full_module": "Spec.P256", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.PrecompBaseTable", "short_module": "SPT" }, { "abbrev": true, "full_module": "Hacl.Impl.Exponentiation.Definitions", "short_module": "BE" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, "full_module": "Lib.Exponentiation.Definition", "short_module": "LE" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.P256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.P256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
k: Prims.nat -> p: Spec.P256.PointOps.aff_point -> Spec.P256.PointOps.aff_point
Prims.Tot
[ "total" ]
[]
[ "Prims.nat", "Spec.P256.PointOps.aff_point", "Lib.Exponentiation.Definition.pow", "Spec.P256.mk_p256_comm_monoid" ]
[]
false
false
false
true
false
let pow_point (k: nat) (p: S.aff_point) =
LE.pow S.mk_p256_comm_monoid p k
false
Vale.AES.Types_helpers.fst
Vale.AES.Types_helpers.lemma_slices_le_quad32_to_bytes
val lemma_slices_le_quad32_to_bytes (q:quad32) : Lemma (ensures ( let s = le_quad32_to_bytes q in q.lo0 == four_to_nat 8 (seq_to_four_LE (slice s 0 4)) /\ q.lo1 == four_to_nat 8 (seq_to_four_LE (slice s 4 8)) /\ q.hi2 == four_to_nat 8 (seq_to_four_LE (slice s 8 12)) /\ q.hi3 == four_to_nat 8 (seq_to_four_LE (slice s 12 16)) ))
val lemma_slices_le_quad32_to_bytes (q:quad32) : Lemma (ensures ( let s = le_quad32_to_bytes q in q.lo0 == four_to_nat 8 (seq_to_four_LE (slice s 0 4)) /\ q.lo1 == four_to_nat 8 (seq_to_four_LE (slice s 4 8)) /\ q.hi2 == four_to_nat 8 (seq_to_four_LE (slice s 8 12)) /\ q.hi3 == four_to_nat 8 (seq_to_four_LE (slice s 12 16)) ))
let lemma_slices_le_quad32_to_bytes (q:quad32) : Lemma (ensures ( let s = le_quad32_to_bytes q in q.lo0 == four_to_nat 8 (seq_to_four_LE (slice s 0 4)) /\ q.lo1 == four_to_nat 8 (seq_to_four_LE (slice s 4 8)) /\ q.hi2 == four_to_nat 8 (seq_to_four_LE (slice s 8 12)) /\ q.hi3 == four_to_nat 8 (seq_to_four_LE (slice s 12 16)) )) = reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #nat8); reveal_opaque (`%le_quad32_to_bytes) le_quad32_to_bytes; ()
{ "file_name": "vale/code/crypto/aes/Vale.AES.Types_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 4, "end_line": 21, "start_col": 0, "start_line": 10 }
module Vale.AES.Types_helpers open Vale.Def.Words.Seq_s open Vale.Def.Words.Four_s open Vale.Def.Types_s open Vale.Arch.Types open FStar.Seq open Vale.Arch.TypesNative
{ "checked_file": "/", "dependencies": [ "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.Types_helpers.fst" }
[ { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "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 } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
q: Vale.Def.Types_s.quad32 -> FStar.Pervasives.Lemma (ensures (let s = Vale.Def.Types_s.le_quad32_to_bytes q in Mkfour?.lo0 q == Vale.Def.Words.Four_s.four_to_nat 8 (Vale.Def.Words.Seq_s.seq_to_four_LE (FStar.Seq.Base.slice s 0 4)) /\ Mkfour?.lo1 q == Vale.Def.Words.Four_s.four_to_nat 8 (Vale.Def.Words.Seq_s.seq_to_four_LE (FStar.Seq.Base.slice s 4 8)) /\ Mkfour?.hi2 q == Vale.Def.Words.Four_s.four_to_nat 8 (Vale.Def.Words.Seq_s.seq_to_four_LE (FStar.Seq.Base.slice s 8 12)) /\ Mkfour?.hi3 q == Vale.Def.Words.Four_s.four_to_nat 8 (Vale.Def.Words.Seq_s.seq_to_four_LE (FStar.Seq.Base.slice s 12 16))))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Vale.Def.Types_s.quad32", "Prims.unit", "FStar.Pervasives.reveal_opaque", "FStar.Seq.Base.seq", "Vale.Def.Types_s.nat8", "Prims.l_True", "Prims.eq2", "Prims.int", "FStar.Seq.Base.length", "Vale.Def.Types_s.le_quad32_to_bytes", "Vale.Def.Words_s.four", "FStar.Mul.op_Star", "Vale.Def.Words.Seq_s.seq_four_to_seq_LE", "Prims.squash", "Prims.l_and", "Vale.Def.Words_s.natN", "Vale.Def.Words_s.pow2_32", "Vale.Def.Words_s.__proj__Mkfour__item__lo0", "Vale.Def.Types_s.nat32", "Vale.Def.Words.Four_s.four_to_nat", "Vale.Def.Words.Seq_s.seq_to_four_LE", "FStar.Seq.Base.slice", "Vale.Def.Words_s.__proj__Mkfour__item__lo1", "Prims.pow2", "Vale.Def.Words_s.__proj__Mkfour__item__hi2", "Vale.Def.Words_s.__proj__Mkfour__item__hi3", "Vale.Def.Words_s.nat8", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let lemma_slices_le_quad32_to_bytes (q: quad32) : Lemma (ensures (let s = le_quad32_to_bytes q in q.lo0 == four_to_nat 8 (seq_to_four_LE (slice s 0 4)) /\ q.lo1 == four_to_nat 8 (seq_to_four_LE (slice s 4 8)) /\ q.hi2 == four_to_nat 8 (seq_to_four_LE (slice s 8 12)) /\ q.hi3 == four_to_nat 8 (seq_to_four_LE (slice s 12 16)))) =
reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #nat8); reveal_opaque (`%le_quad32_to_bytes) le_quad32_to_bytes; ()
false
Vale.SHA.PPC64LE.SHA_helpers.fst
Vale.SHA.PPC64LE.SHA_helpers.lemma_endian_relation
val lemma_endian_relation (quads qs: seq quad32) (input2: seq UInt8.t) : Lemma (requires length qs == 4 /\ length input2 == 64 /\ qs == reverse_bytes_quad32_seq quads /\ input2 == seq_nat8_to_seq_uint8 (le_seq_quad32_to_bytes quads)) (ensures quads_to_block_be qs == words_of_bytes SHA2_256 #(block_word_length SHA2_256) input2)
val lemma_endian_relation (quads qs: seq quad32) (input2: seq UInt8.t) : Lemma (requires length qs == 4 /\ length input2 == 64 /\ qs == reverse_bytes_quad32_seq quads /\ input2 == seq_nat8_to_seq_uint8 (le_seq_quad32_to_bytes quads)) (ensures quads_to_block_be qs == words_of_bytes SHA2_256 #(block_word_length SHA2_256) input2)
let lemma_endian_relation (quads qs:seq quad32) (input2:seq UInt8.t) : Lemma (requires length qs == 4 /\ length input2 == 64 /\ qs == reverse_bytes_quad32_seq quads /\ input2 == seq_nat8_to_seq_uint8 (le_seq_quad32_to_bytes quads)) (ensures quads_to_block_be qs == words_of_bytes SHA2_256 #(block_word_length SHA2_256) input2) = let fi (i:nat{i < length (quads_to_block_be qs)}) : Lemma ((quads_to_block_be qs).[i] == (words_of_bytes SHA2_256 #(block_word_length SHA2_256) input2).[i]) = let open Vale.Def.Words.Four_s in let open Vale.Lib.Seqs_s in let ni = (seq_four_to_seq_LE quads).[i] in let b = slice input2 (4 * i) (4 * i + 4) in calc (==) { b; == {} slice input2 (4 * i) (4 * i + 4); == {} slice (seq_nat8_to_seq_uint8 (le_seq_quad32_to_bytes quads)) (4 * i) (4 * i + 4); == {le_seq_quad32_to_bytes_reveal ()} slice (seq_nat8_to_seq_uint8 (seq_nat32_to_seq_nat8_LE (seq_four_to_seq_LE quads))) (4 * i) (4 * i + 4); equal {} seq_nat8_to_seq_uint8 (slice (seq_nat32_to_seq_nat8_LE (seq_four_to_seq_LE quads)) (4 * i) (4 * i + 4)); == {} seq_nat8_to_seq_uint8 (slice (seq_four_to_seq_LE (seq_map (nat_to_four 8) (seq_four_to_seq_LE quads))) (4 * i) (4 * i + 4)); == {slice_commutes_seq_four_to_seq_LE (seq_map (nat_to_four 8) (seq_four_to_seq_LE quads)) i (i + 1)} seq_nat8_to_seq_uint8 (seq_four_to_seq_LE (slice (seq_map (nat_to_four 8) (seq_four_to_seq_LE quads)) i (i + 1))); equal {reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #nat8)} seq_nat8_to_seq_uint8 (four_to_seq_LE (nat_to_four 8 (seq_four_to_seq_LE quads).[i])); }; let open Lib.IntTypes in calc (==) { (words_of_bytes SHA2_256 #(block_word_length SHA2_256) input2).[i]; == { } (Lib.ByteSequence.uints_from_bytes_be #U32 #SEC #(block_word_length SHA2_256) input2).[i]; == { Lib.ByteSequence.index_uints_from_bytes_be #U32 #SEC #(block_word_length SHA2_256) input2 i } Lib.ByteSequence.uint_from_bytes_be (Lib.Sequence.sub #uint8 #64 input2 (i * 4) 4); == { let open Lib.Sequence in calc (==) { sub #uint8 #64 input2 (i * 4) 4; == { } Seq.slice input2 (4 * i) (4 * i + 4); } } Lib.ByteSequence.uint_from_bytes_be #U32 #SEC b; == { calc (==) { Lib.ByteSequence.nat_from_bytes_be #SEC b; (==) { } Lib.ByteSequence.nat_from_bytes_be #SEC (seq_nat8_to_seq_uint8 (four_to_seq_LE (nat_to_four 8 ni))); (==) { lemma_be_to_n_4 (four_to_seq_LE (nat_to_four 8 ni)) } be_bytes_to_nat32 (four_to_seq_LE (nat_to_four 8 ni)); }; v_inj (Lib.ByteSequence.uint_from_bytes_be #U32 #SEC b) (u32 (be_bytes_to_nat32 (four_to_seq_LE (nat_to_four 8 ni)))) } nat32_to_word (be_bytes_to_nat32 (four_to_seq_LE (nat_to_four 8 ni))); == {} nat32_to_word (be_bytes_to_nat32 (reverse_seq (nat32_to_be_bytes ni))); == {reverse_bytes_nat32_reveal ()} nat32_to_word (reverse_bytes_nat32 ni); == {} nat32_to_word (reverse_bytes_nat32 (seq_four_to_seq_LE quads).[i]); == {reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #nat32); reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #nat32); reveal_reverse_bytes_quad32 quads.[(i / 4)]} nat32_to_word (seq_four_to_seq_BE qs).[i]; == {} (quads_to_block_be qs).[i]; } in FStar.Classical.forall_intro fi; assert (equal (quads_to_block_be qs) (words_of_bytes SHA2_256 #(block_word_length SHA2_256) input2))
{ "file_name": "vale/code/crypto/sha/Vale.SHA.PPC64LE.SHA_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 102, "end_line": 766, "start_col": 0, "start_line": 697 }
module Vale.SHA.PPC64LE.SHA_helpers open FStar.Mul open Vale.Def.Prop_s open Vale.Def.Opaque_s open Spec.SHA2 open Spec.SHA2.Lemmas open Spec.Agile.Hash open Spec.Hash.Definitions open Spec.Hash.Lemmas open Vale.Def.Types_s open Vale.Def.Words_s open FStar.Seq open FStar.UInt32 // Interop with UInt-based SHA spec open Vale.Arch.Types open Vale.Arch.TypesNative open Vale.Def.Sel open Vale.SHA2.Wrapper friend Spec.SHA2 friend Spec.SHA2.Lemmas friend Vale.SHA2.Wrapper #reset-options "--max_fuel 0 --max_ifuel 0" // Define these specific converters here, so that F* only reasons about // the correctness of the conversion once, rather that at every call site let vv (u:Lib.IntTypes.uint32) : nat32 = Lib.IntTypes.v u let to_uint32 (n:nat32) : Lib.IntTypes.uint32 = Lib.IntTypes.u32 n let word = Lib.IntTypes.uint32 let k = (Spec.SHA2.k0 SHA2_256) val add_mod_lemma:x:Lib.IntTypes.uint32 -> y:Lib.IntTypes.uint32 -> Lemma (add_mod x y == Lib.IntTypes.(x +. y)) [SMTPat (Lib.IntTypes.(x +. y))] let add_mod_lemma x y = () unfold let ws_opaque_aux = ws let ws_opaque (b:block_w) (t:counter{t < size_k_w_256}) : nat32 = vv (ws_opaque_aux SHA2_256 b t) unfold let shuffle_core_opaque_aux = shuffle_core let shuffle_core_opaque (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}):hash256 = shuffle_core_opaque_aux SHA2_256 block hash t [@"opaque_to_smt"] let update_multi_opaque_aux = opaque_make update_multi irreducible let update_multi_reveal = opaque_revealer (`%update_multi_opaque_aux) update_multi_opaque_aux update_multi let update_multi_opaque (hash:hash256) (blocks:bytes_blocks):hash256 = update_multi_opaque_aux SHA2_256 hash () blocks let update_multi_transparent (hash:hash256) (blocks:bytes_blocks) = update_multi SHA2_256 hash () blocks let word_to_nat32 = vv let nat32_to_word = to_uint32 let make_ordered_hash_def (abcd efgh:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 abcd.lo0 /\ hash.[1] == to_uint32 abcd.lo1 /\ hash.[2] == to_uint32 abcd.hi2 /\ hash.[3] == to_uint32 abcd.hi3 /\ hash.[4] == to_uint32 efgh.lo0 /\ hash.[5] == to_uint32 efgh.lo1 /\ hash.[6] == to_uint32 efgh.hi2 /\ hash.[7] == to_uint32 efgh.hi3 }) = let a = to_uint32 abcd.lo0 in let b = to_uint32 abcd.lo1 in let c = to_uint32 abcd.hi2 in let d = to_uint32 abcd.hi3 in let e = to_uint32 efgh.lo0 in let f = to_uint32 efgh.lo1 in let g = to_uint32 efgh.hi2 in let h = to_uint32 efgh.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_ordered_hash = opaque_make make_ordered_hash_def irreducible let make_ordered_hash_reveal = opaque_revealer (`%make_ordered_hash) make_ordered_hash make_ordered_hash_def let shuffle_core_properties (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}) : Lemma(let h = shuffle_core_opaque block hash t in let open Lib.IntTypes in 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 let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in h.[0] == t1 +. t2 /\ h.[1] == a0 /\ h.[2] == b0 /\ h.[3] == c0 /\ h.[4] == d0 +. t1 /\ h.[5] == e0 /\ h.[6] == f0 /\ h.[7] == g0) = Pervasives.reveal_opaque (`%shuffle_core) shuffle_core; let h = shuffle_core SHA2_256 block hash t in 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 let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in assert (h == seq_of_list l); elim_of_list l; () let lemma_add_wrap_is_add_mod (n0 n1:nat32) : Lemma (add_wrap n0 n1 == vv (add_mod (to_uint32 n0) (to_uint32 n1))) = assert_norm (pow2 32 == pow2_32); () unfold let shuffle_opaque = shuffle let update_block (hash:hash256) (block:block_w): Tot (hash256) = let hash_1 = shuffle_opaque SHA2_256 hash block in let open Lib.IntTypes in Spec.Loops.seq_map2 ( +. ) hash hash_1 #push-options "--z3cliopt smt.arith.nl=true" (* FIXME: Seemingly needed after fix to #2894 in F*, but should not be *) let lemma_update_block_equiv (hash:hash256) (block:bytes{length block = block_length}) : Lemma (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block) == update SHA2_256 hash block) = Pervasives.reveal_opaque (`%Spec.SHA2.update) Spec.SHA2.update; Pervasives.reveal_opaque (`%Spec.SHA2.shuffle) Spec.SHA2.shuffle; assert (equal (update_block hash (words_of_bytes SHA2_256 #(block_word_length SHA2_256) block)) (update SHA2_256 hash block)); () #pop-options let update_multi_one (h:hash256) (b:bytes_blocks {length b = block_length}) : Lemma (ensures (update_multi SHA2_256 h () b == update SHA2_256 h b)) = update_multi_update SHA2_256 h b friend Lib.ByteSequence #reset-options "--z3rlimit 50 --max_fuel 1 --max_ifuel 0 --z3cliopt smt.arith.nl=true" let lemma_be_to_n_4 (s:seq4 nat8) : Lemma (Lib.ByteSequence.nat_from_bytes_be #Lib.IntTypes.SEC (seq_nat8_to_seq_uint8 s) == be_bytes_to_nat32 s) = let open Lib.IntTypes in let open Vale.Def.Words.Four_s in assert (pow2 8 = 0x100); assert (pow2 16 = 0x10000); assert_norm (pow2 24 = 0x1000000); let x = seq_nat8_to_seq_uint8 s in let f = Lib.ByteSequence.nat_from_intseq_be_ #U8 #SEC in calc (==) { f x <: nat ; == { } FStar.UInt8.v (last x) + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * f (slice x 0 3); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * f (slice x 0 2); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * f (slice x 0 1); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0 + pow2 32 * f (slice x 0 0); == {} index s 3 + pow2 8 * index s 2 + pow2 16 * index s 1 + pow2 24 * index s 0; == {} four_to_nat_unfold 8 (seq_to_four_BE s); == {reveal_opaque (`%four_to_nat) four_to_nat} be_bytes_to_nat32 s; } let lemma_mod_transform (quads:seq quad32) : Lemma (requires length quads % 4 == 0) (ensures length (seq_nat8_to_seq_uint8 (le_seq_quad32_to_bytes quads)) % 64 == 0) = () let lemma_update_multi_opaque_vale_is_update_multi (hash:hash256) (blocks:bytes) : Lemma (requires length blocks % 64 = 0) (ensures update_multi_opaque_vale hash blocks == update_multi_transparent hash blocks) = update_multi_reveal (); () let sigma_0_0_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma0_in = ws_opaque block (t-15) in sigma256_0_0 sigma0_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma0 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ src.hi3 == ws_opaque block (t-15)) (ensures (sigma256_0_0 src.hi3 == sigma_0_0_partial t block)) = sigma_0_0_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_0_1_partial_def (t:counter) (block:block_w) : nat32 = if 16 <= t && t < size_k_w_256 then (let sigma1_in = ws_opaque block (t-2) in sigma256_0_1 sigma1_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma1 (src:quad32) (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256) /\ src.hi3 == ws_opaque block (t-2)) (ensures (sigma256_0_1 src.hi3 == sigma_0_1_partial t block)) = sigma_0_1_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_1_0_partial_def (t:counter) (block:block_w) (hash_orig:hash256) : nat32 = if t < size_k_w_256 then (let sigma0_in = word_to_nat32 ((repeat_range_vale t block hash_orig).[0]) in sigma256_1_0 sigma0_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma2 (src:quad32) (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w(SHA2_256) /\ src.hi3 == word_to_nat32 ((repeat_range_vale t block hash_orig).[0])) (ensures (sigma256_1_0 src.hi3 == sigma_1_0_partial t block hash_orig)) = sigma_1_0_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let sigma_1_1_partial_def (t:counter) (block:block_w) (hash_orig:hash256) : nat32 = if t < size_k_w_256 then (let sigma1_in = word_to_nat32 ((repeat_range_vale t block hash_orig).[4]) in sigma256_1_1 sigma1_in) else 0 #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 30" let lemma_sha256_sigma3 (src:quad32) (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w(SHA2_256) /\ src.hi3 == word_to_nat32 ((repeat_range_vale t block hash_orig).[4])) (ensures (sigma256_1_1 src.hi3 == sigma_1_1_partial t block hash_orig)) = sigma_1_1_partial_reveal (); () #reset-options "--max_fuel 0 --max_ifuel 0" let make_seperated_hash_def (a b c d e f g h:nat32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 a /\ hash.[1] == to_uint32 b /\ hash.[2] == to_uint32 c /\ hash.[3] == to_uint32 d /\ hash.[4] == to_uint32 e /\ hash.[5] == to_uint32 f /\ hash.[6] == to_uint32 g /\ hash.[7] == to_uint32 h }) = let a = to_uint32 a in let b = to_uint32 b in let c = to_uint32 c in let d = to_uint32 d in let e = to_uint32 e in let f = to_uint32 f in let g = to_uint32 g in let h = to_uint32 h in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_seperated_hash = opaque_make make_seperated_hash_def irreducible let make_seperated_hash_reveal = opaque_revealer (`%make_seperated_hash) make_seperated_hash make_seperated_hash_def let make_seperated_hash_quad32_def (a b c d e f g h:quad32) : (hash:words_state SHA2_256 { length hash == 8 /\ hash.[0] == to_uint32 a.hi3 /\ hash.[1] == to_uint32 b.hi3 /\ hash.[2] == to_uint32 c.hi3 /\ hash.[3] == to_uint32 d.hi3 /\ hash.[4] == to_uint32 e.hi3 /\ hash.[5] == to_uint32 f.hi3 /\ hash.[6] == to_uint32 g.hi3 /\ hash.[7] == to_uint32 h.hi3 }) = let a = to_uint32 a.hi3 in let b = to_uint32 b.hi3 in let c = to_uint32 c.hi3 in let d = to_uint32 d.hi3 in let e = to_uint32 e.hi3 in let f = to_uint32 f.hi3 in let g = to_uint32 g.hi3 in let h = to_uint32 h.hi3 in let l = [a; b; c; d; e; f; g; h] in assert_norm (List.length l == 8); let hash = seq_of_list l in assert (length hash == 8); elim_of_list l; hash [@"opaque_to_smt"] let make_seperated_hash_quad32 = opaque_make make_seperated_hash_quad32_def irreducible let make_seperated_hash_quad32_reveal = opaque_revealer (`%make_seperated_hash_quad32) make_seperated_hash_quad32 make_seperated_hash_quad32_def let lemma_make_seperated_hash (hash:hash256) (a b c d e f g h:quad32) : Lemma (requires length hash == 8 /\ a.hi3 == word_to_nat32 hash.[0] /\ b.hi3 == word_to_nat32 hash.[1] /\ c.hi3 == word_to_nat32 hash.[2] /\ d.hi3 == word_to_nat32 hash.[3] /\ e.hi3 == word_to_nat32 hash.[4] /\ f.hi3 == word_to_nat32 hash.[5] /\ g.hi3 == word_to_nat32 hash.[6] /\ h.hi3 == word_to_nat32 hash.[7]) (ensures hash == make_seperated_hash_quad32 a b c d e f g h) = assert (equal hash (make_seperated_hash_quad32 a b c d e f g h)) let lemma_vsel32 (a b c:nat32) : Lemma (ensures (isel32 a b c = (iand32 c a) *^ (iand32 (inot32 c) b))) = reveal_iand_all 32; reveal_inot_all 32; reveal_ixor_all 32; lemma_equal_nth 32 (isel32 a b c) ((iand32 c a) *^ (iand32 (inot32 c) b)) let ch_256_def (x y z:nat32) : (a:nat32 {a == (iand32 x y) *^ (iand32 (inot32 x) z)}) = reveal_iand_all 32; reveal_inot_all 32; reveal_ixor_all 32; ch256 x y z [@"opaque_to_smt"] let ch_256 = opaque_make ch_256_def irreducible let ch_256_reveal = opaque_revealer (`%ch_256) ch_256 ch_256_def let lemma_eq_maj_xvsel32 (a b c:nat32) : Lemma (ensures (isel32 c b (a *^ b) = (iand32 a b) *^ ((iand32 a c) *^ (iand32 b c)))) = reveal_iand_all 32; reveal_ixor_all 32; lemma_equal_nth 32 (isel32 c b (a *^ b)) ((iand32 a b) *^ ((iand32 a c) *^ (iand32 b c))) let maj_256_def (x y z:nat32) : (a:nat32 {a == (iand32 x y) *^ ((iand32 x z) *^ (iand32 y z))}) = reveal_iand_all 32; reveal_ixor_all 32; maj256 x y z [@"opaque_to_smt"] let maj_256 = opaque_make maj_256_def irreducible let maj_256_reveal = opaque_revealer (`%maj_256) maj_256 maj_256_def let lemma_sigma_0_0_partial (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256)) (ensures (sigma256_0_0 (ws_opaque block (t-15)) == sigma_0_0_partial t block)) = sigma_0_0_partial_reveal () let lemma_sigma_0_1_partial (t:counter) (block:block_w) : Lemma (requires 16 <= t /\ t < size_k_w(SHA2_256)) (ensures (sigma256_0_1 (ws_opaque block (t-2)) == sigma_0_1_partial t block)) = sigma_0_1_partial_reveal () let lemma_sigma_1_0_partial (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w(SHA2_256)) (ensures (sigma256_1_0 (word_to_nat32 ((repeat_range_vale t block hash_orig).[0])) == sigma_1_0_partial t block hash_orig)) = sigma_1_0_partial_reveal () let lemma_sigma_1_1_partial (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w(SHA2_256)) (ensures (sigma256_1_1 (word_to_nat32 ((repeat_range_vale t block hash_orig).[4])) == sigma_1_1_partial t block hash_orig)) = sigma_1_1_partial_reveal () #reset-options "--z3rlimit 20 --max_fuel 1" let lemma_quads_to_block_be qs = reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #nat32); reveal_opaque (`%ws) ws #reset-options "--max_fuel 0 --max_ifuel 0" #reset-options "--z3rlimit 20" let lemma_shuffle_core_properties (t:counter) (block:block_w) (hash_orig:hash256) : Lemma (requires t < size_k_w_256) (ensures (let hash = Spec.Loops.repeat_range 0 t (shuffle_core_opaque block) hash_orig in let h = Spec.Loops.repeat_range 0 (t + 1) (shuffle_core_opaque block) hash_orig in let a0 = word_to_nat32 hash.[0] in let b0 = word_to_nat32 hash.[1] in let c0 = word_to_nat32 hash.[2] in let d0 = word_to_nat32 hash.[3] in let e0 = word_to_nat32 hash.[4] in let f0 = word_to_nat32 hash.[5] in let g0 = word_to_nat32 hash.[6] in let h0 = word_to_nat32 hash.[7] in let t1 = add_wrap (add_wrap (add_wrap (add_wrap h0 (sigma256_1_1 e0)) (ch_256 e0 f0 g0)) (word_to_nat32 k.[t])) (ws_opaque block t) in let t2 = add_wrap (sigma256_1_0 a0) (maj_256 a0 b0 c0) in word_to_nat32 h.[0] == add_wrap t1 t2 /\ word_to_nat32 h.[1] == a0 /\ word_to_nat32 h.[2] == b0 /\ word_to_nat32 h.[3] == c0 /\ word_to_nat32 h.[4] == add_wrap d0 t1 /\ word_to_nat32 h.[5] == e0 /\ word_to_nat32 h.[6] == f0 /\ word_to_nat32 h.[7] == g0)) = let hash = Spec.Loops.repeat_range 0 t (shuffle_core_opaque block) hash_orig in let a0 = word_to_nat32 hash.[0] in let b0 = word_to_nat32 hash.[1] in let c0 = word_to_nat32 hash.[2] in let d0 = word_to_nat32 hash.[3] in let e0 = word_to_nat32 hash.[4] in let f0 = word_to_nat32 hash.[5] in let g0 = word_to_nat32 hash.[6] in let h0 = word_to_nat32 hash.[7] in ch_256_reveal (); maj_256_reveal (); lemma_add_wrap_is_add_mod h0 (sigma256_1_1 e0); lemma_add_wrap_is_add_mod (add_wrap h0 (sigma256_1_1 e0)) (ch_256 e0 f0 g0); lemma_add_wrap_is_add_mod (add_wrap (add_wrap h0 (sigma256_1_1 e0)) (ch_256 e0 f0 g0)) (word_to_nat32 k.[t]); lemma_add_wrap_is_add_mod (add_wrap (add_wrap (add_wrap h0 (sigma256_1_1 e0)) (ch_256 e0 f0 g0)) (word_to_nat32 k.[t])) (ws_opaque block t); lemma_add_wrap_is_add_mod (sigma256_1_0 a0) (maj_256 a0 b0 c0); lemma_add_wrap_is_add_mod (add_wrap (add_wrap (add_wrap (add_wrap h0 (sigma256_1_1 e0)) (ch_256 e0 f0 g0)) (word_to_nat32 k.[t])) (ws_opaque block t)) (add_wrap (sigma256_1_0 a0) (maj_256 a0 b0 c0)); lemma_add_wrap_is_add_mod d0 (add_wrap (add_wrap (add_wrap (add_wrap h0 (sigma256_1_1 e0)) (ch_256 e0 f0 g0)) (word_to_nat32 k.[t])) (ws_opaque block t)); Spec.Loops.repeat_range_induction 0 (t + 1) (shuffle_core_opaque block) hash_orig; shuffle_core_properties block (Spec.Loops.repeat_range 0 t (shuffle_core_opaque block) hash_orig) t #reset-options "--max_fuel 0 --max_ifuel 0" let lemma_add_mod_commutes (x y:UInt32.t) : Lemma (add_mod x y == add_mod y x) = () let lemma_add_mod_associates_U32 (x y z:UInt32.t) : Lemma (add_mod x (add_mod y z) == add_mod (add_mod x y) z) = let open Lib.IntTypes in calc (==) { v (x +. (y +. z)); (==) { } (v x + (v y + v z) % pow2 32) % pow2 32; (==) { FStar.Math.Lemmas.lemma_mod_add_distr (v x) (v y + v z) (pow2 32) } ((v x + v y) + v z) % pow2 32; (==) { FStar.Math.Lemmas.lemma_mod_add_distr (v z) (v x + v y) (pow2 32) } ((v x + v y) % pow2 32 + v z) % pow2 32; (==) { } v ((x +. y) +. z); }; v_inj (x +. (y +. z)) ((x +. y) +. z) let lemma_add_mod_ws_rearrangement (a b c d:UInt32.t) : Lemma (let open Lib.IntTypes in a +. b +. c +. d == d +. c +. b +. a) = let open Lib.IntTypes in calc (==) { a +. b +. c +. d; (==) {} (((a +. b) +. c) +. d); (==) { lemma_add_mod_commutes ((a +. b) +. c) d; lemma_add_mod_commutes (a +. b) c; lemma_add_mod_commutes a b } d +. (c +. (b +. a)); (==) { lemma_add_mod_associates_U32 d c (b +. a); lemma_add_mod_associates_U32 (d +. c) b a} (((d +. c) +. b) +. a); } #reset-options "--fuel 1 --z3rlimit 50" let lemma_ws_opaque (block:block_w) (t:counter) : Lemma (requires 16 <= t && t < size_k_w_256) (ensures (let sigma0 = sigma256_0_0 (ws_opaque block (t - 15)) in let sigma1 = sigma256_0_1 (ws_opaque block (t - 2)) in ws_opaque block t == add_wrap (add_wrap (add_wrap sigma1 (ws_opaque block (t - 7))) sigma0) (ws_opaque block (t - 16)))) = let t16 = ws SHA2_256 block (t - 16) in let t15 = ws SHA2_256 block (t - 15) in let t7 = ws SHA2_256 block (t - 7) in let t2 = ws SHA2_256 block (t - 2) in let sigma0 = sigma256_0_0 (ws_opaque block (t - 15)) in let sigma1 = sigma256_0_1 (ws_opaque block (t - 2)) in let s1 = _sigma1 SHA2_256 t2 in let s0 = _sigma0 SHA2_256 t15 in calc (==) { ws_opaque block t; (==) { Pervasives.reveal_opaque (`%ws) ws } vv ((s1 +. t7 +. s0) +. t16); (==) { lemma_add_wrap_is_add_mod (vv (s1 +. t7 +. s0)) (ws_opaque block (t-16)) } add_wrap (vv ((s1 +. t7) +. s0)) (ws_opaque block (t-16)); (==) { lemma_add_wrap_is_add_mod (vv (s1 +. t7)) sigma0 } add_wrap (add_wrap (vv (s1 +. t7)) sigma0) (ws_opaque block (t-16)); (==) { lemma_add_wrap_is_add_mod sigma1 (ws_opaque block (t-7)) } add_wrap (add_wrap (add_wrap sigma1 (ws_opaque block (t - 7))) sigma0) (ws_opaque block (t - 16)); } #reset-options "--fuel 0 --ifuel 0 --z3rlimit 20" let translate_hash_update (a b c d e f g h a' b' c' d' e' f' g' h' a_old b_old c_old d_old e_old f_old g_old h_old:quad32) : Lemma (requires a' == add_wrap_quad32 a a_old /\ b' == add_wrap_quad32 b b_old /\ c' == add_wrap_quad32 c c_old /\ d' == add_wrap_quad32 d d_old /\ e' == add_wrap_quad32 e e_old /\ f' == add_wrap_quad32 f f_old /\ g' == add_wrap_quad32 g g_old /\ h' == add_wrap_quad32 h h_old) (ensures ( let h = make_seperated_hash_quad32 a b c d e f g h in let a = make_seperated_hash_quad32 a_old b_old c_old d_old e_old f_old g_old h_old in let h' = make_seperated_hash_quad32 a' b' c' d' e' f' g' h' in let open Lib.IntTypes in let mapped = Spec.Loops.seq_map2 ( +. ) h a in mapped == h')) = let h = make_seperated_hash_quad32 a b c d e f g h in let a = make_seperated_hash_quad32 a_old b_old c_old d_old e_old f_old g_old h_old in let h' = make_seperated_hash_quad32 a' b' c' d' e' f' g' h' in let open Lib.IntTypes in let mapped = Spec.Loops.seq_map2 ( +. ) h a in FStar.Classical.forall_intro_2 lemma_add_wrap_is_add_mod; assert (equal mapped h'); () let update_lemma (a b c d e f g h a_old b_old c_old d_old e_old f_old g_old h_old a' b' c' d' e' f' g' h':quad32) (block:block_w) : Lemma (requires (let hash_orig = make_seperated_hash_quad32 a_old b_old c_old d_old e_old f_old g_old h_old in make_seperated_hash_quad32 a b c d e f g h == repeat_range_vale_64 block hash_orig /\ a' == add_wrap_quad32 a a_old /\ b' == add_wrap_quad32 b b_old /\ c' == add_wrap_quad32 c c_old /\ d' == add_wrap_quad32 d d_old /\ e' == add_wrap_quad32 e e_old /\ f' == add_wrap_quad32 f f_old /\ g' == add_wrap_quad32 g g_old /\ h' == add_wrap_quad32 h h_old)) (ensures (let hash_orig = make_seperated_hash_quad32 a_old b_old c_old d_old e_old f_old g_old h_old in make_seperated_hash_quad32 a' b' c' d' e' f' g' h' == update_block hash_orig block)) = let hash_orig = make_seperated_hash_quad32 a_old b_old c_old d_old e_old f_old g_old h_old in let hash_1 = shuffle_opaque SHA2_256 hash_orig block in Pervasives.reveal_opaque (`%shuffle) shuffle; Pervasives.reveal_opaque (`%shuffle_core) shuffle_core; let rec r (i:nat{i <= 64}) : Lemma ( Spec.Loops.repeat_range 0 i (shuffle_core_opaque block) hash_orig == Spec.Loops.repeat_range 0 i (shuffle_core SHA2_256 block) hash_orig) = if i = 0 then ( Spec.Loops.repeat_range_base 0 (shuffle_core_opaque block) hash_orig; Spec.Loops.repeat_range_base 0 (shuffle_core SHA2_256 block) hash_orig ) else ( r (i - 1); Spec.Loops.repeat_range_induction 0 i (shuffle_core_opaque block) hash_orig; Spec.Loops.repeat_range_induction 0 i (shuffle_core SHA2_256 block) hash_orig ) in r 64; translate_hash_update a b c d e f g h a' b' c' d' e' f' g' h' a_old b_old c_old d_old e_old f_old g_old h_old; shuffle_is_shuffle_pre SHA2_256 hash_orig block; assert (equal (make_seperated_hash_quad32 a' b' c' d' e' f' g' h') (update_block hash_orig block)); () #push-options "--max_fuel 1" let lemma_slice_commutes_reverse_bytes_quad32_seq (s:seq quad32) (pivot:nat) : Lemma (requires pivot <= length s) (ensures slice (reverse_bytes_quad32_seq s) 0 pivot == reverse_bytes_quad32_seq (slice s 0 pivot)) = let rs = reverse_bytes_quad32_seq s in let srs = slice (reverse_bytes_quad32_seq s) 0 pivot in let ss = slice s 0 pivot in let rss = reverse_bytes_quad32_seq ss in if pivot = 0 then ( assert (equal ss empty); assert (equal srs empty); assert (equal empty (reverse_bytes_quad32_seq empty)); () ) else ( assert (equal srs rss) ) let lemma_update_multi_quads (s:seq quad32) (hash_orig:hash256) (bound:nat) : Lemma (requires bound + 4 <= length s) (ensures (let prefix_LE = slice s 0 bound in let prefix_BE = reverse_bytes_quad32_seq prefix_LE in let h_prefix = update_multi_quads prefix_BE hash_orig in let block_quads_LE = slice s bound (bound + 4) in let block_quads_BE = reverse_bytes_quad32_seq block_quads_LE in let input_LE = slice s 0 (bound+4) in let input_BE = reverse_bytes_quad32_seq input_LE in let h = update_block h_prefix (quads_to_block_be block_quads_BE) in h == update_multi_quads input_BE hash_orig)) = let prefix_LE = slice s 0 bound in let prefix_BE = reverse_bytes_quad32_seq prefix_LE in let h_prefix = update_multi_quads prefix_BE hash_orig in let block_quads_LE = slice s bound (bound + 4) in let block_quads_BE = reverse_bytes_quad32_seq block_quads_LE in let input_LE = slice s 0 (bound+4) in let input_BE = reverse_bytes_quad32_seq input_LE in let h = update_block h_prefix (quads_to_block_be block_quads_BE) in lemma_slice_commutes_reverse_bytes_quad32_seq s bound; lemma_slice_commutes_reverse_bytes_quad32_seq s (bound + 4); assert (prefix_BE == slice (reverse_bytes_quad32_seq s) 0 bound); assert (input_BE == slice (reverse_bytes_quad32_seq s) 0 (bound + 4)); if bound = 0 then () else ( let prefix, qs = split input_BE (length input_BE - 4) in assert (equal prefix prefix_BE); assert (equal qs block_quads_BE); () ) #pop-options #push-options "--max_fuel 1" // One level of expansion that we can use in places that can't use fuel let lemma_update_multi_quads_unfold (s:seq quad32) (hash_orig:hash256) : Lemma (requires length s >= 4) (ensures (let prefix, qs = split s (length s - 4) in let h_prefix = update_multi_quads prefix hash_orig in let hash = update_block h_prefix (quads_to_block_be qs) in update_multi_quads s hash_orig == hash)) = () let lemma_update_multi_quads_short (s:seq quad32) (hash_orig:hash256) : Lemma (requires length s < 4) (ensures update_multi_quads s hash_orig == hash_orig) = () #pop-options let lemma_le_bytes_to_hash_quads_part1 (s:seq quad32) : Lemma (requires length s == 2) (ensures le_bytes_to_hash (le_seq_quad32_to_bytes s) == Vale.Lib.Seqs_s.seq_map nat32_to_word (Vale.Def.Words.Seq_s.seq_four_to_seq_LE s)) = let lhs = le_bytes_to_hash (le_seq_quad32_to_bytes s) in assert (lhs == Vale.Lib.Seqs_s.seq_map nat32_to_word (Vale.Def.Words.Seq_s.seq_nat8_to_seq_nat32_LE (le_seq_quad32_to_bytes s))); le_seq_quad32_to_bytes_reveal (); Vale.Def.Words.Seq.seq_nat8_to_seq_nat32_to_seq_nat8_LE (Vale.Def.Words.Seq_s.seq_four_to_seq_LE s); () #push-options "--z3rlimit 30" let lemma_le_bytes_to_hash_quads (s:seq quad32) : Lemma (requires length s == 2) (ensures (let rhs = le_bytes_to_hash (le_seq_quad32_to_bytes s) in rhs.[0] == to_uint32 (s.[0]).lo0 /\ rhs.[1] == to_uint32 (s.[0]).lo1 /\ rhs.[2] == to_uint32 (s.[0]).hi2 /\ rhs.[3] == to_uint32 (s.[0]).hi3 /\ rhs.[4] == to_uint32 (s.[1]).lo0 /\ rhs.[5] == to_uint32 (s.[1]).lo1 /\ rhs.[6] == to_uint32 (s.[1]).hi2 /\ rhs.[7] == to_uint32 (s.[1]).hi3 /\ length rhs == 8)) = reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #nat32); let rhs = le_bytes_to_hash (le_seq_quad32_to_bytes s) in lemma_le_bytes_to_hash_quads_part1 s; assert (rhs == Vale.Lib.Seqs_s.seq_map nat32_to_word (Vale.Def.Words.Seq_s.seq_four_to_seq_LE s)); () #pop-options let lemma_hash_to_bytes (s:seq quad32) : Lemma (requires length s == 2) (ensures make_ordered_hash s.[0] s.[1] == le_bytes_to_hash (le_seq_quad32_to_bytes s)) = lemma_le_bytes_to_hash_quads s; assert (equal (make_ordered_hash s.[0] s.[1]) (le_bytes_to_hash (le_seq_quad32_to_bytes s))); () #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 40"
{ "checked_file": "/", "dependencies": [ "Vale.SHA2.Wrapper.fst.checked", "Vale.SHA2.Wrapper.fst.checked", "Vale.Lib.Seqs_s.fst.checked", "Vale.Lib.Seqs.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Seq.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Def.Sel.fst.checked", "Vale.Def.Prop_s.fst.checked", "Vale.Def.Opaque_s.fsti.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.Lemmas.fst.checked", "Spec.SHA2.fst.checked", "Spec.SHA2.fst.checked", "Spec.Loops.fst.checked", "Spec.Hash.Lemmas.fsti.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.fst.checked", "FStar.Classical.fsti.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Vale.SHA.PPC64LE.SHA_helpers.fst" }
[ { "abbrev": false, "full_module": "FStar.UInt32 // Interop with UInt-based SHA spec", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt32", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA2.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Sel", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Opaque_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Prop_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.PPC64LE", "short_module": null }, { "abbrev": false, "full_module": "Vale.SHA.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 } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "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": 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" }
false
quads: FStar.Seq.Base.seq Vale.Def.Types_s.quad32 -> qs: FStar.Seq.Base.seq Vale.Def.Types_s.quad32 -> input2: FStar.Seq.Base.seq FStar.UInt8.t -> FStar.Pervasives.Lemma (requires FStar.Seq.Base.length qs == 4 /\ FStar.Seq.Base.length input2 == 64 /\ qs == Vale.Arch.Types.reverse_bytes_quad32_seq quads /\ input2 == Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8 (Vale.Def.Types_s.le_seq_quad32_to_bytes quads)) (ensures Vale.SHA.PPC64LE.SHA_helpers.quads_to_block_be qs == Spec.Hash.Definitions.words_of_bytes Spec.Hash.Definitions.SHA2_256 input2)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.Seq.Base.seq", "Vale.Def.Types_s.quad32", "FStar.UInt8.t", "Prims._assert", "FStar.Seq.Base.equal", "Vale.SHA.PPC64LE.SHA_helpers.word", "Vale.SHA.PPC64LE.SHA_helpers.quads_to_block_be", "Spec.Hash.Definitions.words_of_bytes", "Spec.Hash.Definitions.SHA2_256", "Spec.Hash.Definitions.block_word_length", "Prims.unit", "FStar.Classical.forall_intro", "Prims.nat", "Prims.b2t", "Prims.op_LessThan", "FStar.Seq.Base.length", "Prims.eq2", "FStar.UInt32.t", "Spec.SHA2.op_String_Access", "Spec.Hash.Definitions.word", "Prims.l_True", "Prims.squash", "FStar.Seq.Base.index", "Prims.Nil", "FStar.Pervasives.pattern", "FStar.Calc.calc_finish", "Prims.Cons", "FStar.Preorder.relation", "FStar.Calc.calc_step", "Vale.SHA.PPC64LE.SHA_helpers.nat32_to_word", "Vale.Def.Types_s.nat32", "Vale.Def.Words.Seq_s.seq_four_to_seq_BE", "Vale.Def.Types_s.reverse_bytes_nat32", "Vale.Def.Words.Seq_s.seq_four_to_seq_LE", "Vale.Def.Types_s.be_bytes_to_nat32", "Vale.Lib.Seqs_s.reverse_seq", "Vale.Def.Types_s.nat8", "Vale.Def.Types_s.nat32_to_be_bytes", "Vale.Def.Words.Seq_s.four_to_seq_LE", "Vale.Def.Words_s.natN", "Prims.pow2", "Vale.Def.Words.Four_s.nat_to_four", "Lib.ByteSequence.uint_from_bytes_be", "Lib.IntTypes.U32", "Lib.IntTypes.SEC", "Lib.Sequence.sub", "Lib.IntTypes.uint8", "FStar.Mul.op_Star", "Lib.IntTypes.uint_t", "Lib.ByteSequence.uints_from_bytes_be", "FStar.Calc.calc_init", "FStar.Calc.calc_pack", "Lib.ByteSequence.index_uints_from_bytes_be", "Lib.Sequence.lseq", "Prims.l_and", "Lib.Sequence.to_seq", "FStar.Seq.Base.slice", "Prims.op_Addition", "Prims.l_Forall", "Prims.l_or", "Lib.Sequence.index", "FStar.UInt32.v_inj", "Lib.IntTypes.u32", "Lib.Sequence.length", "Lib.IntTypes.U8", "Lib.ByteSequence.nat_from_bytes_be", "Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8", "Vale.SHA.PPC64LE.SHA_helpers.lemma_be_to_n_4", "Vale.Def.Types_s.reverse_bytes_nat32_reveal", "Vale.Def.Types_s.reveal_reverse_bytes_quad32", "Prims.op_Division", "FStar.Pervasives.reveal_opaque", "Vale.Def.Words_s.four", "Vale.Def.Words_s.nat32", "Prims.int", "Vale.Def.Words_s.nat8", "Vale.Lib.Seqs_s.seq_map", "Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE", "Vale.Def.Types_s.le_seq_quad32_to_bytes", "Vale.Def.Types_s.le_seq_quad32_to_bytes_reveal", "Vale.Arch.Types.slice_commutes_seq_four_to_seq_LE", "Vale.Arch.Types.reverse_bytes_quad32_seq", "Prims.op_Equality", "Vale.SHA.PPC64LE.SHA_helpers.size_block_w_256" ]
[]
false
false
true
false
false
let lemma_endian_relation (quads qs: seq quad32) (input2: seq UInt8.t) : Lemma (requires length qs == 4 /\ length input2 == 64 /\ qs == reverse_bytes_quad32_seq quads /\ input2 == seq_nat8_to_seq_uint8 (le_seq_quad32_to_bytes quads)) (ensures quads_to_block_be qs == words_of_bytes SHA2_256 #(block_word_length SHA2_256) input2) =
let fi (i: nat{i < length (quads_to_block_be qs)}) : Lemma ((quads_to_block_be qs).[ i ] == (words_of_bytes SHA2_256 #(block_word_length SHA2_256) input2).[ i ]) = let open Vale.Def.Words.Four_s in let open Vale.Lib.Seqs_s in let ni = (seq_four_to_seq_LE quads).[ i ] in let b = slice input2 (4 * i) (4 * i + 4) in calc ( == ) { b; ( == ) { () } slice input2 (4 * i) (4 * i + 4); ( == ) { () } slice (seq_nat8_to_seq_uint8 (le_seq_quad32_to_bytes quads)) (4 * i) (4 * i + 4); ( == ) { le_seq_quad32_to_bytes_reveal () } slice (seq_nat8_to_seq_uint8 (seq_nat32_to_seq_nat8_LE (seq_four_to_seq_LE quads))) (4 * i) (4 * i + 4); equal { () } seq_nat8_to_seq_uint8 (slice (seq_nat32_to_seq_nat8_LE (seq_four_to_seq_LE quads)) (4 * i) (4 * i + 4)); ( == ) { () } seq_nat8_to_seq_uint8 (slice (seq_four_to_seq_LE (seq_map (nat_to_four 8) (seq_four_to_seq_LE quads))) (4 * i) (4 * i + 4)); ( == ) { slice_commutes_seq_four_to_seq_LE (seq_map (nat_to_four 8) (seq_four_to_seq_LE quads)) i (i + 1) } seq_nat8_to_seq_uint8 (seq_four_to_seq_LE (slice (seq_map (nat_to_four 8) (seq_four_to_seq_LE quads)) i (i + 1))); equal { reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #nat8) } seq_nat8_to_seq_uint8 (four_to_seq_LE (nat_to_four 8 (seq_four_to_seq_LE quads).[ i ])); }; let open Lib.IntTypes in calc ( == ) { (words_of_bytes SHA2_256 #(block_word_length SHA2_256) input2).[ i ]; ( == ) { () } (Lib.ByteSequence.uints_from_bytes_be #U32 #SEC #(block_word_length SHA2_256) input2).[ i ]; ( == ) { Lib.ByteSequence.index_uints_from_bytes_be #U32 #SEC #(block_word_length SHA2_256) input2 i } Lib.ByteSequence.uint_from_bytes_be (Lib.Sequence.sub #uint8 #64 input2 (i * 4) 4); ( == ) { let open Lib.Sequence in calc ( == ) { sub #uint8 #64 input2 (i * 4) 4; ( == ) { () } Seq.slice input2 (4 * i) (4 * i + 4); } } Lib.ByteSequence.uint_from_bytes_be #U32 #SEC b; ( == ) { (calc ( == ) { Lib.ByteSequence.nat_from_bytes_be #SEC b; ( == ) { () } Lib.ByteSequence.nat_from_bytes_be #SEC (seq_nat8_to_seq_uint8 (four_to_seq_LE (nat_to_four 8 ni))); ( == ) { lemma_be_to_n_4 (four_to_seq_LE (nat_to_four 8 ni)) } be_bytes_to_nat32 (four_to_seq_LE (nat_to_four 8 ni)); }; v_inj (Lib.ByteSequence.uint_from_bytes_be #U32 #SEC b) (u32 (be_bytes_to_nat32 (four_to_seq_LE (nat_to_four 8 ni))))) } nat32_to_word (be_bytes_to_nat32 (four_to_seq_LE (nat_to_four 8 ni))); ( == ) { () } nat32_to_word (be_bytes_to_nat32 (reverse_seq (nat32_to_be_bytes ni))); ( == ) { reverse_bytes_nat32_reveal () } nat32_to_word (reverse_bytes_nat32 ni); ( == ) { () } nat32_to_word (reverse_bytes_nat32 (seq_four_to_seq_LE quads).[ i ]); ( == ) { (reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #nat32); reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #nat32); reveal_reverse_bytes_quad32 quads.[ (i / 4) ]) } nat32_to_word (seq_four_to_seq_BE qs).[ i ]; ( == ) { () } (quads_to_block_be qs).[ i ]; } in FStar.Classical.forall_intro fi; assert (equal (quads_to_block_be qs) (words_of_bytes SHA2_256 #(block_word_length SHA2_256) input2))
false
Vale.AES.Types_helpers.fst
Vale.AES.Types_helpers.lemma_slices_be_quad32_to_bytes
val lemma_slices_be_quad32_to_bytes (q:quad32) : Lemma (ensures ( let s = be_quad32_to_bytes q in q.hi3 == four_to_nat 8 (seq_to_four_BE (slice s 0 4)) /\ q.hi2 == four_to_nat 8 (seq_to_four_BE (slice s 4 8)) /\ q.lo1 == four_to_nat 8 (seq_to_four_BE (slice s 8 12)) /\ q.lo0 == four_to_nat 8 (seq_to_four_BE (slice s 12 16)) ))
val lemma_slices_be_quad32_to_bytes (q:quad32) : Lemma (ensures ( let s = be_quad32_to_bytes q in q.hi3 == four_to_nat 8 (seq_to_four_BE (slice s 0 4)) /\ q.hi2 == four_to_nat 8 (seq_to_four_BE (slice s 4 8)) /\ q.lo1 == four_to_nat 8 (seq_to_four_BE (slice s 8 12)) /\ q.lo0 == four_to_nat 8 (seq_to_four_BE (slice s 12 16)) ))
let lemma_slices_be_quad32_to_bytes (q:quad32) : Lemma (ensures ( let s = be_quad32_to_bytes q in q.hi3 == four_to_nat 8 (seq_to_four_BE (slice s 0 4)) /\ q.hi2 == four_to_nat 8 (seq_to_four_BE (slice s 4 8)) /\ q.lo1 == four_to_nat 8 (seq_to_four_BE (slice s 8 12)) /\ q.lo0 == four_to_nat 8 (seq_to_four_BE (slice s 12 16)) )) = reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #nat8); reveal_opaque (`%be_quad32_to_bytes) be_quad32_to_bytes; ()
{ "file_name": "vale/code/crypto/aes/Vale.AES.Types_helpers.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 4, "end_line": 34, "start_col": 0, "start_line": 23 }
module Vale.AES.Types_helpers open Vale.Def.Words.Seq_s open Vale.Def.Words.Four_s open Vale.Def.Types_s open Vale.Arch.Types open FStar.Seq open Vale.Arch.TypesNative let lemma_slices_le_quad32_to_bytes (q:quad32) : Lemma (ensures ( let s = le_quad32_to_bytes q in q.lo0 == four_to_nat 8 (seq_to_four_LE (slice s 0 4)) /\ q.lo1 == four_to_nat 8 (seq_to_four_LE (slice s 4 8)) /\ q.hi2 == four_to_nat 8 (seq_to_four_LE (slice s 8 12)) /\ q.hi3 == four_to_nat 8 (seq_to_four_LE (slice s 12 16)) )) = reveal_opaque (`%seq_four_to_seq_LE) (seq_four_to_seq_LE #nat8); reveal_opaque (`%le_quad32_to_bytes) le_quad32_to_bytes; ()
{ "checked_file": "/", "dependencies": [ "Vale.Def.Words.Seq_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.TypesNative.fsti.checked", "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": true, "source_file": "Vale.AES.Types_helpers.fst" }
[ { "abbrev": false, "full_module": "Vale.Arch.TypesNative", "short_module": null }, { "abbrev": false, "full_module": "Vale.Lib.Seqs", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Seq_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "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 } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 0, "max_fuel": 1, "max_ifuel": 1, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": true, "smtencoding_l_arith_repr": "native", "smtencoding_nl_arith_repr": "wrapped", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
q: Vale.Def.Types_s.quad32 -> FStar.Pervasives.Lemma (ensures (let s = Vale.Arch.Types.be_quad32_to_bytes q in Mkfour?.hi3 q == Vale.Def.Words.Four_s.four_to_nat 8 (Vale.Def.Words.Seq_s.seq_to_four_BE (FStar.Seq.Base.slice s 0 4)) /\ Mkfour?.hi2 q == Vale.Def.Words.Four_s.four_to_nat 8 (Vale.Def.Words.Seq_s.seq_to_four_BE (FStar.Seq.Base.slice s 4 8)) /\ Mkfour?.lo1 q == Vale.Def.Words.Four_s.four_to_nat 8 (Vale.Def.Words.Seq_s.seq_to_four_BE (FStar.Seq.Base.slice s 8 12)) /\ Mkfour?.lo0 q == Vale.Def.Words.Four_s.four_to_nat 8 (Vale.Def.Words.Seq_s.seq_to_four_BE (FStar.Seq.Base.slice s 12 16))))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Vale.Def.Types_s.quad32", "Prims.unit", "FStar.Pervasives.reveal_opaque", "Vale.Def.Words.Seq_s.seq16", "Vale.Def.Words_s.nat8", "Vale.Arch.Types.be_quad32_to_bytes", "FStar.Seq.Base.seq", "Vale.Def.Words_s.four", "Vale.Def.Types_s.nat8", "Prims.eq2", "Prims.int", "FStar.Seq.Base.length", "FStar.Mul.op_Star", "Vale.Def.Words.Seq_s.seq_four_to_seq_BE", "Prims.l_True", "Prims.squash", "Prims.l_and", "Vale.Def.Words_s.natN", "Vale.Def.Words_s.pow2_32", "Vale.Def.Words_s.__proj__Mkfour__item__hi3", "Vale.Def.Types_s.nat32", "Vale.Def.Words.Four_s.four_to_nat", "Vale.Def.Words.Seq_s.seq_to_four_BE", "FStar.Seq.Base.slice", "Vale.Def.Words_s.__proj__Mkfour__item__hi2", "Prims.pow2", "Vale.Def.Words_s.__proj__Mkfour__item__lo1", "Vale.Def.Words_s.__proj__Mkfour__item__lo0", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let lemma_slices_be_quad32_to_bytes (q: quad32) : Lemma (ensures (let s = be_quad32_to_bytes q in q.hi3 == four_to_nat 8 (seq_to_four_BE (slice s 0 4)) /\ q.hi2 == four_to_nat 8 (seq_to_four_BE (slice s 4 8)) /\ q.lo1 == four_to_nat 8 (seq_to_four_BE (slice s 8 12)) /\ q.lo0 == four_to_nat 8 (seq_to_four_BE (slice s 12 16)))) =
reveal_opaque (`%seq_four_to_seq_BE) (seq_four_to_seq_BE #nat8); reveal_opaque (`%be_quad32_to_bytes) be_quad32_to_bytes; ()
false
MiniParse.Impl.Base.fst
MiniParse.Impl.Base.buffer8
val buffer8 : Type0
let buffer8 = B.buffer U8.t
{ "file_name": "examples/miniparse/MiniParse.Impl.Base.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 27, "end_line": 27, "start_col": 0, "start_line": 27 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module MiniParse.Impl.Base include MiniParse.Spec.Base module B = LowStar.Buffer module M = LowStar.ModifiesPat module U32 = FStar.UInt32 module U8 = FStar.UInt8 module HST = FStar.HyperStack.ST module Seq = FStar.Seq
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "MiniParse.Spec.Base.fst.checked", "LowStar.ModifiesPat.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked" ], "interface_file": false, "source_file": "MiniParse.Impl.Base.fst" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.ModifiesPat", "short_module": "M" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "MiniParse.Spec.Base", "short_module": null }, { "abbrev": false, "full_module": "MiniParse.Impl", "short_module": null }, { "abbrev": false, "full_module": "MiniParse.Impl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Type0
Prims.Tot
[ "total" ]
[]
[ "LowStar.Buffer.buffer", "FStar.UInt8.t" ]
[]
false
false
false
true
true
let buffer8 =
B.buffer U8.t
false
Hacl.P256.PrecompTable.fsti
Hacl.P256.PrecompTable.g_pow2_64
val g_pow2_64:S.aff_point
val g_pow2_64:S.aff_point
let g_pow2_64 : S.aff_point = pow_point (pow2 64) g_aff
{ "file_name": "code/ecdsap256/Hacl.P256.PrecompTable.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 55, "end_line": 54, "start_col": 0, "start_line": 54 }
module Hacl.P256.PrecompTable open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module LE = Lib.Exponentiation.Definition module SE = Spec.Exponentiation module BE = Hacl.Impl.Exponentiation.Definitions module SPT = Hacl.Spec.PrecompBaseTable module S = Spec.P256 module SM = Hacl.Spec.P256.Montgomery open Hacl.Impl.P256.Point include Hacl.Impl.P256.Group #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract val proj_point_to_list: p:S.proj_point -> x:list uint64{FStar.List.Tot.length x = 12 /\ mk_to_p256_comm_monoid.BE.linv (Seq.seq_of_list x)} val lemma_refl: x:S.proj_point -> Lemma (S.mk_p256_concrete_ops.SE.to.SE.refl x == mk_to_p256_comm_monoid.BE.refl (Seq.seq_of_list (proj_point_to_list x))) inline_for_extraction noextract let mk_p256_precomp_base_table: SPT.mk_precomp_base_table S.proj_point U64 12ul 0ul = { SPT.concr_ops = S.mk_p256_concrete_ops; SPT.to_cm = mk_to_p256_comm_monoid; SPT.to_list = proj_point_to_list; SPT.lemma_refl = lemma_refl; } inline_for_extraction noextract let pow_point (k:nat) (p:S.aff_point) = LE.pow S.mk_p256_comm_monoid p k //---------------- noextract let g_aff : S.aff_point = S.to_aff_point S.base_point // [pow2 64]G
{ "checked_file": "/", "dependencies": [ "Spec.P256.fst.checked", "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.Definition.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.PrecompBaseTable.fsti.checked", "Hacl.Spec.P256.Montgomery.fsti.checked", "Hacl.Impl.P256.Point.fsti.checked", "Hacl.Impl.P256.Group.fst.checked", "Hacl.Impl.Exponentiation.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.P256.PrecompTable.fsti" }
[ { "abbrev": false, "full_module": "Hacl.Impl.P256.Group", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.P256.Point", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Spec.P256.Montgomery", "short_module": "SM" }, { "abbrev": true, "full_module": "Spec.P256", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.PrecompBaseTable", "short_module": "SPT" }, { "abbrev": true, "full_module": "Hacl.Impl.Exponentiation.Definitions", "short_module": "BE" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, "full_module": "Lib.Exponentiation.Definition", "short_module": "LE" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.P256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.P256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Spec.P256.PointOps.aff_point
Prims.Tot
[ "total" ]
[]
[ "Hacl.P256.PrecompTable.pow_point", "Prims.pow2", "Hacl.P256.PrecompTable.g_aff" ]
[]
false
false
false
true
false
let g_pow2_64:S.aff_point =
pow_point (pow2 64) g_aff
false
GlobalEnv.fst
GlobalEnv.nullary_macro
val nullary_macro : t: Ast.typ -> d: FStar.Pervasives.Native.option Ast.expr -> GlobalEnv.macro_signature
let nullary_macro t d = { macro_arguments_t = []; macro_result_t = t; macro_defn_t = d }
{ "file_name": "src/3d/GlobalEnv.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
{ "end_col": 1, "end_line": 56, "start_col": 0, "start_line": 52 }
(* 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 as 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 GlobalEnv (* This module implements a pass over the source AST -- checking that all names are properly bound -- well-typed -- computing the size of types -- computing which fields are dependent on others *) open FStar.Mul open FStar.List.Tot open Ast open FStar.All module H = Hashtable /// Computed attributes for a decl: /// -- its size in bytes /// -- whether or not it ends with a variable-length field (suffix) /// -- whether or not its validator may fail /// -- whether the type is an integral type, i.e., can it be decomposed into bitfields type decl_attributes = { may_fail:bool; integral:option integer_type; bit_order: (bit_order: option bitfield_bit_order { Some? bit_order ==> Some? integral }); has_reader:bool; parser_weak_kind:weak_kind; parser_kind_nz:option bool } noeq type macro_signature = { macro_arguments_t: list typ; macro_result_t: typ; macro_defn_t:option expr }
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Hashtable.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.All.fst.checked", "Config.fst.checked", "Ast.fst.checked" ], "interface_file": false, "source_file": "GlobalEnv.fst" }
[ { "abbrev": true, "full_module": "Hashtable", "short_module": "H" }, { "abbrev": false, "full_module": "FStar.All", "short_module": null }, { "abbrev": false, "full_module": "Ast", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
t: Ast.typ -> d: FStar.Pervasives.Native.option Ast.expr -> GlobalEnv.macro_signature
Prims.Tot
[ "total" ]
[]
[ "Ast.typ", "FStar.Pervasives.Native.option", "Ast.expr", "GlobalEnv.Mkmacro_signature", "Prims.Nil", "GlobalEnv.macro_signature" ]
[]
false
false
false
true
false
let nullary_macro t d =
{ macro_arguments_t = []; macro_result_t = t; macro_defn_t = d }
false
Hacl.P256.PrecompTable.fsti
Hacl.P256.PrecompTable.g_pow2_128
val g_pow2_128:S.aff_point
val g_pow2_128:S.aff_point
let g_pow2_128 : S.aff_point = pow_point (pow2 128) g_aff
{ "file_name": "code/ecdsap256/Hacl.P256.PrecompTable.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 57, "end_line": 58, "start_col": 0, "start_line": 58 }
module Hacl.P256.PrecompTable open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module LE = Lib.Exponentiation.Definition module SE = Spec.Exponentiation module BE = Hacl.Impl.Exponentiation.Definitions module SPT = Hacl.Spec.PrecompBaseTable module S = Spec.P256 module SM = Hacl.Spec.P256.Montgomery open Hacl.Impl.P256.Point include Hacl.Impl.P256.Group #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract val proj_point_to_list: p:S.proj_point -> x:list uint64{FStar.List.Tot.length x = 12 /\ mk_to_p256_comm_monoid.BE.linv (Seq.seq_of_list x)} val lemma_refl: x:S.proj_point -> Lemma (S.mk_p256_concrete_ops.SE.to.SE.refl x == mk_to_p256_comm_monoid.BE.refl (Seq.seq_of_list (proj_point_to_list x))) inline_for_extraction noextract let mk_p256_precomp_base_table: SPT.mk_precomp_base_table S.proj_point U64 12ul 0ul = { SPT.concr_ops = S.mk_p256_concrete_ops; SPT.to_cm = mk_to_p256_comm_monoid; SPT.to_list = proj_point_to_list; SPT.lemma_refl = lemma_refl; } inline_for_extraction noextract let pow_point (k:nat) (p:S.aff_point) = LE.pow S.mk_p256_comm_monoid p k //---------------- noextract let g_aff : S.aff_point = S.to_aff_point S.base_point // [pow2 64]G noextract let g_pow2_64 : S.aff_point = pow_point (pow2 64) g_aff // [pow2 128]G
{ "checked_file": "/", "dependencies": [ "Spec.P256.fst.checked", "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.Definition.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.PrecompBaseTable.fsti.checked", "Hacl.Spec.P256.Montgomery.fsti.checked", "Hacl.Impl.P256.Point.fsti.checked", "Hacl.Impl.P256.Group.fst.checked", "Hacl.Impl.Exponentiation.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.P256.PrecompTable.fsti" }
[ { "abbrev": false, "full_module": "Hacl.Impl.P256.Group", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.P256.Point", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Spec.P256.Montgomery", "short_module": "SM" }, { "abbrev": true, "full_module": "Spec.P256", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.PrecompBaseTable", "short_module": "SPT" }, { "abbrev": true, "full_module": "Hacl.Impl.Exponentiation.Definitions", "short_module": "BE" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, "full_module": "Lib.Exponentiation.Definition", "short_module": "LE" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.P256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.P256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Spec.P256.PointOps.aff_point
Prims.Tot
[ "total" ]
[]
[ "Hacl.P256.PrecompTable.pow_point", "Prims.pow2", "Hacl.P256.PrecompTable.g_aff" ]
[]
false
false
false
true
false
let g_pow2_128:S.aff_point =
pow_point (pow2 128) g_aff
false
Hacl.P256.PrecompTable.fsti
Hacl.P256.PrecompTable.g_pow2_192
val g_pow2_192:S.aff_point
val g_pow2_192:S.aff_point
let g_pow2_192 : S.aff_point = pow_point (pow2 192) g_aff
{ "file_name": "code/ecdsap256/Hacl.P256.PrecompTable.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 57, "end_line": 62, "start_col": 0, "start_line": 62 }
module Hacl.P256.PrecompTable open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module LE = Lib.Exponentiation.Definition module SE = Spec.Exponentiation module BE = Hacl.Impl.Exponentiation.Definitions module SPT = Hacl.Spec.PrecompBaseTable module S = Spec.P256 module SM = Hacl.Spec.P256.Montgomery open Hacl.Impl.P256.Point include Hacl.Impl.P256.Group #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract val proj_point_to_list: p:S.proj_point -> x:list uint64{FStar.List.Tot.length x = 12 /\ mk_to_p256_comm_monoid.BE.linv (Seq.seq_of_list x)} val lemma_refl: x:S.proj_point -> Lemma (S.mk_p256_concrete_ops.SE.to.SE.refl x == mk_to_p256_comm_monoid.BE.refl (Seq.seq_of_list (proj_point_to_list x))) inline_for_extraction noextract let mk_p256_precomp_base_table: SPT.mk_precomp_base_table S.proj_point U64 12ul 0ul = { SPT.concr_ops = S.mk_p256_concrete_ops; SPT.to_cm = mk_to_p256_comm_monoid; SPT.to_list = proj_point_to_list; SPT.lemma_refl = lemma_refl; } inline_for_extraction noextract let pow_point (k:nat) (p:S.aff_point) = LE.pow S.mk_p256_comm_monoid p k //---------------- noextract let g_aff : S.aff_point = S.to_aff_point S.base_point // [pow2 64]G noextract let g_pow2_64 : S.aff_point = pow_point (pow2 64) g_aff // [pow2 128]G noextract let g_pow2_128 : S.aff_point = pow_point (pow2 128) g_aff // [pow2 192]G
{ "checked_file": "/", "dependencies": [ "Spec.P256.fst.checked", "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.Definition.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.PrecompBaseTable.fsti.checked", "Hacl.Spec.P256.Montgomery.fsti.checked", "Hacl.Impl.P256.Point.fsti.checked", "Hacl.Impl.P256.Group.fst.checked", "Hacl.Impl.Exponentiation.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.P256.PrecompTable.fsti" }
[ { "abbrev": false, "full_module": "Hacl.Impl.P256.Group", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.P256.Point", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Spec.P256.Montgomery", "short_module": "SM" }, { "abbrev": true, "full_module": "Spec.P256", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.PrecompBaseTable", "short_module": "SPT" }, { "abbrev": true, "full_module": "Hacl.Impl.Exponentiation.Definitions", "short_module": "BE" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, "full_module": "Lib.Exponentiation.Definition", "short_module": "LE" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.P256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.P256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Spec.P256.PointOps.aff_point
Prims.Tot
[ "total" ]
[]
[ "Hacl.P256.PrecompTable.pow_point", "Prims.pow2", "Hacl.P256.PrecompTable.g_aff" ]
[]
false
false
false
true
false
let g_pow2_192:S.aff_point =
pow_point (pow2 192) g_aff
false
HyE.HCCA2.fst
HyE.HCCA2.access_pkraw
val access_pkraw (pk:pkey) : RSA.pkey
val access_pkraw (pk:pkey) : RSA.pkey
let access_pkraw (pk:pkey) = PKey?.rawpk pk
{ "file_name": "examples/crypto/HyE.HCCA2.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 16, "end_line": 37, "start_col": 0, "start_line": 36 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module HyE.HCCA2 open FStar.HyperStack.All open FStar.HyperStack.ST open HyE.Plain open HyE.PlainPKE open Platform.Bytes open FStar.HyperStack module B = Platform.Bytes module P = HyE.Plain module C = HyE.CCA2 module A = HyE.AE module RSA = HyE.RSA (* we idealize first CCA2, then AE *) noeq type pkey = | PKey: #region:C.rid{HyperStack.ST.witnessed (region_contains_pred region)} -> rawpk:RSA.pkey -> cca_pk:C.pkey -> pkey
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Platform.Bytes.fst.checked", "HyE.RSA.fst.checked", "HyE.PlainPKE.fst.checked", "HyE.Plain.fsti.checked", "HyE.CCA2.fsti.checked", "HyE.AE.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "HyE.HCCA2.fst" }
[ { "abbrev": true, "full_module": "HyE.RSA", "short_module": "RSA" }, { "abbrev": true, "full_module": "HyE.AE", "short_module": "A" }, { "abbrev": true, "full_module": "HyE.CCA2", "short_module": "C" }, { "abbrev": true, "full_module": "HyE.Plain", "short_module": "P" }, { "abbrev": true, "full_module": "Platform.Bytes", "short_module": "B" }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Platform.Bytes", "short_module": null }, { "abbrev": false, "full_module": "HyE.PlainPKE", "short_module": null }, { "abbrev": false, "full_module": "HyE.Plain", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "HyE", "short_module": null }, { "abbrev": false, "full_module": "HyE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
pk: HyE.HCCA2.pkey -> HyE.RSA.pkey
Prims.Tot
[ "total" ]
[]
[ "HyE.HCCA2.pkey", "HyE.HCCA2.__proj__PKey__item__rawpk", "HyE.RSA.pkey" ]
[]
false
false
false
true
false
let access_pkraw (pk: pkey) =
PKey?.rawpk pk
false
Hacl.P256.PrecompTable.fsti
Hacl.P256.PrecompTable.precomp_table_acc_inv
val precomp_table_acc_inv : p: Spec.P256.PointOps.aff_point -> table_len: Prims.nat{table_len * 12 <= Lib.IntTypes.max_size_t} -> table: Lib.Sequence.lseq Lib.IntTypes.uint64 (table_len * 12) -> j: Prims.nat{j < table_len} -> Prims.logical
let precomp_table_acc_inv (p:S.aff_point) (table_len:nat{table_len * 12 <= max_size_t}) (table:LSeq.lseq uint64 (table_len * 12)) (j:nat{j < table_len}) = Math.Lemmas.lemma_mult_lt_right 12 j table_len; Math.Lemmas.lemma_mult_le_right 12 (j + 1) table_len; let bj = LSeq.sub table (j * 12) 12 in point_inv_seq bj /\ S.to_aff_point (from_mont_point (as_point_nat_seq bj)) == pow_point j p
{ "file_name": "code/ecdsap256/Hacl.P256.PrecompTable.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 93, "end_line": 112, "start_col": 0, "start_line": 103 }
module Hacl.P256.PrecompTable open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module LE = Lib.Exponentiation.Definition module SE = Spec.Exponentiation module BE = Hacl.Impl.Exponentiation.Definitions module SPT = Hacl.Spec.PrecompBaseTable module S = Spec.P256 module SM = Hacl.Spec.P256.Montgomery open Hacl.Impl.P256.Point include Hacl.Impl.P256.Group #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract val proj_point_to_list: p:S.proj_point -> x:list uint64{FStar.List.Tot.length x = 12 /\ mk_to_p256_comm_monoid.BE.linv (Seq.seq_of_list x)} val lemma_refl: x:S.proj_point -> Lemma (S.mk_p256_concrete_ops.SE.to.SE.refl x == mk_to_p256_comm_monoid.BE.refl (Seq.seq_of_list (proj_point_to_list x))) inline_for_extraction noextract let mk_p256_precomp_base_table: SPT.mk_precomp_base_table S.proj_point U64 12ul 0ul = { SPT.concr_ops = S.mk_p256_concrete_ops; SPT.to_cm = mk_to_p256_comm_monoid; SPT.to_list = proj_point_to_list; SPT.lemma_refl = lemma_refl; } inline_for_extraction noextract let pow_point (k:nat) (p:S.aff_point) = LE.pow S.mk_p256_comm_monoid p k //---------------- noextract let g_aff : S.aff_point = S.to_aff_point S.base_point // [pow2 64]G noextract let g_pow2_64 : S.aff_point = pow_point (pow2 64) g_aff // [pow2 128]G noextract let g_pow2_128 : S.aff_point = pow_point (pow2 128) g_aff // [pow2 192]G noextract let g_pow2_192 : S.aff_point = pow_point (pow2 192) g_aff inline_for_extraction noextract val proj_g_pow2_64_lseq : LSeq.lseq uint64 12 inline_for_extraction noextract val proj_g_pow2_128_lseq : LSeq.lseq uint64 12 inline_for_extraction noextract val proj_g_pow2_192_lseq : LSeq.lseq uint64 12 val proj_g_pow2_64_lseq_lemma: unit -> Lemma (point_inv_seq proj_g_pow2_64_lseq /\ S.to_aff_point (from_mont_point (as_point_nat_seq proj_g_pow2_64_lseq)) == g_pow2_64) val proj_g_pow2_128_lseq_lemma: unit -> Lemma (point_inv_seq proj_g_pow2_128_lseq /\ S.to_aff_point (from_mont_point (as_point_nat_seq proj_g_pow2_128_lseq)) == g_pow2_128) val proj_g_pow2_192_lseq_lemma: unit -> Lemma (point_inv_seq proj_g_pow2_192_lseq /\ S.to_aff_point (from_mont_point (as_point_nat_seq proj_g_pow2_192_lseq)) == g_pow2_192) inline_for_extraction val mk_proj_g_pow2_64: unit -> StackInline (lbuffer uint64 12ul) (requires fun _ -> True) (ensures fun h0 b h1 -> live h1 b /\ stack_allocated b h0 h1 proj_g_pow2_64_lseq) inline_for_extraction val mk_proj_g_pow2_128: unit -> StackInline (lbuffer uint64 12ul) (requires fun _ -> True) (ensures fun h0 b h1 -> live h1 b /\ stack_allocated b h0 h1 proj_g_pow2_128_lseq) inline_for_extraction val mk_proj_g_pow2_192: unit -> StackInline (lbuffer uint64 12ul) (requires fun _ -> True) (ensures fun h0 b h1 -> live h1 b /\ stack_allocated b h0 h1 proj_g_pow2_192_lseq) //----------------
{ "checked_file": "/", "dependencies": [ "Spec.P256.fst.checked", "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.Definition.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.PrecompBaseTable.fsti.checked", "Hacl.Spec.P256.Montgomery.fsti.checked", "Hacl.Impl.P256.Point.fsti.checked", "Hacl.Impl.P256.Group.fst.checked", "Hacl.Impl.Exponentiation.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.P256.PrecompTable.fsti" }
[ { "abbrev": false, "full_module": "Hacl.Impl.P256.Group", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.P256.Point", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Spec.P256.Montgomery", "short_module": "SM" }, { "abbrev": true, "full_module": "Spec.P256", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.PrecompBaseTable", "short_module": "SPT" }, { "abbrev": true, "full_module": "Hacl.Impl.Exponentiation.Definitions", "short_module": "BE" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, "full_module": "Lib.Exponentiation.Definition", "short_module": "LE" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.P256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.P256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: Spec.P256.PointOps.aff_point -> table_len: Prims.nat{table_len * 12 <= Lib.IntTypes.max_size_t} -> table: Lib.Sequence.lseq Lib.IntTypes.uint64 (table_len * 12) -> j: Prims.nat{j < table_len} -> Prims.logical
Prims.Tot
[ "total" ]
[]
[ "Spec.P256.PointOps.aff_point", "Prims.nat", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.Mul.op_Star", "Lib.IntTypes.max_size_t", "Lib.Sequence.lseq", "Lib.IntTypes.uint64", "Prims.op_LessThan", "Prims.l_and", "Hacl.Impl.P256.Point.point_inv_seq", "Prims.eq2", "Spec.P256.PointOps.to_aff_point", "Hacl.Impl.P256.Point.from_mont_point", "Hacl.Impl.P256.Point.as_point_nat_seq", "Hacl.P256.PrecompTable.pow_point", "Lib.IntTypes.int_t", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "FStar.Seq.Base.seq", "Lib.Sequence.to_seq", "FStar.Seq.Base.slice", "Prims.op_Multiply", "Prims.op_Addition", "Prims.l_Forall", "Prims.l_or", "FStar.Seq.Base.index", "Lib.Sequence.index", "Lib.Sequence.sub", "Prims.unit", "FStar.Math.Lemmas.lemma_mult_le_right", "FStar.Math.Lemmas.lemma_mult_lt_right", "Prims.logical" ]
[]
false
false
false
false
true
let precomp_table_acc_inv (p: S.aff_point) (table_len: nat{table_len * 12 <= max_size_t}) (table: LSeq.lseq uint64 (table_len * 12)) (j: nat{j < table_len}) =
Math.Lemmas.lemma_mult_lt_right 12 j table_len; Math.Lemmas.lemma_mult_le_right 12 (j + 1) table_len; let bj = LSeq.sub table (j * 12) 12 in point_inv_seq bj /\ S.to_aff_point (from_mont_point (as_point_nat_seq bj)) == pow_point j p
false
Hacl.P256.PrecompTable.fsti
Hacl.P256.PrecompTable.mk_p256_precomp_base_table
val mk_p256_precomp_base_table:SPT.mk_precomp_base_table S.proj_point U64 12ul 0ul
val mk_p256_precomp_base_table:SPT.mk_precomp_base_table S.proj_point U64 12ul 0ul
let mk_p256_precomp_base_table: SPT.mk_precomp_base_table S.proj_point U64 12ul 0ul = { SPT.concr_ops = S.mk_p256_concrete_ops; SPT.to_cm = mk_to_p256_comm_monoid; SPT.to_list = proj_point_to_list; SPT.lemma_refl = lemma_refl; }
{ "file_name": "code/ecdsap256/Hacl.P256.PrecompTable.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 1, "end_line": 41, "start_col": 0, "start_line": 36 }
module Hacl.P256.PrecompTable open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module LE = Lib.Exponentiation.Definition module SE = Spec.Exponentiation module BE = Hacl.Impl.Exponentiation.Definitions module SPT = Hacl.Spec.PrecompBaseTable module S = Spec.P256 module SM = Hacl.Spec.P256.Montgomery open Hacl.Impl.P256.Point include Hacl.Impl.P256.Group #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract val proj_point_to_list: p:S.proj_point -> x:list uint64{FStar.List.Tot.length x = 12 /\ mk_to_p256_comm_monoid.BE.linv (Seq.seq_of_list x)} val lemma_refl: x:S.proj_point -> Lemma (S.mk_p256_concrete_ops.SE.to.SE.refl x == mk_to_p256_comm_monoid.BE.refl (Seq.seq_of_list (proj_point_to_list x)))
{ "checked_file": "/", "dependencies": [ "Spec.P256.fst.checked", "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.Definition.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.PrecompBaseTable.fsti.checked", "Hacl.Spec.P256.Montgomery.fsti.checked", "Hacl.Impl.P256.Point.fsti.checked", "Hacl.Impl.P256.Group.fst.checked", "Hacl.Impl.Exponentiation.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.P256.PrecompTable.fsti" }
[ { "abbrev": false, "full_module": "Hacl.Impl.P256.Group", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.P256.Point", "short_module": null }, { "abbrev": true, "full_module": "Hacl.Spec.P256.Montgomery", "short_module": "SM" }, { "abbrev": true, "full_module": "Spec.P256", "short_module": "S" }, { "abbrev": true, "full_module": "Hacl.Spec.PrecompBaseTable", "short_module": "SPT" }, { "abbrev": true, "full_module": "Hacl.Impl.Exponentiation.Definitions", "short_module": "BE" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, "full_module": "Lib.Exponentiation.Definition", "short_module": "LE" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.P256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.P256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Spec.PrecompBaseTable.mk_precomp_base_table Spec.P256.PointOps.proj_point Lib.IntTypes.U64 (12ul <: FStar.UInt32.t) (0ul <: FStar.UInt32.t)
Prims.Tot
[ "total" ]
[]
[ "Hacl.Spec.PrecompBaseTable.Mkmk_precomp_base_table", "Spec.P256.PointOps.proj_point", "Lib.IntTypes.U64", "FStar.UInt32.uint_to_t", "Spec.P256.mk_p256_concrete_ops", "Hacl.Impl.P256.Group.mk_to_p256_comm_monoid", "Hacl.P256.PrecompTable.proj_point_to_list", "Hacl.P256.PrecompTable.lemma_refl" ]
[]
false
false
false
false
false
let mk_p256_precomp_base_table:SPT.mk_precomp_base_table S.proj_point U64 12ul 0ul =
{ SPT.concr_ops = S.mk_p256_concrete_ops; SPT.to_cm = mk_to_p256_comm_monoid; SPT.to_list = proj_point_to_list; SPT.lemma_refl = lemma_refl }
false
MiniParse.Impl.Base.fst
MiniParse.Impl.Base.parser_impl
val parser_impl (#t: Type0) (p: parser_spec t) : Tot Type0
val parser_impl (#t: Type0) (p: parser_spec t) : Tot Type0
let parser_impl (#t: Type0) (p: parser_spec t) : Tot Type0 = (input: buffer8) -> (l: U32.t { l == B.len input } ) -> HST.Stack (option (t * U32.t)) (requires (fun h -> B.live h input)) (ensures (fun h res h' -> M.modifies M.loc_none h h' /\ ( match parse p (B.as_seq h input), res with | None, None -> True | Some (y, consumed), Some (y', consumed') -> y == y' /\ U32.v consumed' == consumed | _ -> False )))
{ "file_name": "examples/miniparse/MiniParse.Impl.Base.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 5, "end_line": 42, "start_col": 0, "start_line": 30 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module MiniParse.Impl.Base include MiniParse.Spec.Base module B = LowStar.Buffer module M = LowStar.ModifiesPat module U32 = FStar.UInt32 module U8 = FStar.UInt8 module HST = FStar.HyperStack.ST module Seq = FStar.Seq inline_for_extraction let buffer8 = B.buffer U8.t
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "MiniParse.Spec.Base.fst.checked", "LowStar.ModifiesPat.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked" ], "interface_file": false, "source_file": "MiniParse.Impl.Base.fst" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.ModifiesPat", "short_module": "M" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "MiniParse.Spec.Base", "short_module": null }, { "abbrev": false, "full_module": "MiniParse.Impl", "short_module": null }, { "abbrev": false, "full_module": "MiniParse.Impl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: MiniParse.Spec.Base.parser_spec t -> Type0
Prims.Tot
[ "total" ]
[]
[ "MiniParse.Spec.Base.parser_spec", "MiniParse.Impl.Base.buffer8", "FStar.UInt32.t", "Prims.eq2", "LowStar.Monotonic.Buffer.len", "FStar.UInt8.t", "LowStar.Buffer.trivial_preorder", "FStar.Pervasives.Native.option", "FStar.Pervasives.Native.tuple2", "FStar.Monotonic.HyperStack.mem", "LowStar.Monotonic.Buffer.live", "Prims.l_and", "LowStar.Monotonic.Buffer.modifies", "LowStar.Monotonic.Buffer.loc_none", "FStar.Pervasives.Native.Mktuple2", "MiniParse.Spec.Base.consumed_length", "LowStar.Monotonic.Buffer.as_seq", "MiniParse.Spec.Base.parse", "Prims.l_True", "Prims.int", "Prims.l_or", "Prims.b2t", "Prims.op_GreaterThanOrEqual", "Prims.op_LessThanOrEqual", "FStar.Seq.Base.length", "MiniParse.Spec.Base.byte", "FStar.UInt.size", "FStar.UInt32.n", "FStar.UInt32.v", "Prims.l_False", "Prims.logical" ]
[]
false
false
false
true
true
let parser_impl (#t: Type0) (p: parser_spec t) : Tot Type0 =
input: buffer8 -> l: U32.t{l == B.len input} -> HST.Stack (option (t * U32.t)) (requires (fun h -> B.live h input)) (ensures (fun h res h' -> M.modifies M.loc_none h h' /\ (match parse p (B.as_seq h input), res with | None, None -> True | Some (y, consumed), Some (y', consumed') -> y == y' /\ U32.v consumed' == consumed | _ -> False)))
false
Hacl.NaCl.fst
Hacl.NaCl.crypto_box_open_easy_afternm
val crypto_box_open_easy_afternm: m:buffer uint8 -> c:buffer uint8 -> clen:size_t{length c = v clen /\ v clen = length m + 16} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint m n /\ disjoint c n) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SB.box_open_easy_afternm (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #clen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #(clen -! 16ul) h1 m == Some?.v msg | _ -> None? msg))
val crypto_box_open_easy_afternm: m:buffer uint8 -> c:buffer uint8 -> clen:size_t{length c = v clen /\ v clen = length m + 16} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint m n /\ disjoint c n) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SB.box_open_easy_afternm (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #clen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #(clen -! 16ul) h1 m == Some?.v msg | _ -> None? msg))
let crypto_box_open_easy_afternm m c clen n k = Hacl.Impl.Box.box_open_easy_afternm (clen -! 16ul) m k n c
{ "file_name": "code/nacl-box/Hacl.NaCl.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 60, "end_line": 331, "start_col": 0, "start_line": 330 }
module Hacl.NaCl open FStar.HyperStack.All open FStar.HyperStack open FStar.Mul open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module SB = Spec.Box module SS = Spec.SecretBox #set-options "--max_fuel 50 --max_fuel 0 --max_ifuel 0" [@@ Comment "Encrypt a message with a key and nonce. Note: `c` and `m` can point to the same memory for in-place encryption. @param c Pointer to `mlen` bytes where the ciphertext is written to. @param tag Pointer to 16 (tag length) bytes where the authentication tag is written to. @param m Pointer to `mlen` bytes where the message is read from. @param mlen Length of message. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_detached: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == SS.secretbox_detached (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_secretbox_detached c tag m mlen n k = Hacl.Impl.SecretBox.secretbox_detached mlen c tag k n m; 0ul [@@ Comment "Verify and decrypt a ciphertext produced with `Hacl_NaCl_crypto_secretbox_detached`. Note: `m` and `c` can point to the same memory for in-place decryption. @param m Pointer to `mlen` bytes where the message is written to. @param c Pointer to `mlen` bytes where the ciphertext is read from. @param tag Pointer to 16 (tag length) bytes where the authentication tag is read from. @param mlen Length of message (and ciphertext). @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_open_detached: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SS.secretbox_open_detached (as_seq h0 k) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg)) let crypto_secretbox_open_detached m c tag mlen n k = Hacl.Impl.SecretBox.secretbox_open_detached mlen m k n c tag [@@ Comment "Encrypt a message with a key and nonce. @param c Pointer to 16 (tag length) + `mlen` bytes where the ciphertext is written to. @param m Pointer to `mlen` bytes where the message is read from. @param mlen Length of message. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_easy: c:buffer uint8 -> m:buffer uint8 -> mlen:size_t{length c = v mlen + 16 /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 c h0 h1 /\ as_seq #MUT #uint8 #(mlen +! 16ul) h1 c == SS.secretbox_easy (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_secretbox_easy c m mlen n k = Hacl.Impl.SecretBox.secretbox_easy mlen c k n m; 0ul #set-options "--z3rlimit 100" [@@ Comment "Verify and decrypt a ciphertext produced with `crypto_secretbox_easy`. @param m Pointer to `mlen` bytes where the message is written to. @param c Pointer to `clen` bytes where the ciphertext is read from. The authentication tag must be included. @param clen Length of ciphertext. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_open_easy: m:buffer uint8 -> c:buffer uint8 -> clen:size_t{length c = v clen /\ v clen = length m + 16} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint m n /\ disjoint c n) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SS.secretbox_open_easy (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #clen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #(clen -! 16ul) h1 m == Some?.v msg | _ -> None? msg)) let crypto_secretbox_open_easy m c clen n k = Hacl.Impl.SecretBox.secretbox_open_easy (clen -! 16ul) m k n c [@@ Comment "Compute a shared secret key given a public key and secret key. @param k Pointer to 32 (`crypto_box_BEFORENMBYTES`) bytes of memory where the shared secret is written to. @param pk Pointer to 32 bytes of memory where **their** public key is read from. @param sk Pointer to 32 bytes of memory where **my** secret key is read from."] val crypto_box_beforenm: k:lbuffer uint8 32ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h k /\ live h pk /\ live h sk /\ disjoint k pk /\ disjoint k sk) (ensures fun h0 r h1 -> modifies1 k h0 h1 /\ (let key = SB.box_beforenm (as_seq h0 pk) (as_seq h0 sk) in match r with | 0ul -> Some? key /\ as_seq h1 k == Some?.v key | _ -> None? key)) let crypto_box_beforenm k pk sk = Hacl.Impl.Box.box_beforenm k pk sk [@@ Comment "See `crypto_box_detached`."] val crypto_box_detached_afternm: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == SB.box_detached_afternm (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_box_detached_afternm c tag m mlen n k = Hacl.Impl.Box.box_detached_afternm mlen c tag k n m [@@ Comment "Encrypt a message using the recipient's public key, the sender's secret key, and a nonce. @param c Pointer to `mlen` bytes of memory where the ciphertext is written to. @param tag Pointer to 16 (tag length) bytes of memory where the authentication tag is written to. @param m Pointer to `mlen` bytes of memory where the message is read from. @param mlen Length of the message. @param n Pointer to 24 (`crypto_box_NONCEBYTES`) bytes of memory where the nonce is read from. @param pk Pointer to 32 bytes of memory where **their** public key is read from. @param sk Pointer to 32 bytes of memory where **my** secret key is read from."] val crypto_box_detached: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h sk /\ live h pk /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (let tag_cipher = SB.box_detached (as_seq h0 sk) (as_seq h0 pk) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m) in match r with | 0ul -> Some? tag_cipher /\ (let (tag_s, cipher_s) = Some?.v tag_cipher in (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == (tag_s, cipher_s)) | _ -> None? tag_cipher)) let crypto_box_detached c tag m mlen n pk sk = Hacl.Impl.Box.box_detached mlen c tag sk pk n m [@@ Comment "See `crypto_box_open_detached`."] val crypto_box_open_detached_afternm: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SB.box_open_detached_afternm (as_seq h0 k) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg)) let crypto_box_open_detached_afternm m c tag mlen n k = Hacl.Impl.Box.box_open_detached_afternm mlen m k n c tag [@@ Comment "Verify and decrypt a ciphertext produced by `crypto_box_detached`. @param m Pointer to `mlen` bytes of memory where the decrypted message is written to. @param c Pointer to `mlen` bytes of memory where the ciphertext is read from. Note: the ciphertext must include the tag. @param tag Pointer to 16 (tag length) bytes of memory where the authentication tag is read from. @param mlen Length of the message (and ciphertext). @param n Pointer to 24 (`crypto_box_NONCEBYTES`) bytes of memory where the nonce is read from. @param pk Pointer to 32 bytes of memory where the public key of the sender is read from. @param sk Pointer to 32 bytes of memory where the secret key of the recipient is read from."] val crypto_box_open_detached: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h pk /\ live h sk /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SB.box_open_detached (as_seq h0 pk) (as_seq h0 sk) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg)) let crypto_box_open_detached m c tag mlen n pk sk = Hacl.Impl.Box.box_open_detached mlen m pk sk n c tag [@@ Comment "See `crypto_box_easy`."] val crypto_box_easy_afternm: c:buffer uint8 -> m:buffer uint8 -> mlen:size_t{length c = v mlen + 16 /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 c h0 h1 /\ as_seq #MUT #uint8 #(mlen +! 16ul) h1 c == SB.box_easy_afternm (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_box_easy_afternm c m mlen n k = Hacl.Impl.Box.box_easy_afternm mlen c k n m [@@ Comment "Encrypt a message using the recipient's public key, the sender's secret key, and a nonce. @param c Pointer to 16 (tag length) + `mlen` bytes of memory where the authentication tag and ciphertext is written to. @param m Pointer to `mlen` bytes of memory where the message is read from. @param mlen Length of the message. @param n Pointer to 24 (`crypto_box_NONCEBYTES`) bytes of memory where the nonce is read from. @param pk Pointer to 32 bytes of memory where the public key of the recipient is read from. @param sk Pointer to 32 bytes of memory where the secret key of the sender is read from."] val crypto_box_easy: c:buffer uint8 -> m:buffer uint8 -> mlen:size_t{length c = v mlen + 16 /\ length m = v mlen} -> n:lbuffer uint8 24ul -> pk:lbuffer uint8 32ul -> sk:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h sk /\ live h pk /\ live h n /\ disjoint m c /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 c h0 h1 /\ (let cipher = SB.box_easy (as_seq h0 sk) (as_seq h0 pk) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m) in match r with | 0ul -> Some? cipher /\ as_seq #MUT #uint8 #(mlen +! 16ul) h1 c == Some?.v cipher | _ -> None? cipher)) let crypto_box_easy c m mlen n pk sk = Hacl.Impl.Box.box_easy mlen c sk pk n m [@@ Comment "See `crypto_box_open_easy`."] val crypto_box_open_easy_afternm: m:buffer uint8 -> c:buffer uint8 -> clen:size_t{length c = v clen /\ v clen = length m + 16} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint m n /\ disjoint c n) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SB.box_open_easy_afternm (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #clen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #(clen -! 16ul) h1 m == Some?.v msg | _ -> None? msg))
{ "checked_file": "/", "dependencies": [ "Spec.SecretBox.fst.checked", "Spec.Box.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.SecretBox.fst.checked", "Hacl.Impl.Box.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.NaCl.fst" }
[ { "abbrev": true, "full_module": "Spec.SecretBox", "short_module": "SS" }, { "abbrev": true, "full_module": "Spec.Box", "short_module": "SB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
m: Lib.Buffer.buffer Lib.IntTypes.uint8 -> c: Lib.Buffer.buffer Lib.IntTypes.uint8 -> clen: Lib.IntTypes.size_t { Lib.Buffer.length c = Lib.IntTypes.v clen /\ Lib.IntTypes.v clen = Lib.Buffer.length m + 16 } -> n: Lib.Buffer.lbuffer Lib.IntTypes.uint8 24ul -> k: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul -> FStar.HyperStack.ST.Stack Lib.IntTypes.size_t
FStar.HyperStack.ST.Stack
[]
[]
[ "Lib.Buffer.buffer", "Lib.IntTypes.uint8", "Lib.IntTypes.size_t", "Prims.l_and", "Prims.b2t", "Prims.op_Equality", "Prims.int", "Prims.l_or", "Prims.op_GreaterThanOrEqual", "Lib.IntTypes.range", "Lib.IntTypes.U32", "Lib.Buffer.length", "Lib.Buffer.MUT", "Lib.IntTypes.v", "Lib.IntTypes.PUB", "Prims.op_Addition", "Lib.Buffer.lbuffer", "FStar.UInt32.__uint_to_t", "Hacl.Impl.Box.box_open_easy_afternm", "Lib.IntTypes.op_Subtraction_Bang" ]
[]
false
true
false
false
false
let crypto_box_open_easy_afternm m c clen n k =
Hacl.Impl.Box.box_open_easy_afternm (clen -! 16ul) m k n c
false
MiniParse.Impl.Base.fst
MiniParse.Impl.Base.coerce_parser_impl
val coerce_parser_impl (t2 #t1: Type0) (#p: parser_spec t1) (p32: parser_impl p) (u: squash (t2 == t1)) : Tot (parser_impl (coerce_parser t2 p))
val coerce_parser_impl (t2 #t1: Type0) (#p: parser_spec t1) (p32: parser_impl p) (u: squash (t2 == t1)) : Tot (parser_impl (coerce_parser t2 p))
let coerce_parser_impl (t2: Type0) (#t1: Type0) (#p: parser_spec t1) (p32: parser_impl p) (u: squash (t2 == t1)) : Tot (parser_impl (coerce_parser t2 p)) = p32
{ "file_name": "examples/miniparse/MiniParse.Impl.Base.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 5, "end_line": 52, "start_col": 0, "start_line": 45 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module MiniParse.Impl.Base include MiniParse.Spec.Base module B = LowStar.Buffer module M = LowStar.ModifiesPat module U32 = FStar.UInt32 module U8 = FStar.UInt8 module HST = FStar.HyperStack.ST module Seq = FStar.Seq inline_for_extraction let buffer8 = B.buffer U8.t inline_for_extraction let parser_impl (#t: Type0) (p: parser_spec t) : Tot Type0 = (input: buffer8) -> (l: U32.t { l == B.len input } ) -> HST.Stack (option (t * U32.t)) (requires (fun h -> B.live h input)) (ensures (fun h res h' -> M.modifies M.loc_none h h' /\ ( match parse p (B.as_seq h input), res with | None, None -> True | Some (y, consumed), Some (y', consumed') -> y == y' /\ U32.v consumed' == consumed | _ -> False )))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "MiniParse.Spec.Base.fst.checked", "LowStar.ModifiesPat.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked" ], "interface_file": false, "source_file": "MiniParse.Impl.Base.fst" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.ModifiesPat", "short_module": "M" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "MiniParse.Spec.Base", "short_module": null }, { "abbrev": false, "full_module": "MiniParse.Impl", "short_module": null }, { "abbrev": false, "full_module": "MiniParse.Impl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
t2: Type0 -> p32: MiniParse.Impl.Base.parser_impl p -> u18: Prims.squash (t2 == t1) -> MiniParse.Impl.Base.parser_impl (MiniParse.Spec.Base.coerce_parser t2 p)
Prims.Tot
[ "total" ]
[]
[ "MiniParse.Spec.Base.parser_spec", "MiniParse.Impl.Base.parser_impl", "Prims.squash", "Prims.eq2", "MiniParse.Spec.Base.coerce_parser" ]
[]
false
false
false
false
false
let coerce_parser_impl (t2 #t1: Type0) (#p: parser_spec t1) (p32: parser_impl p) (u: squash (t2 == t1)) : Tot (parser_impl (coerce_parser t2 p)) =
p32
false
MiniParse.Impl.Base.fst
MiniParse.Impl.Base.serializer_impl
val serializer_impl (#t: Type0) (#p: parser_spec t) (s: serializer_spec p) : Tot Type0
val serializer_impl (#t: Type0) (#p: parser_spec t) (s: serializer_spec p) : Tot Type0
let serializer_impl (#t: Type0) (#p: parser_spec t) (s: serializer_spec p) : Tot Type0 = (output: buffer8) -> (l: U32.t { l == B.len output } ) -> (x: t) -> HST.Stack (option U32.t) (requires (fun h -> B.live h output)) (ensures (fun h res h' -> B.live h output /\ B.live h' output /\ ( let len = Seq.length (serialize s x) in match res with | None -> M.modifies (M.loc_buffer output) h h' /\ len > B.length output | Some len' -> U32.v len' == len /\ len <= B.length output /\ ( let b' = B.gsub output 0ul len' in M.modifies (M.loc_buffer b') h h' /\ B.as_seq h' b' == serialize s x ))))
{ "file_name": "examples/miniparse/MiniParse.Impl.Base.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 8, "end_line": 74, "start_col": 0, "start_line": 55 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module MiniParse.Impl.Base include MiniParse.Spec.Base module B = LowStar.Buffer module M = LowStar.ModifiesPat module U32 = FStar.UInt32 module U8 = FStar.UInt8 module HST = FStar.HyperStack.ST module Seq = FStar.Seq inline_for_extraction let buffer8 = B.buffer U8.t inline_for_extraction let parser_impl (#t: Type0) (p: parser_spec t) : Tot Type0 = (input: buffer8) -> (l: U32.t { l == B.len input } ) -> HST.Stack (option (t * U32.t)) (requires (fun h -> B.live h input)) (ensures (fun h res h' -> M.modifies M.loc_none h h' /\ ( match parse p (B.as_seq h input), res with | None, None -> True | Some (y, consumed), Some (y', consumed') -> y == y' /\ U32.v consumed' == consumed | _ -> False ))) inline_for_extraction let coerce_parser_impl (t2: Type0) (#t1: Type0) (#p: parser_spec t1) (p32: parser_impl p) (u: squash (t2 == t1)) : Tot (parser_impl (coerce_parser t2 p)) = p32
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "MiniParse.Spec.Base.fst.checked", "LowStar.ModifiesPat.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked" ], "interface_file": false, "source_file": "MiniParse.Impl.Base.fst" }
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "LowStar.ModifiesPat", "short_module": "M" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": false, "full_module": "MiniParse.Spec.Base", "short_module": null }, { "abbrev": false, "full_module": "MiniParse.Impl", "short_module": null }, { "abbrev": false, "full_module": "MiniParse.Impl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: MiniParse.Spec.Base.serializer_spec p -> Type0
Prims.Tot
[ "total" ]
[]
[ "MiniParse.Spec.Base.parser_spec", "MiniParse.Spec.Base.serializer_spec", "MiniParse.Impl.Base.buffer8", "FStar.UInt32.t", "Prims.eq2", "LowStar.Monotonic.Buffer.len", "FStar.UInt8.t", "LowStar.Buffer.trivial_preorder", "FStar.Pervasives.Native.option", "FStar.Monotonic.HyperStack.mem", "LowStar.Monotonic.Buffer.live", "Prims.l_and", "LowStar.Monotonic.Buffer.modifies", "LowStar.Monotonic.Buffer.loc_buffer", "Prims.b2t", "Prims.op_GreaterThan", "LowStar.Monotonic.Buffer.length", "Prims.int", "Prims.l_or", "FStar.UInt.size", "FStar.UInt32.n", "Prims.op_GreaterThanOrEqual", "FStar.UInt32.v", "Prims.op_LessThanOrEqual", "FStar.Seq.Base.seq", "MiniParse.Spec.Base.byte", "LowStar.Monotonic.Buffer.as_seq", "MiniParse.Spec.Base.serialize", "LowStar.Monotonic.Buffer.mbuffer", "LowStar.Buffer.gsub", "FStar.UInt32.__uint_to_t", "Prims.logical", "Prims.nat", "FStar.Seq.Base.length" ]
[]
false
false
false
false
true
let serializer_impl (#t: Type0) (#p: parser_spec t) (s: serializer_spec p) : Tot Type0 =
output: buffer8 -> l: U32.t{l == B.len output} -> x: t -> HST.Stack (option U32.t) (requires (fun h -> B.live h output)) (ensures (fun h res h' -> B.live h output /\ B.live h' output /\ (let len = Seq.length (serialize s x) in match res with | None -> M.modifies (M.loc_buffer output) h h' /\ len > B.length output | Some len' -> U32.v len' == len /\ len <= B.length output /\ (let b' = B.gsub output 0ul len' in M.modifies (M.loc_buffer b') h h' /\ B.as_seq h' b' == serialize s x))))
false
Hacl.NaCl.fst
Hacl.NaCl.crypto_secretbox_open_easy
val crypto_secretbox_open_easy: m:buffer uint8 -> c:buffer uint8 -> clen:size_t{length c = v clen /\ v clen = length m + 16} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint m n /\ disjoint c n) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SS.secretbox_open_easy (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #clen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #(clen -! 16ul) h1 m == Some?.v msg | _ -> None? msg))
val crypto_secretbox_open_easy: m:buffer uint8 -> c:buffer uint8 -> clen:size_t{length c = v clen /\ v clen = length m + 16} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint m n /\ disjoint c n) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SS.secretbox_open_easy (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #clen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #(clen -! 16ul) h1 m == Some?.v msg | _ -> None? msg))
let crypto_secretbox_open_easy m c clen n k = Hacl.Impl.SecretBox.secretbox_open_easy (clen -! 16ul) m k n c
{ "file_name": "code/nacl-box/Hacl.NaCl.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 64, "end_line": 133, "start_col": 0, "start_line": 132 }
module Hacl.NaCl open FStar.HyperStack.All open FStar.HyperStack open FStar.Mul open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence module SB = Spec.Box module SS = Spec.SecretBox #set-options "--max_fuel 50 --max_fuel 0 --max_ifuel 0" [@@ Comment "Encrypt a message with a key and nonce. Note: `c` and `m` can point to the same memory for in-place encryption. @param c Pointer to `mlen` bytes where the ciphertext is written to. @param tag Pointer to 16 (tag length) bytes where the authentication tag is written to. @param m Pointer to `mlen` bytes where the message is read from. @param mlen Length of message. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_detached: c:buffer uint8 -> tag:lbuffer uint8 16ul -> m:buffer uint8 -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\ (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == SS.secretbox_detached (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_secretbox_detached c tag m mlen n k = Hacl.Impl.SecretBox.secretbox_detached mlen c tag k n m; 0ul [@@ Comment "Verify and decrypt a ciphertext produced with `Hacl_NaCl_crypto_secretbox_detached`. Note: `m` and `c` can point to the same memory for in-place decryption. @param m Pointer to `mlen` bytes where the message is written to. @param c Pointer to `mlen` bytes where the ciphertext is read from. @param tag Pointer to 16 (tag length) bytes where the authentication tag is read from. @param mlen Length of message (and ciphertext). @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_open_detached: m:buffer uint8 -> c:buffer uint8 -> tag:lbuffer uint8 16ul -> mlen:size_t{length c = v mlen /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ live h tag /\ disjoint tag c /\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\ disjoint tag m /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SS.secretbox_open_detached (as_seq h0 k) (as_seq h0 n) (as_seq h0 tag) (as_seq #MUT #uint8 #mlen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #mlen h1 m == Some?.v msg | _ -> None? msg)) let crypto_secretbox_open_detached m c tag mlen n k = Hacl.Impl.SecretBox.secretbox_open_detached mlen m k n c tag [@@ Comment "Encrypt a message with a key and nonce. @param c Pointer to 16 (tag length) + `mlen` bytes where the ciphertext is written to. @param m Pointer to `mlen` bytes where the message is read from. @param mlen Length of message. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_easy: c:buffer uint8 -> m:buffer uint8 -> mlen:size_t{length c = v mlen + 16 /\ length m = v mlen} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint n m /\ disjoint n c) (ensures fun h0 r h1 -> modifies1 c h0 h1 /\ as_seq #MUT #uint8 #(mlen +! 16ul) h1 c == SS.secretbox_easy (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m)) let crypto_secretbox_easy c m mlen n k = Hacl.Impl.SecretBox.secretbox_easy mlen c k n m; 0ul #set-options "--z3rlimit 100" [@@ Comment "Verify and decrypt a ciphertext produced with `crypto_secretbox_easy`. @param m Pointer to `mlen` bytes where the message is written to. @param c Pointer to `clen` bytes where the ciphertext is read from. The authentication tag must be included. @param clen Length of ciphertext. @param n Pointer to 24 (`crypto_secretbox_NONCEBYTES`) bytes where the nonce is read from. @param k Pointer to 32 (`crypto_secretbox_KEYBYTES`) bytes where the key is read from."] val crypto_secretbox_open_easy: m:buffer uint8 -> c:buffer uint8 -> clen:size_t{length c = v clen /\ v clen = length m + 16} -> n:lbuffer uint8 24ul -> k:lbuffer uint8 32ul -> Stack size_t (requires fun h -> live h c /\ live h m /\ live h k /\ live h n /\ disjoint m c /\ disjoint m n /\ disjoint c n) (ensures fun h0 r h1 -> modifies1 m h0 h1 /\ (let msg = SS.secretbox_open_easy (as_seq h0 k) (as_seq h0 n) (as_seq #MUT #uint8 #clen h0 c) in match r with | 0ul -> Some? msg /\ as_seq #MUT #uint8 #(clen -! 16ul) h1 m == Some?.v msg | _ -> None? msg))
{ "checked_file": "/", "dependencies": [ "Spec.SecretBox.fst.checked", "Spec.Box.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.SecretBox.fst.checked", "Hacl.Impl.Box.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.NaCl.fst" }
[ { "abbrev": true, "full_module": "Spec.SecretBox", "short_module": "SS" }, { "abbrev": true, "full_module": "Spec.Box", "short_module": "SB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "Hacl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
m: Lib.Buffer.buffer Lib.IntTypes.uint8 -> c: Lib.Buffer.buffer Lib.IntTypes.uint8 -> clen: Lib.IntTypes.size_t { Lib.Buffer.length c = Lib.IntTypes.v clen /\ Lib.IntTypes.v clen = Lib.Buffer.length m + 16 } -> n: Lib.Buffer.lbuffer Lib.IntTypes.uint8 24ul -> k: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul -> FStar.HyperStack.ST.Stack Lib.IntTypes.size_t
FStar.HyperStack.ST.Stack
[]
[]
[ "Lib.Buffer.buffer", "Lib.IntTypes.uint8", "Lib.IntTypes.size_t", "Prims.l_and", "Prims.b2t", "Prims.op_Equality", "Prims.int", "Prims.l_or", "Prims.op_GreaterThanOrEqual", "Lib.IntTypes.range", "Lib.IntTypes.U32", "Lib.Buffer.length", "Lib.Buffer.MUT", "Lib.IntTypes.v", "Lib.IntTypes.PUB", "Prims.op_Addition", "Lib.Buffer.lbuffer", "FStar.UInt32.__uint_to_t", "Hacl.Impl.SecretBox.secretbox_open_easy", "Lib.IntTypes.op_Subtraction_Bang" ]
[]
false
true
false
false
false
let crypto_secretbox_open_easy m c clen n k =
Hacl.Impl.SecretBox.secretbox_open_easy (clen -! 16ul) m k n c
false
HyE.HCCA2.fst
HyE.HCCA2.decrypt
val decrypt: skey -> c -> ML (option p )
val decrypt: skey -> c -> ML (option p )
let decrypt sk c = let (c0,c1) = c in match C.decrypt sk.cca_sk c0 with | Some k -> A.decrypt k c1 | None -> None
{ "file_name": "examples/crypto/HyE.HCCA2.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 18, "end_line": 58, "start_col": 0, "start_line": 54 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module HyE.HCCA2 open FStar.HyperStack.All open FStar.HyperStack.ST open HyE.Plain open HyE.PlainPKE open Platform.Bytes open FStar.HyperStack module B = Platform.Bytes module P = HyE.Plain module C = HyE.CCA2 module A = HyE.AE module RSA = HyE.RSA (* we idealize first CCA2, then AE *) noeq type pkey = | PKey: #region:C.rid{HyperStack.ST.witnessed (region_contains_pred region)} -> rawpk:RSA.pkey -> cca_pk:C.pkey -> pkey let access_pkraw (pk:pkey) = PKey?.rawpk pk noeq type skey = | SKey: cca_sk:C.skey -> pk:pkey -> skey let keygen parent = let cca_pk, cca_sk = C.keygen parent in let region = new_region parent in let pkey = PKey #region (C.access_pk_raw cca_pk) cca_pk in pkey, SKey cca_sk pkey let encrypt pk t = let region = new_region pk.region in let k = A.keygen region in ((C.encrypt pk.cca_pk k) ,(A.encrypt k t))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Platform.Bytes.fst.checked", "HyE.RSA.fst.checked", "HyE.PlainPKE.fst.checked", "HyE.Plain.fsti.checked", "HyE.CCA2.fsti.checked", "HyE.AE.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "HyE.HCCA2.fst" }
[ { "abbrev": true, "full_module": "HyE.RSA", "short_module": "RSA" }, { "abbrev": true, "full_module": "HyE.AE", "short_module": "A" }, { "abbrev": true, "full_module": "HyE.CCA2", "short_module": "C" }, { "abbrev": true, "full_module": "HyE.Plain", "short_module": "P" }, { "abbrev": true, "full_module": "Platform.Bytes", "short_module": "B" }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Platform.Bytes", "short_module": null }, { "abbrev": false, "full_module": "HyE.PlainPKE", "short_module": null }, { "abbrev": false, "full_module": "HyE.Plain", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "HyE", "short_module": null }, { "abbrev": false, "full_module": "HyE", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
sk: HyE.HCCA2.skey -> c: HyE.HCCA2.c -> FStar.HyperStack.All.ML (FStar.Pervasives.Native.option HyE.HCCA2.p)
FStar.HyperStack.All.ML
[]
[]
[ "HyE.HCCA2.skey", "HyE.HCCA2.c", "HyE.CCA2.cipher", "HyE.AE.cipher", "HyE.PlainPKE.t", "HyE.AE.decrypt", "FStar.Pervasives.Native.option", "HyE.AE.msg", "FStar.Pervasives.Native.None", "HyE.HCCA2.p", "HyE.CCA2.decrypt", "HyE.HCCA2.__proj__SKey__item__cca_sk" ]
[]
false
true
false
false
false
let decrypt sk c =
let c0, c1 = c in match C.decrypt sk.cca_sk c0 with | Some k -> A.decrypt k c1 | None -> None
false