effect
stringclasses 48
values | original_source_type
stringlengths 0
23k
| opens_and_abbrevs
listlengths 2
92
| isa_cross_project_example
bool 1
class | source_definition
stringlengths 9
57.9k
| partial_definition
stringlengths 7
23.3k
| is_div
bool 2
classes | is_type
null | is_proof
bool 2
classes | completed_definiton
stringlengths 1
250k
| dependencies
dict | effect_flags
sequencelengths 0
2
| ideal_premises
sequencelengths 0
236
| mutual_with
sequencelengths 0
11
| file_context
stringlengths 0
407k
| interleaved
bool 1
class | is_simply_typed
bool 2
classes | file_name
stringlengths 5
48
| vconfig
dict | is_simple_lemma
null | source_type
stringlengths 10
23k
| proof_features
sequencelengths 0
1
| name
stringlengths 8
95
| source
dict | verbose_type
stringlengths 1
7.42k
| source_range
dict |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Prims.Tot | val va_codegen_success_Memcpy : win:bool -> Tot va_pbool | [
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_codegen_success_Memcpy win =
(va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (if win then va_pbool_and
(va_codegen_success_InnerMemcpy ()) (va_ttrue ()) else va_pbool_and
(va_codegen_success_Mem64_lemma ()) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRax) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0)
(va_op_reg64_reg64 rRsi) 0 Secret)) (va_pbool_and (va_codegen_success_Mem64_lemma ())
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_opr_code_Mem64
(va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 Secret)) (va_pbool_and
(va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_pbool_and (va_codegen_success_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRcx) 8
Secret) (va_ttrue ()))))))) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue
())))) | val va_codegen_success_Memcpy : win:bool -> Tot va_pbool
let va_codegen_success_Memcpy win = | false | null | false | (va_pbool_and (va_codegen_success_CreateHeaplets ())
(va_pbool_and (if win
then va_pbool_and (va_codegen_success_InnerMemcpy ()) (va_ttrue ())
else
va_pbool_and (va_codegen_success_Mem64_lemma ())
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRax)
(va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0)
(va_op_reg64_reg64 rRsi)
0
Secret))
(va_pbool_and (va_codegen_success_Mem64_lemma ())
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx)
(va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0)
(va_op_reg64_reg64 rRsi)
8
Secret))
(va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet
1)
(va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRax)
0
Secret)
(va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet
1)
(va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRcx)
8
Secret)
(va_ttrue ())))))))
(va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue ())))) | {
"checked_file": "Vale.Test.X64.Vale_memcpy.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.Test.X64.Vale_memcpy.fst"
} | [
"total"
] | [
"Prims.bool",
"Vale.X64.Decls.va_pbool_and",
"Vale.X64.InsMem.va_codegen_success_CreateHeaplets",
"Vale.Test.X64.Vale_memcpy.va_codegen_success_InnerMemcpy",
"Vale.X64.Decls.va_ttrue",
"Vale.X64.InsMem.va_codegen_success_Mem64_lemma",
"Vale.X64.InsBasic.va_codegen_success_Mov64",
"Vale.X64.Decls.va_op_dst_opr64_reg64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.Decls.va_opr_code_Mem64",
"Vale.X64.Decls.va_op_heaplet_mem_heaplet",
"Vale.X64.Decls.va_op_reg64_reg64",
"Vale.X64.Machine_s.rRsi",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.InsMem.va_codegen_success_Store64_buffer",
"Vale.X64.Decls.va_op_reg_opr64_reg64",
"Vale.X64.Machine_s.rRdi",
"Vale.X64.Decls.va_pbool",
"Vale.X64.InsMem.va_codegen_success_DestroyHeaplets"
] | [] | module Vale.Test.X64.Vale_memcpy
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
#set-options "--z3rlimit 20"
//-- InnerMemcpy
val va_code_InnerMemcpy : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_InnerMemcpy () =
(va_Block (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64
rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_CCons (va_code_Load64_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRdx) 8
Secret) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64
rRcx) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8
Secret) (va_CNil ()))))))
val va_codegen_success_InnerMemcpy : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_InnerMemcpy () =
(va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_pbool_and
(va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9)
(va_op_reg_opr64_reg64 rRdx) 8 Secret) (va_pbool_and (va_codegen_success_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rRax) 0
Secret) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8 Secret) (va_ttrue ())))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_InnerMemcpy (va_mods:va_mods_t) (dst:buffer64) (src:buffer64) : (va_quickCode unit
(va_code_InnerMemcpy ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 38 column 18 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRdx) 0 Secret src 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 39 column 18 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9)
(va_op_reg_opr64_reg64 rRdx) 8 Secret src 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 40 column 19 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_reg_opr64_reg64 rRax) 0 Secret dst 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 41 column 19 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_reg_opr64_reg64 rR9) 8 Secret dst 1) (fun (va_s:va_state) _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 42 column 5 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(FStar.Seq.Base.equal #(Vale.X64.Memory.base_typ_as_vale_type Vale.X64.Memory.vuint64)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_s) dst)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_s) src))
(va_QEmpty (()))))))))
val va_lemma_InnerMemcpy : va_b0:va_code -> va_s0:va_state -> dst:buffer64 -> src:buffer64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_InnerMemcpy ()) va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdx va_s0) src 2
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\ Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint64 dst == 2))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\
Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ va_state_eq va_sM
(va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))
[@"opaque_to_smt"]
let va_lemma_InnerMemcpy va_b0 va_s0 dst src =
let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx;
va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_InnerMemcpy va_mods dst src in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_InnerMemcpy ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 21 column 1 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 35 column 63 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 36 column 57 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64
rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_InnerMemcpy (dst:buffer64) (src:buffer64) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64
rRdx va_s0) src 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64
(va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret
/\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 dst == 2 /\ (forall (va_x_mem:vale_heap)
(va_x_rax:nat64) (va_x_rcx:nat64) (va_x_r9:nat64) (va_x_heap1:vale_heap) . let va_sM =
va_upd_mem_heaplet 1 va_x_heap1 (va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rRcx va_x_rcx
(va_upd_reg64 rRax va_x_rax (va_upd_mem va_x_mem va_s0)))) in va_get_ok va_sM /\
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\
Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) ==> va_k va_sM (())))
val va_wpProof_InnerMemcpy : dst:buffer64 -> src:buffer64 -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_InnerMemcpy dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet
1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_InnerMemcpy dst src va_s0 va_k =
let (va_sM, va_f0) = va_lemma_InnerMemcpy (va_code_InnerMemcpy ()) va_s0 dst src in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM
(va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))));
va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64
rRax; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_InnerMemcpy (dst:buffer64) (src:buffer64) : (va_quickCode unit (va_code_InnerMemcpy
())) =
(va_QProc (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx;
va_Mod_reg64 rRax; va_Mod_mem]) (va_wp_InnerMemcpy dst src) (va_wpProof_InnerMemcpy dst src))
//--
//-- Memcpy
[@ "opaque_to_smt" va_qattr]
let va_code_Memcpy win =
(va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (if win then va_Block (va_CCons
(va_code_InnerMemcpy ()) (va_CNil ())) else va_Block (va_CCons (va_code_Mem64_lemma ())
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRax) (va_opr_code_Mem64
(va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 0 Secret)) (va_CCons
(va_code_Mem64_lemma ()) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx)
(va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 Secret)) (va_CCons
(va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRcx) 8
Secret) (va_CNil ())))))))) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))
[@ "opaque_to_smt" va_qattr] | false | true | Vale.Test.X64.Vale_memcpy.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_codegen_success_Memcpy : win:bool -> Tot va_pbool | [] | Vale.Test.X64.Vale_memcpy.va_codegen_success_Memcpy | {
"file_name": "obj/Vale.Test.X64.Vale_memcpy.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | win: Prims.bool -> Vale.X64.Decls.va_pbool | {
"end_col": 10,
"end_line": 167,
"start_col": 2,
"start_line": 156
} |
Prims.Tot | val va_wp_InnerMemcpy (dst src: buffer64) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 | [
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_wp_InnerMemcpy (dst:buffer64) (src:buffer64) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64
rRdx va_s0) src 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64
(va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret
/\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 dst == 2 /\ (forall (va_x_mem:vale_heap)
(va_x_rax:nat64) (va_x_rcx:nat64) (va_x_r9:nat64) (va_x_heap1:vale_heap) . let va_sM =
va_upd_mem_heaplet 1 va_x_heap1 (va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rRcx va_x_rcx
(va_upd_reg64 rRax va_x_rax (va_upd_mem va_x_mem va_s0)))) in va_get_ok va_sM /\
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\
Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) ==> va_k va_sM (()))) | val va_wp_InnerMemcpy (dst src: buffer64) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0
let va_wp_InnerMemcpy (dst src: buffer64) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 = | false | null | false | (va_get_ok va_s0 /\
Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0)
(va_get_reg64 rRdx va_s0)
src
2
(va_get_mem_layout va_s0)
Secret /\
Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRcx va_s0)
dst
2
(va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 dst == 2 /\
(forall (va_x_mem: vale_heap)
(va_x_rax: nat64)
(va_x_rcx: nat64)
(va_x_r9: nat64)
(va_x_heap1: vale_heap).
let va_sM =
va_upd_mem_heaplet 1
va_x_heap1
(va_upd_reg64 rR9
va_x_r9
(va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRax va_x_rax (va_upd_mem va_x_mem va_s0))))
in
va_get_ok va_sM /\
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\
Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) ==>
va_k va_sM (()))) | {
"checked_file": "Vale.Test.X64.Vale_memcpy.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.Test.X64.Vale_memcpy.fst"
} | [
"total"
] | [
"Vale.X64.Memory.buffer64",
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.X64.Decls.validSrcAddrs64",
"Vale.X64.Decls.va_get_mem_heaplet",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.X64.Decls.validDstAddrs64",
"Vale.X64.Machine_s.rRcx",
"Prims.eq2",
"Prims.int",
"Vale.X64.Decls.buffer_length",
"Vale.X64.Memory.vuint64",
"Prims.l_Forall",
"Vale.X64.InsBasic.vale_heap",
"Vale.X64.Memory.nat64",
"Prims.l_imp",
"FStar.Seq.Base.seq",
"Vale.X64.Memory.base_typ_as_vale_type",
"Vale.X64.Memory.buffer_as_seq",
"Vale.X64.Decls.modifies_mem",
"Vale.X64.Decls.loc_buffer",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_mem_heaplet",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRax",
"Vale.X64.Decls.va_upd_mem"
] | [] | module Vale.Test.X64.Vale_memcpy
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
#set-options "--z3rlimit 20"
//-- InnerMemcpy
val va_code_InnerMemcpy : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_InnerMemcpy () =
(va_Block (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64
rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_CCons (va_code_Load64_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRdx) 8
Secret) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64
rRcx) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8
Secret) (va_CNil ()))))))
val va_codegen_success_InnerMemcpy : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_InnerMemcpy () =
(va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_pbool_and
(va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9)
(va_op_reg_opr64_reg64 rRdx) 8 Secret) (va_pbool_and (va_codegen_success_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rRax) 0
Secret) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8 Secret) (va_ttrue ())))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_InnerMemcpy (va_mods:va_mods_t) (dst:buffer64) (src:buffer64) : (va_quickCode unit
(va_code_InnerMemcpy ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 38 column 18 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRdx) 0 Secret src 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 39 column 18 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9)
(va_op_reg_opr64_reg64 rRdx) 8 Secret src 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 40 column 19 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_reg_opr64_reg64 rRax) 0 Secret dst 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 41 column 19 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_reg_opr64_reg64 rR9) 8 Secret dst 1) (fun (va_s:va_state) _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 42 column 5 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(FStar.Seq.Base.equal #(Vale.X64.Memory.base_typ_as_vale_type Vale.X64.Memory.vuint64)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_s) dst)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_s) src))
(va_QEmpty (()))))))))
val va_lemma_InnerMemcpy : va_b0:va_code -> va_s0:va_state -> dst:buffer64 -> src:buffer64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_InnerMemcpy ()) va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdx va_s0) src 2
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\ Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint64 dst == 2))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\
Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ va_state_eq va_sM
(va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))
[@"opaque_to_smt"]
let va_lemma_InnerMemcpy va_b0 va_s0 dst src =
let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx;
va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_InnerMemcpy va_mods dst src in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_InnerMemcpy ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 21 column 1 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 35 column 63 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 36 column 57 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64
rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_InnerMemcpy (dst:buffer64) (src:buffer64) (va_s0:va_state) (va_k:(va_state -> unit -> | false | true | Vale.Test.X64.Vale_memcpy.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_wp_InnerMemcpy (dst src: buffer64) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 | [] | Vale.Test.X64.Vale_memcpy.va_wp_InnerMemcpy | {
"file_name": "obj/Vale.Test.X64.Vale_memcpy.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
dst: Vale.X64.Memory.buffer64 ->
src: Vale.X64.Memory.buffer64 ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | {
"end_col": 83,
"end_line": 111,
"start_col": 2,
"start_line": 100
} |
Prims.Tot | val va_qcode_InnerMemcpy (va_mods: va_mods_t) (dst src: buffer64)
: (va_quickCode unit (va_code_InnerMemcpy ())) | [
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_qcode_InnerMemcpy (va_mods:va_mods_t) (dst:buffer64) (src:buffer64) : (va_quickCode unit
(va_code_InnerMemcpy ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 38 column 18 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRdx) 0 Secret src 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 39 column 18 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9)
(va_op_reg_opr64_reg64 rRdx) 8 Secret src 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 40 column 19 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_reg_opr64_reg64 rRax) 0 Secret dst 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 41 column 19 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_reg_opr64_reg64 rR9) 8 Secret dst 1) (fun (va_s:va_state) _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 42 column 5 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(FStar.Seq.Base.equal #(Vale.X64.Memory.base_typ_as_vale_type Vale.X64.Memory.vuint64)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_s) dst)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_s) src))
(va_QEmpty (())))))))) | val va_qcode_InnerMemcpy (va_mods: va_mods_t) (dst src: buffer64)
: (va_quickCode unit (va_code_InnerMemcpy ()))
let va_qcode_InnerMemcpy (va_mods: va_mods_t) (dst src: buffer64)
: (va_quickCode unit (va_code_InnerMemcpy ())) = | false | null | false | (qblock va_mods
(fun (va_s: va_state) ->
let va_old_s:va_state = va_s in
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 38 column 18 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRdx)
0
Secret
src
0)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 39 column 18 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_dst_opr64_reg64 rR9)
(va_op_reg_opr64_reg64 rRdx)
8
Secret
src
1)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 40 column 19 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRcx)
(va_op_reg_opr64_reg64 rRax)
0
Secret
dst
0)
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 41 column 19 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRcx)
(va_op_reg_opr64_reg64 rR9)
8
Secret
dst
1)
(fun (va_s: va_state) _ ->
va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 42 column 5 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(FStar.Seq.Base.equal #(Vale.X64.Memory.base_typ_as_vale_type Vale.X64.Memory.vuint64
)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64
(va_get_mem_heaplet 1 va_s)
dst)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64
(va_get_mem_heaplet 0 va_s)
src))
(va_QEmpty (())))))))) | {
"checked_file": "Vale.Test.X64.Vale_memcpy.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.Test.X64.Vale_memcpy.fst"
} | [
"total"
] | [
"Vale.X64.QuickCode.va_mods_t",
"Vale.X64.Memory.buffer64",
"Vale.X64.QuickCodes.qblock",
"Prims.unit",
"Prims.Cons",
"Vale.X64.Decls.va_code",
"Vale.X64.InsMem.va_code_Load64_buffer",
"Vale.X64.Decls.va_op_heaplet_mem_heaplet",
"Vale.X64.Decls.va_op_dst_opr64_reg64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.Decls.va_op_reg_opr64_reg64",
"Vale.X64.Machine_s.rRdx",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.X64.Machine_s.rR9",
"Vale.X64.InsMem.va_code_Store64_buffer",
"Vale.X64.Machine_s.rRcx",
"Prims.Nil",
"Vale.X64.Machine_s.precode",
"Vale.X64.Decls.ins",
"Vale.X64.Decls.ocmp",
"Vale.X64.Decls.va_state",
"Vale.X64.QuickCodes.va_QSeq",
"Vale.X64.QuickCodes.va_range1",
"Vale.X64.InsMem.va_quick_Load64_buffer",
"Vale.X64.InsMem.va_quick_Store64_buffer",
"Vale.X64.QuickCodes.va_QBind",
"Vale.X64.QuickCodes.va_qAssert",
"FStar.Seq.Base.equal",
"Vale.X64.Memory.base_typ_as_vale_type",
"Vale.X64.Memory.vuint64",
"Vale.X64.Memory.buffer_as_seq",
"Vale.X64.Decls.va_get_mem_heaplet",
"Vale.X64.QuickCodes.va_QEmpty",
"Vale.X64.QuickCodes.quickCodes",
"Vale.X64.State.vale_state",
"Vale.X64.QuickCode.va_quickCode",
"Vale.Test.X64.Vale_memcpy.va_code_InnerMemcpy"
] | [] | module Vale.Test.X64.Vale_memcpy
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
#set-options "--z3rlimit 20"
//-- InnerMemcpy
val va_code_InnerMemcpy : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_InnerMemcpy () =
(va_Block (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64
rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_CCons (va_code_Load64_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRdx) 8
Secret) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64
rRcx) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8
Secret) (va_CNil ()))))))
val va_codegen_success_InnerMemcpy : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_InnerMemcpy () =
(va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_pbool_and
(va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9)
(va_op_reg_opr64_reg64 rRdx) 8 Secret) (va_pbool_and (va_codegen_success_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rRax) 0
Secret) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8 Secret) (va_ttrue ())))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_InnerMemcpy (va_mods:va_mods_t) (dst:buffer64) (src:buffer64) : (va_quickCode unit | false | false | Vale.Test.X64.Vale_memcpy.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_qcode_InnerMemcpy (va_mods: va_mods_t) (dst src: buffer64)
: (va_quickCode unit (va_code_InnerMemcpy ())) | [] | Vale.Test.X64.Vale_memcpy.va_qcode_InnerMemcpy | {
"file_name": "obj/Vale.Test.X64.Vale_memcpy.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
va_mods: Vale.X64.QuickCode.va_mods_t ->
dst: Vale.X64.Memory.buffer64 ->
src: Vale.X64.Memory.buffer64
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.Test.X64.Vale_memcpy.va_code_InnerMemcpy ()) | {
"end_col": 26,
"end_line": 58,
"start_col": 2,
"start_line": 41
} |
Prims.Tot | val va_code_Memcpy : win:bool -> Tot va_code | [
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_code_Memcpy win =
(va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (if win then va_Block (va_CCons
(va_code_InnerMemcpy ()) (va_CNil ())) else va_Block (va_CCons (va_code_Mem64_lemma ())
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRax) (va_opr_code_Mem64
(va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 0 Secret)) (va_CCons
(va_code_Mem64_lemma ()) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx)
(va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 Secret)) (va_CCons
(va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRcx) 8
Secret) (va_CNil ())))))))) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ()))))) | val va_code_Memcpy : win:bool -> Tot va_code
let va_code_Memcpy win = | false | null | false | (va_Block (va_CCons (va_code_CreateHeaplets ())
(va_CCons (if win
then va_Block (va_CCons (va_code_InnerMemcpy ()) (va_CNil ()))
else
va_Block (va_CCons (va_code_Mem64_lemma ())
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRax)
(va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0)
(va_op_reg64_reg64 rRsi)
0
Secret))
(va_CCons (va_code_Mem64_lemma ())
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx)
(va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0)
(va_op_reg64_reg64 rRsi)
8
Secret))
(va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRax)
0
Secret)
(va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1
)
(va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRcx)
8
Secret)
(va_CNil ()))))))))
(va_CCons (va_code_DestroyHeaplets ()) (va_CNil ()))))) | {
"checked_file": "Vale.Test.X64.Vale_memcpy.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.Test.X64.Vale_memcpy.fst"
} | [
"total"
] | [
"Prims.bool",
"Vale.X64.Decls.va_Block",
"Vale.X64.Decls.va_CCons",
"Vale.X64.InsMem.va_code_CreateHeaplets",
"Vale.Test.X64.Vale_memcpy.va_code_InnerMemcpy",
"Vale.X64.Decls.va_CNil",
"Vale.X64.InsMem.va_code_Mem64_lemma",
"Vale.X64.InsBasic.va_code_Mov64",
"Vale.X64.Decls.va_op_dst_opr64_reg64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.Decls.va_opr_code_Mem64",
"Vale.X64.Decls.va_op_heaplet_mem_heaplet",
"Vale.X64.Decls.va_op_reg64_reg64",
"Vale.X64.Machine_s.rRsi",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.InsMem.va_code_Store64_buffer",
"Vale.X64.Decls.va_op_reg_opr64_reg64",
"Vale.X64.Machine_s.rRdi",
"Vale.X64.Decls.va_code",
"Vale.X64.InsMem.va_code_DestroyHeaplets"
] | [] | module Vale.Test.X64.Vale_memcpy
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
#set-options "--z3rlimit 20"
//-- InnerMemcpy
val va_code_InnerMemcpy : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_InnerMemcpy () =
(va_Block (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64
rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_CCons (va_code_Load64_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRdx) 8
Secret) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64
rRcx) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8
Secret) (va_CNil ()))))))
val va_codegen_success_InnerMemcpy : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_InnerMemcpy () =
(va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_pbool_and
(va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9)
(va_op_reg_opr64_reg64 rRdx) 8 Secret) (va_pbool_and (va_codegen_success_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rRax) 0
Secret) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8 Secret) (va_ttrue ())))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_InnerMemcpy (va_mods:va_mods_t) (dst:buffer64) (src:buffer64) : (va_quickCode unit
(va_code_InnerMemcpy ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 38 column 18 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRdx) 0 Secret src 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 39 column 18 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9)
(va_op_reg_opr64_reg64 rRdx) 8 Secret src 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 40 column 19 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_reg_opr64_reg64 rRax) 0 Secret dst 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 41 column 19 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_reg_opr64_reg64 rR9) 8 Secret dst 1) (fun (va_s:va_state) _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 42 column 5 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(FStar.Seq.Base.equal #(Vale.X64.Memory.base_typ_as_vale_type Vale.X64.Memory.vuint64)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_s) dst)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_s) src))
(va_QEmpty (()))))))))
val va_lemma_InnerMemcpy : va_b0:va_code -> va_s0:va_state -> dst:buffer64 -> src:buffer64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_InnerMemcpy ()) va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdx va_s0) src 2
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\ Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint64 dst == 2))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\
Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ va_state_eq va_sM
(va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))
[@"opaque_to_smt"]
let va_lemma_InnerMemcpy va_b0 va_s0 dst src =
let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx;
va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_InnerMemcpy va_mods dst src in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_InnerMemcpy ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 21 column 1 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 35 column 63 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 36 column 57 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64
rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_InnerMemcpy (dst:buffer64) (src:buffer64) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64
rRdx va_s0) src 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64
(va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret
/\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 dst == 2 /\ (forall (va_x_mem:vale_heap)
(va_x_rax:nat64) (va_x_rcx:nat64) (va_x_r9:nat64) (va_x_heap1:vale_heap) . let va_sM =
va_upd_mem_heaplet 1 va_x_heap1 (va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rRcx va_x_rcx
(va_upd_reg64 rRax va_x_rax (va_upd_mem va_x_mem va_s0)))) in va_get_ok va_sM /\
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\
Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) ==> va_k va_sM (())))
val va_wpProof_InnerMemcpy : dst:buffer64 -> src:buffer64 -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_InnerMemcpy dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet
1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_InnerMemcpy dst src va_s0 va_k =
let (va_sM, va_f0) = va_lemma_InnerMemcpy (va_code_InnerMemcpy ()) va_s0 dst src in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM
(va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))));
va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64
rRax; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_InnerMemcpy (dst:buffer64) (src:buffer64) : (va_quickCode unit (va_code_InnerMemcpy
())) =
(va_QProc (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx;
va_Mod_reg64 rRax; va_Mod_mem]) (va_wp_InnerMemcpy dst src) (va_wpProof_InnerMemcpy dst src))
//--
//-- Memcpy
[@ "opaque_to_smt" va_qattr] | false | true | Vale.Test.X64.Vale_memcpy.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_code_Memcpy : win:bool -> Tot va_code | [] | Vale.Test.X64.Vale_memcpy.va_code_Memcpy | {
"file_name": "obj/Vale.Test.X64.Vale_memcpy.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | win: Prims.bool -> Vale.X64.Decls.va_code | {
"end_col": 87,
"end_line": 152,
"start_col": 2,
"start_line": 143
} |
Prims.Tot | val va_qcode_Memcpy (va_mods: va_mods_t) (win: bool) (dst src: buffer64)
: (va_quickCode unit (va_code_Memcpy win)) | [
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_qcode_Memcpy (va_mods:va_mods_t) (win:bool) (dst:buffer64) (src:buffer64) : (va_quickCode
unit (va_code_Memcpy win)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 67 column 19 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_CreateHeaplets ([declare_buffer64 src 0 Secret Immutable; declare_buffer64 dst 1
Secret Mutable])) (fun (va_s:va_state) _ -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 71 column 15 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 73 column 20 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_InnerMemcpy dst src) (va_QEmpty (())))) (qblock va_mods (fun (va_s:va_state) ->
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 77 column 26 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Mem64_lemma (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 0 src 0 Secret)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 77 column 14 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0)
(va_op_reg64_reg64 rRsi) 0 Secret)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 78 column 26 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Mem64_lemma (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 src 1 Secret)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 78 column 14 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0)
(va_op_reg64_reg64 rRsi) 8 Secret)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 79 column 23 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRax) 0 Secret dst 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 80 column 23 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRcx) 8 Secret dst 1) (va_QEmpty (())))))))))) (fun (va_s:va_state) va_g
-> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 82 column 5 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(FStar.Seq.Base.equal #(Vale.X64.Memory.base_typ_as_vale_type Vale.X64.Memory.vuint64)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_s) dst)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_s) src))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 84 column 20 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))) | val va_qcode_Memcpy (va_mods: va_mods_t) (win: bool) (dst src: buffer64)
: (va_quickCode unit (va_code_Memcpy win))
let va_qcode_Memcpy (va_mods: va_mods_t) (win: bool) (dst src: buffer64)
: (va_quickCode unit (va_code_Memcpy win)) = | false | null | false | (qblock va_mods
(fun (va_s: va_state) ->
let va_old_s:va_state = va_s in
va_QBind va_range1
"***** PRECONDITION NOT MET AT line 67 column 19 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_CreateHeaplets ([
declare_buffer64 src 0 Secret Immutable;
declare_buffer64 dst 1 Secret Mutable
]))
(fun (va_s: va_state) _ ->
va_QBind va_range1
"***** PRECONDITION NOT MET AT line 71 column 15 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_qInlineIf va_mods
win
(qblock va_mods
(fun (va_s: va_state) ->
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 73 column 20 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_InnerMemcpy dst src)
(va_QEmpty (()))))
(qblock va_mods
(fun (va_s: va_state) ->
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 77 column 26 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Mem64_lemma (va_op_heaplet_mem_heaplet 0)
(va_op_reg64_reg64 rRsi)
0
src
0
Secret)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 77 column 14 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax)
(va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0)
(va_op_reg64_reg64 rRsi)
0
Secret))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 78 column 26 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Mem64_lemma (va_op_heaplet_mem_heaplet 0)
(va_op_reg64_reg64 rRsi)
8
src
1
Secret)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 78 column 14 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx)
(va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0)
(va_op_reg64_reg64 rRsi)
8
Secret))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 79 column 23 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRax)
0
Secret
dst
0)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 80 column 23 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet
1)
(va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRcx)
8
Secret
dst
1)
(va_QEmpty (()))))))))))
(fun (va_s: va_state) va_g ->
va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 82 column 5 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(FStar.Seq.Base.equal #(Vale.X64.Memory.base_typ_as_vale_type Vale.X64.Memory.vuint64
)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64
(va_get_mem_heaplet 1 va_s)
dst)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64
(va_get_mem_heaplet 0 va_s)
src))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 84 column 20 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_DestroyHeaplets ())
(va_QEmpty (()))))))) | {
"checked_file": "Vale.Test.X64.Vale_memcpy.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.Test.X64.Vale_memcpy.fst"
} | [
"total"
] | [
"Vale.X64.QuickCode.va_mods_t",
"Prims.bool",
"Vale.X64.Memory.buffer64",
"Vale.X64.QuickCodes.qblock",
"Prims.unit",
"Prims.Cons",
"Vale.X64.Decls.va_code",
"Vale.X64.InsMem.va_code_CreateHeaplets",
"Vale.X64.QuickCodes.if_code",
"Vale.X64.QuickCodes.block",
"Vale.Test.X64.Vale_memcpy.va_code_InnerMemcpy",
"Prims.Nil",
"Vale.X64.Machine_s.precode",
"Vale.X64.Decls.ins",
"Vale.X64.Decls.ocmp",
"Vale.X64.InsMem.va_code_Mem64_lemma",
"Vale.X64.InsBasic.va_code_Mov64",
"Vale.X64.Decls.va_op_dst_opr64_reg64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.Decls.va_opr_code_Mem64",
"Vale.X64.Decls.va_op_heaplet_mem_heaplet",
"Vale.X64.Decls.va_op_reg64_reg64",
"Vale.X64.Machine_s.rRsi",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.InsMem.va_code_Store64_buffer",
"Vale.X64.Decls.va_op_reg_opr64_reg64",
"Vale.X64.Machine_s.rRdi",
"Vale.X64.InsMem.va_code_DestroyHeaplets",
"Vale.X64.Decls.va_state",
"Vale.X64.QuickCodes.va_QBind",
"Vale.X64.QuickCodes.va_range1",
"Vale.X64.InsMem.va_quick_CreateHeaplets",
"Vale.Arch.HeapImpl.buffer_info",
"Vale.X64.InsMem.declare_buffer64",
"Vale.Arch.HeapImpl.Immutable",
"Vale.Arch.HeapImpl.Mutable",
"Vale.X64.QuickCodes.va_qInlineIf",
"Vale.X64.QuickCodes.va_QSeq",
"Vale.Test.X64.Vale_memcpy.va_quick_InnerMemcpy",
"Vale.X64.QuickCodes.va_QEmpty",
"Vale.X64.QuickCodes.quickCodes",
"Vale.X64.InsMem.va_quick_Mem64_lemma",
"Vale.X64.InsBasic.va_quick_Mov64",
"Vale.X64.InsMem.va_quick_Store64_buffer",
"Vale.X64.QuickCodes.va_qAssert",
"FStar.Seq.Base.equal",
"Vale.X64.Memory.base_typ_as_vale_type",
"Vale.X64.Memory.vuint64",
"Vale.X64.Memory.buffer_as_seq",
"Vale.X64.Decls.va_get_mem_heaplet",
"Vale.X64.InsMem.va_quick_DestroyHeaplets",
"Vale.X64.State.vale_state",
"Vale.X64.QuickCode.va_quickCode",
"Vale.Test.X64.Vale_memcpy.va_code_Memcpy"
] | [] | module Vale.Test.X64.Vale_memcpy
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
#set-options "--z3rlimit 20"
//-- InnerMemcpy
val va_code_InnerMemcpy : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_InnerMemcpy () =
(va_Block (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64
rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_CCons (va_code_Load64_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRdx) 8
Secret) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64
rRcx) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8
Secret) (va_CNil ()))))))
val va_codegen_success_InnerMemcpy : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_InnerMemcpy () =
(va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_pbool_and
(va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9)
(va_op_reg_opr64_reg64 rRdx) 8 Secret) (va_pbool_and (va_codegen_success_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rRax) 0
Secret) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8 Secret) (va_ttrue ())))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_InnerMemcpy (va_mods:va_mods_t) (dst:buffer64) (src:buffer64) : (va_quickCode unit
(va_code_InnerMemcpy ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 38 column 18 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRdx) 0 Secret src 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 39 column 18 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9)
(va_op_reg_opr64_reg64 rRdx) 8 Secret src 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 40 column 19 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_reg_opr64_reg64 rRax) 0 Secret dst 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 41 column 19 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_reg_opr64_reg64 rR9) 8 Secret dst 1) (fun (va_s:va_state) _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 42 column 5 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(FStar.Seq.Base.equal #(Vale.X64.Memory.base_typ_as_vale_type Vale.X64.Memory.vuint64)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_s) dst)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_s) src))
(va_QEmpty (()))))))))
val va_lemma_InnerMemcpy : va_b0:va_code -> va_s0:va_state -> dst:buffer64 -> src:buffer64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_InnerMemcpy ()) va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdx va_s0) src 2
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\ Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint64 dst == 2))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\
Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ va_state_eq va_sM
(va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))
[@"opaque_to_smt"]
let va_lemma_InnerMemcpy va_b0 va_s0 dst src =
let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx;
va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_InnerMemcpy va_mods dst src in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_InnerMemcpy ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 21 column 1 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 35 column 63 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 36 column 57 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64
rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_InnerMemcpy (dst:buffer64) (src:buffer64) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64
rRdx va_s0) src 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64
(va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret
/\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 dst == 2 /\ (forall (va_x_mem:vale_heap)
(va_x_rax:nat64) (va_x_rcx:nat64) (va_x_r9:nat64) (va_x_heap1:vale_heap) . let va_sM =
va_upd_mem_heaplet 1 va_x_heap1 (va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rRcx va_x_rcx
(va_upd_reg64 rRax va_x_rax (va_upd_mem va_x_mem va_s0)))) in va_get_ok va_sM /\
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\
Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) ==> va_k va_sM (())))
val va_wpProof_InnerMemcpy : dst:buffer64 -> src:buffer64 -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_InnerMemcpy dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet
1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_InnerMemcpy dst src va_s0 va_k =
let (va_sM, va_f0) = va_lemma_InnerMemcpy (va_code_InnerMemcpy ()) va_s0 dst src in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM
(va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))));
va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64
rRax; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_InnerMemcpy (dst:buffer64) (src:buffer64) : (va_quickCode unit (va_code_InnerMemcpy
())) =
(va_QProc (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx;
va_Mod_reg64 rRax; va_Mod_mem]) (va_wp_InnerMemcpy dst src) (va_wpProof_InnerMemcpy dst src))
//--
//-- Memcpy
[@ "opaque_to_smt" va_qattr]
let va_code_Memcpy win =
(va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (if win then va_Block (va_CCons
(va_code_InnerMemcpy ()) (va_CNil ())) else va_Block (va_CCons (va_code_Mem64_lemma ())
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRax) (va_opr_code_Mem64
(va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 0 Secret)) (va_CCons
(va_code_Mem64_lemma ()) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx)
(va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 Secret)) (va_CCons
(va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRcx) 8
Secret) (va_CNil ())))))))) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Memcpy win =
(va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (if win then va_pbool_and
(va_codegen_success_InnerMemcpy ()) (va_ttrue ()) else va_pbool_and
(va_codegen_success_Mem64_lemma ()) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRax) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0)
(va_op_reg64_reg64 rRsi) 0 Secret)) (va_pbool_and (va_codegen_success_Mem64_lemma ())
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_opr_code_Mem64
(va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 Secret)) (va_pbool_and
(va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_pbool_and (va_codegen_success_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRcx) 8
Secret) (va_ttrue ()))))))) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue
()))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Memcpy (va_mods:va_mods_t) (win:bool) (dst:buffer64) (src:buffer64) : (va_quickCode | false | false | Vale.Test.X64.Vale_memcpy.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_qcode_Memcpy (va_mods: va_mods_t) (win: bool) (dst src: buffer64)
: (va_quickCode unit (va_code_Memcpy win)) | [] | Vale.Test.X64.Vale_memcpy.va_qcode_Memcpy | {
"file_name": "obj/Vale.Test.X64.Vale_memcpy.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
va_mods: Vale.X64.QuickCode.va_mods_t ->
win: Prims.bool ->
dst: Vale.X64.Memory.buffer64 ->
src: Vale.X64.Memory.buffer64
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.Test.X64.Vale_memcpy.va_code_Memcpy win) | {
"end_col": 55,
"end_line": 206,
"start_col": 2,
"start_line": 172
} |
Prims.Tot | val va_quick_InnerMemcpy (dst src: buffer64) : (va_quickCode unit (va_code_InnerMemcpy ())) | [
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_quick_InnerMemcpy (dst:buffer64) (src:buffer64) : (va_quickCode unit (va_code_InnerMemcpy
())) =
(va_QProc (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx;
va_Mod_reg64 rRax; va_Mod_mem]) (va_wp_InnerMemcpy dst src) (va_wpProof_InnerMemcpy dst src)) | val va_quick_InnerMemcpy (dst src: buffer64) : (va_quickCode unit (va_code_InnerMemcpy ()))
let va_quick_InnerMemcpy (dst src: buffer64) : (va_quickCode unit (va_code_InnerMemcpy ())) = | false | null | false | (va_QProc (va_code_InnerMemcpy ())
([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem])
(va_wp_InnerMemcpy dst src)
(va_wpProof_InnerMemcpy dst src)) | {
"checked_file": "Vale.Test.X64.Vale_memcpy.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.Test.X64.Vale_memcpy.fst"
} | [
"total"
] | [
"Vale.X64.Memory.buffer64",
"Vale.X64.QuickCode.va_QProc",
"Prims.unit",
"Vale.Test.X64.Vale_memcpy.va_code_InnerMemcpy",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_mem_heaplet",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRax",
"Vale.X64.QuickCode.va_Mod_mem",
"Prims.Nil",
"Vale.Test.X64.Vale_memcpy.va_wp_InnerMemcpy",
"Vale.Test.X64.Vale_memcpy.va_wpProof_InnerMemcpy",
"Vale.X64.QuickCode.va_quickCode"
] | [] | module Vale.Test.X64.Vale_memcpy
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
#set-options "--z3rlimit 20"
//-- InnerMemcpy
val va_code_InnerMemcpy : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_InnerMemcpy () =
(va_Block (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64
rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_CCons (va_code_Load64_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRdx) 8
Secret) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64
rRcx) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8
Secret) (va_CNil ()))))))
val va_codegen_success_InnerMemcpy : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_InnerMemcpy () =
(va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_pbool_and
(va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9)
(va_op_reg_opr64_reg64 rRdx) 8 Secret) (va_pbool_and (va_codegen_success_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rRax) 0
Secret) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8 Secret) (va_ttrue ())))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_InnerMemcpy (va_mods:va_mods_t) (dst:buffer64) (src:buffer64) : (va_quickCode unit
(va_code_InnerMemcpy ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 38 column 18 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRdx) 0 Secret src 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 39 column 18 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9)
(va_op_reg_opr64_reg64 rRdx) 8 Secret src 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 40 column 19 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_reg_opr64_reg64 rRax) 0 Secret dst 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 41 column 19 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_reg_opr64_reg64 rR9) 8 Secret dst 1) (fun (va_s:va_state) _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 42 column 5 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(FStar.Seq.Base.equal #(Vale.X64.Memory.base_typ_as_vale_type Vale.X64.Memory.vuint64)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_s) dst)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_s) src))
(va_QEmpty (()))))))))
val va_lemma_InnerMemcpy : va_b0:va_code -> va_s0:va_state -> dst:buffer64 -> src:buffer64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_InnerMemcpy ()) va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdx va_s0) src 2
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\ Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint64 dst == 2))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\
Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ va_state_eq va_sM
(va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))
[@"opaque_to_smt"]
let va_lemma_InnerMemcpy va_b0 va_s0 dst src =
let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx;
va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_InnerMemcpy va_mods dst src in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_InnerMemcpy ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 21 column 1 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 35 column 63 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 36 column 57 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64
rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_InnerMemcpy (dst:buffer64) (src:buffer64) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64
rRdx va_s0) src 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64
(va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret
/\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 dst == 2 /\ (forall (va_x_mem:vale_heap)
(va_x_rax:nat64) (va_x_rcx:nat64) (va_x_r9:nat64) (va_x_heap1:vale_heap) . let va_sM =
va_upd_mem_heaplet 1 va_x_heap1 (va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rRcx va_x_rcx
(va_upd_reg64 rRax va_x_rax (va_upd_mem va_x_mem va_s0)))) in va_get_ok va_sM /\
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\
Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) ==> va_k va_sM (())))
val va_wpProof_InnerMemcpy : dst:buffer64 -> src:buffer64 -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_InnerMemcpy dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet
1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_InnerMemcpy dst src va_s0 va_k =
let (va_sM, va_f0) = va_lemma_InnerMemcpy (va_code_InnerMemcpy ()) va_s0 dst src in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM
(va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))));
va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64
rRax; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_InnerMemcpy (dst:buffer64) (src:buffer64) : (va_quickCode unit (va_code_InnerMemcpy | false | false | Vale.Test.X64.Vale_memcpy.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_quick_InnerMemcpy (dst src: buffer64) : (va_quickCode unit (va_code_InnerMemcpy ())) | [] | Vale.Test.X64.Vale_memcpy.va_quick_InnerMemcpy | {
"file_name": "obj/Vale.Test.X64.Vale_memcpy.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | dst: Vale.X64.Memory.buffer64 -> src: Vale.X64.Memory.buffer64
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.Test.X64.Vale_memcpy.va_code_InnerMemcpy ()) | {
"end_col": 97,
"end_line": 137,
"start_col": 2,
"start_line": 136
} |
Prims.Ghost | val va_wpProof_InnerMemcpy : dst:buffer64 -> src:buffer64 -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_InnerMemcpy dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet
1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0 va_k ((va_sM,
va_f0, va_g)))) | [
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_wpProof_InnerMemcpy dst src va_s0 va_k =
let (va_sM, va_f0) = va_lemma_InnerMemcpy (va_code_InnerMemcpy ()) va_s0 dst src in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM
(va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))));
va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64
rRax; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | val va_wpProof_InnerMemcpy : dst:buffer64 -> src:buffer64 -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_InnerMemcpy dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet
1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0 va_k ((va_sM,
va_f0, va_g))))
let va_wpProof_InnerMemcpy dst src va_s0 va_k = | false | null | false | let va_sM, va_f0 = va_lemma_InnerMemcpy (va_code_InnerMemcpy ()) va_s0 dst src in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM
(va_update_mem_heaplet 1
va_sM
(va_update_reg64 rR9
va_sM
(va_update_reg64 rRcx
va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))));
va_lemma_norm_mods ([
va_Mod_mem_heaplet 1;
va_Mod_reg64 rR9;
va_Mod_reg64 rRcx;
va_Mod_reg64 rRax;
va_Mod_mem
])
va_sM
va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | {
"checked_file": "Vale.Test.X64.Vale_memcpy.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.Test.X64.Vale_memcpy.fst"
} | [] | [
"Vale.X64.Memory.buffer64",
"Vale.X64.Decls.va_state",
"Prims.unit",
"Vale.X64.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple3",
"Vale.X64.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_mem_heaplet",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRax",
"Vale.X64.QuickCode.va_Mod_mem",
"Prims.Nil",
"Prims._assert",
"Vale.X64.Decls.va_state_eq",
"Vale.X64.Decls.va_update_mem_heaplet",
"Vale.X64.Decls.va_update_reg64",
"Vale.X64.Decls.va_update_ok",
"Vale.X64.Decls.va_update_mem",
"Vale.X64.Decls.va_lemma_upd_update",
"FStar.Pervasives.Native.tuple3",
"FStar.Pervasives.Native.tuple2",
"Vale.X64.State.vale_state",
"Vale.Test.X64.Vale_memcpy.va_lemma_InnerMemcpy",
"Vale.Test.X64.Vale_memcpy.va_code_InnerMemcpy"
] | [] | module Vale.Test.X64.Vale_memcpy
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
#set-options "--z3rlimit 20"
//-- InnerMemcpy
val va_code_InnerMemcpy : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_InnerMemcpy () =
(va_Block (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64
rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_CCons (va_code_Load64_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRdx) 8
Secret) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64
rRcx) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8
Secret) (va_CNil ()))))))
val va_codegen_success_InnerMemcpy : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_InnerMemcpy () =
(va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_pbool_and
(va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9)
(va_op_reg_opr64_reg64 rRdx) 8 Secret) (va_pbool_and (va_codegen_success_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rRax) 0
Secret) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8 Secret) (va_ttrue ())))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_InnerMemcpy (va_mods:va_mods_t) (dst:buffer64) (src:buffer64) : (va_quickCode unit
(va_code_InnerMemcpy ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 38 column 18 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRdx) 0 Secret src 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 39 column 18 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9)
(va_op_reg_opr64_reg64 rRdx) 8 Secret src 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 40 column 19 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_reg_opr64_reg64 rRax) 0 Secret dst 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 41 column 19 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_reg_opr64_reg64 rR9) 8 Secret dst 1) (fun (va_s:va_state) _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 42 column 5 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(FStar.Seq.Base.equal #(Vale.X64.Memory.base_typ_as_vale_type Vale.X64.Memory.vuint64)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_s) dst)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_s) src))
(va_QEmpty (()))))))))
val va_lemma_InnerMemcpy : va_b0:va_code -> va_s0:va_state -> dst:buffer64 -> src:buffer64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_InnerMemcpy ()) va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdx va_s0) src 2
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\ Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint64 dst == 2))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\
Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ va_state_eq va_sM
(va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))
[@"opaque_to_smt"]
let va_lemma_InnerMemcpy va_b0 va_s0 dst src =
let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx;
va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_InnerMemcpy va_mods dst src in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_InnerMemcpy ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 21 column 1 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 35 column 63 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 36 column 57 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64
rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_InnerMemcpy (dst:buffer64) (src:buffer64) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64
rRdx va_s0) src 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64
(va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret
/\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 dst == 2 /\ (forall (va_x_mem:vale_heap)
(va_x_rax:nat64) (va_x_rcx:nat64) (va_x_r9:nat64) (va_x_heap1:vale_heap) . let va_sM =
va_upd_mem_heaplet 1 va_x_heap1 (va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rRcx va_x_rcx
(va_upd_reg64 rRax va_x_rax (va_upd_mem va_x_mem va_s0)))) in va_get_ok va_sM /\
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\
Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) ==> va_k va_sM (())))
val va_wpProof_InnerMemcpy : dst:buffer64 -> src:buffer64 -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_InnerMemcpy dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet
1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0 va_k ((va_sM,
va_f0, va_g)))) | false | false | Vale.Test.X64.Vale_memcpy.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_wpProof_InnerMemcpy : dst:buffer64 -> src:buffer64 -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_InnerMemcpy dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet
1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0 va_k ((va_sM,
va_f0, va_g)))) | [] | Vale.Test.X64.Vale_memcpy.va_wpProof_InnerMemcpy | {
"file_name": "obj/Vale.Test.X64.Vale_memcpy.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
dst: Vale.X64.Memory.buffer64 ->
src: Vale.X64.Memory.buffer64 ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Prims.Ghost ((Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) * Prims.unit) | {
"end_col": 22,
"end_line": 131,
"start_col": 47,
"start_line": 122
} |
Prims.Ghost | val va_lemma_InnerMemcpy : va_b0:va_code -> va_s0:va_state -> dst:buffer64 -> src:buffer64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_InnerMemcpy ()) va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdx va_s0) src 2
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\ Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint64 dst == 2))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\
Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ va_state_eq va_sM
(va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))) | [
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_lemma_InnerMemcpy va_b0 va_s0 dst src =
let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx;
va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_InnerMemcpy va_mods dst src in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_InnerMemcpy ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 21 column 1 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 35 column 63 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 36 column 57 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64
rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM) | val va_lemma_InnerMemcpy : va_b0:va_code -> va_s0:va_state -> dst:buffer64 -> src:buffer64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_InnerMemcpy ()) va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdx va_s0) src 2
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\ Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint64 dst == 2))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\
Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ va_state_eq va_sM
(va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))
let va_lemma_InnerMemcpy va_b0 va_s0 dst src = | false | null | false | let va_mods:va_mods_t =
[
va_Mod_mem_heaplet 1;
va_Mod_reg64 rR9;
va_Mod_reg64 rRcx;
va_Mod_reg64 rRax;
va_Mod_ok;
va_Mod_mem
]
in
let va_qc = va_qcode_InnerMemcpy va_mods dst src in
let va_sM, va_fM, va_g =
va_wp_sound_code_norm (va_code_InnerMemcpy ())
va_qc
va_s0
(fun va_s0 va_sM va_g ->
let () = va_g in
label va_range1
"***** POSTCONDITION NOT MET AT line 21 column 1 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_get_ok va_sM) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 35 column 63 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 36 column 57 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM)))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([
va_Mod_mem_heaplet 1;
va_Mod_reg64 rR9;
va_Mod_reg64 rRcx;
va_Mod_reg64 rRax;
va_Mod_ok;
va_Mod_mem
])
va_sM
va_s0;
(va_sM, va_fM) | {
"checked_file": "Vale.Test.X64.Vale_memcpy.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.Test.X64.Vale_memcpy.fst"
} | [] | [
"Vale.X64.Decls.va_code",
"Vale.X64.Decls.va_state",
"Vale.X64.Memory.buffer64",
"Vale.X64.QuickCodes.fuel",
"Prims.unit",
"FStar.Pervasives.Native.Mktuple2",
"Vale.X64.Decls.va_fuel",
"Vale.X64.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_mem_heaplet",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRax",
"Vale.X64.QuickCode.va_Mod_ok",
"Vale.X64.QuickCode.va_Mod_mem",
"Prims.Nil",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.list",
"Vale.X64.QuickCode.__proj__QProc__item__mods",
"Vale.Test.X64.Vale_memcpy.va_code_InnerMemcpy",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.tuple3",
"Vale.X64.State.vale_state",
"Vale.X64.QuickCodes.va_wp_sound_code_norm",
"Prims.l_and",
"Vale.X64.QuickCodes.label",
"Vale.X64.QuickCodes.va_range1",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"FStar.Seq.Base.seq",
"Vale.X64.Memory.base_typ_as_vale_type",
"Vale.X64.Memory.vuint64",
"Vale.X64.Memory.buffer_as_seq",
"Vale.X64.Decls.va_get_mem_heaplet",
"Vale.X64.Decls.modifies_mem",
"Vale.X64.Decls.loc_buffer",
"Vale.X64.QuickCode.quickCode",
"Vale.Test.X64.Vale_memcpy.va_qcode_InnerMemcpy"
] | [] | module Vale.Test.X64.Vale_memcpy
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
#set-options "--z3rlimit 20"
//-- InnerMemcpy
val va_code_InnerMemcpy : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_InnerMemcpy () =
(va_Block (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64
rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_CCons (va_code_Load64_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRdx) 8
Secret) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64
rRcx) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8
Secret) (va_CNil ()))))))
val va_codegen_success_InnerMemcpy : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_InnerMemcpy () =
(va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_pbool_and
(va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9)
(va_op_reg_opr64_reg64 rRdx) 8 Secret) (va_pbool_and (va_codegen_success_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rRax) 0
Secret) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8 Secret) (va_ttrue ())))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_InnerMemcpy (va_mods:va_mods_t) (dst:buffer64) (src:buffer64) : (va_quickCode unit
(va_code_InnerMemcpy ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 38 column 18 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRdx) 0 Secret src 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 39 column 18 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9)
(va_op_reg_opr64_reg64 rRdx) 8 Secret src 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 40 column 19 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_reg_opr64_reg64 rRax) 0 Secret dst 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 41 column 19 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_reg_opr64_reg64 rR9) 8 Secret dst 1) (fun (va_s:va_state) _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 42 column 5 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(FStar.Seq.Base.equal #(Vale.X64.Memory.base_typ_as_vale_type Vale.X64.Memory.vuint64)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_s) dst)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_s) src))
(va_QEmpty (()))))))))
val va_lemma_InnerMemcpy : va_b0:va_code -> va_s0:va_state -> dst:buffer64 -> src:buffer64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_InnerMemcpy ()) va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdx va_s0) src 2
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\ Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint64 dst == 2))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\
Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ va_state_eq va_sM
(va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))) | false | false | Vale.Test.X64.Vale_memcpy.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_lemma_InnerMemcpy : va_b0:va_code -> va_s0:va_state -> dst:buffer64 -> src:buffer64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_InnerMemcpy ()) va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdx va_s0) src 2
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\ Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint64 dst == 2))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\
Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ va_state_eq va_sM
(va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))) | [] | Vale.Test.X64.Vale_memcpy.va_lemma_InnerMemcpy | {
"file_name": "obj/Vale.Test.X64.Vale_memcpy.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
va_b0: Vale.X64.Decls.va_code ->
va_s0: Vale.X64.Decls.va_state ->
dst: Vale.X64.Memory.buffer64 ->
src: Vale.X64.Memory.buffer64
-> Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) | {
"end_col": 16,
"end_line": 95,
"start_col": 46,
"start_line": 77
} |
Prims.Ghost | val va_wpProof_Memcpy : win:bool -> dst:buffer64 -> src:buffer64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Memcpy win dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Memcpy win) ([va_Mod_mem_heaplet 1;
va_Mod_mem_layout; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0
va_k ((va_sM, va_f0, va_g)))) | [
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_wpProof_Memcpy win dst src va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Memcpy (va_code_Memcpy win) va_s0 win dst src in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_mem_layout va_sM
(va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0))))))));
va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_mem_layout; va_Mod_reg64 rR9; va_Mod_reg64
rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | val va_wpProof_Memcpy : win:bool -> dst:buffer64 -> src:buffer64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Memcpy win dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Memcpy win) ([va_Mod_mem_heaplet 1;
va_Mod_mem_layout; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0
va_k ((va_sM, va_f0, va_g))))
let va_wpProof_Memcpy win dst src va_s0 va_k = | false | null | false | let va_sM, va_f0 = va_lemma_Memcpy (va_code_Memcpy win) va_s0 win dst src in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM
(va_update_mem_heaplet 1
va_sM
(va_update_mem_layout va_sM
(va_update_reg64 rR9
va_sM
(va_update_reg64 rRcx
va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))
))));
va_lemma_norm_mods ([
va_Mod_mem_heaplet 1;
va_Mod_mem_layout;
va_Mod_reg64 rR9;
va_Mod_reg64 rRcx;
va_Mod_reg64 rRax;
va_Mod_mem
])
va_sM
va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | {
"checked_file": "Vale.Test.X64.Vale_memcpy.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.Test.X64.Vale_memcpy.fst"
} | [] | [
"Prims.bool",
"Vale.X64.Memory.buffer64",
"Vale.X64.Decls.va_state",
"Prims.unit",
"Vale.X64.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple3",
"Vale.X64.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_mem_heaplet",
"Vale.X64.QuickCode.va_Mod_mem_layout",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRax",
"Vale.X64.QuickCode.va_Mod_mem",
"Prims.Nil",
"Prims._assert",
"Vale.X64.Decls.va_state_eq",
"Vale.X64.Decls.va_update_mem_heaplet",
"Vale.X64.Decls.va_update_mem_layout",
"Vale.X64.Decls.va_update_reg64",
"Vale.X64.Decls.va_update_ok",
"Vale.X64.Decls.va_update_mem",
"Vale.X64.Decls.va_lemma_upd_update",
"FStar.Pervasives.Native.tuple3",
"FStar.Pervasives.Native.tuple2",
"Vale.X64.State.vale_state",
"Vale.Test.X64.Vale_memcpy.va_lemma_Memcpy",
"Vale.Test.X64.Vale_memcpy.va_code_Memcpy"
] | [] | module Vale.Test.X64.Vale_memcpy
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
#set-options "--z3rlimit 20"
//-- InnerMemcpy
val va_code_InnerMemcpy : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_InnerMemcpy () =
(va_Block (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64
rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_CCons (va_code_Load64_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRdx) 8
Secret) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64
rRcx) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8
Secret) (va_CNil ()))))))
val va_codegen_success_InnerMemcpy : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_InnerMemcpy () =
(va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_pbool_and
(va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9)
(va_op_reg_opr64_reg64 rRdx) 8 Secret) (va_pbool_and (va_codegen_success_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rRax) 0
Secret) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8 Secret) (va_ttrue ())))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_InnerMemcpy (va_mods:va_mods_t) (dst:buffer64) (src:buffer64) : (va_quickCode unit
(va_code_InnerMemcpy ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 38 column 18 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRdx) 0 Secret src 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 39 column 18 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9)
(va_op_reg_opr64_reg64 rRdx) 8 Secret src 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 40 column 19 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_reg_opr64_reg64 rRax) 0 Secret dst 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 41 column 19 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_reg_opr64_reg64 rR9) 8 Secret dst 1) (fun (va_s:va_state) _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 42 column 5 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(FStar.Seq.Base.equal #(Vale.X64.Memory.base_typ_as_vale_type Vale.X64.Memory.vuint64)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_s) dst)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_s) src))
(va_QEmpty (()))))))))
val va_lemma_InnerMemcpy : va_b0:va_code -> va_s0:va_state -> dst:buffer64 -> src:buffer64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_InnerMemcpy ()) va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdx va_s0) src 2
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\ Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint64 dst == 2))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\
Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ va_state_eq va_sM
(va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))
[@"opaque_to_smt"]
let va_lemma_InnerMemcpy va_b0 va_s0 dst src =
let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx;
va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_InnerMemcpy va_mods dst src in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_InnerMemcpy ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 21 column 1 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 35 column 63 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 36 column 57 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64
rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_InnerMemcpy (dst:buffer64) (src:buffer64) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64
rRdx va_s0) src 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64
(va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret
/\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 dst == 2 /\ (forall (va_x_mem:vale_heap)
(va_x_rax:nat64) (va_x_rcx:nat64) (va_x_r9:nat64) (va_x_heap1:vale_heap) . let va_sM =
va_upd_mem_heaplet 1 va_x_heap1 (va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rRcx va_x_rcx
(va_upd_reg64 rRax va_x_rax (va_upd_mem va_x_mem va_s0)))) in va_get_ok va_sM /\
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\
Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) ==> va_k va_sM (())))
val va_wpProof_InnerMemcpy : dst:buffer64 -> src:buffer64 -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_InnerMemcpy dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet
1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_InnerMemcpy dst src va_s0 va_k =
let (va_sM, va_f0) = va_lemma_InnerMemcpy (va_code_InnerMemcpy ()) va_s0 dst src in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM
(va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))));
va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64
rRax; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_InnerMemcpy (dst:buffer64) (src:buffer64) : (va_quickCode unit (va_code_InnerMemcpy
())) =
(va_QProc (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx;
va_Mod_reg64 rRax; va_Mod_mem]) (va_wp_InnerMemcpy dst src) (va_wpProof_InnerMemcpy dst src))
//--
//-- Memcpy
[@ "opaque_to_smt" va_qattr]
let va_code_Memcpy win =
(va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (if win then va_Block (va_CCons
(va_code_InnerMemcpy ()) (va_CNil ())) else va_Block (va_CCons (va_code_Mem64_lemma ())
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRax) (va_opr_code_Mem64
(va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 0 Secret)) (va_CCons
(va_code_Mem64_lemma ()) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx)
(va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 Secret)) (va_CCons
(va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRcx) 8
Secret) (va_CNil ())))))))) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Memcpy win =
(va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (if win then va_pbool_and
(va_codegen_success_InnerMemcpy ()) (va_ttrue ()) else va_pbool_and
(va_codegen_success_Mem64_lemma ()) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRax) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0)
(va_op_reg64_reg64 rRsi) 0 Secret)) (va_pbool_and (va_codegen_success_Mem64_lemma ())
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_opr_code_Mem64
(va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 Secret)) (va_pbool_and
(va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_pbool_and (va_codegen_success_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRcx) 8
Secret) (va_ttrue ()))))))) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue
()))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Memcpy (va_mods:va_mods_t) (win:bool) (dst:buffer64) (src:buffer64) : (va_quickCode
unit (va_code_Memcpy win)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 67 column 19 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_CreateHeaplets ([declare_buffer64 src 0 Secret Immutable; declare_buffer64 dst 1
Secret Mutable])) (fun (va_s:va_state) _ -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 71 column 15 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 73 column 20 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_InnerMemcpy dst src) (va_QEmpty (())))) (qblock va_mods (fun (va_s:va_state) ->
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 77 column 26 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Mem64_lemma (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 0 src 0 Secret)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 77 column 14 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0)
(va_op_reg64_reg64 rRsi) 0 Secret)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 78 column 26 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Mem64_lemma (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 src 1 Secret)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 78 column 14 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0)
(va_op_reg64_reg64 rRsi) 8 Secret)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 79 column 23 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRax) 0 Secret dst 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 80 column 23 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRcx) 8 Secret dst 1) (va_QEmpty (())))))))))) (fun (va_s:va_state) va_g
-> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 82 column 5 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(FStar.Seq.Base.equal #(Vale.X64.Memory.base_typ_as_vale_type Vale.X64.Memory.vuint64)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_s) dst)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_s) src))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 84 column 20 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_DestroyHeaplets ()) (va_QEmpty (())))))))
[@"opaque_to_smt"]
let va_lemma_Memcpy va_b0 va_s0 win dst src =
let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_mem_layout; va_Mod_reg64 rR9;
va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Memcpy va_mods win dst src in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Memcpy win) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 45 column 1 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 59 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) src) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 53 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem va_s0) (va_get_mem va_sM))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_mem_layout; va_Mod_reg64 rR9; va_Mod_reg64
rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM) | false | false | Vale.Test.X64.Vale_memcpy.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_wpProof_Memcpy : win:bool -> dst:buffer64 -> src:buffer64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Memcpy win dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Memcpy win) ([va_Mod_mem_heaplet 1;
va_Mod_mem_layout; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0
va_k ((va_sM, va_f0, va_g)))) | [] | Vale.Test.X64.Vale_memcpy.va_wpProof_Memcpy | {
"file_name": "obj/Vale.Test.X64.Vale_memcpy.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
win: Prims.bool ->
dst: Vale.X64.Memory.buffer64 ->
src: Vale.X64.Memory.buffer64 ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Prims.Ghost ((Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) * Prims.unit) | {
"end_col": 22,
"end_line": 242,
"start_col": 46,
"start_line": 233
} |
Prims.Ghost | val va_lemma_Memcpy : va_b0:va_code -> va_s0:va_state -> win:bool -> dst:buffer64 -> src:buffer64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Memcpy win) va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\
Vale.X64.Decls.locs_disjoint ([Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst;
Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 src]) /\ Vale.X64.Decls.validSrcAddrs64
(va_get_mem va_s0) (if win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) src 2
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0) (if win
then va_get_reg64 rRcx va_s0 else va_get_reg64 rRdi va_s0) dst 2 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 dst == 2))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) src /\
Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem va_s0) (va_get_mem va_sM) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM
(va_update_mem_layout va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))) | [
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Test.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let va_lemma_Memcpy va_b0 va_s0 win dst src =
let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_mem_layout; va_Mod_reg64 rR9;
va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Memcpy va_mods win dst src in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Memcpy win) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 45 column 1 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 59 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) src) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 65 column 53 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem va_s0) (va_get_mem va_sM))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_mem_layout; va_Mod_reg64 rR9; va_Mod_reg64
rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM) | val va_lemma_Memcpy : va_b0:va_code -> va_s0:va_state -> win:bool -> dst:buffer64 -> src:buffer64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Memcpy win) va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\
Vale.X64.Decls.locs_disjoint ([Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst;
Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 src]) /\ Vale.X64.Decls.validSrcAddrs64
(va_get_mem va_s0) (if win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) src 2
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0) (if win
then va_get_reg64 rRcx va_s0 else va_get_reg64 rRdi va_s0) dst 2 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 dst == 2))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) src /\
Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem va_s0) (va_get_mem va_sM) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM
(va_update_mem_layout va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))
let va_lemma_Memcpy va_b0 va_s0 win dst src = | false | null | false | let va_mods:va_mods_t =
[
va_Mod_mem_heaplet 1;
va_Mod_mem_layout;
va_Mod_reg64 rR9;
va_Mod_reg64 rRcx;
va_Mod_reg64 rRax;
va_Mod_ok;
va_Mod_mem
]
in
let va_qc = va_qcode_Memcpy va_mods win dst src in
let va_sM, va_fM, va_g =
va_wp_sound_code_norm (va_code_Memcpy win)
va_qc
va_s0
(fun va_s0 va_sM va_g ->
let () = va_g in
label va_range1
"***** POSTCONDITION NOT MET AT line 45 column 1 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_get_ok va_sM) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 63 column 59 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) src) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 65 column 53 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem va_s0)
(va_get_mem va_sM)))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([
va_Mod_mem_heaplet 1;
va_Mod_mem_layout;
va_Mod_reg64 rR9;
va_Mod_reg64 rRcx;
va_Mod_reg64 rRax;
va_Mod_ok;
va_Mod_mem
])
va_sM
va_s0;
(va_sM, va_fM) | {
"checked_file": "Vale.Test.X64.Vale_memcpy.fst.checked",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.Test.X64.Vale_memcpy.fst"
} | [] | [
"Vale.X64.Decls.va_code",
"Vale.X64.Decls.va_state",
"Prims.bool",
"Vale.X64.Memory.buffer64",
"Vale.X64.QuickCodes.fuel",
"Prims.unit",
"FStar.Pervasives.Native.Mktuple2",
"Vale.X64.Decls.va_fuel",
"Vale.X64.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_mem_heaplet",
"Vale.X64.QuickCode.va_Mod_mem_layout",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRax",
"Vale.X64.QuickCode.va_Mod_ok",
"Vale.X64.QuickCode.va_Mod_mem",
"Prims.Nil",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.list",
"Vale.X64.QuickCode.__proj__QProc__item__mods",
"Vale.Test.X64.Vale_memcpy.va_code_Memcpy",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.tuple3",
"Vale.X64.State.vale_state",
"Vale.X64.QuickCodes.va_wp_sound_code_norm",
"Prims.l_and",
"Vale.X64.QuickCodes.label",
"Vale.X64.QuickCodes.va_range1",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"FStar.Seq.Base.seq",
"Vale.X64.Memory.base_typ_as_vale_type",
"Vale.X64.Memory.vuint64",
"Vale.X64.Memory.buffer_as_seq",
"Vale.X64.Decls.va_get_mem",
"Vale.X64.Decls.modifies_mem",
"Vale.X64.Decls.loc_buffer",
"Vale.X64.QuickCode.quickCode",
"Vale.Test.X64.Vale_memcpy.va_qcode_Memcpy"
] | [] | module Vale.Test.X64.Vale_memcpy
open Vale.Arch.HeapImpl
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
#set-options "--z3rlimit 20"
//-- InnerMemcpy
val va_code_InnerMemcpy : va_dummy:unit -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_InnerMemcpy () =
(va_Block (va_CCons (va_code_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64
rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_CCons (va_code_Load64_buffer
(va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRdx) 8
Secret) (va_CCons (va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64
rRcx) (va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8
Secret) (va_CNil ()))))))
val va_codegen_success_InnerMemcpy : va_dummy:unit -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_InnerMemcpy () =
(va_pbool_and (va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRdx) 0 Secret) (va_pbool_and
(va_codegen_success_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9)
(va_op_reg_opr64_reg64 rRdx) 8 Secret) (va_pbool_and (va_codegen_success_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rRax) 0
Secret) (va_pbool_and (va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1)
(va_op_reg_opr64_reg64 rRcx) (va_op_reg_opr64_reg64 rR9) 8 Secret) (va_ttrue ())))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_InnerMemcpy (va_mods:va_mods_t) (dst:buffer64) (src:buffer64) : (va_quickCode unit
(va_code_InnerMemcpy ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 38 column 18 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRdx) 0 Secret src 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 39 column 18 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Load64_buffer (va_op_heaplet_mem_heaplet 0) (va_op_dst_opr64_reg64 rR9)
(va_op_reg_opr64_reg64 rRdx) 8 Secret src 1) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 40 column 19 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_reg_opr64_reg64 rRax) 0 Secret dst 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 41 column 19 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRcx)
(va_op_reg_opr64_reg64 rR9) 8 Secret dst 1) (fun (va_s:va_state) _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 42 column 5 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(FStar.Seq.Base.equal #(Vale.X64.Memory.base_typ_as_vale_type Vale.X64.Memory.vuint64)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_s) dst)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_s) src))
(va_QEmpty (()))))))))
val va_lemma_InnerMemcpy : va_b0:va_code -> va_s0:va_state -> dst:buffer64 -> src:buffer64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_InnerMemcpy ()) va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdx va_s0) src 2
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\ Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint64 dst == 2))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\
Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ va_state_eq va_sM
(va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))
[@"opaque_to_smt"]
let va_lemma_InnerMemcpy va_b0 va_s0 dst src =
let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx;
va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_InnerMemcpy va_mods dst src in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_InnerMemcpy ()) va_qc va_s0 (fun va_s0
va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 21 column 1 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_get_ok va_sM) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 35 column 63 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 36 column 57 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64
rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_InnerMemcpy (dst:buffer64) (src:buffer64) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem_heaplet 0 va_s0) (va_get_reg64
rRdx va_s0) src 2 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64
(va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRcx va_s0) dst 2 (va_get_mem_layout va_s0) Secret
/\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 dst == 2 /\ (forall (va_x_mem:vale_heap)
(va_x_rax:nat64) (va_x_rcx:nat64) (va_x_r9:nat64) (va_x_heap1:vale_heap) . let va_sM =
va_upd_mem_heaplet 1 va_x_heap1 (va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rRcx va_x_rcx
(va_upd_reg64 rRax va_x_rax (va_upd_mem va_x_mem va_s0)))) in va_get_ok va_sM /\
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_sM) src /\
Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) ==> va_k va_sM (())))
val va_wpProof_InnerMemcpy : dst:buffer64 -> src:buffer64 -> va_s0:va_state -> va_k:(va_state ->
unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_InnerMemcpy dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet
1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_InnerMemcpy dst src va_s0 va_k =
let (va_sM, va_f0) = va_lemma_InnerMemcpy (va_code_InnerMemcpy ()) va_s0 dst src in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM
(va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0)))))));
va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64
rRax; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_InnerMemcpy (dst:buffer64) (src:buffer64) : (va_quickCode unit (va_code_InnerMemcpy
())) =
(va_QProc (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx;
va_Mod_reg64 rRax; va_Mod_mem]) (va_wp_InnerMemcpy dst src) (va_wpProof_InnerMemcpy dst src))
//--
//-- Memcpy
[@ "opaque_to_smt" va_qattr]
let va_code_Memcpy win =
(va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (if win then va_Block (va_CCons
(va_code_InnerMemcpy ()) (va_CNil ())) else va_Block (va_CCons (va_code_Mem64_lemma ())
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRax) (va_opr_code_Mem64
(va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 0 Secret)) (va_CCons
(va_code_Mem64_lemma ()) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx)
(va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 Secret)) (va_CCons
(va_code_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRcx) 8
Secret) (va_CNil ())))))))) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil ())))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Memcpy win =
(va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and (if win then va_pbool_and
(va_codegen_success_InnerMemcpy ()) (va_ttrue ()) else va_pbool_and
(va_codegen_success_Mem64_lemma ()) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRax) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0)
(va_op_reg64_reg64 rRsi) 0 Secret)) (va_pbool_and (va_codegen_success_Mem64_lemma ())
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_opr_code_Mem64
(va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 Secret)) (va_pbool_and
(va_codegen_success_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_pbool_and (va_codegen_success_Store64_buffer
(va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRcx) 8
Secret) (va_ttrue ()))))))) (va_pbool_and (va_codegen_success_DestroyHeaplets ()) (va_ttrue
()))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Memcpy (va_mods:va_mods_t) (win:bool) (dst:buffer64) (src:buffer64) : (va_quickCode
unit (va_code_Memcpy win)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 67 column 19 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_CreateHeaplets ([declare_buffer64 src 0 Secret Immutable; declare_buffer64 dst 1
Secret Mutable])) (fun (va_s:va_state) _ -> va_QBind va_range1
"***** PRECONDITION NOT MET AT line 71 column 15 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 73 column 20 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_InnerMemcpy dst src) (va_QEmpty (())))) (qblock va_mods (fun (va_s:va_state) ->
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 77 column 26 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Mem64_lemma (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 0 src 0 Secret)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 77 column 14 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0)
(va_op_reg64_reg64 rRsi) 0 Secret)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 78 column 26 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Mem64_lemma (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 src 1 Secret)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 78 column 14 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0)
(va_op_reg64_reg64 rRsi) 8 Secret)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 79 column 23 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRax) 0 Secret dst 0) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 80 column 23 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRcx) 8 Secret dst 1) (va_QEmpty (())))))))))) (fun (va_s:va_state) va_g
-> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 82 column 5 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(FStar.Seq.Base.equal #(Vale.X64.Memory.base_typ_as_vale_type Vale.X64.Memory.vuint64)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_s) dst)
(Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_s) src))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 84 column 20 of file /home/gebner/everest/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****"
(va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))) | false | false | Vale.Test.X64.Vale_memcpy.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val va_lemma_Memcpy : va_b0:va_code -> va_s0:va_state -> win:bool -> dst:buffer64 -> src:buffer64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Memcpy win) va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\
Vale.X64.Decls.locs_disjoint ([Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst;
Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 src]) /\ Vale.X64.Decls.validSrcAddrs64
(va_get_mem va_s0) (if win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) src 2
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0) (if win
then va_get_reg64 rRcx va_s0 else va_get_reg64 rRdi va_s0) dst 2 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 dst == 2))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) dst ==
Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) src /\
Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)
(va_get_mem va_s0) (va_get_mem va_sM) /\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM
(va_update_mem_layout va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))) | [] | Vale.Test.X64.Vale_memcpy.va_lemma_Memcpy | {
"file_name": "obj/Vale.Test.X64.Vale_memcpy.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
va_b0: Vale.X64.Decls.va_code ->
va_s0: Vale.X64.Decls.va_state ->
win: Prims.bool ->
dst: Vale.X64.Memory.buffer64 ->
src: Vale.X64.Memory.buffer64
-> Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) | {
"end_col": 16,
"end_line": 229,
"start_col": 45,
"start_line": 211
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let expand_info_length_pred (a:fixed_len_alg) (info_length:nat) =
(hash_length a + info_length + 1 + block_length a) `less_than_max_input_length` a | let expand_info_length_pred (a: fixed_len_alg) (info_length: nat) = | false | null | false | (hash_length a + info_length + 1 + block_length a) `less_than_max_input_length` a | {
"checked_file": "Spec.Agile.HKDF.fsti.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Agile.HKDF.fsti"
} | [
"total"
] | [
"Spec.Hash.Definitions.fixed_len_alg",
"Prims.nat",
"Spec.Hash.Definitions.less_than_max_input_length",
"Prims.op_Addition",
"Spec.Hash.Definitions.hash_length",
"Spec.Hash.Definitions.block_length",
"Prims.bool"
] | [] | module Spec.Agile.HKDF
open FStar.Mul
open Spec.Hash.Definitions
let lbytes (l:nat) = b:bytes {Seq.length b = l}
let extract_ikm_length_pred (a:hash_alg) (ikm_length:nat) =
(ikm_length + block_length a) `less_than_max_input_length` a
val extract:
a: fixed_len_alg ->
key: bytes ->
data: bytes ->
Pure (lbytes (hash_length a))
(requires
Spec.Agile.HMAC.keysized a (Seq.length key) /\
extract_ikm_length_pred a (Seq.length data))
(ensures fun _ -> True) | false | true | Spec.Agile.HKDF.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val expand_info_length_pred : a: Spec.Hash.Definitions.fixed_len_alg -> info_length: Prims.nat -> Prims.bool | [] | Spec.Agile.HKDF.expand_info_length_pred | {
"file_name": "specs/Spec.Agile.HKDF.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Spec.Hash.Definitions.fixed_len_alg -> info_length: Prims.nat -> Prims.bool | {
"end_col": 83,
"end_line": 22,
"start_col": 2,
"start_line": 22
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Integers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let expand_output_length_pred (a:fixed_len_alg) (len:nat) =
len <= 255 * hash_length a | let expand_output_length_pred (a: fixed_len_alg) (len: nat) = | false | null | false | len <= 255 * hash_length a | {
"checked_file": "Spec.Agile.HKDF.fsti.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Agile.HKDF.fsti"
} | [
"total"
] | [
"Spec.Hash.Definitions.fixed_len_alg",
"Prims.nat",
"Prims.op_LessThanOrEqual",
"FStar.Mul.op_Star",
"Spec.Hash.Definitions.hash_length",
"Prims.bool"
] | [] | module Spec.Agile.HKDF
open FStar.Mul
open Spec.Hash.Definitions
let lbytes (l:nat) = b:bytes {Seq.length b = l}
let extract_ikm_length_pred (a:hash_alg) (ikm_length:nat) =
(ikm_length + block_length a) `less_than_max_input_length` a
val extract:
a: fixed_len_alg ->
key: bytes ->
data: bytes ->
Pure (lbytes (hash_length a))
(requires
Spec.Agile.HMAC.keysized a (Seq.length key) /\
extract_ikm_length_pred a (Seq.length data))
(ensures fun _ -> True)
let expand_info_length_pred (a:fixed_len_alg) (info_length:nat) =
(hash_length a + info_length + 1 + block_length a) `less_than_max_input_length` a | false | true | Spec.Agile.HKDF.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val expand_output_length_pred : a: Spec.Hash.Definitions.fixed_len_alg -> len: Prims.nat -> Prims.bool | [] | Spec.Agile.HKDF.expand_output_length_pred | {
"file_name": "specs/Spec.Agile.HKDF.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Spec.Hash.Definitions.fixed_len_alg -> len: Prims.nat -> Prims.bool | {
"end_col": 28,
"end_line": 25,
"start_col": 2,
"start_line": 25
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let extract_ikm_length_pred (a:hash_alg) (ikm_length:nat) =
(ikm_length + block_length a) `less_than_max_input_length` a | let extract_ikm_length_pred (a: hash_alg) (ikm_length: nat) = | false | null | false | (ikm_length + block_length a) `less_than_max_input_length` a | {
"checked_file": "Spec.Agile.HKDF.fsti.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Agile.HKDF.fsti"
} | [
"total"
] | [
"Spec.Hash.Definitions.hash_alg",
"Prims.nat",
"Spec.Hash.Definitions.less_than_max_input_length",
"Prims.op_Addition",
"Spec.Hash.Definitions.block_length",
"Prims.bool"
] | [] | module Spec.Agile.HKDF
open FStar.Mul
open Spec.Hash.Definitions
let lbytes (l:nat) = b:bytes {Seq.length b = l} | false | true | Spec.Agile.HKDF.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val extract_ikm_length_pred : a: Spec.Hash.Definitions.hash_alg -> ikm_length: Prims.nat -> Prims.bool | [] | Spec.Agile.HKDF.extract_ikm_length_pred | {
"file_name": "specs/Spec.Agile.HKDF.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Spec.Hash.Definitions.hash_alg -> ikm_length: Prims.nat -> Prims.bool | {
"end_col": 62,
"end_line": 9,
"start_col": 2,
"start_line": 9
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let lbytes (l:nat) = b:bytes {Seq.length b = l} | let lbytes (l: nat) = | false | null | false | b: bytes{Seq.length b = l} | {
"checked_file": "Spec.Agile.HKDF.fsti.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.HMAC.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Agile.HKDF.fsti"
} | [
"total"
] | [
"Prims.nat",
"Spec.Hash.Definitions.bytes",
"Prims.b2t",
"Prims.op_Equality",
"FStar.Seq.Base.length",
"Lib.IntTypes.uint8"
] | [] | module Spec.Agile.HKDF
open FStar.Mul
open Spec.Hash.Definitions | false | true | Spec.Agile.HKDF.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lbytes : l: Prims.nat -> Type0 | [] | Spec.Agile.HKDF.lbytes | {
"file_name": "specs/Spec.Agile.HKDF.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | l: Prims.nat -> Type0 | {
"end_col": 47,
"end_line": 6,
"start_col": 21,
"start_line": 6
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let interval_condition (x y t: int) = (x <= t) && (t < y) | let interval_condition (x y t: int) = | false | null | false | (x <= t) && (t < y) | {
"checked_file": "FStar.IntegerIntervals.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.IntegerIntervals.fst"
} | [
"total"
] | [
"Prims.int",
"Prims.op_AmpAmp",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"Prims.bool"
] | [] | (*
Copyright 2008-2022 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: A. Rozanov
*)
module FStar.IntegerIntervals
(* Aliases to all kinds of integer intervals *)
(* general infinite integer intervals *)
type less_than (k: int) = x:int{x<k}
type greater_than (k: int) = x:int{x>k}
type not_less_than (x: int) = greater_than (x-1)
type not_greater_than (x: int) = less_than (x+1)
(* Type coercion. While supposed to be absolutely trivial,
might still be invoked directly under extremely low rlimits *)
let coerce_to_less_than #n (x: not_greater_than n) : less_than (n+1) = x
let coerce_to_not_less_than #n (x: greater_than n) : not_less_than (n+1) = x | false | true | FStar.IntegerIntervals.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val interval_condition : x: Prims.int -> y: Prims.int -> t: Prims.int -> Prims.bool | [] | FStar.IntegerIntervals.interval_condition | {
"file_name": "ulib/FStar.IntegerIntervals.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | x: Prims.int -> y: Prims.int -> t: Prims.int -> Prims.bool | {
"end_col": 57,
"end_line": 33,
"start_col": 38,
"start_line": 33
} |
|
Prims.Tot | val coerce_to_less_than (#n: _) (x: not_greater_than n) : less_than (n + 1) | [
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let coerce_to_less_than #n (x: not_greater_than n) : less_than (n+1) = x | val coerce_to_less_than (#n: _) (x: not_greater_than n) : less_than (n + 1)
let coerce_to_less_than #n (x: not_greater_than n) : less_than (n + 1) = | false | null | false | x | {
"checked_file": "FStar.IntegerIntervals.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.IntegerIntervals.fst"
} | [
"total"
] | [
"Prims.int",
"FStar.IntegerIntervals.not_greater_than",
"FStar.IntegerIntervals.less_than",
"Prims.op_Addition"
] | [] | (*
Copyright 2008-2022 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: A. Rozanov
*)
module FStar.IntegerIntervals
(* Aliases to all kinds of integer intervals *)
(* general infinite integer intervals *)
type less_than (k: int) = x:int{x<k}
type greater_than (k: int) = x:int{x>k}
type not_less_than (x: int) = greater_than (x-1)
type not_greater_than (x: int) = less_than (x+1)
(* Type coercion. While supposed to be absolutely trivial, | false | false | FStar.IntegerIntervals.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val coerce_to_less_than (#n: _) (x: not_greater_than n) : less_than (n + 1) | [] | FStar.IntegerIntervals.coerce_to_less_than | {
"file_name": "ulib/FStar.IntegerIntervals.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | x: FStar.IntegerIntervals.not_greater_than n -> FStar.IntegerIntervals.less_than (n + 1) | {
"end_col": 72,
"end_line": 30,
"start_col": 71,
"start_line": 30
} |
Prims.Tot | val closed_interval_size (x y: int) : nat | [
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let closed_interval_size (x y: int) : nat = interval_size (ifrom_ito x y) | val closed_interval_size (x y: int) : nat
let closed_interval_size (x y: int) : nat = | false | null | false | interval_size (ifrom_ito x y) | {
"checked_file": "FStar.IntegerIntervals.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.IntegerIntervals.fst"
} | [
"total"
] | [
"Prims.int",
"FStar.IntegerIntervals.interval_size",
"Prims.op_Addition",
"FStar.IntegerIntervals.ifrom_ito",
"Prims.nat"
] | [] | (*
Copyright 2008-2022 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: A. Rozanov
*)
module FStar.IntegerIntervals
(* Aliases to all kinds of integer intervals *)
(* general infinite integer intervals *)
type less_than (k: int) = x:int{x<k}
type greater_than (k: int) = x:int{x>k}
type not_less_than (x: int) = greater_than (x-1)
type not_greater_than (x: int) = less_than (x+1)
(* Type coercion. While supposed to be absolutely trivial,
might still be invoked directly under extremely low rlimits *)
let coerce_to_less_than #n (x: not_greater_than n) : less_than (n+1) = x
let coerce_to_not_less_than #n (x: greater_than n) : not_less_than (n+1) = x
let interval_condition (x y t: int) = (x <= t) && (t < y)
type interval_type (x y:int) = z : Type0{ z == t:int{interval_condition x y t} }
(* Default interval is half-open, which is the most frequently used case *)
type interval (x y: int) : interval_type x y = t:int{interval_condition x y t}
(* general finite integer intervals *)
type efrom_eto (x y: int) = interval (x+1) y
type efrom_ito (x y: int) = interval (x+1) (y+1)
type ifrom_eto (x y: int) = interval x y
type ifrom_ito (x y: int) = interval x (y+1)
(* Special case for naturals under k, to use in sequences, lists, arrays, etc *)
type under (k: nat) = interval 0 k
(* If we define our intervals this way, then the following lemma comes for free: *)
private let closed_interval_lemma (x y:int) : Lemma (interval x (y+1) == ifrom_ito x y) = ()
(* how many numbers fall into an interval? *)
let interval_size (#x #y: int) (interval: interval_type x y) : nat
= if y >= x then y-x else 0
(* when we want a zero-based index that runs over an interval, we use this *)
type counter_for (#x #y:int) (interval: interval_type x y) = under (interval_size interval) | false | true | FStar.IntegerIntervals.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val closed_interval_size (x y: int) : nat | [] | FStar.IntegerIntervals.closed_interval_size | {
"file_name": "ulib/FStar.IntegerIntervals.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | x: Prims.int -> y: Prims.int -> Prims.nat | {
"end_col": 73,
"end_line": 61,
"start_col": 44,
"start_line": 61
} |
Prims.Tot | val coerce_to_not_less_than (#n: _) (x: greater_than n) : not_less_than (n + 1) | [
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let coerce_to_not_less_than #n (x: greater_than n) : not_less_than (n+1) = x | val coerce_to_not_less_than (#n: _) (x: greater_than n) : not_less_than (n + 1)
let coerce_to_not_less_than #n (x: greater_than n) : not_less_than (n + 1) = | false | null | false | x | {
"checked_file": "FStar.IntegerIntervals.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.IntegerIntervals.fst"
} | [
"total"
] | [
"Prims.int",
"FStar.IntegerIntervals.greater_than",
"FStar.IntegerIntervals.not_less_than",
"Prims.op_Addition"
] | [] | (*
Copyright 2008-2022 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: A. Rozanov
*)
module FStar.IntegerIntervals
(* Aliases to all kinds of integer intervals *)
(* general infinite integer intervals *)
type less_than (k: int) = x:int{x<k}
type greater_than (k: int) = x:int{x>k}
type not_less_than (x: int) = greater_than (x-1)
type not_greater_than (x: int) = less_than (x+1)
(* Type coercion. While supposed to be absolutely trivial,
might still be invoked directly under extremely low rlimits *) | false | false | FStar.IntegerIntervals.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val coerce_to_not_less_than (#n: _) (x: greater_than n) : not_less_than (n + 1) | [] | FStar.IntegerIntervals.coerce_to_not_less_than | {
"file_name": "ulib/FStar.IntegerIntervals.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | x: FStar.IntegerIntervals.greater_than n -> FStar.IntegerIntervals.not_less_than (n + 1) | {
"end_col": 76,
"end_line": 31,
"start_col": 75,
"start_line": 31
} |
Prims.Tot | val interval_size (#x #y: int) (interval: interval_type x y) : nat | [
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let interval_size (#x #y: int) (interval: interval_type x y) : nat
= if y >= x then y-x else 0 | val interval_size (#x #y: int) (interval: interval_type x y) : nat
let interval_size (#x #y: int) (interval: interval_type x y) : nat = | false | null | false | if y >= x then y - x else 0 | {
"checked_file": "FStar.IntegerIntervals.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.IntegerIntervals.fst"
} | [
"total"
] | [
"Prims.int",
"FStar.IntegerIntervals.interval_type",
"Prims.op_GreaterThanOrEqual",
"Prims.op_Subtraction",
"Prims.bool",
"Prims.nat"
] | [] | (*
Copyright 2008-2022 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: A. Rozanov
*)
module FStar.IntegerIntervals
(* Aliases to all kinds of integer intervals *)
(* general infinite integer intervals *)
type less_than (k: int) = x:int{x<k}
type greater_than (k: int) = x:int{x>k}
type not_less_than (x: int) = greater_than (x-1)
type not_greater_than (x: int) = less_than (x+1)
(* Type coercion. While supposed to be absolutely trivial,
might still be invoked directly under extremely low rlimits *)
let coerce_to_less_than #n (x: not_greater_than n) : less_than (n+1) = x
let coerce_to_not_less_than #n (x: greater_than n) : not_less_than (n+1) = x
let interval_condition (x y t: int) = (x <= t) && (t < y)
type interval_type (x y:int) = z : Type0{ z == t:int{interval_condition x y t} }
(* Default interval is half-open, which is the most frequently used case *)
type interval (x y: int) : interval_type x y = t:int{interval_condition x y t}
(* general finite integer intervals *)
type efrom_eto (x y: int) = interval (x+1) y
type efrom_ito (x y: int) = interval (x+1) (y+1)
type ifrom_eto (x y: int) = interval x y
type ifrom_ito (x y: int) = interval x (y+1)
(* Special case for naturals under k, to use in sequences, lists, arrays, etc *)
type under (k: nat) = interval 0 k
(* If we define our intervals this way, then the following lemma comes for free: *)
private let closed_interval_lemma (x y:int) : Lemma (interval x (y+1) == ifrom_ito x y) = ()
(* how many numbers fall into an interval? *) | false | false | FStar.IntegerIntervals.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val interval_size (#x #y: int) (interval: interval_type x y) : nat | [] | FStar.IntegerIntervals.interval_size | {
"file_name": "ulib/FStar.IntegerIntervals.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | interval: FStar.IntegerIntervals.interval_type x y -> Prims.nat | {
"end_col": 29,
"end_line": 55,
"start_col": 4,
"start_line": 55
} |
Prims.Tot | val indices_seq (n: nat)
: (f:
FStar.Seq.Base.seq (under n)
{FStar.Seq.Base.length f = n /\ (forall (k: under n). FStar.Seq.Base.index f k = k)}) | [
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let indices_seq (n: nat)
: (f:FStar.Seq.Base.seq (under n) {
FStar.Seq.Base.length f = n /\
(forall (k: under n). FStar.Seq.Base.index f k = k)
})
= FStar.Seq.Base.init n (fun (x:under n) -> x) | val indices_seq (n: nat)
: (f:
FStar.Seq.Base.seq (under n)
{FStar.Seq.Base.length f = n /\ (forall (k: under n). FStar.Seq.Base.index f k = k)})
let indices_seq (n: nat)
: (f:
FStar.Seq.Base.seq (under n)
{FStar.Seq.Base.length f = n /\ (forall (k: under n). FStar.Seq.Base.index f k = k)}) = | false | null | false | FStar.Seq.Base.init n (fun (x: under n) -> x) | {
"checked_file": "FStar.IntegerIntervals.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.IntegerIntervals.fst"
} | [
"total"
] | [
"Prims.nat",
"FStar.Seq.Base.init",
"FStar.IntegerIntervals.under",
"FStar.Seq.Base.seq",
"Prims.l_and",
"Prims.b2t",
"Prims.op_Equality",
"FStar.Seq.Base.length",
"Prims.l_Forall",
"FStar.Seq.Base.index"
] | [] | (*
Copyright 2008-2022 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: A. Rozanov
*)
module FStar.IntegerIntervals
(* Aliases to all kinds of integer intervals *)
(* general infinite integer intervals *)
type less_than (k: int) = x:int{x<k}
type greater_than (k: int) = x:int{x>k}
type not_less_than (x: int) = greater_than (x-1)
type not_greater_than (x: int) = less_than (x+1)
(* Type coercion. While supposed to be absolutely trivial,
might still be invoked directly under extremely low rlimits *)
let coerce_to_less_than #n (x: not_greater_than n) : less_than (n+1) = x
let coerce_to_not_less_than #n (x: greater_than n) : not_less_than (n+1) = x
let interval_condition (x y t: int) = (x <= t) && (t < y)
type interval_type (x y:int) = z : Type0{ z == t:int{interval_condition x y t} }
(* Default interval is half-open, which is the most frequently used case *)
type interval (x y: int) : interval_type x y = t:int{interval_condition x y t}
(* general finite integer intervals *)
type efrom_eto (x y: int) = interval (x+1) y
type efrom_ito (x y: int) = interval (x+1) (y+1)
type ifrom_eto (x y: int) = interval x y
type ifrom_ito (x y: int) = interval x (y+1)
(* Special case for naturals under k, to use in sequences, lists, arrays, etc *)
type under (k: nat) = interval 0 k
(* If we define our intervals this way, then the following lemma comes for free: *)
private let closed_interval_lemma (x y:int) : Lemma (interval x (y+1) == ifrom_ito x y) = ()
(* how many numbers fall into an interval? *)
let interval_size (#x #y: int) (interval: interval_type x y) : nat
= if y >= x then y-x else 0
(* when we want a zero-based index that runs over an interval, we use this *)
type counter_for (#x #y:int) (interval: interval_type x y) = under (interval_size interval)
(* special case for closed intervals, used in FStar.Algebra.CommMonoid.Fold *)
let closed_interval_size (x y: int) : nat = interval_size (ifrom_ito x y)
(* A usage example and a test at the same time: *)
private let _ = assert (interval_size (interval 5 10) = 5)
private let _ = assert (interval_size (ifrom_ito 5 10) = 6)
private let _ = assert (interval_size (ifrom_ito 15 10) = 0)
(* This lemma, especially when used with forall_intro, helps the
prover verify the index ranges of sequences that correspond
to arbitrary folds.
It is supposed to be invoked to decrease the toll we put on rlimit,
i.e. will be redundant in most use cases. *)
let counter_bounds_lemma (x y:int) (i: (counter_for (ifrom_ito x y)))
: Lemma (x+i >= x /\ x+i <= y) = ()
(* An integer sequence [0..n), n values in total,
with index value available to the prover. *)
let indices_seq (n: nat)
: (f:FStar.Seq.Base.seq (under n) {
FStar.Seq.Base.length f = n /\
(forall (k: under n). FStar.Seq.Base.index f k = k) | false | false | FStar.IntegerIntervals.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val indices_seq (n: nat)
: (f:
FStar.Seq.Base.seq (under n)
{FStar.Seq.Base.length f = n /\ (forall (k: under n). FStar.Seq.Base.index f k = k)}) | [] | FStar.IntegerIntervals.indices_seq | {
"file_name": "ulib/FStar.IntegerIntervals.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | n: Prims.nat
-> f:
FStar.Seq.Base.seq (FStar.IntegerIntervals.under n)
{ FStar.Seq.Base.length f = n /\
(forall (k: FStar.IntegerIntervals.under n). FStar.Seq.Base.index f k = k) } | {
"end_col": 48,
"end_line": 84,
"start_col": 4,
"start_line": 84
} |
FStar.HyperStack.ST.Stack | val make_g: g:point -> Stack unit
(requires fun h -> live h g)
(ensures fun h0 _ h1 -> modifies (loc g) h0 h1 /\
F51.point_inv_t h1 g /\ F51.inv_ext_point (as_seq h1 g) /\
F51.point_eval h1 g == S.g) | [
{
"abbrev": true,
"full_module": "Spec.Ed25519",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field51.Definition",
"short_module": "S51"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Ed25519.Field51",
"short_module": "F51"
},
{
"abbrev": false,
"full_module": "Hacl.Bignum25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let make_g g =
let gx = getx g in
let gy = gety g in
let gz = getz g in
let gt = gett g in
[@inline_let] let (x0, x1, x2, x3, x4) =
(u64 0x00062d608f25d51a,
u64 0x000412a4b4f6592a,
u64 0x00075b7171a4b31d,
u64 0x0001ff60527118fe,
u64 0x000216936d3cd6e5) in
[@inline_let] let (y0, y1, y2, y3, y4) =
(u64 0x0006666666666658,
u64 0x0004cccccccccccc,
u64 0x0001999999999999,
u64 0x0003333333333333,
u64 0x0006666666666666) in
[@inline_let] let (t0, t1, t2, t3, t4) =
(u64 0x00068ab3a5b7dda3,
u64 0x00000eea2a5eadbb,
u64 0x0002af8df483c27e,
u64 0x000332b375274732,
u64 0x00067875f0fd78b7) in
make_u64_5 gx x0 x1 x2 x3 x4;
make_u64_5 gy y0 y1 y2 y3 y4;
make_one gz;
make_u64_5 gt t0 t1 t2 t3 t4;
(**) assert_norm (Spec.Ed25519.g_x ==
S51.as_nat5 (x0, x1, x2, x3, x4) % Spec.Curve25519.prime);
(**) assert_norm (Spec.Ed25519.g_y ==
S51.as_nat5 (y0, y1, y2, y3, y4) % Spec.Curve25519.prime);
(**) assert_norm (Mktuple4?._4 Spec.Ed25519.g ==
S51.as_nat5 (t0, t1, t2, t3, t4) % Spec.Curve25519.prime);
let h1 = ST.get () in
assert (F51.point_inv_t h1 g);
assert (F51.point_eval h1 g == Spec.Ed25519.g);
Spec.Ed25519.Lemmas.g_is_on_curve () | val make_g: g:point -> Stack unit
(requires fun h -> live h g)
(ensures fun h0 _ h1 -> modifies (loc g) h0 h1 /\
F51.point_inv_t h1 g /\ F51.inv_ext_point (as_seq h1 g) /\
F51.point_eval h1 g == S.g)
let make_g g = | true | null | false | let gx = getx g in
let gy = gety g in
let gz = getz g in
let gt = gett g in
[@@ inline_let ]let x0, x1, x2, x3, x4 =
(u64 0x00062d608f25d51a,
u64 0x000412a4b4f6592a,
u64 0x00075b7171a4b31d,
u64 0x0001ff60527118fe,
u64 0x000216936d3cd6e5)
in
[@@ inline_let ]let y0, y1, y2, y3, y4 =
(u64 0x0006666666666658,
u64 0x0004cccccccccccc,
u64 0x0001999999999999,
u64 0x0003333333333333,
u64 0x0006666666666666)
in
[@@ inline_let ]let t0, t1, t2, t3, t4 =
(u64 0x00068ab3a5b7dda3,
u64 0x00000eea2a5eadbb,
u64 0x0002af8df483c27e,
u64 0x000332b375274732,
u64 0x00067875f0fd78b7)
in
make_u64_5 gx x0 x1 x2 x3 x4;
make_u64_5 gy y0 y1 y2 y3 y4;
make_one gz;
make_u64_5 gt t0 t1 t2 t3 t4;
assert_norm (Spec.Ed25519.g_x == S51.as_nat5 (x0, x1, x2, x3, x4) % Spec.Curve25519.prime);
assert_norm (Spec.Ed25519.g_y == S51.as_nat5 (y0, y1, y2, y3, y4) % Spec.Curve25519.prime);
assert_norm (Mktuple4?._4 Spec.Ed25519.g == S51.as_nat5 (t0, t1, t2, t3, t4) % Spec.Curve25519.prime
);
let h1 = ST.get () in
assert (F51.point_inv_t h1 g);
assert (F51.point_eval h1 g == Spec.Ed25519.g);
Spec.Ed25519.Lemmas.g_is_on_curve () | {
"checked_file": "Hacl.Impl.Ed25519.PointConstants.fst.checked",
"dependencies": [
"Spec.Ed25519.Lemmas.fsti.checked",
"Spec.Ed25519.fst.checked",
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"Hacl.Impl.Ed25519.Field51.fst.checked",
"Hacl.Bignum25519.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Ed25519.PointConstants.fst"
} | [] | [
"Hacl.Bignum25519.point",
"Lib.IntTypes.uint64",
"Spec.Ed25519.Lemmas.g_is_on_curve",
"Prims.unit",
"Prims._assert",
"Prims.eq2",
"Spec.Ed25519.PointOps.ext_point",
"Hacl.Impl.Ed25519.Field51.point_eval",
"Spec.Ed25519.PointOps.g",
"Hacl.Impl.Ed25519.Field51.point_inv_t",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"FStar.Pervasives.assert_norm",
"Prims.int",
"FStar.Pervasives.Native.__proj__Mktuple4__item___4",
"Spec.Curve25519.elem",
"Prims.op_Modulus",
"Hacl.Spec.Curve25519.Field51.Definition.as_nat5",
"FStar.Pervasives.Native.Mktuple5",
"Spec.Curve25519.prime",
"Spec.Ed25519.PointOps.g_y",
"Spec.Ed25519.PointOps.g_x",
"Hacl.Bignum25519.make_u64_5",
"Hacl.Bignum25519.make_one",
"FStar.Pervasives.Native.tuple5",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"Lib.IntTypes.u64",
"Hacl.Bignum25519.felem",
"Hacl.Bignum25519.gett",
"Hacl.Bignum25519.getz",
"Hacl.Bignum25519.gety",
"Hacl.Bignum25519.getx"
] | [] | module Hacl.Impl.Ed25519.PointConstants
module ST = FStar.HyperStack.ST
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Bignum25519
module F51 = Hacl.Impl.Ed25519.Field51
module S51 = Hacl.Spec.Curve25519.Field51.Definition
module S = Spec.Ed25519
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
val make_point_inf:
b:lbuffer uint64 20ul ->
Stack unit
(requires fun h -> live h b)
(ensures fun h0 _ h1 -> modifies (loc b) h0 h1 /\
F51.point_inv_t h1 b /\ F51.inv_ext_point (as_seq h1 b) /\
S.to_aff_point (F51.point_eval h1 b) == S.aff_point_at_infinity)
let make_point_inf b =
let x = getx b in
let y = gety b in
let z = getz b in
let t = gett b in
make_zero x;
make_one y;
make_one z;
make_zero t;
let h1 = ST.get () in
assert (F51.point_eval h1 b == S.point_at_infinity);
Spec.Ed25519.Lemmas.to_aff_point_at_infinity_lemma ()
inline_for_extraction noextract
val make_g: g:point -> Stack unit
(requires fun h -> live h g)
(ensures fun h0 _ h1 -> modifies (loc g) h0 h1 /\
F51.point_inv_t h1 g /\ F51.inv_ext_point (as_seq h1 g) /\
F51.point_eval h1 g == S.g) | false | false | Hacl.Impl.Ed25519.PointConstants.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val make_g: g:point -> Stack unit
(requires fun h -> live h g)
(ensures fun h0 _ h1 -> modifies (loc g) h0 h1 /\
F51.point_inv_t h1 g /\ F51.inv_ext_point (as_seq h1 g) /\
F51.point_eval h1 g == S.g) | [] | Hacl.Impl.Ed25519.PointConstants.make_g | {
"file_name": "code/ed25519/Hacl.Impl.Ed25519.PointConstants.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | g: Hacl.Bignum25519.point -> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 38,
"end_line": 90,
"start_col": 14,
"start_line": 49
} |
FStar.HyperStack.ST.Stack | val make_point_inf:
b:lbuffer uint64 20ul ->
Stack unit
(requires fun h -> live h b)
(ensures fun h0 _ h1 -> modifies (loc b) h0 h1 /\
F51.point_inv_t h1 b /\ F51.inv_ext_point (as_seq h1 b) /\
S.to_aff_point (F51.point_eval h1 b) == S.aff_point_at_infinity) | [
{
"abbrev": true,
"full_module": "Spec.Ed25519",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Curve25519.Field51.Definition",
"short_module": "S51"
},
{
"abbrev": true,
"full_module": "Hacl.Impl.Ed25519.Field51",
"short_module": "F51"
},
{
"abbrev": false,
"full_module": "Hacl.Bignum25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Ed25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let make_point_inf b =
let x = getx b in
let y = gety b in
let z = getz b in
let t = gett b in
make_zero x;
make_one y;
make_one z;
make_zero t;
let h1 = ST.get () in
assert (F51.point_eval h1 b == S.point_at_infinity);
Spec.Ed25519.Lemmas.to_aff_point_at_infinity_lemma () | val make_point_inf:
b:lbuffer uint64 20ul ->
Stack unit
(requires fun h -> live h b)
(ensures fun h0 _ h1 -> modifies (loc b) h0 h1 /\
F51.point_inv_t h1 b /\ F51.inv_ext_point (as_seq h1 b) /\
S.to_aff_point (F51.point_eval h1 b) == S.aff_point_at_infinity)
let make_point_inf b = | true | null | false | let x = getx b in
let y = gety b in
let z = getz b in
let t = gett b in
make_zero x;
make_one y;
make_one z;
make_zero t;
let h1 = ST.get () in
assert (F51.point_eval h1 b == S.point_at_infinity);
Spec.Ed25519.Lemmas.to_aff_point_at_infinity_lemma () | {
"checked_file": "Hacl.Impl.Ed25519.PointConstants.fst.checked",
"dependencies": [
"Spec.Ed25519.Lemmas.fsti.checked",
"Spec.Ed25519.fst.checked",
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"Hacl.Impl.Ed25519.Field51.fst.checked",
"Hacl.Bignum25519.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Ed25519.PointConstants.fst"
} | [] | [
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint64",
"FStar.UInt32.__uint_to_t",
"Spec.Ed25519.Lemmas.to_aff_point_at_infinity_lemma",
"Prims.unit",
"Prims._assert",
"Prims.eq2",
"Spec.Ed25519.PointOps.ext_point",
"Hacl.Impl.Ed25519.Field51.point_eval",
"Spec.Ed25519.PointOps.point_at_infinity",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Hacl.Bignum25519.make_zero",
"Hacl.Bignum25519.make_one",
"Hacl.Bignum25519.felem",
"Hacl.Bignum25519.gett",
"Hacl.Bignum25519.getz",
"Hacl.Bignum25519.gety",
"Hacl.Bignum25519.getx"
] | [] | module Hacl.Impl.Ed25519.PointConstants
module ST = FStar.HyperStack.ST
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Hacl.Bignum25519
module F51 = Hacl.Impl.Ed25519.Field51
module S51 = Hacl.Spec.Curve25519.Field51.Definition
module S = Spec.Ed25519
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
val make_point_inf:
b:lbuffer uint64 20ul ->
Stack unit
(requires fun h -> live h b)
(ensures fun h0 _ h1 -> modifies (loc b) h0 h1 /\
F51.point_inv_t h1 b /\ F51.inv_ext_point (as_seq h1 b) /\
S.to_aff_point (F51.point_eval h1 b) == S.aff_point_at_infinity) | false | false | Hacl.Impl.Ed25519.PointConstants.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val make_point_inf:
b:lbuffer uint64 20ul ->
Stack unit
(requires fun h -> live h b)
(ensures fun h0 _ h1 -> modifies (loc b) h0 h1 /\
F51.point_inv_t h1 b /\ F51.inv_ext_point (as_seq h1 b) /\
S.to_aff_point (F51.point_eval h1 b) == S.aff_point_at_infinity) | [] | Hacl.Impl.Ed25519.PointConstants.make_point_inf | {
"file_name": "code/ed25519/Hacl.Impl.Ed25519.PointConstants.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | b: Lib.Buffer.lbuffer Lib.IntTypes.uint64 20ul -> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 55,
"end_line": 39,
"start_col": 22,
"start_line": 28
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.UpdateMulti",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Lib.UpdateMulti",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.UpdateMulti",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let uint8 = Lib.IntTypes.uint8 | let uint8 = | false | null | false | Lib.IntTypes.uint8 | {
"checked_file": "Lib.UpdateMulti.Lemmas.fsti.checked",
"dependencies": [
"prims.fst.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Lib.UpdateMulti.Lemmas.fsti"
} | [
"total"
] | [
"Lib.IntTypes.uint8"
] | [] | module Lib.UpdateMulti.Lemmas
module S = FStar.Seq
open Lib.UpdateMulti
open FStar.Mul | false | true | Lib.UpdateMulti.Lemmas.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val uint8 : Type0 | [] | Lib.UpdateMulti.Lemmas.uint8 | {
"file_name": "lib/Lib.UpdateMulti.Lemmas.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 30,
"end_line": 8,
"start_col": 12,
"start_line": 8
} |
|
Prims.Tot | val repeat_l
(#a: _)
(block_length: pos{block_length < pow2 32})
(update_last: (a -> s: S.seq uint8 {S.length s < block_length} -> a))
(input: S.seq uint8)
(l: Lib.IntTypes.size_nat{l < block_length})
(s: Lib.Sequence.lseq uint8 l)
(acc: a)
: a | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.UpdateMulti",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Lib.UpdateMulti",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.UpdateMulti",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let repeat_l #a (block_length:pos { block_length < pow2 32 })
(update_last: (a -> s:S.seq uint8 { S.length s < block_length } -> a))
(input:S.seq uint8)
(l: Lib.IntTypes.size_nat { l < block_length })
(s: Lib.Sequence.lseq uint8 l)
(acc: a): a
=
update_last acc s | val repeat_l
(#a: _)
(block_length: pos{block_length < pow2 32})
(update_last: (a -> s: S.seq uint8 {S.length s < block_length} -> a))
(input: S.seq uint8)
(l: Lib.IntTypes.size_nat{l < block_length})
(s: Lib.Sequence.lseq uint8 l)
(acc: a)
: a
let repeat_l
#a
(block_length: pos{block_length < pow2 32})
(update_last: (a -> s: S.seq uint8 {S.length s < block_length} -> a))
(input: S.seq uint8)
(l: Lib.IntTypes.size_nat{l < block_length})
(s: Lib.Sequence.lseq uint8 l)
(acc: a)
: a = | false | null | false | update_last acc s | {
"checked_file": "Lib.UpdateMulti.Lemmas.fsti.checked",
"dependencies": [
"prims.fst.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Lib.UpdateMulti.Lemmas.fsti"
} | [
"total"
] | [
"Prims.pos",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.pow2",
"FStar.Seq.Base.seq",
"Lib.UpdateMulti.Lemmas.uint8",
"FStar.Seq.Base.length",
"Lib.IntTypes.size_nat",
"Lib.Sequence.lseq"
] | [] | module Lib.UpdateMulti.Lemmas
module S = FStar.Seq
open Lib.UpdateMulti
open FStar.Mul
let uint8 = Lib.IntTypes.uint8
#set-options "--fuel 0 --ifuel 0"
/// This module establishes some equivalence between the update-multi style used
/// for specifications in the streaming functor, and the lib-based repeat
/// imperative combinators.
/// The following lemmas characterize the result of ``split_at_last_lazy`` with
/// conditions which are easy to assess, and is very useful when using it in order
/// to implement a stream hash, to prove properties about how to update the internal
/// buffer so that its content is actually the correct remainder of the data seen
/// so far.
/// This first auxiliary lemma only manipulates the lengths of the sequences.
val split_at_last_lazy_nb_rem_spec (l : pos) (d n rest: nat) :
Lemma
(requires (
rest <= l /\
(rest = 0 ==> d = 0) /\
d = n * l + rest))
(ensures ((n, rest) = split_at_last_lazy_nb_rem l d))
/// This second lemma characterizes the sequences themselves.
val split_at_last_lazy_spec (l : pos)
(b blocks rest: S.seq uint8) :
Lemma
(requires (
S.length blocks % l = 0 /\
S.length rest <= l /\
(S.length rest = 0 ==> S.length b = 0) /\
b `Seq.equal` Seq.append blocks rest))
(ensures (
(blocks, rest) == split_at_last_lazy l b))
/// Some helpers to flip the order of arguments
let repeat_f #a (block_length:pos { block_length < pow2 32 })
(update: (a -> s:S.seq uint8 { S.length s = block_length } -> a))
(b: S.seq uint8 { S.length b = block_length }) (acc: a): a
=
update acc b
let repeat_l #a (block_length:pos { block_length < pow2 32 })
(update_last: (a -> s:S.seq uint8 { S.length s < block_length } -> a))
(input:S.seq uint8)
(l: Lib.IntTypes.size_nat { l < block_length })
(s: Lib.Sequence.lseq uint8 l)
(acc: a): a | false | false | Lib.UpdateMulti.Lemmas.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val repeat_l
(#a: _)
(block_length: pos{block_length < pow2 32})
(update_last: (a -> s: S.seq uint8 {S.length s < block_length} -> a))
(input: S.seq uint8)
(l: Lib.IntTypes.size_nat{l < block_length})
(s: Lib.Sequence.lseq uint8 l)
(acc: a)
: a | [] | Lib.UpdateMulti.Lemmas.repeat_l | {
"file_name": "lib/Lib.UpdateMulti.Lemmas.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
block_length: Prims.pos{block_length < Prims.pow2 32} ->
update_last:
(
_: a ->
s:
FStar.Seq.Base.seq Lib.UpdateMulti.Lemmas.uint8
{FStar.Seq.Base.length s < block_length}
-> a) ->
input: FStar.Seq.Base.seq Lib.UpdateMulti.Lemmas.uint8 ->
l: Lib.IntTypes.size_nat{l < block_length} ->
s: Lib.Sequence.lseq Lib.UpdateMulti.Lemmas.uint8 l ->
acc: a
-> a | {
"end_col": 19,
"end_line": 58,
"start_col": 2,
"start_line": 58
} |
Prims.Tot | val repeat_f
(#a: _)
(block_length: pos{block_length < pow2 32})
(update: (a -> s: S.seq uint8 {S.length s = block_length} -> a))
(b: S.seq uint8 {S.length b = block_length})
(acc: a)
: a | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.UpdateMulti",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Lib.UpdateMulti",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.UpdateMulti",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let repeat_f #a (block_length:pos { block_length < pow2 32 })
(update: (a -> s:S.seq uint8 { S.length s = block_length } -> a))
(b: S.seq uint8 { S.length b = block_length }) (acc: a): a
=
update acc b | val repeat_f
(#a: _)
(block_length: pos{block_length < pow2 32})
(update: (a -> s: S.seq uint8 {S.length s = block_length} -> a))
(b: S.seq uint8 {S.length b = block_length})
(acc: a)
: a
let repeat_f
#a
(block_length: pos{block_length < pow2 32})
(update: (a -> s: S.seq uint8 {S.length s = block_length} -> a))
(b: S.seq uint8 {S.length b = block_length})
(acc: a)
: a = | false | null | false | update acc b | {
"checked_file": "Lib.UpdateMulti.Lemmas.fsti.checked",
"dependencies": [
"prims.fst.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Lib.UpdateMulti.Lemmas.fsti"
} | [
"total"
] | [
"Prims.pos",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.pow2",
"FStar.Seq.Base.seq",
"Lib.UpdateMulti.Lemmas.uint8",
"Prims.op_Equality",
"Prims.int",
"Prims.l_or",
"Prims.op_GreaterThanOrEqual",
"Prims.l_and",
"Prims.op_GreaterThan",
"FStar.Seq.Base.length"
] | [] | module Lib.UpdateMulti.Lemmas
module S = FStar.Seq
open Lib.UpdateMulti
open FStar.Mul
let uint8 = Lib.IntTypes.uint8
#set-options "--fuel 0 --ifuel 0"
/// This module establishes some equivalence between the update-multi style used
/// for specifications in the streaming functor, and the lib-based repeat
/// imperative combinators.
/// The following lemmas characterize the result of ``split_at_last_lazy`` with
/// conditions which are easy to assess, and is very useful when using it in order
/// to implement a stream hash, to prove properties about how to update the internal
/// buffer so that its content is actually the correct remainder of the data seen
/// so far.
/// This first auxiliary lemma only manipulates the lengths of the sequences.
val split_at_last_lazy_nb_rem_spec (l : pos) (d n rest: nat) :
Lemma
(requires (
rest <= l /\
(rest = 0 ==> d = 0) /\
d = n * l + rest))
(ensures ((n, rest) = split_at_last_lazy_nb_rem l d))
/// This second lemma characterizes the sequences themselves.
val split_at_last_lazy_spec (l : pos)
(b blocks rest: S.seq uint8) :
Lemma
(requires (
S.length blocks % l = 0 /\
S.length rest <= l /\
(S.length rest = 0 ==> S.length b = 0) /\
b `Seq.equal` Seq.append blocks rest))
(ensures (
(blocks, rest) == split_at_last_lazy l b))
/// Some helpers to flip the order of arguments
let repeat_f #a (block_length:pos { block_length < pow2 32 })
(update: (a -> s:S.seq uint8 { S.length s = block_length } -> a))
(b: S.seq uint8 { S.length b = block_length }) (acc: a): a | false | false | Lib.UpdateMulti.Lemmas.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val repeat_f
(#a: _)
(block_length: pos{block_length < pow2 32})
(update: (a -> s: S.seq uint8 {S.length s = block_length} -> a))
(b: S.seq uint8 {S.length b = block_length})
(acc: a)
: a | [] | Lib.UpdateMulti.Lemmas.repeat_f | {
"file_name": "lib/Lib.UpdateMulti.Lemmas.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
block_length: Prims.pos{block_length < Prims.pow2 32} ->
update:
(
_: a ->
s:
FStar.Seq.Base.seq Lib.UpdateMulti.Lemmas.uint8
{FStar.Seq.Base.length s = block_length}
-> a) ->
b: FStar.Seq.Base.seq Lib.UpdateMulti.Lemmas.uint8 {FStar.Seq.Base.length b = block_length} ->
acc: a
-> a | {
"end_col": 14,
"end_line": 49,
"start_col": 2,
"start_line": 49
} |
Prims.Tot | val serialize32_bitsum_cond
(#tot: pos)
(#t: eqtype)
(#cl: uint_t tot t)
(b: bitsum' cl tot)
(k: parser_kind)
(type_of_tag: (bitsum'_key_type b -> Tot Type))
(f: (x: bitsum'_key_type b -> Tot (k: parser_kind & parser k (type_of_tag x))))
: Tot bool | [
{
"abbrev": true,
"full_module": "FStar.Bytes",
"short_module": "B32"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.BitSum",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.BitFields",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow.Enum",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let serialize32_bitsum_cond
(#tot: pos)
(#t: eqtype)
(#cl: uint_t tot t)
(b: bitsum' cl tot)
(k: parser_kind)
(type_of_tag: (bitsum'_key_type b -> Tot Type))
(f: (x: bitsum'_key_type b) -> Tot (k: parser_kind & parser k (type_of_tag x)))
: Tot bool
= match k.parser_kind_high, (weaken_parse_bitsum_cases_kind b type_of_tag f).parser_kind_high with
| Some max1, Some max2 -> max1 + max2 < 4294967296
| _ -> false | val serialize32_bitsum_cond
(#tot: pos)
(#t: eqtype)
(#cl: uint_t tot t)
(b: bitsum' cl tot)
(k: parser_kind)
(type_of_tag: (bitsum'_key_type b -> Tot Type))
(f: (x: bitsum'_key_type b -> Tot (k: parser_kind & parser k (type_of_tag x))))
: Tot bool
let serialize32_bitsum_cond
(#tot: pos)
(#t: eqtype)
(#cl: uint_t tot t)
(b: bitsum' cl tot)
(k: parser_kind)
(type_of_tag: (bitsum'_key_type b -> Tot Type))
(f: (x: bitsum'_key_type b -> Tot (k: parser_kind & parser k (type_of_tag x))))
: Tot bool = | false | null | false | match k.parser_kind_high, (weaken_parse_bitsum_cases_kind b type_of_tag f).parser_kind_high with
| Some max1, Some max2 -> max1 + max2 < 4294967296
| _ -> false | {
"checked_file": "LowParse.SLow.BitSum.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.BitSum.fst.checked",
"LowParse.SLow.Enum.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Bytes.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.SLow.BitSum.fst"
} | [
"total"
] | [
"Prims.pos",
"Prims.eqtype",
"LowParse.BitFields.uint_t",
"LowParse.Spec.BitSum.bitsum'",
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.BitSum.bitsum'_key_type",
"Prims.dtuple2",
"LowParse.Spec.Base.parser",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Pervasives.Native.option",
"Prims.nat",
"LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_high",
"LowParse.Spec.BitSum.weaken_parse_bitsum_cases_kind",
"Prims.op_LessThan",
"Prims.op_Addition",
"FStar.Pervasives.Native.tuple2",
"Prims.bool"
] | [] | module LowParse.SLow.BitSum
include LowParse.SLow.Enum
include LowParse.BitFields
include LowParse.Spec.BitSum
module U32 = FStar.UInt32
module B32 = FStar.Bytes
(* WARNING: these functions currently does not extract to C *)
inline_for_extraction
let parse32_bitsum
(#kt: parser_kind)
(#tot: pos)
(#t: eqtype)
(#cl: uint_t tot t)
(b: bitsum' cl tot)
(#data: Type)
(tag_of_data: (data -> Tot (bitsum'_type b)))
(type_of_tag: (bitsum'_key_type b -> Tot Type))
(synth_case: synth_case_t b data tag_of_data type_of_tag)
(#p: parser kt t)
(p32: parser32 p)
(f: (x: bitsum'_key_type b) -> Tot (k: parser_kind & parser k (type_of_tag x)))
(f32: (x: bitsum'_key_type b) -> Tot (parser32 (dsnd (f x))))
: Tot (parser32 (parse_bitsum b tag_of_data type_of_tag synth_case p f))
= fun x ->
parse_bitsum_eq' b tag_of_data type_of_tag synth_case p f (B32.reveal x);
match p32 x with
| None -> None
| Some (tg', consumed1) ->
if filter_bitsum' b tg'
then
let tg = synth_bitsum' b tg' in
let x' = B32.slice x consumed1 (B32.len x) in
begin match f32 (bitsum'_key_of_t b tg) x' with
| None -> None
| Some (y, consumed2) ->
Some ((synth_case.f tg y <: data), consumed1 `U32.add` consumed2)
end
else
None
let serialize32_bitsum_cond
(#tot: pos)
(#t: eqtype)
(#cl: uint_t tot t)
(b: bitsum' cl tot)
(k: parser_kind)
(type_of_tag: (bitsum'_key_type b -> Tot Type))
(f: (x: bitsum'_key_type b) -> Tot (k: parser_kind & parser k (type_of_tag x))) | false | false | LowParse.SLow.BitSum.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val serialize32_bitsum_cond
(#tot: pos)
(#t: eqtype)
(#cl: uint_t tot t)
(b: bitsum' cl tot)
(k: parser_kind)
(type_of_tag: (bitsum'_key_type b -> Tot Type))
(f: (x: bitsum'_key_type b -> Tot (k: parser_kind & parser k (type_of_tag x))))
: Tot bool | [] | LowParse.SLow.BitSum.serialize32_bitsum_cond | {
"file_name": "src/lowparse/LowParse.SLow.BitSum.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
b: LowParse.Spec.BitSum.bitsum' cl tot ->
k: LowParse.Spec.Base.parser_kind ->
type_of_tag: (_: LowParse.Spec.BitSum.bitsum'_key_type b -> Type) ->
f:
(x: LowParse.Spec.BitSum.bitsum'_key_type b
-> Prims.dtuple2 LowParse.Spec.Base.parser_kind
(fun k -> LowParse.Spec.Base.parser k (type_of_tag x)))
-> Prims.bool | {
"end_col": 14,
"end_line": 56,
"start_col": 2,
"start_line": 54
} |
Prims.Tot | val serialize32_bitsum
(#kt: parser_kind)
(#tot: pos)
(#t: eqtype)
(#cl: uint_t tot t)
(b: bitsum' cl tot)
(#data: Type)
(tag_of_data: (data -> Tot (bitsum'_type b)))
(type_of_tag: (bitsum'_key_type b -> Tot Type))
(synth_case: synth_case_t b data tag_of_data type_of_tag)
(#p: parser kt t)
(#s: serializer p)
(s32: serializer32 s {kt.parser_kind_subkind == Some ParserStrong})
(#f: (x: bitsum'_key_type b -> Tot (k: parser_kind & parser k (type_of_tag x))))
(g: (x: bitsum'_key_type b -> Tot (serializer (dsnd (f x)))))
(g32: (x: bitsum'_key_type b -> Tot (serializer32 (g x))))
(sq: squash (serialize32_bitsum_cond b kt type_of_tag f))
: Tot (serializer32 (serialize_bitsum b tag_of_data type_of_tag synth_case s #f g)) | [
{
"abbrev": true,
"full_module": "FStar.Bytes",
"short_module": "B32"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.BitSum",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.BitFields",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow.Enum",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let serialize32_bitsum
(#kt: parser_kind)
(#tot: pos)
(#t: eqtype)
(#cl: uint_t tot t)
(b: bitsum' cl tot)
(#data: Type)
(tag_of_data: (data -> Tot (bitsum'_type b)))
(type_of_tag: (bitsum'_key_type b -> Tot Type))
(synth_case: synth_case_t b data tag_of_data type_of_tag)
(#p: parser kt t)
(#s: serializer p)
(s32: serializer32 s { kt.parser_kind_subkind == Some ParserStrong } )
(#f: (x: bitsum'_key_type b) -> Tot (k: parser_kind & parser k (type_of_tag x)))
(g: (x: bitsum'_key_type b) -> Tot (serializer (dsnd (f x))))
(g32: (x: bitsum'_key_type b) -> Tot (serializer32 (g x)))
(sq: squash (
serialize32_bitsum_cond b kt type_of_tag f
))
: Tot (serializer32 (serialize_bitsum b tag_of_data type_of_tag synth_case s #f g))
=
fun x ->
serialize_bitsum_eq b tag_of_data type_of_tag synth_case s g x;
let tg = tag_of_data x in
let k = bitsum'_key_of_t b tg in
let payload = synth_case.g tg x in
let s_tg = s32 (synth_bitsum'_recip b tg) in
let s_pl = g32 k payload in
s_tg `B32.append` s_pl | val serialize32_bitsum
(#kt: parser_kind)
(#tot: pos)
(#t: eqtype)
(#cl: uint_t tot t)
(b: bitsum' cl tot)
(#data: Type)
(tag_of_data: (data -> Tot (bitsum'_type b)))
(type_of_tag: (bitsum'_key_type b -> Tot Type))
(synth_case: synth_case_t b data tag_of_data type_of_tag)
(#p: parser kt t)
(#s: serializer p)
(s32: serializer32 s {kt.parser_kind_subkind == Some ParserStrong})
(#f: (x: bitsum'_key_type b -> Tot (k: parser_kind & parser k (type_of_tag x))))
(g: (x: bitsum'_key_type b -> Tot (serializer (dsnd (f x)))))
(g32: (x: bitsum'_key_type b -> Tot (serializer32 (g x))))
(sq: squash (serialize32_bitsum_cond b kt type_of_tag f))
: Tot (serializer32 (serialize_bitsum b tag_of_data type_of_tag synth_case s #f g))
let serialize32_bitsum
(#kt: parser_kind)
(#tot: pos)
(#t: eqtype)
(#cl: uint_t tot t)
(b: bitsum' cl tot)
(#data: Type)
(tag_of_data: (data -> Tot (bitsum'_type b)))
(type_of_tag: (bitsum'_key_type b -> Tot Type))
(synth_case: synth_case_t b data tag_of_data type_of_tag)
(#p: parser kt t)
(#s: serializer p)
(s32: serializer32 s {kt.parser_kind_subkind == Some ParserStrong})
(#f: (x: bitsum'_key_type b -> Tot (k: parser_kind & parser k (type_of_tag x))))
(g: (x: bitsum'_key_type b -> Tot (serializer (dsnd (f x)))))
(g32: (x: bitsum'_key_type b -> Tot (serializer32 (g x))))
(sq: squash (serialize32_bitsum_cond b kt type_of_tag f))
: Tot (serializer32 (serialize_bitsum b tag_of_data type_of_tag synth_case s #f g)) = | false | null | false | fun x ->
serialize_bitsum_eq b tag_of_data type_of_tag synth_case s g x;
let tg = tag_of_data x in
let k = bitsum'_key_of_t b tg in
let payload = synth_case.g tg x in
let s_tg = s32 (synth_bitsum'_recip b tg) in
let s_pl = g32 k payload in
s_tg `B32.append` s_pl | {
"checked_file": "LowParse.SLow.BitSum.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.BitSum.fst.checked",
"LowParse.SLow.Enum.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Bytes.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.SLow.BitSum.fst"
} | [
"total"
] | [
"LowParse.Spec.Base.parser_kind",
"Prims.pos",
"Prims.eqtype",
"LowParse.BitFields.uint_t",
"LowParse.Spec.BitSum.bitsum'",
"LowParse.Spec.BitSum.bitsum'_type",
"LowParse.Spec.BitSum.bitsum'_key_type",
"LowParse.Spec.BitSum.synth_case_t",
"LowParse.Spec.Base.parser",
"LowParse.Spec.Base.serializer",
"LowParse.SLow.Base.serializer32",
"Prims.eq2",
"FStar.Pervasives.Native.option",
"LowParse.Spec.Base.parser_subkind",
"LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_subkind",
"FStar.Pervasives.Native.Some",
"LowParse.Spec.Base.ParserStrong",
"Prims.dtuple2",
"Prims.__proj__Mkdtuple2__item___1",
"FStar.Pervasives.dsnd",
"Prims.squash",
"Prims.b2t",
"LowParse.SLow.BitSum.serialize32_bitsum_cond",
"FStar.Bytes.append",
"LowParse.SLow.Base.bytes32",
"LowParse.SLow.Base.serializer32_correct",
"LowParse.Spec.BitSum.synth_bitsum'_recip",
"LowParse.Spec.BitSum.bitsum'_key_of_t",
"LowParse.Spec.BitSum.__proj__SynthCase__item__g",
"Prims.unit",
"LowParse.Spec.BitSum.serialize_bitsum_eq",
"LowParse.Spec.BitSum.parse_bitsum_kind",
"LowParse.Spec.BitSum.parse_bitsum",
"LowParse.Spec.BitSum.serialize_bitsum"
] | [] | module LowParse.SLow.BitSum
include LowParse.SLow.Enum
include LowParse.BitFields
include LowParse.Spec.BitSum
module U32 = FStar.UInt32
module B32 = FStar.Bytes
(* WARNING: these functions currently does not extract to C *)
inline_for_extraction
let parse32_bitsum
(#kt: parser_kind)
(#tot: pos)
(#t: eqtype)
(#cl: uint_t tot t)
(b: bitsum' cl tot)
(#data: Type)
(tag_of_data: (data -> Tot (bitsum'_type b)))
(type_of_tag: (bitsum'_key_type b -> Tot Type))
(synth_case: synth_case_t b data tag_of_data type_of_tag)
(#p: parser kt t)
(p32: parser32 p)
(f: (x: bitsum'_key_type b) -> Tot (k: parser_kind & parser k (type_of_tag x)))
(f32: (x: bitsum'_key_type b) -> Tot (parser32 (dsnd (f x))))
: Tot (parser32 (parse_bitsum b tag_of_data type_of_tag synth_case p f))
= fun x ->
parse_bitsum_eq' b tag_of_data type_of_tag synth_case p f (B32.reveal x);
match p32 x with
| None -> None
| Some (tg', consumed1) ->
if filter_bitsum' b tg'
then
let tg = synth_bitsum' b tg' in
let x' = B32.slice x consumed1 (B32.len x) in
begin match f32 (bitsum'_key_of_t b tg) x' with
| None -> None
| Some (y, consumed2) ->
Some ((synth_case.f tg y <: data), consumed1 `U32.add` consumed2)
end
else
None
let serialize32_bitsum_cond
(#tot: pos)
(#t: eqtype)
(#cl: uint_t tot t)
(b: bitsum' cl tot)
(k: parser_kind)
(type_of_tag: (bitsum'_key_type b -> Tot Type))
(f: (x: bitsum'_key_type b) -> Tot (k: parser_kind & parser k (type_of_tag x)))
: Tot bool
= match k.parser_kind_high, (weaken_parse_bitsum_cases_kind b type_of_tag f).parser_kind_high with
| Some max1, Some max2 -> max1 + max2 < 4294967296
| _ -> false
inline_for_extraction
let serialize32_bitsum
(#kt: parser_kind)
(#tot: pos)
(#t: eqtype)
(#cl: uint_t tot t)
(b: bitsum' cl tot)
(#data: Type)
(tag_of_data: (data -> Tot (bitsum'_type b)))
(type_of_tag: (bitsum'_key_type b -> Tot Type))
(synth_case: synth_case_t b data tag_of_data type_of_tag)
(#p: parser kt t)
(#s: serializer p)
(s32: serializer32 s { kt.parser_kind_subkind == Some ParserStrong } )
(#f: (x: bitsum'_key_type b) -> Tot (k: parser_kind & parser k (type_of_tag x)))
(g: (x: bitsum'_key_type b) -> Tot (serializer (dsnd (f x))))
(g32: (x: bitsum'_key_type b) -> Tot (serializer32 (g x)))
(sq: squash (
serialize32_bitsum_cond b kt type_of_tag f
))
: Tot (serializer32 (serialize_bitsum b tag_of_data type_of_tag synth_case s #f g)) | false | false | LowParse.SLow.BitSum.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val serialize32_bitsum
(#kt: parser_kind)
(#tot: pos)
(#t: eqtype)
(#cl: uint_t tot t)
(b: bitsum' cl tot)
(#data: Type)
(tag_of_data: (data -> Tot (bitsum'_type b)))
(type_of_tag: (bitsum'_key_type b -> Tot Type))
(synth_case: synth_case_t b data tag_of_data type_of_tag)
(#p: parser kt t)
(#s: serializer p)
(s32: serializer32 s {kt.parser_kind_subkind == Some ParserStrong})
(#f: (x: bitsum'_key_type b -> Tot (k: parser_kind & parser k (type_of_tag x))))
(g: (x: bitsum'_key_type b -> Tot (serializer (dsnd (f x)))))
(g32: (x: bitsum'_key_type b -> Tot (serializer32 (g x))))
(sq: squash (serialize32_bitsum_cond b kt type_of_tag f))
: Tot (serializer32 (serialize_bitsum b tag_of_data type_of_tag synth_case s #f g)) | [] | LowParse.SLow.BitSum.serialize32_bitsum | {
"file_name": "src/lowparse/LowParse.SLow.BitSum.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
b: LowParse.Spec.BitSum.bitsum' cl tot ->
tag_of_data: (_: data -> LowParse.Spec.BitSum.bitsum'_type b) ->
type_of_tag: (_: LowParse.Spec.BitSum.bitsum'_key_type b -> Type) ->
synth_case: LowParse.Spec.BitSum.synth_case_t b data tag_of_data type_of_tag ->
s32:
LowParse.SLow.Base.serializer32 s
{ Mkparser_kind'?.parser_kind_subkind kt ==
FStar.Pervasives.Native.Some LowParse.Spec.Base.ParserStrong } ->
g:
(x: LowParse.Spec.BitSum.bitsum'_key_type b
-> LowParse.Spec.Base.serializer (FStar.Pervasives.dsnd (f x))) ->
g32: (x: LowParse.Spec.BitSum.bitsum'_key_type b -> LowParse.SLow.Base.serializer32 (g x)) ->
sq: Prims.squash (LowParse.SLow.BitSum.serialize32_bitsum_cond b kt type_of_tag f)
-> LowParse.SLow.Base.serializer32 (LowParse.Spec.BitSum.serialize_bitsum b
tag_of_data
type_of_tag
synth_case
s
g) | {
"end_col": 26,
"end_line": 87,
"start_col": 2,
"start_line": 80
} |
Prims.Tot | val parse32_bitsum
(#kt: parser_kind)
(#tot: pos)
(#t: eqtype)
(#cl: uint_t tot t)
(b: bitsum' cl tot)
(#data: Type)
(tag_of_data: (data -> Tot (bitsum'_type b)))
(type_of_tag: (bitsum'_key_type b -> Tot Type))
(synth_case: synth_case_t b data tag_of_data type_of_tag)
(#p: parser kt t)
(p32: parser32 p)
(f: (x: bitsum'_key_type b -> Tot (k: parser_kind & parser k (type_of_tag x))))
(f32: (x: bitsum'_key_type b -> Tot (parser32 (dsnd (f x)))))
: Tot (parser32 (parse_bitsum b tag_of_data type_of_tag synth_case p f)) | [
{
"abbrev": true,
"full_module": "FStar.Bytes",
"short_module": "B32"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.BitSum",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.BitFields",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow.Enum",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.SLow",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let parse32_bitsum
(#kt: parser_kind)
(#tot: pos)
(#t: eqtype)
(#cl: uint_t tot t)
(b: bitsum' cl tot)
(#data: Type)
(tag_of_data: (data -> Tot (bitsum'_type b)))
(type_of_tag: (bitsum'_key_type b -> Tot Type))
(synth_case: synth_case_t b data tag_of_data type_of_tag)
(#p: parser kt t)
(p32: parser32 p)
(f: (x: bitsum'_key_type b) -> Tot (k: parser_kind & parser k (type_of_tag x)))
(f32: (x: bitsum'_key_type b) -> Tot (parser32 (dsnd (f x))))
: Tot (parser32 (parse_bitsum b tag_of_data type_of_tag synth_case p f))
= fun x ->
parse_bitsum_eq' b tag_of_data type_of_tag synth_case p f (B32.reveal x);
match p32 x with
| None -> None
| Some (tg', consumed1) ->
if filter_bitsum' b tg'
then
let tg = synth_bitsum' b tg' in
let x' = B32.slice x consumed1 (B32.len x) in
begin match f32 (bitsum'_key_of_t b tg) x' with
| None -> None
| Some (y, consumed2) ->
Some ((synth_case.f tg y <: data), consumed1 `U32.add` consumed2)
end
else
None | val parse32_bitsum
(#kt: parser_kind)
(#tot: pos)
(#t: eqtype)
(#cl: uint_t tot t)
(b: bitsum' cl tot)
(#data: Type)
(tag_of_data: (data -> Tot (bitsum'_type b)))
(type_of_tag: (bitsum'_key_type b -> Tot Type))
(synth_case: synth_case_t b data tag_of_data type_of_tag)
(#p: parser kt t)
(p32: parser32 p)
(f: (x: bitsum'_key_type b -> Tot (k: parser_kind & parser k (type_of_tag x))))
(f32: (x: bitsum'_key_type b -> Tot (parser32 (dsnd (f x)))))
: Tot (parser32 (parse_bitsum b tag_of_data type_of_tag synth_case p f))
let parse32_bitsum
(#kt: parser_kind)
(#tot: pos)
(#t: eqtype)
(#cl: uint_t tot t)
(b: bitsum' cl tot)
(#data: Type)
(tag_of_data: (data -> Tot (bitsum'_type b)))
(type_of_tag: (bitsum'_key_type b -> Tot Type))
(synth_case: synth_case_t b data tag_of_data type_of_tag)
(#p: parser kt t)
(p32: parser32 p)
(f: (x: bitsum'_key_type b -> Tot (k: parser_kind & parser k (type_of_tag x))))
(f32: (x: bitsum'_key_type b -> Tot (parser32 (dsnd (f x)))))
: Tot (parser32 (parse_bitsum b tag_of_data type_of_tag synth_case p f)) = | false | null | false | fun x ->
parse_bitsum_eq' b tag_of_data type_of_tag synth_case p f (B32.reveal x);
match p32 x with
| None -> None
| Some (tg', consumed1) ->
if filter_bitsum' b tg'
then
let tg = synth_bitsum' b tg' in
let x' = B32.slice x consumed1 (B32.len x) in
match f32 (bitsum'_key_of_t b tg) x' with
| None -> None
| Some (y, consumed2) -> Some ((synth_case.f tg y <: data), consumed1 `U32.add` consumed2)
else None | {
"checked_file": "LowParse.SLow.BitSum.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.BitSum.fst.checked",
"LowParse.SLow.Enum.fst.checked",
"LowParse.BitFields.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Bytes.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.SLow.BitSum.fst"
} | [
"total"
] | [
"LowParse.Spec.Base.parser_kind",
"Prims.pos",
"Prims.eqtype",
"LowParse.BitFields.uint_t",
"LowParse.Spec.BitSum.bitsum'",
"LowParse.Spec.BitSum.bitsum'_type",
"LowParse.Spec.BitSum.bitsum'_key_type",
"LowParse.Spec.BitSum.synth_case_t",
"LowParse.Spec.Base.parser",
"LowParse.SLow.Base.parser32",
"Prims.dtuple2",
"Prims.__proj__Mkdtuple2__item___1",
"FStar.Pervasives.dsnd",
"LowParse.SLow.Base.bytes32",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.tuple2",
"FStar.UInt32.t",
"LowParse.Spec.BitSum.filter_bitsum'",
"LowParse.Spec.BitSum.bitsum'_key_of_t",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.Mktuple2",
"LowParse.Spec.BitSum.__proj__SynthCase__item__f",
"FStar.UInt32.add",
"FStar.Pervasives.Native.option",
"LowParse.SLow.Base.parser32_correct",
"LowParse.Spec.BitSum.parse_bitsum_kind",
"LowParse.Spec.BitSum.parse_bitsum",
"FStar.Bytes.bytes",
"Prims.eq2",
"FStar.Seq.Base.seq",
"FStar.UInt8.t",
"FStar.Bytes.reveal",
"FStar.Seq.Base.slice",
"FStar.UInt32.v",
"FStar.Bytes.len",
"FStar.Bytes.slice",
"LowParse.Spec.BitSum.synth_bitsum'",
"Prims.bool",
"Prims.unit",
"LowParse.Spec.BitSum.parse_bitsum_eq'"
] | [] | module LowParse.SLow.BitSum
include LowParse.SLow.Enum
include LowParse.BitFields
include LowParse.Spec.BitSum
module U32 = FStar.UInt32
module B32 = FStar.Bytes
(* WARNING: these functions currently does not extract to C *)
inline_for_extraction
let parse32_bitsum
(#kt: parser_kind)
(#tot: pos)
(#t: eqtype)
(#cl: uint_t tot t)
(b: bitsum' cl tot)
(#data: Type)
(tag_of_data: (data -> Tot (bitsum'_type b)))
(type_of_tag: (bitsum'_key_type b -> Tot Type))
(synth_case: synth_case_t b data tag_of_data type_of_tag)
(#p: parser kt t)
(p32: parser32 p)
(f: (x: bitsum'_key_type b) -> Tot (k: parser_kind & parser k (type_of_tag x)))
(f32: (x: bitsum'_key_type b) -> Tot (parser32 (dsnd (f x)))) | false | false | LowParse.SLow.BitSum.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val parse32_bitsum
(#kt: parser_kind)
(#tot: pos)
(#t: eqtype)
(#cl: uint_t tot t)
(b: bitsum' cl tot)
(#data: Type)
(tag_of_data: (data -> Tot (bitsum'_type b)))
(type_of_tag: (bitsum'_key_type b -> Tot Type))
(synth_case: synth_case_t b data tag_of_data type_of_tag)
(#p: parser kt t)
(p32: parser32 p)
(f: (x: bitsum'_key_type b -> Tot (k: parser_kind & parser k (type_of_tag x))))
(f32: (x: bitsum'_key_type b -> Tot (parser32 (dsnd (f x)))))
: Tot (parser32 (parse_bitsum b tag_of_data type_of_tag synth_case p f)) | [] | LowParse.SLow.BitSum.parse32_bitsum | {
"file_name": "src/lowparse/LowParse.SLow.BitSum.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} |
b: LowParse.Spec.BitSum.bitsum' cl tot ->
tag_of_data: (_: data -> LowParse.Spec.BitSum.bitsum'_type b) ->
type_of_tag: (_: LowParse.Spec.BitSum.bitsum'_key_type b -> Type) ->
synth_case: LowParse.Spec.BitSum.synth_case_t b data tag_of_data type_of_tag ->
p32: LowParse.SLow.Base.parser32 p ->
f:
(x: LowParse.Spec.BitSum.bitsum'_key_type b
-> Prims.dtuple2 LowParse.Spec.Base.parser_kind
(fun k -> LowParse.Spec.Base.parser k (type_of_tag x))) ->
f32:
(x: LowParse.Spec.BitSum.bitsum'_key_type b
-> LowParse.SLow.Base.parser32 (FStar.Pervasives.dsnd (f x)))
-> LowParse.SLow.Base.parser32 (LowParse.Spec.BitSum.parse_bitsum b
tag_of_data
type_of_tag
synth_case
p
f) | {
"end_col": 10,
"end_line": 43,
"start_col": 2,
"start_line": 28
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let max = FStar.Math.Lib.max | let max = | false | null | false | FStar.Math.Lib.max | {
"checked_file": "Vale.Math.Poly2.Defs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Math.Poly2.Defs_s.fst"
} | [
"total"
] | [
"FStar.Math.Lib.max"
] | [] | module Vale.Math.Poly2.Defs_s
open FStar.Mul | false | false | Vale.Math.Poly2.Defs_s.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val max : x: Prims.int -> y: Prims.int -> z: Prims.int{(x >= y ==> z = x) /\ (x < y ==> z = y)} | [] | Vale.Math.Poly2.Defs_s.max | {
"file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Prims.int -> y: Prims.int -> z: Prims.int{(x >= y ==> z = x) /\ (x < y ==> z = y)} | {
"end_col": 35,
"end_line": 4,
"start_col": 17,
"start_line": 4
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let poly = s:(seq bool){valid s} | let poly = | false | null | false | s: (seq bool){valid s} | {
"checked_file": "Vale.Math.Poly2.Defs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Math.Poly2.Defs_s.fst"
} | [
"total"
] | [
"FStar.Seq.Base.seq",
"Prims.bool",
"Prims.b2t",
"Vale.Math.Poly2.Defs_s.valid"
] | [] | module Vale.Math.Poly2.Defs_s
open FStar.Mul
open FStar.Seq
unfold let max = FStar.Math.Lib.max
// Polynomials cn * x^n + ... + c0 * x^0
// where coefficients ck are treated mod 2
let valid (s:seq bool) : bool =
length s = 0 || index s (length s - 1)
// Each coefficient of a polynomial is 0 (false) or 1 (true).
// Each polynomial has a unique valid representation:
// - zero is []
// - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term)
// The unique representation ensures that mathematically equal polynomials are = in F*. | false | true | Vale.Math.Poly2.Defs_s.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val poly : Type0 | [] | Vale.Math.Poly2.Defs_s.poly | {
"file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 32,
"end_line": 18,
"start_col": 11,
"start_line": 18
} |
|
Prims.Tot | val mul_element (a b: poly) (k: int) : bool | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let mul_element (a b:poly) (k:int) : bool =
sum_of_bools 0 (k + 1) (mul_element_fun a b k) | val mul_element (a b: poly) (k: int) : bool
let mul_element (a b: poly) (k: int) : bool = | false | null | false | sum_of_bools 0 (k + 1) (mul_element_fun a b k) | {
"checked_file": "Vale.Math.Poly2.Defs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Math.Poly2.Defs_s.fst"
} | [
"total"
] | [
"Vale.Math.Poly2.Defs_s.poly",
"Prims.int",
"Vale.Math.Poly2.Defs_s.sum_of_bools",
"Prims.op_Addition",
"Vale.Math.Poly2.Defs_s.mul_element_fun",
"Prims.bool"
] | [] | module Vale.Math.Poly2.Defs_s
open FStar.Mul
open FStar.Seq
unfold let max = FStar.Math.Lib.max
// Polynomials cn * x^n + ... + c0 * x^0
// where coefficients ck are treated mod 2
let valid (s:seq bool) : bool =
length s = 0 || index s (length s - 1)
// Each coefficient of a polynomial is 0 (false) or 1 (true).
// Each polynomial has a unique valid representation:
// - zero is []
// - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term)
// The unique representation ensures that mathematically equal polynomials are = in F*.
// s[0] is lowest-order term (x^0).
let poly = s:(seq bool){valid s}
let degree (p:poly) : int = length p - 1
let zero = create 0 false
let one = create 1 true
let monomial (n:nat) : poly = append (create n false) one
let lshift (p:poly) (n:nat) : poly =
if length p = 0 then p
else append (create n false) p
let rshift (p:poly) (n:nat) : poly =
if length p <= n then zero
else slice p n (length p)
let shift (p:poly) (n:int) : poly =
if n >= 0 then lshift p n else rshift p (-n)
// Index any coefficient, where all coefficients beyond highest-order term are zero
// (and n < 0 returns zero)
let poly_index (p:poly) (n:int) : bool =
if 0 <= n && n < length p then index p n
else false
unfold let ( .[] ) = poly_index
let to_seq (p:poly) (n:nat) : Pure (seq bool)
(requires True)
(ensures fun s ->
length s == n /\
(forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i)
)
=
init n (poly_index p)
let rec of_seq (s:seq bool) : Pure poly
(requires True)
(ensures fun p ->
length p <= length s /\
(forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i)
)
(decreases (length s))
=
if valid s then s
else
of_seq (slice s 0 (length s - 1))
[@"opaque_to_smt"]
let of_fun (len:nat) (f:nat -> bool) : Pure poly
(requires True)
(ensures fun p ->
length p <= len /\
(forall (i:nat).{:pattern p.[i] \/ (f i)} i < len ==> p.[i] == f i) /\
(forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i < len)
)
=
of_seq (init len f)
[@"opaque_to_smt"]
let reverse (a:poly) (n:nat) : Pure poly
(requires True)
(ensures fun p ->
length p <= n + 1 /\
(forall (i:nat).{:pattern p.[i]} p.[i] == a.[n - i]) /\
(forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i <= n)
)
=
of_fun (n + 1) (fun (i:nat) -> a.[n - i])
[@"opaque_to_smt"]
let add (a b:poly) : Pure poly
(requires True)
(ensures fun p ->
let len = max (length a) (length b) in
length p <= len /\
(forall (i:int).{:pattern p.[i] \/ a.[i] \/ b.[i]} p.[i] == (a.[i] <> b.[i]))
)
=
let len = max (length a) (length b) in
of_fun len (fun (i:nat) -> a.[i] <> b.[i])
// f j + f (j + 1) + ... + f (k - 1)
let rec sum_of_bools (j k:int) (f:int -> bool) : Tot bool (decreases (k - j)) =
if j >= k then false
else (sum_of_bools j (k - 1) f) <> f (k - 1)
let mul_element_fun (a b:poly) (k i:int) : bool = a.[i] && b.[k - i]
// a0 * bk + a1 * b(k-1) + ... + ak * b0 | false | true | Vale.Math.Poly2.Defs_s.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val mul_element (a b: poly) (k: int) : bool | [] | Vale.Math.Poly2.Defs_s.mul_element | {
"file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Vale.Math.Poly2.Defs_s.poly -> b: Vale.Math.Poly2.Defs_s.poly -> k: Prims.int -> Prims.bool | {
"end_col": 48,
"end_line": 108,
"start_col": 2,
"start_line": 108
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let one = create 1 true | let one = | false | null | false | create 1 true | {
"checked_file": "Vale.Math.Poly2.Defs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Math.Poly2.Defs_s.fst"
} | [
"total"
] | [
"FStar.Seq.Base.create",
"Prims.bool"
] | [] | module Vale.Math.Poly2.Defs_s
open FStar.Mul
open FStar.Seq
unfold let max = FStar.Math.Lib.max
// Polynomials cn * x^n + ... + c0 * x^0
// where coefficients ck are treated mod 2
let valid (s:seq bool) : bool =
length s = 0 || index s (length s - 1)
// Each coefficient of a polynomial is 0 (false) or 1 (true).
// Each polynomial has a unique valid representation:
// - zero is []
// - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term)
// The unique representation ensures that mathematically equal polynomials are = in F*.
// s[0] is lowest-order term (x^0).
let poly = s:(seq bool){valid s}
let degree (p:poly) : int = length p - 1 | false | true | Vale.Math.Poly2.Defs_s.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val one : FStar.Seq.Base.seq Prims.bool | [] | Vale.Math.Poly2.Defs_s.one | {
"file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | FStar.Seq.Base.seq Prims.bool | {
"end_col": 23,
"end_line": 22,
"start_col": 10,
"start_line": 22
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let zero = create 0 false | let zero = | false | null | false | create 0 false | {
"checked_file": "Vale.Math.Poly2.Defs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Math.Poly2.Defs_s.fst"
} | [
"total"
] | [
"FStar.Seq.Base.create",
"Prims.bool"
] | [] | module Vale.Math.Poly2.Defs_s
open FStar.Mul
open FStar.Seq
unfold let max = FStar.Math.Lib.max
// Polynomials cn * x^n + ... + c0 * x^0
// where coefficients ck are treated mod 2
let valid (s:seq bool) : bool =
length s = 0 || index s (length s - 1)
// Each coefficient of a polynomial is 0 (false) or 1 (true).
// Each polynomial has a unique valid representation:
// - zero is []
// - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term)
// The unique representation ensures that mathematically equal polynomials are = in F*.
// s[0] is lowest-order term (x^0).
let poly = s:(seq bool){valid s} | false | true | Vale.Math.Poly2.Defs_s.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val zero : FStar.Seq.Base.seq Prims.bool | [] | Vale.Math.Poly2.Defs_s.zero | {
"file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | FStar.Seq.Base.seq Prims.bool | {
"end_col": 25,
"end_line": 21,
"start_col": 11,
"start_line": 21
} |
|
Prims.Tot | val mul_element_fun (a b: poly) (k i: int) : bool | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let mul_element_fun (a b:poly) (k i:int) : bool = a.[i] && b.[k - i] | val mul_element_fun (a b: poly) (k i: int) : bool
let mul_element_fun (a b: poly) (k i: int) : bool = | false | null | false | a.[ i ] && b.[ k - i ] | {
"checked_file": "Vale.Math.Poly2.Defs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Math.Poly2.Defs_s.fst"
} | [
"total"
] | [
"Vale.Math.Poly2.Defs_s.poly",
"Prims.int",
"Prims.op_AmpAmp",
"Vale.Math.Poly2.Defs_s.op_String_Access",
"Prims.op_Subtraction",
"Prims.bool"
] | [] | module Vale.Math.Poly2.Defs_s
open FStar.Mul
open FStar.Seq
unfold let max = FStar.Math.Lib.max
// Polynomials cn * x^n + ... + c0 * x^0
// where coefficients ck are treated mod 2
let valid (s:seq bool) : bool =
length s = 0 || index s (length s - 1)
// Each coefficient of a polynomial is 0 (false) or 1 (true).
// Each polynomial has a unique valid representation:
// - zero is []
// - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term)
// The unique representation ensures that mathematically equal polynomials are = in F*.
// s[0] is lowest-order term (x^0).
let poly = s:(seq bool){valid s}
let degree (p:poly) : int = length p - 1
let zero = create 0 false
let one = create 1 true
let monomial (n:nat) : poly = append (create n false) one
let lshift (p:poly) (n:nat) : poly =
if length p = 0 then p
else append (create n false) p
let rshift (p:poly) (n:nat) : poly =
if length p <= n then zero
else slice p n (length p)
let shift (p:poly) (n:int) : poly =
if n >= 0 then lshift p n else rshift p (-n)
// Index any coefficient, where all coefficients beyond highest-order term are zero
// (and n < 0 returns zero)
let poly_index (p:poly) (n:int) : bool =
if 0 <= n && n < length p then index p n
else false
unfold let ( .[] ) = poly_index
let to_seq (p:poly) (n:nat) : Pure (seq bool)
(requires True)
(ensures fun s ->
length s == n /\
(forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i)
)
=
init n (poly_index p)
let rec of_seq (s:seq bool) : Pure poly
(requires True)
(ensures fun p ->
length p <= length s /\
(forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i)
)
(decreases (length s))
=
if valid s then s
else
of_seq (slice s 0 (length s - 1))
[@"opaque_to_smt"]
let of_fun (len:nat) (f:nat -> bool) : Pure poly
(requires True)
(ensures fun p ->
length p <= len /\
(forall (i:nat).{:pattern p.[i] \/ (f i)} i < len ==> p.[i] == f i) /\
(forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i < len)
)
=
of_seq (init len f)
[@"opaque_to_smt"]
let reverse (a:poly) (n:nat) : Pure poly
(requires True)
(ensures fun p ->
length p <= n + 1 /\
(forall (i:nat).{:pattern p.[i]} p.[i] == a.[n - i]) /\
(forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i <= n)
)
=
of_fun (n + 1) (fun (i:nat) -> a.[n - i])
[@"opaque_to_smt"]
let add (a b:poly) : Pure poly
(requires True)
(ensures fun p ->
let len = max (length a) (length b) in
length p <= len /\
(forall (i:int).{:pattern p.[i] \/ a.[i] \/ b.[i]} p.[i] == (a.[i] <> b.[i]))
)
=
let len = max (length a) (length b) in
of_fun len (fun (i:nat) -> a.[i] <> b.[i])
// f j + f (j + 1) + ... + f (k - 1)
let rec sum_of_bools (j k:int) (f:int -> bool) : Tot bool (decreases (k - j)) =
if j >= k then false
else (sum_of_bools j (k - 1) f) <> f (k - 1) | false | true | Vale.Math.Poly2.Defs_s.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val mul_element_fun (a b: poly) (k i: int) : bool | [] | Vale.Math.Poly2.Defs_s.mul_element_fun | {
"file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Vale.Math.Poly2.Defs_s.poly -> b: Vale.Math.Poly2.Defs_s.poly -> k: Prims.int -> i: Prims.int
-> Prims.bool | {
"end_col": 68,
"end_line": 104,
"start_col": 50,
"start_line": 104
} |
Prims.Tot | val degree (p: poly) : int | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let degree (p:poly) : int = length p - 1 | val degree (p: poly) : int
let degree (p: poly) : int = | false | null | false | length p - 1 | {
"checked_file": "Vale.Math.Poly2.Defs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Math.Poly2.Defs_s.fst"
} | [
"total"
] | [
"Vale.Math.Poly2.Defs_s.poly",
"Prims.op_Subtraction",
"FStar.Seq.Base.length",
"Prims.bool",
"Prims.int"
] | [] | module Vale.Math.Poly2.Defs_s
open FStar.Mul
open FStar.Seq
unfold let max = FStar.Math.Lib.max
// Polynomials cn * x^n + ... + c0 * x^0
// where coefficients ck are treated mod 2
let valid (s:seq bool) : bool =
length s = 0 || index s (length s - 1)
// Each coefficient of a polynomial is 0 (false) or 1 (true).
// Each polynomial has a unique valid representation:
// - zero is []
// - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term)
// The unique representation ensures that mathematically equal polynomials are = in F*.
// s[0] is lowest-order term (x^0).
let poly = s:(seq bool){valid s} | false | true | Vale.Math.Poly2.Defs_s.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val degree (p: poly) : int | [] | Vale.Math.Poly2.Defs_s.degree | {
"file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | p: Vale.Math.Poly2.Defs_s.poly -> Prims.int | {
"end_col": 40,
"end_line": 20,
"start_col": 28,
"start_line": 20
} |
Prims.Tot | val mod (a: poly) (b: poly{length b > 0}) : poly | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let mod (a:poly) (b:poly{length b > 0}) : poly = snd (divmod a b) | val mod (a: poly) (b: poly{length b > 0}) : poly
let mod (a: poly) (b: poly{length b > 0}) : poly = | false | null | false | snd (divmod a b) | {
"checked_file": "Vale.Math.Poly2.Defs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Math.Poly2.Defs_s.fst"
} | [
"total"
] | [
"Vale.Math.Poly2.Defs_s.poly",
"Prims.b2t",
"Prims.op_GreaterThan",
"FStar.Seq.Base.length",
"Prims.bool",
"FStar.Pervasives.Native.snd",
"Vale.Math.Poly2.Defs_s.divmod"
] | [] | module Vale.Math.Poly2.Defs_s
open FStar.Mul
open FStar.Seq
unfold let max = FStar.Math.Lib.max
// Polynomials cn * x^n + ... + c0 * x^0
// where coefficients ck are treated mod 2
let valid (s:seq bool) : bool =
length s = 0 || index s (length s - 1)
// Each coefficient of a polynomial is 0 (false) or 1 (true).
// Each polynomial has a unique valid representation:
// - zero is []
// - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term)
// The unique representation ensures that mathematically equal polynomials are = in F*.
// s[0] is lowest-order term (x^0).
let poly = s:(seq bool){valid s}
let degree (p:poly) : int = length p - 1
let zero = create 0 false
let one = create 1 true
let monomial (n:nat) : poly = append (create n false) one
let lshift (p:poly) (n:nat) : poly =
if length p = 0 then p
else append (create n false) p
let rshift (p:poly) (n:nat) : poly =
if length p <= n then zero
else slice p n (length p)
let shift (p:poly) (n:int) : poly =
if n >= 0 then lshift p n else rshift p (-n)
// Index any coefficient, where all coefficients beyond highest-order term are zero
// (and n < 0 returns zero)
let poly_index (p:poly) (n:int) : bool =
if 0 <= n && n < length p then index p n
else false
unfold let ( .[] ) = poly_index
let to_seq (p:poly) (n:nat) : Pure (seq bool)
(requires True)
(ensures fun s ->
length s == n /\
(forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i)
)
=
init n (poly_index p)
let rec of_seq (s:seq bool) : Pure poly
(requires True)
(ensures fun p ->
length p <= length s /\
(forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i)
)
(decreases (length s))
=
if valid s then s
else
of_seq (slice s 0 (length s - 1))
[@"opaque_to_smt"]
let of_fun (len:nat) (f:nat -> bool) : Pure poly
(requires True)
(ensures fun p ->
length p <= len /\
(forall (i:nat).{:pattern p.[i] \/ (f i)} i < len ==> p.[i] == f i) /\
(forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i < len)
)
=
of_seq (init len f)
[@"opaque_to_smt"]
let reverse (a:poly) (n:nat) : Pure poly
(requires True)
(ensures fun p ->
length p <= n + 1 /\
(forall (i:nat).{:pattern p.[i]} p.[i] == a.[n - i]) /\
(forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i <= n)
)
=
of_fun (n + 1) (fun (i:nat) -> a.[n - i])
[@"opaque_to_smt"]
let add (a b:poly) : Pure poly
(requires True)
(ensures fun p ->
let len = max (length a) (length b) in
length p <= len /\
(forall (i:int).{:pattern p.[i] \/ a.[i] \/ b.[i]} p.[i] == (a.[i] <> b.[i]))
)
=
let len = max (length a) (length b) in
of_fun len (fun (i:nat) -> a.[i] <> b.[i])
// f j + f (j + 1) + ... + f (k - 1)
let rec sum_of_bools (j k:int) (f:int -> bool) : Tot bool (decreases (k - j)) =
if j >= k then false
else (sum_of_bools j (k - 1) f) <> f (k - 1)
let mul_element_fun (a b:poly) (k i:int) : bool = a.[i] && b.[k - i]
// a0 * bk + a1 * b(k-1) + ... + ak * b0
let mul_element (a b:poly) (k:int) : bool =
sum_of_bools 0 (k + 1) (mul_element_fun a b k)
[@"opaque_to_smt"]
let mul (a b:poly) : Pure poly
(requires True)
(ensures fun p ->
let len = length a + length b in
length p <= len /\
(forall (i:nat).{:pattern p.[i]} i < len ==> p.[i] == mul_element a b i)
)
=
let len = length a + length b in
of_fun len (fun (i:nat) -> mul_element a b i)
let rec divmod (a:poly) (b:poly{length b > 0}) : Tot (poly & poly) (decreases (length a)) =
if length a < length b then
(zero, a)
else
let _ = assert (a.[length a - 1]) in
let a' = add a (shift b (length a - length b)) in
let (d, m) = divmod a' b in
(add d (monomial (length a - length b)), m) | false | false | Vale.Math.Poly2.Defs_s.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val mod (a: poly) (b: poly{length b > 0}) : poly | [] | Vale.Math.Poly2.Defs_s.mod | {
"file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Vale.Math.Poly2.Defs_s.poly -> b: Vale.Math.Poly2.Defs_s.poly{FStar.Seq.Base.length b > 0}
-> Vale.Math.Poly2.Defs_s.poly | {
"end_col": 65,
"end_line": 132,
"start_col": 49,
"start_line": 132
} |
Prims.Tot | val div (a: poly) (b: poly{length b > 0}) : poly | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let div (a:poly) (b:poly{length b > 0}) : poly = fst (divmod a b) | val div (a: poly) (b: poly{length b > 0}) : poly
let div (a: poly) (b: poly{length b > 0}) : poly = | false | null | false | fst (divmod a b) | {
"checked_file": "Vale.Math.Poly2.Defs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Math.Poly2.Defs_s.fst"
} | [
"total"
] | [
"Vale.Math.Poly2.Defs_s.poly",
"Prims.b2t",
"Prims.op_GreaterThan",
"FStar.Seq.Base.length",
"Prims.bool",
"FStar.Pervasives.Native.fst",
"Vale.Math.Poly2.Defs_s.divmod"
] | [] | module Vale.Math.Poly2.Defs_s
open FStar.Mul
open FStar.Seq
unfold let max = FStar.Math.Lib.max
// Polynomials cn * x^n + ... + c0 * x^0
// where coefficients ck are treated mod 2
let valid (s:seq bool) : bool =
length s = 0 || index s (length s - 1)
// Each coefficient of a polynomial is 0 (false) or 1 (true).
// Each polynomial has a unique valid representation:
// - zero is []
// - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term)
// The unique representation ensures that mathematically equal polynomials are = in F*.
// s[0] is lowest-order term (x^0).
let poly = s:(seq bool){valid s}
let degree (p:poly) : int = length p - 1
let zero = create 0 false
let one = create 1 true
let monomial (n:nat) : poly = append (create n false) one
let lshift (p:poly) (n:nat) : poly =
if length p = 0 then p
else append (create n false) p
let rshift (p:poly) (n:nat) : poly =
if length p <= n then zero
else slice p n (length p)
let shift (p:poly) (n:int) : poly =
if n >= 0 then lshift p n else rshift p (-n)
// Index any coefficient, where all coefficients beyond highest-order term are zero
// (and n < 0 returns zero)
let poly_index (p:poly) (n:int) : bool =
if 0 <= n && n < length p then index p n
else false
unfold let ( .[] ) = poly_index
let to_seq (p:poly) (n:nat) : Pure (seq bool)
(requires True)
(ensures fun s ->
length s == n /\
(forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i)
)
=
init n (poly_index p)
let rec of_seq (s:seq bool) : Pure poly
(requires True)
(ensures fun p ->
length p <= length s /\
(forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i)
)
(decreases (length s))
=
if valid s then s
else
of_seq (slice s 0 (length s - 1))
[@"opaque_to_smt"]
let of_fun (len:nat) (f:nat -> bool) : Pure poly
(requires True)
(ensures fun p ->
length p <= len /\
(forall (i:nat).{:pattern p.[i] \/ (f i)} i < len ==> p.[i] == f i) /\
(forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i < len)
)
=
of_seq (init len f)
[@"opaque_to_smt"]
let reverse (a:poly) (n:nat) : Pure poly
(requires True)
(ensures fun p ->
length p <= n + 1 /\
(forall (i:nat).{:pattern p.[i]} p.[i] == a.[n - i]) /\
(forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i <= n)
)
=
of_fun (n + 1) (fun (i:nat) -> a.[n - i])
[@"opaque_to_smt"]
let add (a b:poly) : Pure poly
(requires True)
(ensures fun p ->
let len = max (length a) (length b) in
length p <= len /\
(forall (i:int).{:pattern p.[i] \/ a.[i] \/ b.[i]} p.[i] == (a.[i] <> b.[i]))
)
=
let len = max (length a) (length b) in
of_fun len (fun (i:nat) -> a.[i] <> b.[i])
// f j + f (j + 1) + ... + f (k - 1)
let rec sum_of_bools (j k:int) (f:int -> bool) : Tot bool (decreases (k - j)) =
if j >= k then false
else (sum_of_bools j (k - 1) f) <> f (k - 1)
let mul_element_fun (a b:poly) (k i:int) : bool = a.[i] && b.[k - i]
// a0 * bk + a1 * b(k-1) + ... + ak * b0
let mul_element (a b:poly) (k:int) : bool =
sum_of_bools 0 (k + 1) (mul_element_fun a b k)
[@"opaque_to_smt"]
let mul (a b:poly) : Pure poly
(requires True)
(ensures fun p ->
let len = length a + length b in
length p <= len /\
(forall (i:nat).{:pattern p.[i]} i < len ==> p.[i] == mul_element a b i)
)
=
let len = length a + length b in
of_fun len (fun (i:nat) -> mul_element a b i)
let rec divmod (a:poly) (b:poly{length b > 0}) : Tot (poly & poly) (decreases (length a)) =
if length a < length b then
(zero, a)
else
let _ = assert (a.[length a - 1]) in
let a' = add a (shift b (length a - length b)) in
let (d, m) = divmod a' b in
(add d (monomial (length a - length b)), m) | false | false | Vale.Math.Poly2.Defs_s.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val div (a: poly) (b: poly{length b > 0}) : poly | [] | Vale.Math.Poly2.Defs_s.div | {
"file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Vale.Math.Poly2.Defs_s.poly -> b: Vale.Math.Poly2.Defs_s.poly{FStar.Seq.Base.length b > 0}
-> Vale.Math.Poly2.Defs_s.poly | {
"end_col": 65,
"end_line": 131,
"start_col": 49,
"start_line": 131
} |
Prims.Tot | val valid (s: seq bool) : bool | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let valid (s:seq bool) : bool =
length s = 0 || index s (length s - 1) | val valid (s: seq bool) : bool
let valid (s: seq bool) : bool = | false | null | false | length s = 0 || index s (length s - 1) | {
"checked_file": "Vale.Math.Poly2.Defs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Math.Poly2.Defs_s.fst"
} | [
"total"
] | [
"FStar.Seq.Base.seq",
"Prims.bool",
"Prims.op_BarBar",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"FStar.Seq.Base.index",
"Prims.op_Subtraction"
] | [] | module Vale.Math.Poly2.Defs_s
open FStar.Mul
open FStar.Seq
unfold let max = FStar.Math.Lib.max
// Polynomials cn * x^n + ... + c0 * x^0
// where coefficients ck are treated mod 2 | false | true | Vale.Math.Poly2.Defs_s.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val valid (s: seq bool) : bool | [] | Vale.Math.Poly2.Defs_s.valid | {
"file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: FStar.Seq.Base.seq Prims.bool -> Prims.bool | {
"end_col": 40,
"end_line": 10,
"start_col": 2,
"start_line": 10
} |
Prims.Tot | val monomial (n: nat) : poly | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let monomial (n:nat) : poly = append (create n false) one | val monomial (n: nat) : poly
let monomial (n: nat) : poly = | false | null | false | append (create n false) one | {
"checked_file": "Vale.Math.Poly2.Defs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Math.Poly2.Defs_s.fst"
} | [
"total"
] | [
"Prims.nat",
"FStar.Seq.Base.append",
"Prims.bool",
"FStar.Seq.Base.create",
"Vale.Math.Poly2.Defs_s.one",
"Vale.Math.Poly2.Defs_s.poly"
] | [] | module Vale.Math.Poly2.Defs_s
open FStar.Mul
open FStar.Seq
unfold let max = FStar.Math.Lib.max
// Polynomials cn * x^n + ... + c0 * x^0
// where coefficients ck are treated mod 2
let valid (s:seq bool) : bool =
length s = 0 || index s (length s - 1)
// Each coefficient of a polynomial is 0 (false) or 1 (true).
// Each polynomial has a unique valid representation:
// - zero is []
// - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term)
// The unique representation ensures that mathematically equal polynomials are = in F*.
// s[0] is lowest-order term (x^0).
let poly = s:(seq bool){valid s}
let degree (p:poly) : int = length p - 1
let zero = create 0 false | false | true | Vale.Math.Poly2.Defs_s.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val monomial (n: nat) : poly | [] | Vale.Math.Poly2.Defs_s.monomial | {
"file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | n: Prims.nat -> Vale.Math.Poly2.Defs_s.poly | {
"end_col": 57,
"end_line": 23,
"start_col": 30,
"start_line": 23
} |
Prims.Tot | val lshift (p: poly) (n: nat) : poly | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let lshift (p:poly) (n:nat) : poly =
if length p = 0 then p
else append (create n false) p | val lshift (p: poly) (n: nat) : poly
let lshift (p: poly) (n: nat) : poly = | false | null | false | if length p = 0 then p else append (create n false) p | {
"checked_file": "Vale.Math.Poly2.Defs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Math.Poly2.Defs_s.fst"
} | [
"total"
] | [
"Vale.Math.Poly2.Defs_s.poly",
"Prims.nat",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.bool",
"FStar.Seq.Base.append",
"FStar.Seq.Base.create"
] | [] | module Vale.Math.Poly2.Defs_s
open FStar.Mul
open FStar.Seq
unfold let max = FStar.Math.Lib.max
// Polynomials cn * x^n + ... + c0 * x^0
// where coefficients ck are treated mod 2
let valid (s:seq bool) : bool =
length s = 0 || index s (length s - 1)
// Each coefficient of a polynomial is 0 (false) or 1 (true).
// Each polynomial has a unique valid representation:
// - zero is []
// - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term)
// The unique representation ensures that mathematically equal polynomials are = in F*.
// s[0] is lowest-order term (x^0).
let poly = s:(seq bool){valid s}
let degree (p:poly) : int = length p - 1
let zero = create 0 false
let one = create 1 true
let monomial (n:nat) : poly = append (create n false) one | false | true | Vale.Math.Poly2.Defs_s.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lshift (p: poly) (n: nat) : poly | [] | Vale.Math.Poly2.Defs_s.lshift | {
"file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | p: Vale.Math.Poly2.Defs_s.poly -> n: Prims.nat -> Vale.Math.Poly2.Defs_s.poly | {
"end_col": 32,
"end_line": 27,
"start_col": 2,
"start_line": 26
} |
Prims.Tot | val rshift (p: poly) (n: nat) : poly | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rshift (p:poly) (n:nat) : poly =
if length p <= n then zero
else slice p n (length p) | val rshift (p: poly) (n: nat) : poly
let rshift (p: poly) (n: nat) : poly = | false | null | false | if length p <= n then zero else slice p n (length p) | {
"checked_file": "Vale.Math.Poly2.Defs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Math.Poly2.Defs_s.fst"
} | [
"total"
] | [
"Vale.Math.Poly2.Defs_s.poly",
"Prims.nat",
"Prims.op_LessThanOrEqual",
"FStar.Seq.Base.length",
"Prims.bool",
"Vale.Math.Poly2.Defs_s.zero",
"FStar.Seq.Base.slice"
] | [] | module Vale.Math.Poly2.Defs_s
open FStar.Mul
open FStar.Seq
unfold let max = FStar.Math.Lib.max
// Polynomials cn * x^n + ... + c0 * x^0
// where coefficients ck are treated mod 2
let valid (s:seq bool) : bool =
length s = 0 || index s (length s - 1)
// Each coefficient of a polynomial is 0 (false) or 1 (true).
// Each polynomial has a unique valid representation:
// - zero is []
// - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term)
// The unique representation ensures that mathematically equal polynomials are = in F*.
// s[0] is lowest-order term (x^0).
let poly = s:(seq bool){valid s}
let degree (p:poly) : int = length p - 1
let zero = create 0 false
let one = create 1 true
let monomial (n:nat) : poly = append (create n false) one
let lshift (p:poly) (n:nat) : poly =
if length p = 0 then p
else append (create n false) p | false | true | Vale.Math.Poly2.Defs_s.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val rshift (p: poly) (n: nat) : poly | [] | Vale.Math.Poly2.Defs_s.rshift | {
"file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | p: Vale.Math.Poly2.Defs_s.poly -> n: Prims.nat -> Vale.Math.Poly2.Defs_s.poly | {
"end_col": 27,
"end_line": 31,
"start_col": 2,
"start_line": 30
} |
Prims.Tot | val shift (p: poly) (n: int) : poly | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let shift (p:poly) (n:int) : poly =
if n >= 0 then lshift p n else rshift p (-n) | val shift (p: poly) (n: int) : poly
let shift (p: poly) (n: int) : poly = | false | null | false | if n >= 0 then lshift p n else rshift p (- n) | {
"checked_file": "Vale.Math.Poly2.Defs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Math.Poly2.Defs_s.fst"
} | [
"total"
] | [
"Vale.Math.Poly2.Defs_s.poly",
"Prims.int",
"Prims.op_GreaterThanOrEqual",
"Vale.Math.Poly2.Defs_s.lshift",
"Prims.bool",
"Vale.Math.Poly2.Defs_s.rshift",
"Prims.op_Minus"
] | [] | module Vale.Math.Poly2.Defs_s
open FStar.Mul
open FStar.Seq
unfold let max = FStar.Math.Lib.max
// Polynomials cn * x^n + ... + c0 * x^0
// where coefficients ck are treated mod 2
let valid (s:seq bool) : bool =
length s = 0 || index s (length s - 1)
// Each coefficient of a polynomial is 0 (false) or 1 (true).
// Each polynomial has a unique valid representation:
// - zero is []
// - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term)
// The unique representation ensures that mathematically equal polynomials are = in F*.
// s[0] is lowest-order term (x^0).
let poly = s:(seq bool){valid s}
let degree (p:poly) : int = length p - 1
let zero = create 0 false
let one = create 1 true
let monomial (n:nat) : poly = append (create n false) one
let lshift (p:poly) (n:nat) : poly =
if length p = 0 then p
else append (create n false) p
let rshift (p:poly) (n:nat) : poly =
if length p <= n then zero
else slice p n (length p) | false | true | Vale.Math.Poly2.Defs_s.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val shift (p: poly) (n: int) : poly | [] | Vale.Math.Poly2.Defs_s.shift | {
"file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | p: Vale.Math.Poly2.Defs_s.poly -> n: Prims.int -> Vale.Math.Poly2.Defs_s.poly | {
"end_col": 46,
"end_line": 34,
"start_col": 2,
"start_line": 34
} |
Prims.Tot | val sum_of_bools (j k: int) (f: (int -> bool)) : Tot bool (decreases (k - j)) | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec sum_of_bools (j k:int) (f:int -> bool) : Tot bool (decreases (k - j)) =
if j >= k then false
else (sum_of_bools j (k - 1) f) <> f (k - 1) | val sum_of_bools (j k: int) (f: (int -> bool)) : Tot bool (decreases (k - j))
let rec sum_of_bools (j k: int) (f: (int -> bool)) : Tot bool (decreases (k - j)) = | false | null | false | if j >= k then false else (sum_of_bools j (k - 1) f) <> f (k - 1) | {
"checked_file": "Vale.Math.Poly2.Defs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Math.Poly2.Defs_s.fst"
} | [
"total",
""
] | [
"Prims.int",
"Prims.bool",
"Prims.op_GreaterThanOrEqual",
"Prims.op_disEquality",
"Vale.Math.Poly2.Defs_s.sum_of_bools",
"Prims.op_Subtraction"
] | [] | module Vale.Math.Poly2.Defs_s
open FStar.Mul
open FStar.Seq
unfold let max = FStar.Math.Lib.max
// Polynomials cn * x^n + ... + c0 * x^0
// where coefficients ck are treated mod 2
let valid (s:seq bool) : bool =
length s = 0 || index s (length s - 1)
// Each coefficient of a polynomial is 0 (false) or 1 (true).
// Each polynomial has a unique valid representation:
// - zero is []
// - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term)
// The unique representation ensures that mathematically equal polynomials are = in F*.
// s[0] is lowest-order term (x^0).
let poly = s:(seq bool){valid s}
let degree (p:poly) : int = length p - 1
let zero = create 0 false
let one = create 1 true
let monomial (n:nat) : poly = append (create n false) one
let lshift (p:poly) (n:nat) : poly =
if length p = 0 then p
else append (create n false) p
let rshift (p:poly) (n:nat) : poly =
if length p <= n then zero
else slice p n (length p)
let shift (p:poly) (n:int) : poly =
if n >= 0 then lshift p n else rshift p (-n)
// Index any coefficient, where all coefficients beyond highest-order term are zero
// (and n < 0 returns zero)
let poly_index (p:poly) (n:int) : bool =
if 0 <= n && n < length p then index p n
else false
unfold let ( .[] ) = poly_index
let to_seq (p:poly) (n:nat) : Pure (seq bool)
(requires True)
(ensures fun s ->
length s == n /\
(forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i)
)
=
init n (poly_index p)
let rec of_seq (s:seq bool) : Pure poly
(requires True)
(ensures fun p ->
length p <= length s /\
(forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i)
)
(decreases (length s))
=
if valid s then s
else
of_seq (slice s 0 (length s - 1))
[@"opaque_to_smt"]
let of_fun (len:nat) (f:nat -> bool) : Pure poly
(requires True)
(ensures fun p ->
length p <= len /\
(forall (i:nat).{:pattern p.[i] \/ (f i)} i < len ==> p.[i] == f i) /\
(forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i < len)
)
=
of_seq (init len f)
[@"opaque_to_smt"]
let reverse (a:poly) (n:nat) : Pure poly
(requires True)
(ensures fun p ->
length p <= n + 1 /\
(forall (i:nat).{:pattern p.[i]} p.[i] == a.[n - i]) /\
(forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i <= n)
)
=
of_fun (n + 1) (fun (i:nat) -> a.[n - i])
[@"opaque_to_smt"]
let add (a b:poly) : Pure poly
(requires True)
(ensures fun p ->
let len = max (length a) (length b) in
length p <= len /\
(forall (i:int).{:pattern p.[i] \/ a.[i] \/ b.[i]} p.[i] == (a.[i] <> b.[i]))
)
=
let len = max (length a) (length b) in
of_fun len (fun (i:nat) -> a.[i] <> b.[i])
// f j + f (j + 1) + ... + f (k - 1) | false | true | Vale.Math.Poly2.Defs_s.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val sum_of_bools (j k: int) (f: (int -> bool)) : Tot bool (decreases (k - j)) | [
"recursion"
] | Vale.Math.Poly2.Defs_s.sum_of_bools | {
"file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | j: Prims.int -> k: Prims.int -> f: (_: Prims.int -> Prims.bool) -> Prims.Tot Prims.bool | {
"end_col": 46,
"end_line": 102,
"start_col": 2,
"start_line": 101
} |
Prims.Tot | val poly_index (p: poly) (n: int) : bool | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let poly_index (p:poly) (n:int) : bool =
if 0 <= n && n < length p then index p n
else false | val poly_index (p: poly) (n: int) : bool
let poly_index (p: poly) (n: int) : bool = | false | null | false | if 0 <= n && n < length p then index p n else false | {
"checked_file": "Vale.Math.Poly2.Defs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Math.Poly2.Defs_s.fst"
} | [
"total"
] | [
"Vale.Math.Poly2.Defs_s.poly",
"Prims.int",
"Prims.op_AmpAmp",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"FStar.Seq.Base.length",
"Prims.bool",
"FStar.Seq.Base.index"
] | [] | module Vale.Math.Poly2.Defs_s
open FStar.Mul
open FStar.Seq
unfold let max = FStar.Math.Lib.max
// Polynomials cn * x^n + ... + c0 * x^0
// where coefficients ck are treated mod 2
let valid (s:seq bool) : bool =
length s = 0 || index s (length s - 1)
// Each coefficient of a polynomial is 0 (false) or 1 (true).
// Each polynomial has a unique valid representation:
// - zero is []
// - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term)
// The unique representation ensures that mathematically equal polynomials are = in F*.
// s[0] is lowest-order term (x^0).
let poly = s:(seq bool){valid s}
let degree (p:poly) : int = length p - 1
let zero = create 0 false
let one = create 1 true
let monomial (n:nat) : poly = append (create n false) one
let lshift (p:poly) (n:nat) : poly =
if length p = 0 then p
else append (create n false) p
let rshift (p:poly) (n:nat) : poly =
if length p <= n then zero
else slice p n (length p)
let shift (p:poly) (n:int) : poly =
if n >= 0 then lshift p n else rshift p (-n)
// Index any coefficient, where all coefficients beyond highest-order term are zero
// (and n < 0 returns zero) | false | true | Vale.Math.Poly2.Defs_s.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val poly_index (p: poly) (n: int) : bool | [] | Vale.Math.Poly2.Defs_s.poly_index | {
"file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | p: Vale.Math.Poly2.Defs_s.poly -> n: Prims.int -> Prims.bool | {
"end_col": 12,
"end_line": 40,
"start_col": 2,
"start_line": 39
} |
Prims.Pure | val of_fun (len: nat) (f: (nat -> bool))
: Pure poly
(requires True)
(ensures
fun p ->
length p <= len /\ (forall (i: nat). {:pattern p.[ i ]\/(f i)} i < len ==> p.[ i ] == f i) /\
(forall (i: int). {:pattern p.[ i ]} p.[ i ] ==> 0 <= i /\ i < len)) | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let of_fun (len:nat) (f:nat -> bool) : Pure poly
(requires True)
(ensures fun p ->
length p <= len /\
(forall (i:nat).{:pattern p.[i] \/ (f i)} i < len ==> p.[i] == f i) /\
(forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i < len)
)
=
of_seq (init len f) | val of_fun (len: nat) (f: (nat -> bool))
: Pure poly
(requires True)
(ensures
fun p ->
length p <= len /\ (forall (i: nat). {:pattern p.[ i ]\/(f i)} i < len ==> p.[ i ] == f i) /\
(forall (i: int). {:pattern p.[ i ]} p.[ i ] ==> 0 <= i /\ i < len))
let of_fun (len: nat) (f: (nat -> bool))
: Pure poly
(requires True)
(ensures
fun p ->
length p <= len /\ (forall (i: nat). {:pattern p.[ i ]\/(f i)} i < len ==> p.[ i ] == f i) /\
(forall (i: int). {:pattern p.[ i ]} p.[ i ] ==> 0 <= i /\ i < len)) = | false | null | false | of_seq (init len f) | {
"checked_file": "Vale.Math.Poly2.Defs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Math.Poly2.Defs_s.fst"
} | [] | [
"Prims.nat",
"Prims.bool",
"Vale.Math.Poly2.Defs_s.of_seq",
"FStar.Seq.Base.init",
"Vale.Math.Poly2.Defs_s.poly",
"Prims.l_True",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.Seq.Base.length",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.op_LessThan",
"Prims.eq2",
"Vale.Math.Poly2.Defs_s.op_String_Access",
"Prims.int"
] | [] | module Vale.Math.Poly2.Defs_s
open FStar.Mul
open FStar.Seq
unfold let max = FStar.Math.Lib.max
// Polynomials cn * x^n + ... + c0 * x^0
// where coefficients ck are treated mod 2
let valid (s:seq bool) : bool =
length s = 0 || index s (length s - 1)
// Each coefficient of a polynomial is 0 (false) or 1 (true).
// Each polynomial has a unique valid representation:
// - zero is []
// - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term)
// The unique representation ensures that mathematically equal polynomials are = in F*.
// s[0] is lowest-order term (x^0).
let poly = s:(seq bool){valid s}
let degree (p:poly) : int = length p - 1
let zero = create 0 false
let one = create 1 true
let monomial (n:nat) : poly = append (create n false) one
let lshift (p:poly) (n:nat) : poly =
if length p = 0 then p
else append (create n false) p
let rshift (p:poly) (n:nat) : poly =
if length p <= n then zero
else slice p n (length p)
let shift (p:poly) (n:int) : poly =
if n >= 0 then lshift p n else rshift p (-n)
// Index any coefficient, where all coefficients beyond highest-order term are zero
// (and n < 0 returns zero)
let poly_index (p:poly) (n:int) : bool =
if 0 <= n && n < length p then index p n
else false
unfold let ( .[] ) = poly_index
let to_seq (p:poly) (n:nat) : Pure (seq bool)
(requires True)
(ensures fun s ->
length s == n /\
(forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i)
)
=
init n (poly_index p)
let rec of_seq (s:seq bool) : Pure poly
(requires True)
(ensures fun p ->
length p <= length s /\
(forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i)
)
(decreases (length s))
=
if valid s then s
else
of_seq (slice s 0 (length s - 1))
[@"opaque_to_smt"]
let of_fun (len:nat) (f:nat -> bool) : Pure poly
(requires True)
(ensures fun p ->
length p <= len /\
(forall (i:nat).{:pattern p.[i] \/ (f i)} i < len ==> p.[i] == f i) /\
(forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i < len)
) | false | false | Vale.Math.Poly2.Defs_s.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val of_fun (len: nat) (f: (nat -> bool))
: Pure poly
(requires True)
(ensures
fun p ->
length p <= len /\ (forall (i: nat). {:pattern p.[ i ]\/(f i)} i < len ==> p.[ i ] == f i) /\
(forall (i: int). {:pattern p.[ i ]} p.[ i ] ==> 0 <= i /\ i < len)) | [] | Vale.Math.Poly2.Defs_s.of_fun | {
"file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | len: Prims.nat -> f: (_: Prims.nat -> Prims.bool) -> Prims.Pure Vale.Math.Poly2.Defs_s.poly | {
"end_col": 21,
"end_line": 74,
"start_col": 2,
"start_line": 74
} |
Prims.Pure | val to_seq (p: poly) (n: nat)
: Pure (seq bool)
(requires True)
(ensures
fun s ->
length s == n /\
(forall (i: nat). {:pattern (p.[ i ])\/(index s i)} i < length s ==> p.[ i ] == index s i)
) | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let to_seq (p:poly) (n:nat) : Pure (seq bool)
(requires True)
(ensures fun s ->
length s == n /\
(forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i)
)
=
init n (poly_index p) | val to_seq (p: poly) (n: nat)
: Pure (seq bool)
(requires True)
(ensures
fun s ->
length s == n /\
(forall (i: nat). {:pattern (p.[ i ])\/(index s i)} i < length s ==> p.[ i ] == index s i)
)
let to_seq (p: poly) (n: nat)
: Pure (seq bool)
(requires True)
(ensures
fun s ->
length s == n /\
(forall (i: nat). {:pattern (p.[ i ])\/(index s i)} i < length s ==> p.[ i ] == index s i)
) = | false | null | false | init n (poly_index p) | {
"checked_file": "Vale.Math.Poly2.Defs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Math.Poly2.Defs_s.fst"
} | [] | [
"Vale.Math.Poly2.Defs_s.poly",
"Prims.nat",
"FStar.Seq.Base.init",
"Prims.bool",
"Vale.Math.Poly2.Defs_s.poly_index",
"FStar.Seq.Base.seq",
"Prims.l_True",
"Prims.l_and",
"Prims.eq2",
"FStar.Seq.Base.length",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.b2t",
"Prims.op_LessThan",
"Vale.Math.Poly2.Defs_s.op_String_Access",
"FStar.Seq.Base.index"
] | [] | module Vale.Math.Poly2.Defs_s
open FStar.Mul
open FStar.Seq
unfold let max = FStar.Math.Lib.max
// Polynomials cn * x^n + ... + c0 * x^0
// where coefficients ck are treated mod 2
let valid (s:seq bool) : bool =
length s = 0 || index s (length s - 1)
// Each coefficient of a polynomial is 0 (false) or 1 (true).
// Each polynomial has a unique valid representation:
// - zero is []
// - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term)
// The unique representation ensures that mathematically equal polynomials are = in F*.
// s[0] is lowest-order term (x^0).
let poly = s:(seq bool){valid s}
let degree (p:poly) : int = length p - 1
let zero = create 0 false
let one = create 1 true
let monomial (n:nat) : poly = append (create n false) one
let lshift (p:poly) (n:nat) : poly =
if length p = 0 then p
else append (create n false) p
let rshift (p:poly) (n:nat) : poly =
if length p <= n then zero
else slice p n (length p)
let shift (p:poly) (n:int) : poly =
if n >= 0 then lshift p n else rshift p (-n)
// Index any coefficient, where all coefficients beyond highest-order term are zero
// (and n < 0 returns zero)
let poly_index (p:poly) (n:int) : bool =
if 0 <= n && n < length p then index p n
else false
unfold let ( .[] ) = poly_index
let to_seq (p:poly) (n:nat) : Pure (seq bool)
(requires True)
(ensures fun s ->
length s == n /\
(forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i)
) | false | false | Vale.Math.Poly2.Defs_s.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val to_seq (p: poly) (n: nat)
: Pure (seq bool)
(requires True)
(ensures
fun s ->
length s == n /\
(forall (i: nat). {:pattern (p.[ i ])\/(index s i)} i < length s ==> p.[ i ] == index s i)
) | [] | Vale.Math.Poly2.Defs_s.to_seq | {
"file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | p: Vale.Math.Poly2.Defs_s.poly -> n: Prims.nat -> Prims.Pure (FStar.Seq.Base.seq Prims.bool) | {
"end_col": 23,
"end_line": 51,
"start_col": 2,
"start_line": 51
} |
Prims.Pure | val reverse (a: poly) (n: nat)
: Pure poly
(requires True)
(ensures
fun p ->
length p <= n + 1 /\ (forall (i: nat). {:pattern p.[ i ]} p.[ i ] == a.[ n - i ]) /\
(forall (i: int). {:pattern p.[ i ]} p.[ i ] ==> 0 <= i /\ i <= n)) | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let reverse (a:poly) (n:nat) : Pure poly
(requires True)
(ensures fun p ->
length p <= n + 1 /\
(forall (i:nat).{:pattern p.[i]} p.[i] == a.[n - i]) /\
(forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i <= n)
)
=
of_fun (n + 1) (fun (i:nat) -> a.[n - i]) | val reverse (a: poly) (n: nat)
: Pure poly
(requires True)
(ensures
fun p ->
length p <= n + 1 /\ (forall (i: nat). {:pattern p.[ i ]} p.[ i ] == a.[ n - i ]) /\
(forall (i: int). {:pattern p.[ i ]} p.[ i ] ==> 0 <= i /\ i <= n))
let reverse (a: poly) (n: nat)
: Pure poly
(requires True)
(ensures
fun p ->
length p <= n + 1 /\ (forall (i: nat). {:pattern p.[ i ]} p.[ i ] == a.[ n - i ]) /\
(forall (i: int). {:pattern p.[ i ]} p.[ i ] ==> 0 <= i /\ i <= n)) = | false | null | false | of_fun (n + 1) (fun (i: nat) -> a.[ n - i ]) | {
"checked_file": "Vale.Math.Poly2.Defs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Math.Poly2.Defs_s.fst"
} | [] | [
"Vale.Math.Poly2.Defs_s.poly",
"Prims.nat",
"Vale.Math.Poly2.Defs_s.of_fun",
"Prims.op_Addition",
"Vale.Math.Poly2.Defs_s.op_String_Access",
"Prims.op_Subtraction",
"Prims.bool",
"Prims.l_True",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.Seq.Base.length",
"Prims.l_Forall",
"Prims.eq2",
"Prims.int",
"Prims.l_imp"
] | [] | module Vale.Math.Poly2.Defs_s
open FStar.Mul
open FStar.Seq
unfold let max = FStar.Math.Lib.max
// Polynomials cn * x^n + ... + c0 * x^0
// where coefficients ck are treated mod 2
let valid (s:seq bool) : bool =
length s = 0 || index s (length s - 1)
// Each coefficient of a polynomial is 0 (false) or 1 (true).
// Each polynomial has a unique valid representation:
// - zero is []
// - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term)
// The unique representation ensures that mathematically equal polynomials are = in F*.
// s[0] is lowest-order term (x^0).
let poly = s:(seq bool){valid s}
let degree (p:poly) : int = length p - 1
let zero = create 0 false
let one = create 1 true
let monomial (n:nat) : poly = append (create n false) one
let lshift (p:poly) (n:nat) : poly =
if length p = 0 then p
else append (create n false) p
let rshift (p:poly) (n:nat) : poly =
if length p <= n then zero
else slice p n (length p)
let shift (p:poly) (n:int) : poly =
if n >= 0 then lshift p n else rshift p (-n)
// Index any coefficient, where all coefficients beyond highest-order term are zero
// (and n < 0 returns zero)
let poly_index (p:poly) (n:int) : bool =
if 0 <= n && n < length p then index p n
else false
unfold let ( .[] ) = poly_index
let to_seq (p:poly) (n:nat) : Pure (seq bool)
(requires True)
(ensures fun s ->
length s == n /\
(forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i)
)
=
init n (poly_index p)
let rec of_seq (s:seq bool) : Pure poly
(requires True)
(ensures fun p ->
length p <= length s /\
(forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i)
)
(decreases (length s))
=
if valid s then s
else
of_seq (slice s 0 (length s - 1))
[@"opaque_to_smt"]
let of_fun (len:nat) (f:nat -> bool) : Pure poly
(requires True)
(ensures fun p ->
length p <= len /\
(forall (i:nat).{:pattern p.[i] \/ (f i)} i < len ==> p.[i] == f i) /\
(forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i < len)
)
=
of_seq (init len f)
[@"opaque_to_smt"]
let reverse (a:poly) (n:nat) : Pure poly
(requires True)
(ensures fun p ->
length p <= n + 1 /\
(forall (i:nat).{:pattern p.[i]} p.[i] == a.[n - i]) /\
(forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i <= n)
) | false | false | Vale.Math.Poly2.Defs_s.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val reverse (a: poly) (n: nat)
: Pure poly
(requires True)
(ensures
fun p ->
length p <= n + 1 /\ (forall (i: nat). {:pattern p.[ i ]} p.[ i ] == a.[ n - i ]) /\
(forall (i: int). {:pattern p.[ i ]} p.[ i ] ==> 0 <= i /\ i <= n)) | [] | Vale.Math.Poly2.Defs_s.reverse | {
"file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Vale.Math.Poly2.Defs_s.poly -> n: Prims.nat -> Prims.Pure Vale.Math.Poly2.Defs_s.poly | {
"end_col": 43,
"end_line": 85,
"start_col": 2,
"start_line": 85
} |
Prims.Pure | val mul (a b: poly)
: Pure poly
(requires True)
(ensures
fun p ->
let len = length a + length b in
length p <= len /\
(forall (i: nat). {:pattern p.[ i ]} i < len ==> p.[ i ] == mul_element a b i)) | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let mul (a b:poly) : Pure poly
(requires True)
(ensures fun p ->
let len = length a + length b in
length p <= len /\
(forall (i:nat).{:pattern p.[i]} i < len ==> p.[i] == mul_element a b i)
)
=
let len = length a + length b in
of_fun len (fun (i:nat) -> mul_element a b i) | val mul (a b: poly)
: Pure poly
(requires True)
(ensures
fun p ->
let len = length a + length b in
length p <= len /\
(forall (i: nat). {:pattern p.[ i ]} i < len ==> p.[ i ] == mul_element a b i))
let mul (a b: poly)
: Pure poly
(requires True)
(ensures
fun p ->
let len = length a + length b in
length p <= len /\
(forall (i: nat). {:pattern p.[ i ]} i < len ==> p.[ i ] == mul_element a b i)) = | false | null | false | let len = length a + length b in
of_fun len (fun (i: nat) -> mul_element a b i) | {
"checked_file": "Vale.Math.Poly2.Defs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Math.Poly2.Defs_s.fst"
} | [] | [
"Vale.Math.Poly2.Defs_s.poly",
"Vale.Math.Poly2.Defs_s.of_fun",
"Prims.nat",
"Vale.Math.Poly2.Defs_s.mul_element",
"Prims.bool",
"Prims.int",
"Prims.op_Addition",
"FStar.Seq.Base.length",
"Prims.l_True",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.op_LessThan",
"Prims.eq2",
"Vale.Math.Poly2.Defs_s.op_String_Access"
] | [] | module Vale.Math.Poly2.Defs_s
open FStar.Mul
open FStar.Seq
unfold let max = FStar.Math.Lib.max
// Polynomials cn * x^n + ... + c0 * x^0
// where coefficients ck are treated mod 2
let valid (s:seq bool) : bool =
length s = 0 || index s (length s - 1)
// Each coefficient of a polynomial is 0 (false) or 1 (true).
// Each polynomial has a unique valid representation:
// - zero is []
// - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term)
// The unique representation ensures that mathematically equal polynomials are = in F*.
// s[0] is lowest-order term (x^0).
let poly = s:(seq bool){valid s}
let degree (p:poly) : int = length p - 1
let zero = create 0 false
let one = create 1 true
let monomial (n:nat) : poly = append (create n false) one
let lshift (p:poly) (n:nat) : poly =
if length p = 0 then p
else append (create n false) p
let rshift (p:poly) (n:nat) : poly =
if length p <= n then zero
else slice p n (length p)
let shift (p:poly) (n:int) : poly =
if n >= 0 then lshift p n else rshift p (-n)
// Index any coefficient, where all coefficients beyond highest-order term are zero
// (and n < 0 returns zero)
let poly_index (p:poly) (n:int) : bool =
if 0 <= n && n < length p then index p n
else false
unfold let ( .[] ) = poly_index
let to_seq (p:poly) (n:nat) : Pure (seq bool)
(requires True)
(ensures fun s ->
length s == n /\
(forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i)
)
=
init n (poly_index p)
let rec of_seq (s:seq bool) : Pure poly
(requires True)
(ensures fun p ->
length p <= length s /\
(forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i)
)
(decreases (length s))
=
if valid s then s
else
of_seq (slice s 0 (length s - 1))
[@"opaque_to_smt"]
let of_fun (len:nat) (f:nat -> bool) : Pure poly
(requires True)
(ensures fun p ->
length p <= len /\
(forall (i:nat).{:pattern p.[i] \/ (f i)} i < len ==> p.[i] == f i) /\
(forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i < len)
)
=
of_seq (init len f)
[@"opaque_to_smt"]
let reverse (a:poly) (n:nat) : Pure poly
(requires True)
(ensures fun p ->
length p <= n + 1 /\
(forall (i:nat).{:pattern p.[i]} p.[i] == a.[n - i]) /\
(forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i <= n)
)
=
of_fun (n + 1) (fun (i:nat) -> a.[n - i])
[@"opaque_to_smt"]
let add (a b:poly) : Pure poly
(requires True)
(ensures fun p ->
let len = max (length a) (length b) in
length p <= len /\
(forall (i:int).{:pattern p.[i] \/ a.[i] \/ b.[i]} p.[i] == (a.[i] <> b.[i]))
)
=
let len = max (length a) (length b) in
of_fun len (fun (i:nat) -> a.[i] <> b.[i])
// f j + f (j + 1) + ... + f (k - 1)
let rec sum_of_bools (j k:int) (f:int -> bool) : Tot bool (decreases (k - j)) =
if j >= k then false
else (sum_of_bools j (k - 1) f) <> f (k - 1)
let mul_element_fun (a b:poly) (k i:int) : bool = a.[i] && b.[k - i]
// a0 * bk + a1 * b(k-1) + ... + ak * b0
let mul_element (a b:poly) (k:int) : bool =
sum_of_bools 0 (k + 1) (mul_element_fun a b k)
[@"opaque_to_smt"]
let mul (a b:poly) : Pure poly
(requires True)
(ensures fun p ->
let len = length a + length b in
length p <= len /\
(forall (i:nat).{:pattern p.[i]} i < len ==> p.[i] == mul_element a b i) | false | false | Vale.Math.Poly2.Defs_s.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val mul (a b: poly)
: Pure poly
(requires True)
(ensures
fun p ->
let len = length a + length b in
length p <= len /\
(forall (i: nat). {:pattern p.[ i ]} i < len ==> p.[ i ] == mul_element a b i)) | [] | Vale.Math.Poly2.Defs_s.mul | {
"file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Vale.Math.Poly2.Defs_s.poly -> b: Vale.Math.Poly2.Defs_s.poly
-> Prims.Pure Vale.Math.Poly2.Defs_s.poly | {
"end_col": 47,
"end_line": 120,
"start_col": 3,
"start_line": 118
} |
Prims.Pure | val of_seq (s: seq bool)
: Pure poly
(requires True)
(ensures
fun p ->
length p <= length s /\
(forall (i: nat). {:pattern (p.[ i ])\/(index s i)} i < length s ==> p.[ i ] == index s i)
)
(decreases (length s)) | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec of_seq (s:seq bool) : Pure poly
(requires True)
(ensures fun p ->
length p <= length s /\
(forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i)
)
(decreases (length s))
=
if valid s then s
else
of_seq (slice s 0 (length s - 1)) | val of_seq (s: seq bool)
: Pure poly
(requires True)
(ensures
fun p ->
length p <= length s /\
(forall (i: nat). {:pattern (p.[ i ])\/(index s i)} i < length s ==> p.[ i ] == index s i)
)
(decreases (length s))
let rec of_seq (s: seq bool)
: Pure poly
(requires True)
(ensures
fun p ->
length p <= length s /\
(forall (i: nat). {:pattern (p.[ i ])\/(index s i)} i < length s ==> p.[ i ] == index s i)
)
(decreases (length s)) = | false | null | false | if valid s then s else of_seq (slice s 0 (length s - 1)) | {
"checked_file": "Vale.Math.Poly2.Defs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Math.Poly2.Defs_s.fst"
} | [
""
] | [
"FStar.Seq.Base.seq",
"Prims.bool",
"Vale.Math.Poly2.Defs_s.valid",
"Vale.Math.Poly2.Defs_s.of_seq",
"FStar.Seq.Base.slice",
"Prims.op_Subtraction",
"FStar.Seq.Base.length",
"Vale.Math.Poly2.Defs_s.poly",
"Prims.l_True",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.l_Forall",
"Prims.nat",
"Prims.l_imp",
"Prims.op_LessThan",
"Prims.eq2",
"Vale.Math.Poly2.Defs_s.op_String_Access",
"FStar.Seq.Base.index"
] | [] | module Vale.Math.Poly2.Defs_s
open FStar.Mul
open FStar.Seq
unfold let max = FStar.Math.Lib.max
// Polynomials cn * x^n + ... + c0 * x^0
// where coefficients ck are treated mod 2
let valid (s:seq bool) : bool =
length s = 0 || index s (length s - 1)
// Each coefficient of a polynomial is 0 (false) or 1 (true).
// Each polynomial has a unique valid representation:
// - zero is []
// - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term)
// The unique representation ensures that mathematically equal polynomials are = in F*.
// s[0] is lowest-order term (x^0).
let poly = s:(seq bool){valid s}
let degree (p:poly) : int = length p - 1
let zero = create 0 false
let one = create 1 true
let monomial (n:nat) : poly = append (create n false) one
let lshift (p:poly) (n:nat) : poly =
if length p = 0 then p
else append (create n false) p
let rshift (p:poly) (n:nat) : poly =
if length p <= n then zero
else slice p n (length p)
let shift (p:poly) (n:int) : poly =
if n >= 0 then lshift p n else rshift p (-n)
// Index any coefficient, where all coefficients beyond highest-order term are zero
// (and n < 0 returns zero)
let poly_index (p:poly) (n:int) : bool =
if 0 <= n && n < length p then index p n
else false
unfold let ( .[] ) = poly_index
let to_seq (p:poly) (n:nat) : Pure (seq bool)
(requires True)
(ensures fun s ->
length s == n /\
(forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i)
)
=
init n (poly_index p)
let rec of_seq (s:seq bool) : Pure poly
(requires True)
(ensures fun p ->
length p <= length s /\
(forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i)
)
(decreases (length s)) | false | false | Vale.Math.Poly2.Defs_s.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val of_seq (s: seq bool)
: Pure poly
(requires True)
(ensures
fun p ->
length p <= length s /\
(forall (i: nat). {:pattern (p.[ i ])\/(index s i)} i < length s ==> p.[ i ] == index s i)
)
(decreases (length s)) | [
"recursion"
] | Vale.Math.Poly2.Defs_s.of_seq | {
"file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s: FStar.Seq.Base.seq Prims.bool -> Prims.Pure Vale.Math.Poly2.Defs_s.poly | {
"end_col": 37,
"end_line": 63,
"start_col": 2,
"start_line": 61
} |
Prims.Tot | val divmod (a: poly) (b: poly{length b > 0}) : Tot (poly & poly) (decreases (length a)) | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec divmod (a:poly) (b:poly{length b > 0}) : Tot (poly & poly) (decreases (length a)) =
if length a < length b then
(zero, a)
else
let _ = assert (a.[length a - 1]) in
let a' = add a (shift b (length a - length b)) in
let (d, m) = divmod a' b in
(add d (monomial (length a - length b)), m) | val divmod (a: poly) (b: poly{length b > 0}) : Tot (poly & poly) (decreases (length a))
let rec divmod (a: poly) (b: poly{length b > 0}) : Tot (poly & poly) (decreases (length a)) = | false | null | false | if length a < length b
then (zero, a)
else
let _ = assert (a.[ length a - 1 ]) in
let a' = add a (shift b (length a - length b)) in
let d, m = divmod a' b in
(add d (monomial (length a - length b)), m) | {
"checked_file": "Vale.Math.Poly2.Defs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Math.Poly2.Defs_s.fst"
} | [
"total",
""
] | [
"Vale.Math.Poly2.Defs_s.poly",
"Prims.b2t",
"Prims.op_GreaterThan",
"FStar.Seq.Base.length",
"Prims.bool",
"Prims.op_LessThan",
"FStar.Pervasives.Native.Mktuple2",
"Vale.Math.Poly2.Defs_s.zero",
"Vale.Math.Poly2.Defs_s.add",
"Vale.Math.Poly2.Defs_s.monomial",
"Prims.op_Subtraction",
"FStar.Pervasives.Native.tuple2",
"Vale.Math.Poly2.Defs_s.divmod",
"Vale.Math.Poly2.Defs_s.shift",
"Prims.unit",
"Prims._assert",
"Vale.Math.Poly2.Defs_s.op_String_Access"
] | [] | module Vale.Math.Poly2.Defs_s
open FStar.Mul
open FStar.Seq
unfold let max = FStar.Math.Lib.max
// Polynomials cn * x^n + ... + c0 * x^0
// where coefficients ck are treated mod 2
let valid (s:seq bool) : bool =
length s = 0 || index s (length s - 1)
// Each coefficient of a polynomial is 0 (false) or 1 (true).
// Each polynomial has a unique valid representation:
// - zero is []
// - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term)
// The unique representation ensures that mathematically equal polynomials are = in F*.
// s[0] is lowest-order term (x^0).
let poly = s:(seq bool){valid s}
let degree (p:poly) : int = length p - 1
let zero = create 0 false
let one = create 1 true
let monomial (n:nat) : poly = append (create n false) one
let lshift (p:poly) (n:nat) : poly =
if length p = 0 then p
else append (create n false) p
let rshift (p:poly) (n:nat) : poly =
if length p <= n then zero
else slice p n (length p)
let shift (p:poly) (n:int) : poly =
if n >= 0 then lshift p n else rshift p (-n)
// Index any coefficient, where all coefficients beyond highest-order term are zero
// (and n < 0 returns zero)
let poly_index (p:poly) (n:int) : bool =
if 0 <= n && n < length p then index p n
else false
unfold let ( .[] ) = poly_index
let to_seq (p:poly) (n:nat) : Pure (seq bool)
(requires True)
(ensures fun s ->
length s == n /\
(forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i)
)
=
init n (poly_index p)
let rec of_seq (s:seq bool) : Pure poly
(requires True)
(ensures fun p ->
length p <= length s /\
(forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i)
)
(decreases (length s))
=
if valid s then s
else
of_seq (slice s 0 (length s - 1))
[@"opaque_to_smt"]
let of_fun (len:nat) (f:nat -> bool) : Pure poly
(requires True)
(ensures fun p ->
length p <= len /\
(forall (i:nat).{:pattern p.[i] \/ (f i)} i < len ==> p.[i] == f i) /\
(forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i < len)
)
=
of_seq (init len f)
[@"opaque_to_smt"]
let reverse (a:poly) (n:nat) : Pure poly
(requires True)
(ensures fun p ->
length p <= n + 1 /\
(forall (i:nat).{:pattern p.[i]} p.[i] == a.[n - i]) /\
(forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i <= n)
)
=
of_fun (n + 1) (fun (i:nat) -> a.[n - i])
[@"opaque_to_smt"]
let add (a b:poly) : Pure poly
(requires True)
(ensures fun p ->
let len = max (length a) (length b) in
length p <= len /\
(forall (i:int).{:pattern p.[i] \/ a.[i] \/ b.[i]} p.[i] == (a.[i] <> b.[i]))
)
=
let len = max (length a) (length b) in
of_fun len (fun (i:nat) -> a.[i] <> b.[i])
// f j + f (j + 1) + ... + f (k - 1)
let rec sum_of_bools (j k:int) (f:int -> bool) : Tot bool (decreases (k - j)) =
if j >= k then false
else (sum_of_bools j (k - 1) f) <> f (k - 1)
let mul_element_fun (a b:poly) (k i:int) : bool = a.[i] && b.[k - i]
// a0 * bk + a1 * b(k-1) + ... + ak * b0
let mul_element (a b:poly) (k:int) : bool =
sum_of_bools 0 (k + 1) (mul_element_fun a b k)
[@"opaque_to_smt"]
let mul (a b:poly) : Pure poly
(requires True)
(ensures fun p ->
let len = length a + length b in
length p <= len /\
(forall (i:nat).{:pattern p.[i]} i < len ==> p.[i] == mul_element a b i)
)
=
let len = length a + length b in
of_fun len (fun (i:nat) -> mul_element a b i) | false | false | Vale.Math.Poly2.Defs_s.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val divmod (a: poly) (b: poly{length b > 0}) : Tot (poly & poly) (decreases (length a)) | [
"recursion"
] | Vale.Math.Poly2.Defs_s.divmod | {
"file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Vale.Math.Poly2.Defs_s.poly -> b: Vale.Math.Poly2.Defs_s.poly{FStar.Seq.Base.length b > 0}
-> Prims.Tot (Vale.Math.Poly2.Defs_s.poly * Vale.Math.Poly2.Defs_s.poly) | {
"end_col": 47,
"end_line": 129,
"start_col": 2,
"start_line": 123
} |
Prims.Pure | val add (a b: poly)
: Pure poly
(requires True)
(ensures
fun p ->
let len = max (length a) (length b) in
length p <= len /\
(forall (i: int). {:pattern p.[ i ]\/a.[ i ]\/b.[ i ]} p.[ i ] == (a.[ i ] <> b.[ i ]))) | [
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let add (a b:poly) : Pure poly
(requires True)
(ensures fun p ->
let len = max (length a) (length b) in
length p <= len /\
(forall (i:int).{:pattern p.[i] \/ a.[i] \/ b.[i]} p.[i] == (a.[i] <> b.[i]))
)
=
let len = max (length a) (length b) in
of_fun len (fun (i:nat) -> a.[i] <> b.[i]) | val add (a b: poly)
: Pure poly
(requires True)
(ensures
fun p ->
let len = max (length a) (length b) in
length p <= len /\
(forall (i: int). {:pattern p.[ i ]\/a.[ i ]\/b.[ i ]} p.[ i ] == (a.[ i ] <> b.[ i ])))
let add (a b: poly)
: Pure poly
(requires True)
(ensures
fun p ->
let len = max (length a) (length b) in
length p <= len /\
(forall (i: int). {:pattern p.[ i ]\/a.[ i ]\/b.[ i ]} p.[ i ] == (a.[ i ] <> b.[ i ]))) = | false | null | false | let len = max (length a) (length b) in
of_fun len (fun (i: nat) -> a.[ i ] <> b.[ i ]) | {
"checked_file": "Vale.Math.Poly2.Defs_s.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lib.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Math.Poly2.Defs_s.fst"
} | [] | [
"Vale.Math.Poly2.Defs_s.poly",
"Vale.Math.Poly2.Defs_s.of_fun",
"Prims.nat",
"Prims.op_disEquality",
"Prims.bool",
"Vale.Math.Poly2.Defs_s.op_String_Access",
"Prims.int",
"Prims.l_and",
"Prims.l_imp",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"FStar.Seq.Base.length",
"Prims.op_Equality",
"Prims.op_LessThan",
"Vale.Math.Poly2.Defs_s.max",
"Prims.l_True",
"Prims.op_LessThanOrEqual",
"Prims.l_Forall",
"Prims.eq2"
] | [] | module Vale.Math.Poly2.Defs_s
open FStar.Mul
open FStar.Seq
unfold let max = FStar.Math.Lib.max
// Polynomials cn * x^n + ... + c0 * x^0
// where coefficients ck are treated mod 2
let valid (s:seq bool) : bool =
length s = 0 || index s (length s - 1)
// Each coefficient of a polynomial is 0 (false) or 1 (true).
// Each polynomial has a unique valid representation:
// - zero is []
// - a nonzero polynomial has a 1 as its high bit (no extra zeros beyond highest-order term)
// The unique representation ensures that mathematically equal polynomials are = in F*.
// s[0] is lowest-order term (x^0).
let poly = s:(seq bool){valid s}
let degree (p:poly) : int = length p - 1
let zero = create 0 false
let one = create 1 true
let monomial (n:nat) : poly = append (create n false) one
let lshift (p:poly) (n:nat) : poly =
if length p = 0 then p
else append (create n false) p
let rshift (p:poly) (n:nat) : poly =
if length p <= n then zero
else slice p n (length p)
let shift (p:poly) (n:int) : poly =
if n >= 0 then lshift p n else rshift p (-n)
// Index any coefficient, where all coefficients beyond highest-order term are zero
// (and n < 0 returns zero)
let poly_index (p:poly) (n:int) : bool =
if 0 <= n && n < length p then index p n
else false
unfold let ( .[] ) = poly_index
let to_seq (p:poly) (n:nat) : Pure (seq bool)
(requires True)
(ensures fun s ->
length s == n /\
(forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i)
)
=
init n (poly_index p)
let rec of_seq (s:seq bool) : Pure poly
(requires True)
(ensures fun p ->
length p <= length s /\
(forall (i:nat).{:pattern (p.[i]) \/ (index s i)} i < length s ==> p.[i] == index s i)
)
(decreases (length s))
=
if valid s then s
else
of_seq (slice s 0 (length s - 1))
[@"opaque_to_smt"]
let of_fun (len:nat) (f:nat -> bool) : Pure poly
(requires True)
(ensures fun p ->
length p <= len /\
(forall (i:nat).{:pattern p.[i] \/ (f i)} i < len ==> p.[i] == f i) /\
(forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i < len)
)
=
of_seq (init len f)
[@"opaque_to_smt"]
let reverse (a:poly) (n:nat) : Pure poly
(requires True)
(ensures fun p ->
length p <= n + 1 /\
(forall (i:nat).{:pattern p.[i]} p.[i] == a.[n - i]) /\
(forall (i:int).{:pattern p.[i]} p.[i] ==> 0 <= i /\ i <= n)
)
=
of_fun (n + 1) (fun (i:nat) -> a.[n - i])
[@"opaque_to_smt"]
let add (a b:poly) : Pure poly
(requires True)
(ensures fun p ->
let len = max (length a) (length b) in
length p <= len /\
(forall (i:int).{:pattern p.[i] \/ a.[i] \/ b.[i]} p.[i] == (a.[i] <> b.[i])) | false | false | Vale.Math.Poly2.Defs_s.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val add (a b: poly)
: Pure poly
(requires True)
(ensures
fun p ->
let len = max (length a) (length b) in
length p <= len /\
(forall (i: int). {:pattern p.[ i ]\/a.[ i ]\/b.[ i ]} p.[ i ] == (a.[ i ] <> b.[ i ]))) | [] | Vale.Math.Poly2.Defs_s.add | {
"file_name": "vale/specs/math/Vale.Math.Poly2.Defs_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Vale.Math.Poly2.Defs_s.poly -> b: Vale.Math.Poly2.Defs_s.poly
-> Prims.Pure Vale.Math.Poly2.Defs_s.poly | {
"end_col": 44,
"end_line": 97,
"start_col": 3,
"start_line": 95
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Bignum.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let bn_len (t:limb_t) = len:size_pos{2 * bits t * len <= max_size_t} | let bn_len (t: limb_t) = | false | null | false | len: size_pos{(2 * bits t) * len <= max_size_t} | {
"checked_file": "Hacl.Spec.Bignum.fsti.checked",
"dependencies": [
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.Base.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Bignum.fsti"
} | [
"total"
] | [
"Hacl.Spec.Bignum.Definitions.limb_t",
"Lib.IntTypes.size_pos",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.Mul.op_Star",
"Lib.IntTypes.bits",
"Lib.IntTypes.max_size_t"
] | [] | module Hacl.Spec.Bignum
open FStar.Mul
open Lib.IntTypes
open Lib.Sequence
open Hacl.Spec.Bignum.Base
open Hacl.Spec.Bignum.Definitions
module BSeq = Lib.ByteSequence
#reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" | false | true | Hacl.Spec.Bignum.fsti | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val bn_len : t: Hacl.Spec.Bignum.Definitions.limb_t -> Type0 | [] | Hacl.Spec.Bignum.bn_len | {
"file_name": "code/bignum/Hacl.Spec.Bignum.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | t: Hacl.Spec.Bignum.Definitions.limb_t -> Type0 | {
"end_col": 68,
"end_line": 16,
"start_col": 24,
"start_line": 16
} |
|
Prims.Tot | val legacy_update_last: update_last_st (|SHA1, ()|) | [
{
"abbrev": false,
"full_module": "Hacl.Hash.Core.SHA1",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Core.SHA1",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let legacy_update_last: update_last_st (|SHA1, ()|) =
Hacl.Hash.MD.mk_update_last SHA1 legacy_update_multi legacy_pad | val legacy_update_last: update_last_st (|SHA1, ()|)
let legacy_update_last:update_last_st (| SHA1, () |) = | false | null | false | Hacl.Hash.MD.mk_update_last SHA1 legacy_update_multi legacy_pad | {
"checked_file": "Hacl.Hash.SHA1.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"prims.fst.checked",
"Hacl.Hash.MD.fst.checked",
"Hacl.Hash.Definitions.fst.checked",
"Hacl.Hash.Core.SHA1.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Hacl.Hash.SHA1.fst"
} | [
"total"
] | [
"Hacl.Hash.MD.mk_update_last",
"Spec.Hash.Definitions.SHA1",
"Hacl.Hash.SHA1.legacy_update_multi",
"Hacl.Hash.Core.SHA1.legacy_pad",
"Hacl.Hash.Definitions.update_last_st",
"Prims.Mkdtuple2",
"Spec.Hash.Definitions.hash_alg",
"Hacl.Hash.Definitions.m_spec"
] | [] | module Hacl.Hash.SHA1
open Hacl.Hash.Definitions
open Spec.Hash.Definitions
include Hacl.Hash.Core.SHA1
friend Hacl.Hash.MD
let legacy_update_multi: update_multi_st (|SHA1, ()|) =
Hacl.Hash.MD.mk_update_multi SHA1 legacy_update | false | false | Hacl.Hash.SHA1.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val legacy_update_last: update_last_st (|SHA1, ()|) | [] | Hacl.Hash.SHA1.legacy_update_last | {
"file_name": "code/hash/Hacl.Hash.SHA1.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Hash.Definitions.update_last_st (| Spec.Hash.Definitions.SHA1, () |) | {
"end_col": 65,
"end_line": 14,
"start_col": 2,
"start_line": 14
} |
Prims.Tot | val legacy_update_multi: update_multi_st (|SHA1, ()|) | [
{
"abbrev": false,
"full_module": "Hacl.Hash.Core.SHA1",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Core.SHA1",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let legacy_update_multi: update_multi_st (|SHA1, ()|) =
Hacl.Hash.MD.mk_update_multi SHA1 legacy_update | val legacy_update_multi: update_multi_st (|SHA1, ()|)
let legacy_update_multi:update_multi_st (| SHA1, () |) = | false | null | false | Hacl.Hash.MD.mk_update_multi SHA1 legacy_update | {
"checked_file": "Hacl.Hash.SHA1.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"prims.fst.checked",
"Hacl.Hash.MD.fst.checked",
"Hacl.Hash.Definitions.fst.checked",
"Hacl.Hash.Core.SHA1.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Hacl.Hash.SHA1.fst"
} | [
"total"
] | [
"Hacl.Hash.MD.mk_update_multi",
"Spec.Hash.Definitions.SHA1",
"Hacl.Hash.Core.SHA1.legacy_update",
"Hacl.Hash.Definitions.update_multi_st",
"Prims.Mkdtuple2",
"Spec.Hash.Definitions.hash_alg",
"Hacl.Hash.Definitions.m_spec"
] | [] | module Hacl.Hash.SHA1
open Hacl.Hash.Definitions
open Spec.Hash.Definitions
include Hacl.Hash.Core.SHA1
friend Hacl.Hash.MD | false | false | Hacl.Hash.SHA1.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val legacy_update_multi: update_multi_st (|SHA1, ()|) | [] | Hacl.Hash.SHA1.legacy_update_multi | {
"file_name": "code/hash/Hacl.Hash.SHA1.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Hash.Definitions.update_multi_st (| Spec.Hash.Definitions.SHA1, () |) | {
"end_col": 49,
"end_line": 11,
"start_col": 2,
"start_line": 11
} |
Prims.Tot | val legacy_hash: hash_st SHA1 | [
{
"abbrev": false,
"full_module": "Hacl.Hash.Core.SHA1",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Core.SHA1",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let legacy_hash: hash_st SHA1 =
Hacl.Hash.MD.mk_hash SHA1 legacy_alloca legacy_update_multi legacy_update_last legacy_finish | val legacy_hash: hash_st SHA1
let legacy_hash:hash_st SHA1 = | false | null | false | Hacl.Hash.MD.mk_hash SHA1 legacy_alloca legacy_update_multi legacy_update_last legacy_finish | {
"checked_file": "Hacl.Hash.SHA1.fst.checked",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"prims.fst.checked",
"Hacl.Hash.MD.fst.checked",
"Hacl.Hash.Definitions.fst.checked",
"Hacl.Hash.Core.SHA1.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Hacl.Hash.SHA1.fst"
} | [
"total"
] | [
"Hacl.Hash.MD.mk_hash",
"Spec.Hash.Definitions.SHA1",
"Hacl.Hash.Core.SHA1.legacy_alloca",
"Hacl.Hash.SHA1.legacy_update_multi",
"Hacl.Hash.SHA1.legacy_update_last",
"Hacl.Hash.Core.SHA1.legacy_finish",
"Hacl.Hash.Definitions.hash_st"
] | [] | module Hacl.Hash.SHA1
open Hacl.Hash.Definitions
open Spec.Hash.Definitions
include Hacl.Hash.Core.SHA1
friend Hacl.Hash.MD
let legacy_update_multi: update_multi_st (|SHA1, ()|) =
Hacl.Hash.MD.mk_update_multi SHA1 legacy_update
let legacy_update_last: update_last_st (|SHA1, ()|) =
Hacl.Hash.MD.mk_update_last SHA1 legacy_update_multi legacy_pad | false | false | Hacl.Hash.SHA1.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val legacy_hash: hash_st SHA1 | [] | Hacl.Hash.SHA1.legacy_hash | {
"file_name": "code/hash/Hacl.Hash.SHA1.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Hash.Definitions.hash_st Spec.Hash.Definitions.SHA1 | {
"end_col": 94,
"end_line": 17,
"start_col": 2,
"start_line": 17
} |
FStar.Tactics.Effect.Tac | val app_head_tail (t: term) : Tac (term * list argv) | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "LowParse.Norm",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let app_head_tail (t: term) :
Tac (term * list argv)
= collect_app t | val app_head_tail (t: term) : Tac (term * list argv)
let app_head_tail (t: term) : Tac (term * list argv) = | true | null | false | collect_app t | {
"checked_file": "LowParse.TacLib.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Norm.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "LowParse.TacLib.fst"
} | [] | [
"FStar.Reflection.Types.term",
"FStar.Tactics.V1.SyntaxHelpers.collect_app",
"FStar.Pervasives.Native.tuple2",
"Prims.list",
"FStar.Reflection.V1.Data.argv"
] | [] | module LowParse.TacLib
include FStar.Tactics
include LowParse.Norm
module L = FStar.List.Tot
[@@ noextract_to "krml"]
let conclude ()
: Tac unit
= // dump "conclude before";
norm [delta; iota; primops];
begin if lax_on ()
then smt ()
else
first [
trefl;
trivial;
]
end;
// dump "conclude after";
qed ()
[@@ noextract_to "krml"]
let solve_vc ()
: Tac unit
= exact_guard (quote ()); conclude ()
[@@ noextract_to "krml"]
let app_head_tail (t: term) : | false | false | LowParse.TacLib.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val app_head_tail (t: term) : Tac (term * list argv) | [] | LowParse.TacLib.app_head_tail | {
"file_name": "src/lowparse/LowParse.TacLib.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | t: FStar.Reflection.Types.term
-> FStar.Tactics.Effect.Tac
(FStar.Reflection.Types.term * Prims.list FStar.Reflection.V1.Data.argv) | {
"end_col": 15,
"end_line": 31,
"start_col": 2,
"start_line": 31
} |
FStar.Tactics.Effect.Tac | val solve_vc: Prims.unit -> Tac unit | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "LowParse.Norm",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let solve_vc ()
: Tac unit
= exact_guard (quote ()); conclude () | val solve_vc: Prims.unit -> Tac unit
let solve_vc () : Tac unit = | true | null | false | exact_guard (quote ());
conclude () | {
"checked_file": "LowParse.TacLib.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Norm.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "LowParse.TacLib.fst"
} | [] | [
"Prims.unit",
"LowParse.TacLib.conclude",
"FStar.Tactics.V1.Derived.exact_guard",
"FStar.Reflection.Types.term"
] | [] | module LowParse.TacLib
include FStar.Tactics
include LowParse.Norm
module L = FStar.List.Tot
[@@ noextract_to "krml"]
let conclude ()
: Tac unit
= // dump "conclude before";
norm [delta; iota; primops];
begin if lax_on ()
then smt ()
else
first [
trefl;
trivial;
]
end;
// dump "conclude after";
qed ()
[@@ noextract_to "krml"]
let solve_vc () | false | false | LowParse.TacLib.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val solve_vc: Prims.unit -> Tac unit | [] | LowParse.TacLib.solve_vc | {
"file_name": "src/lowparse/LowParse.TacLib.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 37,
"end_line": 26,
"start_col": 2,
"start_line": 26
} |
FStar.Tactics.Effect.Tac | val pp_norm_tac: Prims.unit -> Tac unit | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "LowParse.Norm",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let pp_norm_tac () : Tac unit =
norm norm_steps;
trefl ();
to_all_goals (fun _ ->
norm [delta; iota; zeta; primops];
smt ()
);
qed () | val pp_norm_tac: Prims.unit -> Tac unit
let pp_norm_tac () : Tac unit = | true | null | false | norm norm_steps;
trefl ();
to_all_goals (fun _ ->
norm [delta; iota; zeta; primops];
smt ());
qed () | {
"checked_file": "LowParse.TacLib.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Norm.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "LowParse.TacLib.fst"
} | [] | [
"Prims.unit",
"FStar.Tactics.V1.Derived.qed",
"LowParse.TacLib.to_all_goals",
"FStar.Tactics.V1.Derived.smt",
"FStar.Tactics.V1.Builtins.norm",
"Prims.Cons",
"FStar.Pervasives.norm_step",
"FStar.Pervasives.delta",
"FStar.Pervasives.iota",
"FStar.Pervasives.zeta",
"FStar.Pervasives.primops",
"Prims.Nil",
"FStar.Tactics.V1.Derived.trefl",
"LowParse.Norm.norm_steps"
] | [] | module LowParse.TacLib
include FStar.Tactics
include LowParse.Norm
module L = FStar.List.Tot
[@@ noextract_to "krml"]
let conclude ()
: Tac unit
= // dump "conclude before";
norm [delta; iota; primops];
begin if lax_on ()
then smt ()
else
first [
trefl;
trivial;
]
end;
// dump "conclude after";
qed ()
[@@ noextract_to "krml"]
let solve_vc ()
: Tac unit
= exact_guard (quote ()); conclude ()
[@@ noextract_to "krml"]
let app_head_tail (t: term) :
Tac (term * list argv)
= collect_app t
[@@ noextract_to "krml"]
let tassert (b: bool) : Tac (squash b) =
if b
then ()
else
let s = term_to_string (quote b) in
fail ("Tactic assertion failed: " ^ s)
[@@ noextract_to "krml"]
let rec to_all_goals (t: (unit -> Tac unit)) : Tac unit =
if ngoals () = 0
then ()
else
let _ = divide 1 t (fun () -> to_all_goals t) in ()
[@@ noextract_to "krml"]
let rec intros_until_squash
()
: Tac binder
= let i = intro () in
let (tm, _) = app_head_tail (cur_goal ()) in
if tm `is_fvar` (`%squash)
then i
else intros_until_squash ()
[@@ noextract_to "krml"]
let rec intros_until_eq_hyp
()
: Tac binder
= let i = intro () in
let (sq, ar) = app_head_tail (type_of_binder i) in
let cond =
if sq `is_fvar` (`%squash) then
match ar with
| (ar1, _) :: _ ->
let (eq, _) = app_head_tail ar1 in
eq `is_fvar` (`%eq2)
| _ -> false
else false
in
if cond
then i
else intros_until_eq_hyp ()
[@@ noextract_to "krml"] | false | false | LowParse.TacLib.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val pp_norm_tac: Prims.unit -> Tac unit | [] | LowParse.TacLib.pp_norm_tac | {
"file_name": "src/lowparse/LowParse.TacLib.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 8,
"end_line": 85,
"start_col": 2,
"start_line": 79
} |
FStar.Tactics.Effect.Tac | val conclude: Prims.unit -> Tac unit | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "LowParse.Norm",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let conclude ()
: Tac unit
= // dump "conclude before";
norm [delta; iota; primops];
begin if lax_on ()
then smt ()
else
first [
trefl;
trivial;
]
end;
// dump "conclude after";
qed () | val conclude: Prims.unit -> Tac unit
let conclude () : Tac unit = | true | null | false | norm [delta; iota; primops];
if lax_on () then smt () else first [trefl; trivial];
qed () | {
"checked_file": "LowParse.TacLib.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Norm.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "LowParse.TacLib.fst"
} | [] | [
"Prims.unit",
"FStar.Tactics.V1.Derived.qed",
"FStar.Tactics.V1.Derived.smt",
"Prims.bool",
"FStar.Tactics.V1.Derived.first",
"Prims.Cons",
"FStar.Tactics.V1.Derived.trefl",
"FStar.Tactics.V1.Derived.trivial",
"Prims.Nil",
"FStar.Tactics.V1.Builtins.lax_on",
"FStar.Tactics.V1.Builtins.norm",
"FStar.Pervasives.norm_step",
"FStar.Pervasives.delta",
"FStar.Pervasives.iota",
"FStar.Pervasives.primops"
] | [] | module LowParse.TacLib
include FStar.Tactics
include LowParse.Norm
module L = FStar.List.Tot
[@@ noextract_to "krml"]
let conclude ()
: Tac unit | false | false | LowParse.TacLib.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val conclude: Prims.unit -> Tac unit | [] | LowParse.TacLib.conclude | {
"file_name": "src/lowparse/LowParse.TacLib.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 8,
"end_line": 21,
"start_col": 2,
"start_line": 11
} |
FStar.Tactics.Effect.Tac | val intros_until_squash: Prims.unit -> Tac binder | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "LowParse.Norm",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec intros_until_squash
()
: Tac binder
= let i = intro () in
let (tm, _) = app_head_tail (cur_goal ()) in
if tm `is_fvar` (`%squash)
then i
else intros_until_squash () | val intros_until_squash: Prims.unit -> Tac binder
let rec intros_until_squash () : Tac binder = | true | null | false | let i = intro () in
let tm, _ = app_head_tail (cur_goal ()) in
if tm `is_fvar` (`%squash) then i else intros_until_squash () | {
"checked_file": "LowParse.TacLib.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Norm.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "LowParse.TacLib.fst"
} | [] | [
"Prims.unit",
"FStar.Reflection.Types.term",
"Prims.list",
"FStar.Reflection.V1.Data.argv",
"FStar.Reflection.V1.Derived.is_fvar",
"FStar.Reflection.Types.binder",
"Prims.bool",
"LowParse.TacLib.intros_until_squash",
"FStar.Pervasives.Native.tuple2",
"LowParse.TacLib.app_head_tail",
"FStar.Tactics.V1.Derived.cur_goal",
"FStar.Reflection.Types.typ",
"FStar.Tactics.V1.Builtins.intro"
] | [] | module LowParse.TacLib
include FStar.Tactics
include LowParse.Norm
module L = FStar.List.Tot
[@@ noextract_to "krml"]
let conclude ()
: Tac unit
= // dump "conclude before";
norm [delta; iota; primops];
begin if lax_on ()
then smt ()
else
first [
trefl;
trivial;
]
end;
// dump "conclude after";
qed ()
[@@ noextract_to "krml"]
let solve_vc ()
: Tac unit
= exact_guard (quote ()); conclude ()
[@@ noextract_to "krml"]
let app_head_tail (t: term) :
Tac (term * list argv)
= collect_app t
[@@ noextract_to "krml"]
let tassert (b: bool) : Tac (squash b) =
if b
then ()
else
let s = term_to_string (quote b) in
fail ("Tactic assertion failed: " ^ s)
[@@ noextract_to "krml"]
let rec to_all_goals (t: (unit -> Tac unit)) : Tac unit =
if ngoals () = 0
then ()
else
let _ = divide 1 t (fun () -> to_all_goals t) in ()
[@@ noextract_to "krml"]
let rec intros_until_squash
() | false | false | LowParse.TacLib.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val intros_until_squash: Prims.unit -> Tac binder | [
"recursion"
] | LowParse.TacLib.intros_until_squash | {
"file_name": "src/lowparse/LowParse.TacLib.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | _: Prims.unit -> FStar.Tactics.Effect.Tac FStar.Reflection.Types.binder | {
"end_col": 29,
"end_line": 56,
"start_col": 1,
"start_line": 52
} |
FStar.Tactics.Effect.Tac | val to_all_goals (t: (unit -> Tac unit)) : Tac unit | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "LowParse.Norm",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec to_all_goals (t: (unit -> Tac unit)) : Tac unit =
if ngoals () = 0
then ()
else
let _ = divide 1 t (fun () -> to_all_goals t) in () | val to_all_goals (t: (unit -> Tac unit)) : Tac unit
let rec to_all_goals (t: (unit -> Tac unit)) : Tac unit = | true | null | false | if ngoals () = 0
then ()
else
let _ = divide 1 t (fun () -> to_all_goals t) in
() | {
"checked_file": "LowParse.TacLib.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Norm.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "LowParse.TacLib.fst"
} | [] | [
"Prims.unit",
"Prims.bool",
"FStar.Pervasives.Native.tuple2",
"FStar.Tactics.V1.Derived.divide",
"LowParse.TacLib.to_all_goals",
"Prims.op_Equality",
"Prims.int",
"FStar.Tactics.V1.Derived.ngoals"
] | [] | module LowParse.TacLib
include FStar.Tactics
include LowParse.Norm
module L = FStar.List.Tot
[@@ noextract_to "krml"]
let conclude ()
: Tac unit
= // dump "conclude before";
norm [delta; iota; primops];
begin if lax_on ()
then smt ()
else
first [
trefl;
trivial;
]
end;
// dump "conclude after";
qed ()
[@@ noextract_to "krml"]
let solve_vc ()
: Tac unit
= exact_guard (quote ()); conclude ()
[@@ noextract_to "krml"]
let app_head_tail (t: term) :
Tac (term * list argv)
= collect_app t
[@@ noextract_to "krml"]
let tassert (b: bool) : Tac (squash b) =
if b
then ()
else
let s = term_to_string (quote b) in
fail ("Tactic assertion failed: " ^ s)
[@@ noextract_to "krml"] | false | false | LowParse.TacLib.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val to_all_goals (t: (unit -> Tac unit)) : Tac unit | [
"recursion"
] | LowParse.TacLib.to_all_goals | {
"file_name": "src/lowparse/LowParse.TacLib.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | t: (_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit) -> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 55,
"end_line": 46,
"start_col": 2,
"start_line": 43
} |
FStar.Tactics.Effect.Tac | val intros_until_eq_hyp: Prims.unit -> Tac binder | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "LowParse.Norm",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let rec intros_until_eq_hyp
()
: Tac binder
= let i = intro () in
let (sq, ar) = app_head_tail (type_of_binder i) in
let cond =
if sq `is_fvar` (`%squash) then
match ar with
| (ar1, _) :: _ ->
let (eq, _) = app_head_tail ar1 in
eq `is_fvar` (`%eq2)
| _ -> false
else false
in
if cond
then i
else intros_until_eq_hyp () | val intros_until_eq_hyp: Prims.unit -> Tac binder
let rec intros_until_eq_hyp () : Tac binder = | true | null | false | let i = intro () in
let sq, ar = app_head_tail (type_of_binder i) in
let cond =
if sq `is_fvar` (`%squash)
then
match ar with
| (ar1, _) :: _ ->
let eq, _ = app_head_tail ar1 in
eq `is_fvar` (`%eq2)
| _ -> false
else false
in
if cond then i else intros_until_eq_hyp () | {
"checked_file": "LowParse.TacLib.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Norm.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "LowParse.TacLib.fst"
} | [] | [
"Prims.unit",
"FStar.Reflection.Types.term",
"Prims.list",
"FStar.Reflection.V1.Data.argv",
"FStar.Reflection.Types.binder",
"Prims.bool",
"LowParse.TacLib.intros_until_eq_hyp",
"FStar.Reflection.V1.Derived.is_fvar",
"FStar.Reflection.V1.Data.aqualv",
"FStar.Pervasives.Native.tuple2",
"LowParse.TacLib.app_head_tail",
"FStar.Reflection.V1.Derived.type_of_binder",
"FStar.Tactics.V1.Builtins.intro"
] | [] | module LowParse.TacLib
include FStar.Tactics
include LowParse.Norm
module L = FStar.List.Tot
[@@ noextract_to "krml"]
let conclude ()
: Tac unit
= // dump "conclude before";
norm [delta; iota; primops];
begin if lax_on ()
then smt ()
else
first [
trefl;
trivial;
]
end;
// dump "conclude after";
qed ()
[@@ noextract_to "krml"]
let solve_vc ()
: Tac unit
= exact_guard (quote ()); conclude ()
[@@ noextract_to "krml"]
let app_head_tail (t: term) :
Tac (term * list argv)
= collect_app t
[@@ noextract_to "krml"]
let tassert (b: bool) : Tac (squash b) =
if b
then ()
else
let s = term_to_string (quote b) in
fail ("Tactic assertion failed: " ^ s)
[@@ noextract_to "krml"]
let rec to_all_goals (t: (unit -> Tac unit)) : Tac unit =
if ngoals () = 0
then ()
else
let _ = divide 1 t (fun () -> to_all_goals t) in ()
[@@ noextract_to "krml"]
let rec intros_until_squash
()
: Tac binder
= let i = intro () in
let (tm, _) = app_head_tail (cur_goal ()) in
if tm `is_fvar` (`%squash)
then i
else intros_until_squash ()
[@@ noextract_to "krml"]
let rec intros_until_eq_hyp
() | false | false | LowParse.TacLib.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val intros_until_eq_hyp: Prims.unit -> Tac binder | [
"recursion"
] | LowParse.TacLib.intros_until_eq_hyp | {
"file_name": "src/lowparse/LowParse.TacLib.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | _: Prims.unit -> FStar.Tactics.Effect.Tac FStar.Reflection.Types.binder | {
"end_col": 29,
"end_line": 75,
"start_col": 1,
"start_line": 62
} |
FStar.Tactics.Effect.Tac | val tassert (b: bool) : Tac (squash b) | [
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "LowParse.Norm",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let tassert (b: bool) : Tac (squash b) =
if b
then ()
else
let s = term_to_string (quote b) in
fail ("Tactic assertion failed: " ^ s) | val tassert (b: bool) : Tac (squash b)
let tassert (b: bool) : Tac (squash b) = | true | null | true | if b
then ()
else
let s = term_to_string (quote b) in
fail ("Tactic assertion failed: " ^ s) | {
"checked_file": "LowParse.TacLib.fst.checked",
"dependencies": [
"prims.fst.checked",
"LowParse.Norm.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "LowParse.TacLib.fst"
} | [] | [
"Prims.bool",
"Prims.squash",
"Prims.b2t",
"FStar.Tactics.V1.Derived.fail",
"Prims.op_Hat",
"Prims.string",
"FStar.Tactics.V1.Builtins.term_to_string",
"FStar.Reflection.Types.term"
] | [] | module LowParse.TacLib
include FStar.Tactics
include LowParse.Norm
module L = FStar.List.Tot
[@@ noextract_to "krml"]
let conclude ()
: Tac unit
= // dump "conclude before";
norm [delta; iota; primops];
begin if lax_on ()
then smt ()
else
first [
trefl;
trivial;
]
end;
// dump "conclude after";
qed ()
[@@ noextract_to "krml"]
let solve_vc ()
: Tac unit
= exact_guard (quote ()); conclude ()
[@@ noextract_to "krml"]
let app_head_tail (t: term) :
Tac (term * list argv)
= collect_app t
[@@ noextract_to "krml"] | false | false | LowParse.TacLib.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val tassert (b: bool) : Tac (squash b) | [] | LowParse.TacLib.tassert | {
"file_name": "src/lowparse/LowParse.TacLib.fst",
"git_rev": "446a08ce38df905547cf20f28c43776b22b8087a",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | b: Prims.bool -> FStar.Tactics.Effect.Tac (Prims.squash b) | {
"end_col": 42,
"end_line": 39,
"start_col": 2,
"start_line": 35
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test.Lowstarize",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let hash_vectors_tmp = List.Tot.map (fun h ->
h.hash_alg, h.input, h.output, h.repeat
) hash_vectors | let hash_vectors_tmp = | false | null | false | List.Tot.map (fun h -> h.hash_alg, h.input, h.output, h.repeat) hash_vectors | {
"checked_file": "Test.Vectors.fst.checked",
"dependencies": [
"Test.Lowstarize.fst.checked",
"Spec.HMAC_DRBG.Test.Vectors.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"EverCrypt.Hash.fsti.checked"
],
"interface_file": false,
"source_file": "Test.Vectors.fst"
} | [
"total"
] | [
"FStar.List.Tot.Base.map",
"Test.Vectors.hash_vector",
"FStar.Pervasives.Native.tuple4",
"Test.Vectors.hash_alg",
"Prims.string",
"Test.Lowstarize.hex_encoded",
"FStar.UInt32.t",
"FStar.Pervasives.Native.Mktuple4",
"Test.Vectors.__proj__Mkhash_vector__item__hash_alg",
"Test.Vectors.__proj__Mkhash_vector__item__input",
"Test.Vectors.__proj__Mkhash_vector__item__output",
"Test.Vectors.__proj__Mkhash_vector__item__repeat",
"Test.Vectors.hash_vectors"
] | [] | module Test.Vectors
open Test.Lowstarize
open EverCrypt.Hash
open Spec.Hash.Definitions
/// Hash algorithms
type hash_alg = EverCrypt.Hash.alg
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
noeq noextract
type hash_vector = {
(* The input [input] is repeated [repeat] times. *)
hash_alg: hash_alg;
input: string;
output: hex_encoded;
repeat: UInt32.t;
}
noextract
let hash_vectors = [{
hash_alg = MD5;
input = "";
output = h"d41d8cd98f00b204e9800998ecf8427e";
repeat = 1ul
}; {
hash_alg = MD5;
input = "a";
output = h"0cc175b9c0f1b6a831c399e269772661";
repeat = 1ul
}; {
hash_alg = MD5;
input = "abc";
output = h"900150983cd24fb0d6963f7d28e17f72";
repeat = 1ul
}; {
hash_alg = MD5;
input = "message digest";
output = h"f96b697d7cb7938d525a2f31aaf161d0";
repeat = 1ul
}; {
hash_alg = MD5;
input = "abcdefghijklmnopqrstuvwxyz";
output = h"c3fcd3d76192e4007dfb496cca67e13b";
repeat = 1ul
}; {
hash_alg = MD5;
input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
output = h"d174ab98d277d9f5a5611c2c9f419d9f";
repeat = 1ul
}; {
hash_alg = MD5;
input = "12345678901234567890123456789012345678901234567890123456789012345678901234567890";
output = h"57edf4a22be3c955ac49da2e2107b67a";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "abc";
output = h"a9993e364706816aba3e25717850c26c9cd0d89d";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h"84983e441c3bd26ebaae4aa1f95129e5e54670f1";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "a";
output = h"34aa973cd4c4daa4f61eeb2bdbad27316534016f";
repeat = 1000000ul
}; {
hash_alg = SHA1;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"dea356a2cddd90c7a7ecedc5ebb563934f460452";
repeat = 10ul
}; {
hash_alg = SHA2_256;
input = "abc";
output = h"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad";
repeat = 1ul
}; {
hash_alg = SHA2_256;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h"248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1";
repeat = 1ul
}; {
hash_alg = SHA2_256;
input = "a";
output = h"cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0";
repeat = 1000000ul
}; {
hash_alg = SHA2_256;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"594847328451bdfa85056225462cc1d867d877fb388df0ce35f25ab5562bfbb5";
repeat = 10ul
}; {
hash_alg = SHA2_256;
input = "\x19";
output = h"68aa2e2ee5dff96e3355e6c7ee373e3d6a4e17f75f9518d843709c0c9bc3e3d4";
repeat = 1ul
};(* {
hash_alg = SHA2_256;
// 2018.05.26: Don't know how to encode byte literals in strings; this doesn't work
// as in OCaml
input = "\xe3\xd7\x25\x70\xdc\xdd\x78\x7c\xe3\x88\x7a\xb2\xcd\x68\x46\x52";
output = h"175ee69b02ba9b58e2b0a5fd13819cea573f3940a94f825128cf4209beabb4e8";
repeat = 1ul
}; *){
hash_alg = SHA2_384;
input = "abc";
output = h"cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7";
repeat = 1ul
}; {
hash_alg = SHA2_384;
input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output = h"09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039";
repeat = 1ul
}; {
hash_alg = SHA2_384;
input = "a";
output = h"9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985";
repeat = 1000000ul
}; {
hash_alg = SHA2_384;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"2fc64a4f500ddb6828f6a3430b8dd72a368eb7f3a8322a70bc84275b9c0b3ab00d27a5cc3c2d224aa6b61a0d79fb4596";
repeat = 10ul
}; {
hash_alg = SHA2_512;
input = "abc";
output = h"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f";
repeat = 1ul
}; {
hash_alg = SHA2_512;
input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output = h"8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909";
repeat = 1ul
}; {
hash_alg = SHA2_512;
input = "a";
output = h"e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b";
repeat = 1000000ul
}; {
hash_alg = SHA2_512;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"89d05ba632c699c31231ded4ffc127d5a894dad412c0e024db872d1abd2ba8141a0f85072a9be1e2aa04cf33c765cb510813a39cd5a84c4acaa64d3f3fb7bae9";
repeat = 10ul
}
] | false | true | Test.Vectors.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val hash_vectors_tmp : Prims.list (((Test.Vectors.hash_alg * Prims.string) * Test.Lowstarize.hex_encoded) * FStar.UInt32.t) | [] | Test.Vectors.hash_vectors_tmp | {
"file_name": "providers/test/Test.Vectors.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.list (((Test.Vectors.hash_alg * Prims.string) * Test.Lowstarize.hex_encoded) * FStar.UInt32.t) | {
"end_col": 14,
"end_line": 156,
"start_col": 23,
"start_line": 154
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test.Lowstarize",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let hmac_vectors_tmp = List.Tot.map (fun h ->
h.ha, h.key, h.data, h.output
) hmac_vectors | let hmac_vectors_tmp = | false | null | false | List.Tot.map (fun h -> h.ha, h.key, h.data, h.output) hmac_vectors | {
"checked_file": "Test.Vectors.fst.checked",
"dependencies": [
"Test.Lowstarize.fst.checked",
"Spec.HMAC_DRBG.Test.Vectors.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"EverCrypt.Hash.fsti.checked"
],
"interface_file": false,
"source_file": "Test.Vectors.fst"
} | [
"total"
] | [
"FStar.List.Tot.Base.map",
"Test.Vectors.hmac_vector",
"FStar.Pervasives.Native.tuple4",
"Test.Vectors.hash_alg",
"Test.Lowstarize.hex_encoded",
"FStar.Pervasives.Native.Mktuple4",
"Test.Vectors.__proj__Mkhmac_vector__item__ha",
"Test.Vectors.__proj__Mkhmac_vector__item__key",
"Test.Vectors.__proj__Mkhmac_vector__item__data",
"Test.Vectors.__proj__Mkhmac_vector__item__output",
"Test.Vectors.hmac_vectors"
] | [] | module Test.Vectors
open Test.Lowstarize
open EverCrypt.Hash
open Spec.Hash.Definitions
/// Hash algorithms
type hash_alg = EverCrypt.Hash.alg
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
noeq noextract
type hash_vector = {
(* The input [input] is repeated [repeat] times. *)
hash_alg: hash_alg;
input: string;
output: hex_encoded;
repeat: UInt32.t;
}
noextract
let hash_vectors = [{
hash_alg = MD5;
input = "";
output = h"d41d8cd98f00b204e9800998ecf8427e";
repeat = 1ul
}; {
hash_alg = MD5;
input = "a";
output = h"0cc175b9c0f1b6a831c399e269772661";
repeat = 1ul
}; {
hash_alg = MD5;
input = "abc";
output = h"900150983cd24fb0d6963f7d28e17f72";
repeat = 1ul
}; {
hash_alg = MD5;
input = "message digest";
output = h"f96b697d7cb7938d525a2f31aaf161d0";
repeat = 1ul
}; {
hash_alg = MD5;
input = "abcdefghijklmnopqrstuvwxyz";
output = h"c3fcd3d76192e4007dfb496cca67e13b";
repeat = 1ul
}; {
hash_alg = MD5;
input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
output = h"d174ab98d277d9f5a5611c2c9f419d9f";
repeat = 1ul
}; {
hash_alg = MD5;
input = "12345678901234567890123456789012345678901234567890123456789012345678901234567890";
output = h"57edf4a22be3c955ac49da2e2107b67a";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "abc";
output = h"a9993e364706816aba3e25717850c26c9cd0d89d";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h"84983e441c3bd26ebaae4aa1f95129e5e54670f1";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "a";
output = h"34aa973cd4c4daa4f61eeb2bdbad27316534016f";
repeat = 1000000ul
}; {
hash_alg = SHA1;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"dea356a2cddd90c7a7ecedc5ebb563934f460452";
repeat = 10ul
}; {
hash_alg = SHA2_256;
input = "abc";
output = h"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad";
repeat = 1ul
}; {
hash_alg = SHA2_256;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h"248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1";
repeat = 1ul
}; {
hash_alg = SHA2_256;
input = "a";
output = h"cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0";
repeat = 1000000ul
}; {
hash_alg = SHA2_256;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"594847328451bdfa85056225462cc1d867d877fb388df0ce35f25ab5562bfbb5";
repeat = 10ul
}; {
hash_alg = SHA2_256;
input = "\x19";
output = h"68aa2e2ee5dff96e3355e6c7ee373e3d6a4e17f75f9518d843709c0c9bc3e3d4";
repeat = 1ul
};(* {
hash_alg = SHA2_256;
// 2018.05.26: Don't know how to encode byte literals in strings; this doesn't work
// as in OCaml
input = "\xe3\xd7\x25\x70\xdc\xdd\x78\x7c\xe3\x88\x7a\xb2\xcd\x68\x46\x52";
output = h"175ee69b02ba9b58e2b0a5fd13819cea573f3940a94f825128cf4209beabb4e8";
repeat = 1ul
}; *){
hash_alg = SHA2_384;
input = "abc";
output = h"cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7";
repeat = 1ul
}; {
hash_alg = SHA2_384;
input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output = h"09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039";
repeat = 1ul
}; {
hash_alg = SHA2_384;
input = "a";
output = h"9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985";
repeat = 1000000ul
}; {
hash_alg = SHA2_384;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"2fc64a4f500ddb6828f6a3430b8dd72a368eb7f3a8322a70bc84275b9c0b3ab00d27a5cc3c2d224aa6b61a0d79fb4596";
repeat = 10ul
}; {
hash_alg = SHA2_512;
input = "abc";
output = h"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f";
repeat = 1ul
}; {
hash_alg = SHA2_512;
input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output = h"8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909";
repeat = 1ul
}; {
hash_alg = SHA2_512;
input = "a";
output = h"e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b";
repeat = 1000000ul
}; {
hash_alg = SHA2_512;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"89d05ba632c699c31231ded4ffc127d5a894dad412c0e024db872d1abd2ba8141a0f85072a9be1e2aa04cf33c765cb510813a39cd5a84c4acaa64d3f3fb7bae9";
repeat = 10ul
}
]
noextract
let hash_vectors_tmp = List.Tot.map (fun h ->
h.hash_alg, h.input, h.output, h.repeat
) hash_vectors
// 2018.08.06 SZ: I can't verify this in interactive mode but verifies from the command-line
%splice[] (lowstarize_toplevel "hash_vectors_tmp" "hash_vectors_low")
/// HMAC
noeq noextract
type hmac_vector = {
ha: hash_alg;
key: hex_encoded;
data: hex_encoded;
output: hex_encoded;
}
// selected test vectors from
// https://tools.ietf.org/html/rfc4231#section-4.2
// pls extend me!
noextract
let hmac_vectors = [{
ha = SHA2_256;
key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
data = h"4869205468657265";
output = h"b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7";
}; {
ha = SHA2_384;
key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
data = h"4869205468657265";
output = h"afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6";
}] | false | true | Test.Vectors.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val hmac_vectors_tmp : Prims.list (((Test.Vectors.hash_alg * Test.Lowstarize.hex_encoded) * Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) | [] | Test.Vectors.hmac_vectors_tmp | {
"file_name": "providers/test/Test.Vectors.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.list (((Test.Vectors.hash_alg * Test.Lowstarize.hex_encoded) * Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) | {
"end_col": 14,
"end_line": 190,
"start_col": 23,
"start_line": 188
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test.Lowstarize",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let hmac_drbg_vectors_tmp =
let open Spec.HMAC_DRBG.Test.Vectors in
List.Tot.map
(fun x -> x.a, h x.entropy_input, h x.nonce, h x.personalization_string,
h x.entropy_input_reseed, h x.additional_input_reseed,
(h x.additional_input_1, h x.additional_input_2),
h x.returned_bits)
test_vectors | let hmac_drbg_vectors_tmp = | false | null | false | let open Spec.HMAC_DRBG.Test.Vectors in
List.Tot.map (fun x ->
x.a,
h x.entropy_input,
h x.nonce,
h x.personalization_string,
h x.entropy_input_reseed,
h x.additional_input_reseed,
(h x.additional_input_1, h x.additional_input_2),
h x.returned_bits)
test_vectors | {
"checked_file": "Test.Vectors.fst.checked",
"dependencies": [
"Test.Lowstarize.fst.checked",
"Spec.HMAC_DRBG.Test.Vectors.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"EverCrypt.Hash.fsti.checked"
],
"interface_file": false,
"source_file": "Test.Vectors.fst"
} | [
"total"
] | [
"FStar.List.Tot.Base.map",
"Spec.HMAC_DRBG.Test.Vectors.vec",
"FStar.Pervasives.Native.tuple8",
"Spec.HMAC_DRBG.Test.Vectors.supported_alg",
"Test.Lowstarize.hex_encoded",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.Mktuple8",
"Spec.HMAC_DRBG.Test.Vectors.__proj__Mkvec__item__a",
"Test.Lowstarize.h",
"Spec.HMAC_DRBG.Test.Vectors.__proj__Mkvec__item__entropy_input",
"Spec.HMAC_DRBG.Test.Vectors.__proj__Mkvec__item__nonce",
"Spec.HMAC_DRBG.Test.Vectors.__proj__Mkvec__item__personalization_string",
"Spec.HMAC_DRBG.Test.Vectors.__proj__Mkvec__item__entropy_input_reseed",
"Spec.HMAC_DRBG.Test.Vectors.__proj__Mkvec__item__additional_input_reseed",
"FStar.Pervasives.Native.Mktuple2",
"Spec.HMAC_DRBG.Test.Vectors.__proj__Mkvec__item__additional_input_1",
"Spec.HMAC_DRBG.Test.Vectors.__proj__Mkvec__item__additional_input_2",
"Spec.HMAC_DRBG.Test.Vectors.__proj__Mkvec__item__returned_bits",
"Spec.HMAC_DRBG.Test.Vectors.test_vectors"
] | [] | module Test.Vectors
open Test.Lowstarize
open EverCrypt.Hash
open Spec.Hash.Definitions
/// Hash algorithms
type hash_alg = EverCrypt.Hash.alg
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
noeq noextract
type hash_vector = {
(* The input [input] is repeated [repeat] times. *)
hash_alg: hash_alg;
input: string;
output: hex_encoded;
repeat: UInt32.t;
}
noextract
let hash_vectors = [{
hash_alg = MD5;
input = "";
output = h"d41d8cd98f00b204e9800998ecf8427e";
repeat = 1ul
}; {
hash_alg = MD5;
input = "a";
output = h"0cc175b9c0f1b6a831c399e269772661";
repeat = 1ul
}; {
hash_alg = MD5;
input = "abc";
output = h"900150983cd24fb0d6963f7d28e17f72";
repeat = 1ul
}; {
hash_alg = MD5;
input = "message digest";
output = h"f96b697d7cb7938d525a2f31aaf161d0";
repeat = 1ul
}; {
hash_alg = MD5;
input = "abcdefghijklmnopqrstuvwxyz";
output = h"c3fcd3d76192e4007dfb496cca67e13b";
repeat = 1ul
}; {
hash_alg = MD5;
input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
output = h"d174ab98d277d9f5a5611c2c9f419d9f";
repeat = 1ul
}; {
hash_alg = MD5;
input = "12345678901234567890123456789012345678901234567890123456789012345678901234567890";
output = h"57edf4a22be3c955ac49da2e2107b67a";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "abc";
output = h"a9993e364706816aba3e25717850c26c9cd0d89d";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h"84983e441c3bd26ebaae4aa1f95129e5e54670f1";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "a";
output = h"34aa973cd4c4daa4f61eeb2bdbad27316534016f";
repeat = 1000000ul
}; {
hash_alg = SHA1;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"dea356a2cddd90c7a7ecedc5ebb563934f460452";
repeat = 10ul
}; {
hash_alg = SHA2_256;
input = "abc";
output = h"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad";
repeat = 1ul
}; {
hash_alg = SHA2_256;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h"248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1";
repeat = 1ul
}; {
hash_alg = SHA2_256;
input = "a";
output = h"cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0";
repeat = 1000000ul
}; {
hash_alg = SHA2_256;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"594847328451bdfa85056225462cc1d867d877fb388df0ce35f25ab5562bfbb5";
repeat = 10ul
}; {
hash_alg = SHA2_256;
input = "\x19";
output = h"68aa2e2ee5dff96e3355e6c7ee373e3d6a4e17f75f9518d843709c0c9bc3e3d4";
repeat = 1ul
};(* {
hash_alg = SHA2_256;
// 2018.05.26: Don't know how to encode byte literals in strings; this doesn't work
// as in OCaml
input = "\xe3\xd7\x25\x70\xdc\xdd\x78\x7c\xe3\x88\x7a\xb2\xcd\x68\x46\x52";
output = h"175ee69b02ba9b58e2b0a5fd13819cea573f3940a94f825128cf4209beabb4e8";
repeat = 1ul
}; *){
hash_alg = SHA2_384;
input = "abc";
output = h"cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7";
repeat = 1ul
}; {
hash_alg = SHA2_384;
input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output = h"09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039";
repeat = 1ul
}; {
hash_alg = SHA2_384;
input = "a";
output = h"9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985";
repeat = 1000000ul
}; {
hash_alg = SHA2_384;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"2fc64a4f500ddb6828f6a3430b8dd72a368eb7f3a8322a70bc84275b9c0b3ab00d27a5cc3c2d224aa6b61a0d79fb4596";
repeat = 10ul
}; {
hash_alg = SHA2_512;
input = "abc";
output = h"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f";
repeat = 1ul
}; {
hash_alg = SHA2_512;
input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output = h"8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909";
repeat = 1ul
}; {
hash_alg = SHA2_512;
input = "a";
output = h"e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b";
repeat = 1000000ul
}; {
hash_alg = SHA2_512;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"89d05ba632c699c31231ded4ffc127d5a894dad412c0e024db872d1abd2ba8141a0f85072a9be1e2aa04cf33c765cb510813a39cd5a84c4acaa64d3f3fb7bae9";
repeat = 10ul
}
]
noextract
let hash_vectors_tmp = List.Tot.map (fun h ->
h.hash_alg, h.input, h.output, h.repeat
) hash_vectors
// 2018.08.06 SZ: I can't verify this in interactive mode but verifies from the command-line
%splice[] (lowstarize_toplevel "hash_vectors_tmp" "hash_vectors_low")
/// HMAC
noeq noextract
type hmac_vector = {
ha: hash_alg;
key: hex_encoded;
data: hex_encoded;
output: hex_encoded;
}
// selected test vectors from
// https://tools.ietf.org/html/rfc4231#section-4.2
// pls extend me!
noextract
let hmac_vectors = [{
ha = SHA2_256;
key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
data = h"4869205468657265";
output = h"b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7";
}; {
ha = SHA2_384;
key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
data = h"4869205468657265";
output = h"afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6";
}]
noextract
let hmac_vectors_tmp = List.Tot.map (fun h ->
h.ha, h.key, h.data, h.output
) hmac_vectors
%splice[] (lowstarize_toplevel "hmac_vectors_tmp" "hmac_vectors_low")
/// HMAC_DRBG
noextract
let hmac_drbg_vectors_tmp = | false | true | Test.Vectors.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val hmac_drbg_vectors_tmp : Prims.list (((((((Spec.HMAC_DRBG.Test.Vectors.supported_alg * Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) *
(Test.Lowstarize.hex_encoded * Test.Lowstarize.hex_encoded)) *
Test.Lowstarize.hex_encoded) | [] | Test.Vectors.hmac_drbg_vectors_tmp | {
"file_name": "providers/test/Test.Vectors.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.list (((((((Spec.HMAC_DRBG.Test.Vectors.supported_alg * Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) *
(Test.Lowstarize.hex_encoded * Test.Lowstarize.hex_encoded)) *
Test.Lowstarize.hex_encoded) | {
"end_col": 14,
"end_line": 204,
"start_col": 2,
"start_line": 199
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test.Lowstarize",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let hash_vectors = [{
hash_alg = MD5;
input = "";
output = h"d41d8cd98f00b204e9800998ecf8427e";
repeat = 1ul
}; {
hash_alg = MD5;
input = "a";
output = h"0cc175b9c0f1b6a831c399e269772661";
repeat = 1ul
}; {
hash_alg = MD5;
input = "abc";
output = h"900150983cd24fb0d6963f7d28e17f72";
repeat = 1ul
}; {
hash_alg = MD5;
input = "message digest";
output = h"f96b697d7cb7938d525a2f31aaf161d0";
repeat = 1ul
}; {
hash_alg = MD5;
input = "abcdefghijklmnopqrstuvwxyz";
output = h"c3fcd3d76192e4007dfb496cca67e13b";
repeat = 1ul
}; {
hash_alg = MD5;
input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
output = h"d174ab98d277d9f5a5611c2c9f419d9f";
repeat = 1ul
}; {
hash_alg = MD5;
input = "12345678901234567890123456789012345678901234567890123456789012345678901234567890";
output = h"57edf4a22be3c955ac49da2e2107b67a";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "abc";
output = h"a9993e364706816aba3e25717850c26c9cd0d89d";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h"84983e441c3bd26ebaae4aa1f95129e5e54670f1";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "a";
output = h"34aa973cd4c4daa4f61eeb2bdbad27316534016f";
repeat = 1000000ul
}; {
hash_alg = SHA1;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"dea356a2cddd90c7a7ecedc5ebb563934f460452";
repeat = 10ul
}; {
hash_alg = SHA2_256;
input = "abc";
output = h"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad";
repeat = 1ul
}; {
hash_alg = SHA2_256;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h"248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1";
repeat = 1ul
}; {
hash_alg = SHA2_256;
input = "a";
output = h"cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0";
repeat = 1000000ul
}; {
hash_alg = SHA2_256;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"594847328451bdfa85056225462cc1d867d877fb388df0ce35f25ab5562bfbb5";
repeat = 10ul
}; {
hash_alg = SHA2_256;
input = "\x19";
output = h"68aa2e2ee5dff96e3355e6c7ee373e3d6a4e17f75f9518d843709c0c9bc3e3d4";
repeat = 1ul
};(* {
hash_alg = SHA2_256;
// 2018.05.26: Don't know how to encode byte literals in strings; this doesn't work
// as in OCaml
input = "\xe3\xd7\x25\x70\xdc\xdd\x78\x7c\xe3\x88\x7a\xb2\xcd\x68\x46\x52";
output = h"175ee69b02ba9b58e2b0a5fd13819cea573f3940a94f825128cf4209beabb4e8";
repeat = 1ul
}; *){
hash_alg = SHA2_384;
input = "abc";
output = h"cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7";
repeat = 1ul
}; {
hash_alg = SHA2_384;
input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output = h"09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039";
repeat = 1ul
}; {
hash_alg = SHA2_384;
input = "a";
output = h"9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985";
repeat = 1000000ul
}; {
hash_alg = SHA2_384;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"2fc64a4f500ddb6828f6a3430b8dd72a368eb7f3a8322a70bc84275b9c0b3ab00d27a5cc3c2d224aa6b61a0d79fb4596";
repeat = 10ul
}; {
hash_alg = SHA2_512;
input = "abc";
output = h"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f";
repeat = 1ul
}; {
hash_alg = SHA2_512;
input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output = h"8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909";
repeat = 1ul
}; {
hash_alg = SHA2_512;
input = "a";
output = h"e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b";
repeat = 1000000ul
}; {
hash_alg = SHA2_512;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"89d05ba632c699c31231ded4ffc127d5a894dad412c0e024db872d1abd2ba8141a0f85072a9be1e2aa04cf33c765cb510813a39cd5a84c4acaa64d3f3fb7bae9";
repeat = 10ul
}
] | let hash_vectors = | false | null | false | [
{ hash_alg = MD5; input = ""; output = h "d41d8cd98f00b204e9800998ecf8427e"; repeat = 1ul };
{ hash_alg = MD5; input = "a"; output = h "0cc175b9c0f1b6a831c399e269772661"; repeat = 1ul };
{ hash_alg = MD5; input = "abc"; output = h "900150983cd24fb0d6963f7d28e17f72"; repeat = 1ul };
{
hash_alg = MD5;
input = "message digest";
output = h "f96b697d7cb7938d525a2f31aaf161d0";
repeat = 1ul
};
{
hash_alg = MD5;
input = "abcdefghijklmnopqrstuvwxyz";
output = h "c3fcd3d76192e4007dfb496cca67e13b";
repeat = 1ul
};
{
hash_alg = MD5;
input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
output = h "d174ab98d277d9f5a5611c2c9f419d9f";
repeat = 1ul
};
{
hash_alg = MD5;
input = "12345678901234567890123456789012345678901234567890123456789012345678901234567890";
output = h "57edf4a22be3c955ac49da2e2107b67a";
repeat = 1ul
};
{
hash_alg = SHA1;
input = "abc";
output = h "a9993e364706816aba3e25717850c26c9cd0d89d";
repeat = 1ul
};
{
hash_alg = SHA1;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h "84983e441c3bd26ebaae4aa1f95129e5e54670f1";
repeat = 1ul
};
{
hash_alg = SHA1;
input = "a";
output = h "34aa973cd4c4daa4f61eeb2bdbad27316534016f";
repeat = 1000000ul
};
{
hash_alg = SHA1;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h "dea356a2cddd90c7a7ecedc5ebb563934f460452";
repeat = 10ul
};
{
hash_alg = SHA2_256;
input = "abc";
output = h "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad";
repeat = 1ul
};
{
hash_alg = SHA2_256;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h "248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1";
repeat = 1ul
};
{
hash_alg = SHA2_256;
input = "a";
output = h "cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0";
repeat = 1000000ul
};
{
hash_alg = SHA2_256;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h "594847328451bdfa85056225462cc1d867d877fb388df0ce35f25ab5562bfbb5";
repeat = 10ul
};
{
hash_alg = SHA2_256;
input = "\025";
output = h "68aa2e2ee5dff96e3355e6c7ee373e3d6a4e17f75f9518d843709c0c9bc3e3d4";
repeat = 1ul
};
{
hash_alg = SHA2_384;
input = "abc";
output
=
h "cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7"
;
repeat = 1ul
};
{
hash_alg = SHA2_384;
input
=
"abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output
=
h "09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039"
;
repeat = 1ul
};
{
hash_alg = SHA2_384;
input = "a";
output
=
h "9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985"
;
repeat = 1000000ul
};
{
hash_alg = SHA2_384;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output
=
h "2fc64a4f500ddb6828f6a3430b8dd72a368eb7f3a8322a70bc84275b9c0b3ab00d27a5cc3c2d224aa6b61a0d79fb4596"
;
repeat = 10ul
};
{
hash_alg = SHA2_512;
input = "abc";
output
=
h "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f"
;
repeat = 1ul
};
{
hash_alg = SHA2_512;
input
=
"abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output
=
h "8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909"
;
repeat = 1ul
};
{
hash_alg = SHA2_512;
input = "a";
output
=
h "e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b"
;
repeat = 1000000ul
};
{
hash_alg = SHA2_512;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output
=
h "89d05ba632c699c31231ded4ffc127d5a894dad412c0e024db872d1abd2ba8141a0f85072a9be1e2aa04cf33c765cb510813a39cd5a84c4acaa64d3f3fb7bae9"
;
repeat = 10ul
}
] | {
"checked_file": "Test.Vectors.fst.checked",
"dependencies": [
"Test.Lowstarize.fst.checked",
"Spec.HMAC_DRBG.Test.Vectors.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"EverCrypt.Hash.fsti.checked"
],
"interface_file": false,
"source_file": "Test.Vectors.fst"
} | [
"total"
] | [
"Prims.Cons",
"Test.Vectors.hash_vector",
"Test.Vectors.Mkhash_vector",
"Spec.Hash.Definitions.MD5",
"Test.Lowstarize.h",
"FStar.UInt32.__uint_to_t",
"Spec.Hash.Definitions.SHA1",
"Spec.Hash.Definitions.SHA2_256",
"Spec.Hash.Definitions.SHA2_384",
"Spec.Hash.Definitions.SHA2_512",
"Prims.Nil"
] | [] | module Test.Vectors
open Test.Lowstarize
open EverCrypt.Hash
open Spec.Hash.Definitions
/// Hash algorithms
type hash_alg = EverCrypt.Hash.alg
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
noeq noextract
type hash_vector = {
(* The input [input] is repeated [repeat] times. *)
hash_alg: hash_alg;
input: string;
output: hex_encoded;
repeat: UInt32.t;
} | false | true | Test.Vectors.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val hash_vectors : Prims.list Test.Vectors.hash_vector | [] | Test.Vectors.hash_vectors | {
"file_name": "providers/test/Test.Vectors.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.list Test.Vectors.hash_vector | {
"end_col": 1,
"end_line": 151,
"start_col": 19,
"start_line": 23
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test.Lowstarize",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let hmac_vectors = [{
ha = SHA2_256;
key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
data = h"4869205468657265";
output = h"b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7";
}; {
ha = SHA2_384;
key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
data = h"4869205468657265";
output = h"afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6";
}] | let hmac_vectors = | false | null | false | [
{
ha = SHA2_256;
key = h "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
data = h "4869205468657265";
output = h "b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7"
};
{
ha = SHA2_384;
key = h "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
data = h "4869205468657265";
output
=
h "afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6"
}
] | {
"checked_file": "Test.Vectors.fst.checked",
"dependencies": [
"Test.Lowstarize.fst.checked",
"Spec.HMAC_DRBG.Test.Vectors.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"EverCrypt.Hash.fsti.checked"
],
"interface_file": false,
"source_file": "Test.Vectors.fst"
} | [
"total"
] | [
"Prims.Cons",
"Test.Vectors.hmac_vector",
"Test.Vectors.Mkhmac_vector",
"Spec.Hash.Definitions.SHA2_256",
"Test.Lowstarize.h",
"Spec.Hash.Definitions.SHA2_384",
"Prims.Nil"
] | [] | module Test.Vectors
open Test.Lowstarize
open EverCrypt.Hash
open Spec.Hash.Definitions
/// Hash algorithms
type hash_alg = EverCrypt.Hash.alg
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
noeq noextract
type hash_vector = {
(* The input [input] is repeated [repeat] times. *)
hash_alg: hash_alg;
input: string;
output: hex_encoded;
repeat: UInt32.t;
}
noextract
let hash_vectors = [{
hash_alg = MD5;
input = "";
output = h"d41d8cd98f00b204e9800998ecf8427e";
repeat = 1ul
}; {
hash_alg = MD5;
input = "a";
output = h"0cc175b9c0f1b6a831c399e269772661";
repeat = 1ul
}; {
hash_alg = MD5;
input = "abc";
output = h"900150983cd24fb0d6963f7d28e17f72";
repeat = 1ul
}; {
hash_alg = MD5;
input = "message digest";
output = h"f96b697d7cb7938d525a2f31aaf161d0";
repeat = 1ul
}; {
hash_alg = MD5;
input = "abcdefghijklmnopqrstuvwxyz";
output = h"c3fcd3d76192e4007dfb496cca67e13b";
repeat = 1ul
}; {
hash_alg = MD5;
input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
output = h"d174ab98d277d9f5a5611c2c9f419d9f";
repeat = 1ul
}; {
hash_alg = MD5;
input = "12345678901234567890123456789012345678901234567890123456789012345678901234567890";
output = h"57edf4a22be3c955ac49da2e2107b67a";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "abc";
output = h"a9993e364706816aba3e25717850c26c9cd0d89d";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h"84983e441c3bd26ebaae4aa1f95129e5e54670f1";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "a";
output = h"34aa973cd4c4daa4f61eeb2bdbad27316534016f";
repeat = 1000000ul
}; {
hash_alg = SHA1;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"dea356a2cddd90c7a7ecedc5ebb563934f460452";
repeat = 10ul
}; {
hash_alg = SHA2_256;
input = "abc";
output = h"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad";
repeat = 1ul
}; {
hash_alg = SHA2_256;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h"248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1";
repeat = 1ul
}; {
hash_alg = SHA2_256;
input = "a";
output = h"cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0";
repeat = 1000000ul
}; {
hash_alg = SHA2_256;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"594847328451bdfa85056225462cc1d867d877fb388df0ce35f25ab5562bfbb5";
repeat = 10ul
}; {
hash_alg = SHA2_256;
input = "\x19";
output = h"68aa2e2ee5dff96e3355e6c7ee373e3d6a4e17f75f9518d843709c0c9bc3e3d4";
repeat = 1ul
};(* {
hash_alg = SHA2_256;
// 2018.05.26: Don't know how to encode byte literals in strings; this doesn't work
// as in OCaml
input = "\xe3\xd7\x25\x70\xdc\xdd\x78\x7c\xe3\x88\x7a\xb2\xcd\x68\x46\x52";
output = h"175ee69b02ba9b58e2b0a5fd13819cea573f3940a94f825128cf4209beabb4e8";
repeat = 1ul
}; *){
hash_alg = SHA2_384;
input = "abc";
output = h"cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7";
repeat = 1ul
}; {
hash_alg = SHA2_384;
input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output = h"09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039";
repeat = 1ul
}; {
hash_alg = SHA2_384;
input = "a";
output = h"9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985";
repeat = 1000000ul
}; {
hash_alg = SHA2_384;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"2fc64a4f500ddb6828f6a3430b8dd72a368eb7f3a8322a70bc84275b9c0b3ab00d27a5cc3c2d224aa6b61a0d79fb4596";
repeat = 10ul
}; {
hash_alg = SHA2_512;
input = "abc";
output = h"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f";
repeat = 1ul
}; {
hash_alg = SHA2_512;
input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output = h"8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909";
repeat = 1ul
}; {
hash_alg = SHA2_512;
input = "a";
output = h"e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b";
repeat = 1000000ul
}; {
hash_alg = SHA2_512;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"89d05ba632c699c31231ded4ffc127d5a894dad412c0e024db872d1abd2ba8141a0f85072a9be1e2aa04cf33c765cb510813a39cd5a84c4acaa64d3f3fb7bae9";
repeat = 10ul
}
]
noextract
let hash_vectors_tmp = List.Tot.map (fun h ->
h.hash_alg, h.input, h.output, h.repeat
) hash_vectors
// 2018.08.06 SZ: I can't verify this in interactive mode but verifies from the command-line
%splice[] (lowstarize_toplevel "hash_vectors_tmp" "hash_vectors_low")
/// HMAC
noeq noextract
type hmac_vector = {
ha: hash_alg;
key: hex_encoded;
data: hex_encoded;
output: hex_encoded;
}
// selected test vectors from
// https://tools.ietf.org/html/rfc4231#section-4.2
// pls extend me! | false | true | Test.Vectors.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val hmac_vectors : Prims.list Test.Vectors.hmac_vector | [] | Test.Vectors.hmac_vectors | {
"file_name": "providers/test/Test.Vectors.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.list Test.Vectors.hmac_vector | {
"end_col": 4,
"end_line": 185,
"start_col": 19,
"start_line": 175
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test.Lowstarize",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let block_cipher_vectors = [
{
block = AES128;
rkey = h"2b7e151628aed2a6abf7158809cf4f3c";
plain = h"6bc1bee22e409f96e93d7e117393172a";
enc = h"3ad77bb40d7a3660a89ecaf32466ef97"
}; {
block = AES128;
rkey = h"2b7e151628aed2a6abf7158809cf4f3c";
plain = h"ae2d8a571e03ac9c9eb76fac45af8e51";
enc = h"f5d3d58503b9699de785895a96fdbaaf"
}; {
block = AES128;
rkey = h"2b7e151628aed2a6abf7158809cf4f3c";
plain = h"30c81c46a35ce411e5fbc1191a0a52ef";
enc = h"43b1cd7f598ece23881b00e3ed030688"
}; {
block = AES128;
rkey = h"2b7e151628aed2a6abf7158809cf4f3c";
plain = h"f69f2445df4f9b17ad2b417be66c3710";
enc = h"7b0c785e27e8ad3f8223207104725dd4"
}; {
block = AES256;
rkey = h"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h"6bc1bee22e409f96e93d7e117393172a";
enc = h"f3eed1bdb5d2a03c064b5a7e3db181f8"
}; {
block = AES256;
rkey = h"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h"ae2d8a571e03ac9c9eb76fac45af8e51";
enc = h"591ccb10d410ed26dc5ba74a31362870"
}; {
block = AES256;
rkey = h"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h"30c81c46a35ce411e5fbc1191a0a52ef";
enc = h"b6ed21b99ca6f4f9f153e7b1beafed1d"
}; {
block = AES256;
rkey = h"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h"f69f2445df4f9b17ad2b417be66c3710";
enc = h"23304b7a39f9f3ff067d8d8f9e24ecc7"
}] | let block_cipher_vectors = | false | null | false | [
{
block = AES128;
rkey = h "2b7e151628aed2a6abf7158809cf4f3c";
plain = h "6bc1bee22e409f96e93d7e117393172a";
enc = h "3ad77bb40d7a3660a89ecaf32466ef97"
};
{
block = AES128;
rkey = h "2b7e151628aed2a6abf7158809cf4f3c";
plain = h "ae2d8a571e03ac9c9eb76fac45af8e51";
enc = h "f5d3d58503b9699de785895a96fdbaaf"
};
{
block = AES128;
rkey = h "2b7e151628aed2a6abf7158809cf4f3c";
plain = h "30c81c46a35ce411e5fbc1191a0a52ef";
enc = h "43b1cd7f598ece23881b00e3ed030688"
};
{
block = AES128;
rkey = h "2b7e151628aed2a6abf7158809cf4f3c";
plain = h "f69f2445df4f9b17ad2b417be66c3710";
enc = h "7b0c785e27e8ad3f8223207104725dd4"
};
{
block = AES256;
rkey = h "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h "6bc1bee22e409f96e93d7e117393172a";
enc = h "f3eed1bdb5d2a03c064b5a7e3db181f8"
};
{
block = AES256;
rkey = h "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h "ae2d8a571e03ac9c9eb76fac45af8e51";
enc = h "591ccb10d410ed26dc5ba74a31362870"
};
{
block = AES256;
rkey = h "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h "30c81c46a35ce411e5fbc1191a0a52ef";
enc = h "b6ed21b99ca6f4f9f153e7b1beafed1d"
};
{
block = AES256;
rkey = h "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h "f69f2445df4f9b17ad2b417be66c3710";
enc = h "23304b7a39f9f3ff067d8d8f9e24ecc7"
}
] | {
"checked_file": "Test.Vectors.fst.checked",
"dependencies": [
"Test.Lowstarize.fst.checked",
"Spec.HMAC_DRBG.Test.Vectors.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"EverCrypt.Hash.fsti.checked"
],
"interface_file": false,
"source_file": "Test.Vectors.fst"
} | [
"total"
] | [
"Prims.Cons",
"Test.Vectors.block_cipher_vector",
"Test.Vectors.Mkblock_cipher_vector",
"Test.Vectors.AES128",
"Test.Lowstarize.h",
"Test.Vectors.AES256",
"Prims.Nil"
] | [] | module Test.Vectors
open Test.Lowstarize
open EverCrypt.Hash
open Spec.Hash.Definitions
/// Hash algorithms
type hash_alg = EverCrypt.Hash.alg
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
noeq noextract
type hash_vector = {
(* The input [input] is repeated [repeat] times. *)
hash_alg: hash_alg;
input: string;
output: hex_encoded;
repeat: UInt32.t;
}
noextract
let hash_vectors = [{
hash_alg = MD5;
input = "";
output = h"d41d8cd98f00b204e9800998ecf8427e";
repeat = 1ul
}; {
hash_alg = MD5;
input = "a";
output = h"0cc175b9c0f1b6a831c399e269772661";
repeat = 1ul
}; {
hash_alg = MD5;
input = "abc";
output = h"900150983cd24fb0d6963f7d28e17f72";
repeat = 1ul
}; {
hash_alg = MD5;
input = "message digest";
output = h"f96b697d7cb7938d525a2f31aaf161d0";
repeat = 1ul
}; {
hash_alg = MD5;
input = "abcdefghijklmnopqrstuvwxyz";
output = h"c3fcd3d76192e4007dfb496cca67e13b";
repeat = 1ul
}; {
hash_alg = MD5;
input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
output = h"d174ab98d277d9f5a5611c2c9f419d9f";
repeat = 1ul
}; {
hash_alg = MD5;
input = "12345678901234567890123456789012345678901234567890123456789012345678901234567890";
output = h"57edf4a22be3c955ac49da2e2107b67a";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "abc";
output = h"a9993e364706816aba3e25717850c26c9cd0d89d";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h"84983e441c3bd26ebaae4aa1f95129e5e54670f1";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "a";
output = h"34aa973cd4c4daa4f61eeb2bdbad27316534016f";
repeat = 1000000ul
}; {
hash_alg = SHA1;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"dea356a2cddd90c7a7ecedc5ebb563934f460452";
repeat = 10ul
}; {
hash_alg = SHA2_256;
input = "abc";
output = h"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad";
repeat = 1ul
}; {
hash_alg = SHA2_256;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h"248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1";
repeat = 1ul
}; {
hash_alg = SHA2_256;
input = "a";
output = h"cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0";
repeat = 1000000ul
}; {
hash_alg = SHA2_256;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"594847328451bdfa85056225462cc1d867d877fb388df0ce35f25ab5562bfbb5";
repeat = 10ul
}; {
hash_alg = SHA2_256;
input = "\x19";
output = h"68aa2e2ee5dff96e3355e6c7ee373e3d6a4e17f75f9518d843709c0c9bc3e3d4";
repeat = 1ul
};(* {
hash_alg = SHA2_256;
// 2018.05.26: Don't know how to encode byte literals in strings; this doesn't work
// as in OCaml
input = "\xe3\xd7\x25\x70\xdc\xdd\x78\x7c\xe3\x88\x7a\xb2\xcd\x68\x46\x52";
output = h"175ee69b02ba9b58e2b0a5fd13819cea573f3940a94f825128cf4209beabb4e8";
repeat = 1ul
}; *){
hash_alg = SHA2_384;
input = "abc";
output = h"cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7";
repeat = 1ul
}; {
hash_alg = SHA2_384;
input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output = h"09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039";
repeat = 1ul
}; {
hash_alg = SHA2_384;
input = "a";
output = h"9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985";
repeat = 1000000ul
}; {
hash_alg = SHA2_384;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"2fc64a4f500ddb6828f6a3430b8dd72a368eb7f3a8322a70bc84275b9c0b3ab00d27a5cc3c2d224aa6b61a0d79fb4596";
repeat = 10ul
}; {
hash_alg = SHA2_512;
input = "abc";
output = h"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f";
repeat = 1ul
}; {
hash_alg = SHA2_512;
input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output = h"8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909";
repeat = 1ul
}; {
hash_alg = SHA2_512;
input = "a";
output = h"e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b";
repeat = 1000000ul
}; {
hash_alg = SHA2_512;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"89d05ba632c699c31231ded4ffc127d5a894dad412c0e024db872d1abd2ba8141a0f85072a9be1e2aa04cf33c765cb510813a39cd5a84c4acaa64d3f3fb7bae9";
repeat = 10ul
}
]
noextract
let hash_vectors_tmp = List.Tot.map (fun h ->
h.hash_alg, h.input, h.output, h.repeat
) hash_vectors
// 2018.08.06 SZ: I can't verify this in interactive mode but verifies from the command-line
%splice[] (lowstarize_toplevel "hash_vectors_tmp" "hash_vectors_low")
/// HMAC
noeq noextract
type hmac_vector = {
ha: hash_alg;
key: hex_encoded;
data: hex_encoded;
output: hex_encoded;
}
// selected test vectors from
// https://tools.ietf.org/html/rfc4231#section-4.2
// pls extend me!
noextract
let hmac_vectors = [{
ha = SHA2_256;
key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
data = h"4869205468657265";
output = h"b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7";
}; {
ha = SHA2_384;
key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
data = h"4869205468657265";
output = h"afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6";
}]
noextract
let hmac_vectors_tmp = List.Tot.map (fun h ->
h.ha, h.key, h.data, h.output
) hmac_vectors
%splice[] (lowstarize_toplevel "hmac_vectors_tmp" "hmac_vectors_low")
/// HMAC_DRBG
noextract
let hmac_drbg_vectors_tmp =
let open Spec.HMAC_DRBG.Test.Vectors in
List.Tot.map
(fun x -> x.a, h x.entropy_input, h x.nonce, h x.personalization_string,
h x.entropy_input_reseed, h x.additional_input_reseed,
(h x.additional_input_1, h x.additional_input_2),
h x.returned_bits)
test_vectors
%splice[] (lowstarize_toplevel "hmac_drbg_vectors_tmp" "hmac_drbg_vectors_low")
/// HKDF
/// https://tools.ietf.org/html/rfc5869.html
/// pls extend me! We miss SHA2_384 and SHA2_512 tests
///
/// The test is in 2 steps:
/// prk <- extract sal ikm
/// okm <- expand prk info okmlen
noeq noextract
type hkdf_vector = {
ha: hash_alg;
ikm: hex_encoded; // input key materials
salt: hex_encoded; // input salt
info: hex_encoded; // expansion label
prk: hex_encoded; // extracted pseudo-random key (its length is Spec.Hash.Definitions.hash_len ha)
okm: hex_encoded; // output: expanded key materials (its length is an input)
}
noextract
let hkdf_vectors = [{
// Test Case 1
// Basic test case with SHA-256
ha = SHA2_256;
ikm = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";// (22 octets)
salt = h"000102030405060708090a0b0c";// (13 octets)
info = h"f0f1f2f3f4f5f6f7f8f9";// (10 octets)
prk = h"077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5";// (32 octets)
okm = h"3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865";// (42 octets)
}; {
// Test Case 2
// Test with SHA-256 and longer inputs/outputs
ha = SHA2_256;
ikm = h"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f";// (80 octets)
salt = h"606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf";// (80 octets)
info = h"b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff";// (80 octets)
prk = h"06a6b88c5853361a06104c9ceb35b45cef760014904671014a193f40c15fc244";// (32 octets)
okm = h"b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87";// (82 octets)
}; {
// Test Case 3
// Test with SHA-256 and zero-length salt/info
ha = SHA2_256;
ikm = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";// (22 octets)
salt = h"";
info = h"";
prk = h"19ef24a32c717b167f33a91d6f648bdf96596776afdb6377ac434c1c293ccb04";// (32 octets)
okm = h"8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d9d201395faa4b61a96c8";// (42 octets)
}]
noextract
let hkdf_vectors_tmp = List.Tot.map (fun h ->
h.ha, h.ikm, h.salt, h.info, h.prk, h.okm
) hkdf_vectors
%splice[] (lowstarize_toplevel "hkdf_vectors_tmp" "hkdf_vectors_low")
//TODO add test_hkdf, test_hkdf_one as for HMAC
/// Cipher block function
type block_cipher =
| AES128
| AES256
// Funky field names to avoid collisions...
noeq noextract
type block_cipher_vector = {
block: block_cipher;
rkey: hex_encoded;
plain: hex_encoded;
enc: hex_encoded;
} | false | true | Test.Vectors.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val block_cipher_vectors : Prims.list Test.Vectors.block_cipher_vector | [] | Test.Vectors.block_cipher_vectors | {
"file_name": "providers/test/Test.Vectors.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.list Test.Vectors.block_cipher_vector | {
"end_col": 4,
"end_line": 323,
"start_col": 27,
"start_line": 282
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test.Lowstarize",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let chacha20_vectors = [
{
c20_key = h"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f";
c20_iv = h"000000000000004a00000000";
c20_ctr = 1ul;
c20_plain = h"4c616469657320616e642047656e746c656d656e206f662074686520636c617373206f66202739393a204966204920636f756c64206f6666657220796f75206f6e6c79206f6e652074697020666f7220746865206675747572652c2073756e73637265656e20776f756c642062652069742e";
c20_cipher = h"6e2e359a2568f98041ba0728dd0d6981e97e7aec1d4360c20a27afccfd9fae0bf91b65c5524733ab8f593dabcd62b3571639d624e65152ab8f530c359f0861d807ca0dbf500d6a6156a38e088a22b65e52bc514d16ccf806818ce91ab77937365af90bbf74a35be6b40b8eedf2785e42874d";
}] | let chacha20_vectors = | false | null | false | [
{
c20_key = h "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f";
c20_iv = h "000000000000004a00000000";
c20_ctr = 1ul;
c20_plain
=
h "4c616469657320616e642047656e746c656d656e206f662074686520636c617373206f66202739393a204966204920636f756c64206f6666657220796f75206f6e6c79206f6e652074697020666f7220746865206675747572652c2073756e73637265656e20776f756c642062652069742e"
;
c20_cipher
=
h "6e2e359a2568f98041ba0728dd0d6981e97e7aec1d4360c20a27afccfd9fae0bf91b65c5524733ab8f593dabcd62b3571639d624e65152ab8f530c359f0861d807ca0dbf500d6a6156a38e088a22b65e52bc514d16ccf806818ce91ab77937365af90bbf74a35be6b40b8eedf2785e42874d"
}
] | {
"checked_file": "Test.Vectors.fst.checked",
"dependencies": [
"Test.Lowstarize.fst.checked",
"Spec.HMAC_DRBG.Test.Vectors.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"EverCrypt.Hash.fsti.checked"
],
"interface_file": false,
"source_file": "Test.Vectors.fst"
} | [
"total"
] | [
"Prims.Cons",
"Test.Vectors.chacha20_vector",
"Test.Vectors.Mkchacha20_vector",
"Test.Lowstarize.h",
"FStar.UInt32.__uint_to_t",
"Prims.Nil"
] | [] | module Test.Vectors
open Test.Lowstarize
open EverCrypt.Hash
open Spec.Hash.Definitions
/// Hash algorithms
type hash_alg = EverCrypt.Hash.alg
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
noeq noextract
type hash_vector = {
(* The input [input] is repeated [repeat] times. *)
hash_alg: hash_alg;
input: string;
output: hex_encoded;
repeat: UInt32.t;
}
noextract
let hash_vectors = [{
hash_alg = MD5;
input = "";
output = h"d41d8cd98f00b204e9800998ecf8427e";
repeat = 1ul
}; {
hash_alg = MD5;
input = "a";
output = h"0cc175b9c0f1b6a831c399e269772661";
repeat = 1ul
}; {
hash_alg = MD5;
input = "abc";
output = h"900150983cd24fb0d6963f7d28e17f72";
repeat = 1ul
}; {
hash_alg = MD5;
input = "message digest";
output = h"f96b697d7cb7938d525a2f31aaf161d0";
repeat = 1ul
}; {
hash_alg = MD5;
input = "abcdefghijklmnopqrstuvwxyz";
output = h"c3fcd3d76192e4007dfb496cca67e13b";
repeat = 1ul
}; {
hash_alg = MD5;
input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
output = h"d174ab98d277d9f5a5611c2c9f419d9f";
repeat = 1ul
}; {
hash_alg = MD5;
input = "12345678901234567890123456789012345678901234567890123456789012345678901234567890";
output = h"57edf4a22be3c955ac49da2e2107b67a";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "abc";
output = h"a9993e364706816aba3e25717850c26c9cd0d89d";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h"84983e441c3bd26ebaae4aa1f95129e5e54670f1";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "a";
output = h"34aa973cd4c4daa4f61eeb2bdbad27316534016f";
repeat = 1000000ul
}; {
hash_alg = SHA1;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"dea356a2cddd90c7a7ecedc5ebb563934f460452";
repeat = 10ul
}; {
hash_alg = SHA2_256;
input = "abc";
output = h"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad";
repeat = 1ul
}; {
hash_alg = SHA2_256;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h"248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1";
repeat = 1ul
}; {
hash_alg = SHA2_256;
input = "a";
output = h"cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0";
repeat = 1000000ul
}; {
hash_alg = SHA2_256;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"594847328451bdfa85056225462cc1d867d877fb388df0ce35f25ab5562bfbb5";
repeat = 10ul
}; {
hash_alg = SHA2_256;
input = "\x19";
output = h"68aa2e2ee5dff96e3355e6c7ee373e3d6a4e17f75f9518d843709c0c9bc3e3d4";
repeat = 1ul
};(* {
hash_alg = SHA2_256;
// 2018.05.26: Don't know how to encode byte literals in strings; this doesn't work
// as in OCaml
input = "\xe3\xd7\x25\x70\xdc\xdd\x78\x7c\xe3\x88\x7a\xb2\xcd\x68\x46\x52";
output = h"175ee69b02ba9b58e2b0a5fd13819cea573f3940a94f825128cf4209beabb4e8";
repeat = 1ul
}; *){
hash_alg = SHA2_384;
input = "abc";
output = h"cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7";
repeat = 1ul
}; {
hash_alg = SHA2_384;
input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output = h"09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039";
repeat = 1ul
}; {
hash_alg = SHA2_384;
input = "a";
output = h"9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985";
repeat = 1000000ul
}; {
hash_alg = SHA2_384;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"2fc64a4f500ddb6828f6a3430b8dd72a368eb7f3a8322a70bc84275b9c0b3ab00d27a5cc3c2d224aa6b61a0d79fb4596";
repeat = 10ul
}; {
hash_alg = SHA2_512;
input = "abc";
output = h"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f";
repeat = 1ul
}; {
hash_alg = SHA2_512;
input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output = h"8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909";
repeat = 1ul
}; {
hash_alg = SHA2_512;
input = "a";
output = h"e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b";
repeat = 1000000ul
}; {
hash_alg = SHA2_512;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"89d05ba632c699c31231ded4ffc127d5a894dad412c0e024db872d1abd2ba8141a0f85072a9be1e2aa04cf33c765cb510813a39cd5a84c4acaa64d3f3fb7bae9";
repeat = 10ul
}
]
noextract
let hash_vectors_tmp = List.Tot.map (fun h ->
h.hash_alg, h.input, h.output, h.repeat
) hash_vectors
// 2018.08.06 SZ: I can't verify this in interactive mode but verifies from the command-line
%splice[] (lowstarize_toplevel "hash_vectors_tmp" "hash_vectors_low")
/// HMAC
noeq noextract
type hmac_vector = {
ha: hash_alg;
key: hex_encoded;
data: hex_encoded;
output: hex_encoded;
}
// selected test vectors from
// https://tools.ietf.org/html/rfc4231#section-4.2
// pls extend me!
noextract
let hmac_vectors = [{
ha = SHA2_256;
key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
data = h"4869205468657265";
output = h"b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7";
}; {
ha = SHA2_384;
key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
data = h"4869205468657265";
output = h"afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6";
}]
noextract
let hmac_vectors_tmp = List.Tot.map (fun h ->
h.ha, h.key, h.data, h.output
) hmac_vectors
%splice[] (lowstarize_toplevel "hmac_vectors_tmp" "hmac_vectors_low")
/// HMAC_DRBG
noextract
let hmac_drbg_vectors_tmp =
let open Spec.HMAC_DRBG.Test.Vectors in
List.Tot.map
(fun x -> x.a, h x.entropy_input, h x.nonce, h x.personalization_string,
h x.entropy_input_reseed, h x.additional_input_reseed,
(h x.additional_input_1, h x.additional_input_2),
h x.returned_bits)
test_vectors
%splice[] (lowstarize_toplevel "hmac_drbg_vectors_tmp" "hmac_drbg_vectors_low")
/// HKDF
/// https://tools.ietf.org/html/rfc5869.html
/// pls extend me! We miss SHA2_384 and SHA2_512 tests
///
/// The test is in 2 steps:
/// prk <- extract sal ikm
/// okm <- expand prk info okmlen
noeq noextract
type hkdf_vector = {
ha: hash_alg;
ikm: hex_encoded; // input key materials
salt: hex_encoded; // input salt
info: hex_encoded; // expansion label
prk: hex_encoded; // extracted pseudo-random key (its length is Spec.Hash.Definitions.hash_len ha)
okm: hex_encoded; // output: expanded key materials (its length is an input)
}
noextract
let hkdf_vectors = [{
// Test Case 1
// Basic test case with SHA-256
ha = SHA2_256;
ikm = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";// (22 octets)
salt = h"000102030405060708090a0b0c";// (13 octets)
info = h"f0f1f2f3f4f5f6f7f8f9";// (10 octets)
prk = h"077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5";// (32 octets)
okm = h"3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865";// (42 octets)
}; {
// Test Case 2
// Test with SHA-256 and longer inputs/outputs
ha = SHA2_256;
ikm = h"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f";// (80 octets)
salt = h"606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf";// (80 octets)
info = h"b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff";// (80 octets)
prk = h"06a6b88c5853361a06104c9ceb35b45cef760014904671014a193f40c15fc244";// (32 octets)
okm = h"b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87";// (82 octets)
}; {
// Test Case 3
// Test with SHA-256 and zero-length salt/info
ha = SHA2_256;
ikm = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";// (22 octets)
salt = h"";
info = h"";
prk = h"19ef24a32c717b167f33a91d6f648bdf96596776afdb6377ac434c1c293ccb04";// (32 octets)
okm = h"8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d9d201395faa4b61a96c8";// (42 octets)
}]
noextract
let hkdf_vectors_tmp = List.Tot.map (fun h ->
h.ha, h.ikm, h.salt, h.info, h.prk, h.okm
) hkdf_vectors
%splice[] (lowstarize_toplevel "hkdf_vectors_tmp" "hkdf_vectors_low")
//TODO add test_hkdf, test_hkdf_one as for HMAC
/// Cipher block function
type block_cipher =
| AES128
| AES256
// Funky field names to avoid collisions...
noeq noextract
type block_cipher_vector = {
block: block_cipher;
rkey: hex_encoded;
plain: hex_encoded;
enc: hex_encoded;
}
noextract
let block_cipher_vectors = [
{
block = AES128;
rkey = h"2b7e151628aed2a6abf7158809cf4f3c";
plain = h"6bc1bee22e409f96e93d7e117393172a";
enc = h"3ad77bb40d7a3660a89ecaf32466ef97"
}; {
block = AES128;
rkey = h"2b7e151628aed2a6abf7158809cf4f3c";
plain = h"ae2d8a571e03ac9c9eb76fac45af8e51";
enc = h"f5d3d58503b9699de785895a96fdbaaf"
}; {
block = AES128;
rkey = h"2b7e151628aed2a6abf7158809cf4f3c";
plain = h"30c81c46a35ce411e5fbc1191a0a52ef";
enc = h"43b1cd7f598ece23881b00e3ed030688"
}; {
block = AES128;
rkey = h"2b7e151628aed2a6abf7158809cf4f3c";
plain = h"f69f2445df4f9b17ad2b417be66c3710";
enc = h"7b0c785e27e8ad3f8223207104725dd4"
}; {
block = AES256;
rkey = h"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h"6bc1bee22e409f96e93d7e117393172a";
enc = h"f3eed1bdb5d2a03c064b5a7e3db181f8"
}; {
block = AES256;
rkey = h"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h"ae2d8a571e03ac9c9eb76fac45af8e51";
enc = h"591ccb10d410ed26dc5ba74a31362870"
}; {
block = AES256;
rkey = h"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h"30c81c46a35ce411e5fbc1191a0a52ef";
enc = h"b6ed21b99ca6f4f9f153e7b1beafed1d"
}; {
block = AES256;
rkey = h"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h"f69f2445df4f9b17ad2b417be66c3710";
enc = h"23304b7a39f9f3ff067d8d8f9e24ecc7"
}]
noextract
let block_cipher_vectors_tmp = List.Tot.map (fun h ->
h.block, h.rkey, h.plain, h.enc
) block_cipher_vectors
%splice[] (lowstarize_toplevel "block_cipher_vectors_tmp" "block_cipher_vectors_low")
noeq noextract
type chacha20_vector = {
c20_key: hex_encoded;
c20_iv: hex_encoded;
c20_ctr: UInt32.t;
c20_plain: hex_encoded;
c20_cipher: hex_encoded;
} | false | true | Test.Vectors.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val chacha20_vectors : Prims.list Test.Vectors.chacha20_vector | [] | Test.Vectors.chacha20_vectors | {
"file_name": "providers/test/Test.Vectors.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.list Test.Vectors.chacha20_vector | {
"end_col": 4,
"end_line": 349,
"start_col": 23,
"start_line": 342
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test.Lowstarize",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let block_cipher_vectors_tmp = List.Tot.map (fun h ->
h.block, h.rkey, h.plain, h.enc
) block_cipher_vectors | let block_cipher_vectors_tmp = | false | null | false | List.Tot.map (fun h -> h.block, h.rkey, h.plain, h.enc) block_cipher_vectors | {
"checked_file": "Test.Vectors.fst.checked",
"dependencies": [
"Test.Lowstarize.fst.checked",
"Spec.HMAC_DRBG.Test.Vectors.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"EverCrypt.Hash.fsti.checked"
],
"interface_file": false,
"source_file": "Test.Vectors.fst"
} | [
"total"
] | [
"FStar.List.Tot.Base.map",
"Test.Vectors.block_cipher_vector",
"FStar.Pervasives.Native.tuple4",
"Test.Vectors.block_cipher",
"Test.Lowstarize.hex_encoded",
"FStar.Pervasives.Native.Mktuple4",
"Test.Vectors.__proj__Mkblock_cipher_vector__item__block",
"Test.Vectors.__proj__Mkblock_cipher_vector__item__rkey",
"Test.Vectors.__proj__Mkblock_cipher_vector__item__plain",
"Test.Vectors.__proj__Mkblock_cipher_vector__item__enc",
"Test.Vectors.block_cipher_vectors"
] | [] | module Test.Vectors
open Test.Lowstarize
open EverCrypt.Hash
open Spec.Hash.Definitions
/// Hash algorithms
type hash_alg = EverCrypt.Hash.alg
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
noeq noextract
type hash_vector = {
(* The input [input] is repeated [repeat] times. *)
hash_alg: hash_alg;
input: string;
output: hex_encoded;
repeat: UInt32.t;
}
noextract
let hash_vectors = [{
hash_alg = MD5;
input = "";
output = h"d41d8cd98f00b204e9800998ecf8427e";
repeat = 1ul
}; {
hash_alg = MD5;
input = "a";
output = h"0cc175b9c0f1b6a831c399e269772661";
repeat = 1ul
}; {
hash_alg = MD5;
input = "abc";
output = h"900150983cd24fb0d6963f7d28e17f72";
repeat = 1ul
}; {
hash_alg = MD5;
input = "message digest";
output = h"f96b697d7cb7938d525a2f31aaf161d0";
repeat = 1ul
}; {
hash_alg = MD5;
input = "abcdefghijklmnopqrstuvwxyz";
output = h"c3fcd3d76192e4007dfb496cca67e13b";
repeat = 1ul
}; {
hash_alg = MD5;
input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
output = h"d174ab98d277d9f5a5611c2c9f419d9f";
repeat = 1ul
}; {
hash_alg = MD5;
input = "12345678901234567890123456789012345678901234567890123456789012345678901234567890";
output = h"57edf4a22be3c955ac49da2e2107b67a";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "abc";
output = h"a9993e364706816aba3e25717850c26c9cd0d89d";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h"84983e441c3bd26ebaae4aa1f95129e5e54670f1";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "a";
output = h"34aa973cd4c4daa4f61eeb2bdbad27316534016f";
repeat = 1000000ul
}; {
hash_alg = SHA1;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"dea356a2cddd90c7a7ecedc5ebb563934f460452";
repeat = 10ul
}; {
hash_alg = SHA2_256;
input = "abc";
output = h"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad";
repeat = 1ul
}; {
hash_alg = SHA2_256;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h"248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1";
repeat = 1ul
}; {
hash_alg = SHA2_256;
input = "a";
output = h"cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0";
repeat = 1000000ul
}; {
hash_alg = SHA2_256;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"594847328451bdfa85056225462cc1d867d877fb388df0ce35f25ab5562bfbb5";
repeat = 10ul
}; {
hash_alg = SHA2_256;
input = "\x19";
output = h"68aa2e2ee5dff96e3355e6c7ee373e3d6a4e17f75f9518d843709c0c9bc3e3d4";
repeat = 1ul
};(* {
hash_alg = SHA2_256;
// 2018.05.26: Don't know how to encode byte literals in strings; this doesn't work
// as in OCaml
input = "\xe3\xd7\x25\x70\xdc\xdd\x78\x7c\xe3\x88\x7a\xb2\xcd\x68\x46\x52";
output = h"175ee69b02ba9b58e2b0a5fd13819cea573f3940a94f825128cf4209beabb4e8";
repeat = 1ul
}; *){
hash_alg = SHA2_384;
input = "abc";
output = h"cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7";
repeat = 1ul
}; {
hash_alg = SHA2_384;
input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output = h"09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039";
repeat = 1ul
}; {
hash_alg = SHA2_384;
input = "a";
output = h"9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985";
repeat = 1000000ul
}; {
hash_alg = SHA2_384;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"2fc64a4f500ddb6828f6a3430b8dd72a368eb7f3a8322a70bc84275b9c0b3ab00d27a5cc3c2d224aa6b61a0d79fb4596";
repeat = 10ul
}; {
hash_alg = SHA2_512;
input = "abc";
output = h"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f";
repeat = 1ul
}; {
hash_alg = SHA2_512;
input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output = h"8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909";
repeat = 1ul
}; {
hash_alg = SHA2_512;
input = "a";
output = h"e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b";
repeat = 1000000ul
}; {
hash_alg = SHA2_512;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"89d05ba632c699c31231ded4ffc127d5a894dad412c0e024db872d1abd2ba8141a0f85072a9be1e2aa04cf33c765cb510813a39cd5a84c4acaa64d3f3fb7bae9";
repeat = 10ul
}
]
noextract
let hash_vectors_tmp = List.Tot.map (fun h ->
h.hash_alg, h.input, h.output, h.repeat
) hash_vectors
// 2018.08.06 SZ: I can't verify this in interactive mode but verifies from the command-line
%splice[] (lowstarize_toplevel "hash_vectors_tmp" "hash_vectors_low")
/// HMAC
noeq noextract
type hmac_vector = {
ha: hash_alg;
key: hex_encoded;
data: hex_encoded;
output: hex_encoded;
}
// selected test vectors from
// https://tools.ietf.org/html/rfc4231#section-4.2
// pls extend me!
noextract
let hmac_vectors = [{
ha = SHA2_256;
key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
data = h"4869205468657265";
output = h"b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7";
}; {
ha = SHA2_384;
key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
data = h"4869205468657265";
output = h"afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6";
}]
noextract
let hmac_vectors_tmp = List.Tot.map (fun h ->
h.ha, h.key, h.data, h.output
) hmac_vectors
%splice[] (lowstarize_toplevel "hmac_vectors_tmp" "hmac_vectors_low")
/// HMAC_DRBG
noextract
let hmac_drbg_vectors_tmp =
let open Spec.HMAC_DRBG.Test.Vectors in
List.Tot.map
(fun x -> x.a, h x.entropy_input, h x.nonce, h x.personalization_string,
h x.entropy_input_reseed, h x.additional_input_reseed,
(h x.additional_input_1, h x.additional_input_2),
h x.returned_bits)
test_vectors
%splice[] (lowstarize_toplevel "hmac_drbg_vectors_tmp" "hmac_drbg_vectors_low")
/// HKDF
/// https://tools.ietf.org/html/rfc5869.html
/// pls extend me! We miss SHA2_384 and SHA2_512 tests
///
/// The test is in 2 steps:
/// prk <- extract sal ikm
/// okm <- expand prk info okmlen
noeq noextract
type hkdf_vector = {
ha: hash_alg;
ikm: hex_encoded; // input key materials
salt: hex_encoded; // input salt
info: hex_encoded; // expansion label
prk: hex_encoded; // extracted pseudo-random key (its length is Spec.Hash.Definitions.hash_len ha)
okm: hex_encoded; // output: expanded key materials (its length is an input)
}
noextract
let hkdf_vectors = [{
// Test Case 1
// Basic test case with SHA-256
ha = SHA2_256;
ikm = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";// (22 octets)
salt = h"000102030405060708090a0b0c";// (13 octets)
info = h"f0f1f2f3f4f5f6f7f8f9";// (10 octets)
prk = h"077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5";// (32 octets)
okm = h"3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865";// (42 octets)
}; {
// Test Case 2
// Test with SHA-256 and longer inputs/outputs
ha = SHA2_256;
ikm = h"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f";// (80 octets)
salt = h"606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf";// (80 octets)
info = h"b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff";// (80 octets)
prk = h"06a6b88c5853361a06104c9ceb35b45cef760014904671014a193f40c15fc244";// (32 octets)
okm = h"b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87";// (82 octets)
}; {
// Test Case 3
// Test with SHA-256 and zero-length salt/info
ha = SHA2_256;
ikm = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";// (22 octets)
salt = h"";
info = h"";
prk = h"19ef24a32c717b167f33a91d6f648bdf96596776afdb6377ac434c1c293ccb04";// (32 octets)
okm = h"8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d9d201395faa4b61a96c8";// (42 octets)
}]
noextract
let hkdf_vectors_tmp = List.Tot.map (fun h ->
h.ha, h.ikm, h.salt, h.info, h.prk, h.okm
) hkdf_vectors
%splice[] (lowstarize_toplevel "hkdf_vectors_tmp" "hkdf_vectors_low")
//TODO add test_hkdf, test_hkdf_one as for HMAC
/// Cipher block function
type block_cipher =
| AES128
| AES256
// Funky field names to avoid collisions...
noeq noextract
type block_cipher_vector = {
block: block_cipher;
rkey: hex_encoded;
plain: hex_encoded;
enc: hex_encoded;
}
noextract
let block_cipher_vectors = [
{
block = AES128;
rkey = h"2b7e151628aed2a6abf7158809cf4f3c";
plain = h"6bc1bee22e409f96e93d7e117393172a";
enc = h"3ad77bb40d7a3660a89ecaf32466ef97"
}; {
block = AES128;
rkey = h"2b7e151628aed2a6abf7158809cf4f3c";
plain = h"ae2d8a571e03ac9c9eb76fac45af8e51";
enc = h"f5d3d58503b9699de785895a96fdbaaf"
}; {
block = AES128;
rkey = h"2b7e151628aed2a6abf7158809cf4f3c";
plain = h"30c81c46a35ce411e5fbc1191a0a52ef";
enc = h"43b1cd7f598ece23881b00e3ed030688"
}; {
block = AES128;
rkey = h"2b7e151628aed2a6abf7158809cf4f3c";
plain = h"f69f2445df4f9b17ad2b417be66c3710";
enc = h"7b0c785e27e8ad3f8223207104725dd4"
}; {
block = AES256;
rkey = h"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h"6bc1bee22e409f96e93d7e117393172a";
enc = h"f3eed1bdb5d2a03c064b5a7e3db181f8"
}; {
block = AES256;
rkey = h"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h"ae2d8a571e03ac9c9eb76fac45af8e51";
enc = h"591ccb10d410ed26dc5ba74a31362870"
}; {
block = AES256;
rkey = h"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h"30c81c46a35ce411e5fbc1191a0a52ef";
enc = h"b6ed21b99ca6f4f9f153e7b1beafed1d"
}; {
block = AES256;
rkey = h"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h"f69f2445df4f9b17ad2b417be66c3710";
enc = h"23304b7a39f9f3ff067d8d8f9e24ecc7"
}] | false | true | Test.Vectors.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val block_cipher_vectors_tmp : Prims.list (((Test.Vectors.block_cipher * Test.Lowstarize.hex_encoded) * Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) | [] | Test.Vectors.block_cipher_vectors_tmp | {
"file_name": "providers/test/Test.Vectors.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.list (((Test.Vectors.block_cipher * Test.Lowstarize.hex_encoded) * Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) | {
"end_col": 22,
"end_line": 328,
"start_col": 31,
"start_line": 326
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test.Lowstarize",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let chacha20_vectors_tmp = List.Tot.map (fun h ->
h.c20_key, h.c20_iv, h.c20_ctr, h.c20_plain, h.c20_cipher
) chacha20_vectors | let chacha20_vectors_tmp = | false | null | false | List.Tot.map (fun h -> h.c20_key, h.c20_iv, h.c20_ctr, h.c20_plain, h.c20_cipher) chacha20_vectors | {
"checked_file": "Test.Vectors.fst.checked",
"dependencies": [
"Test.Lowstarize.fst.checked",
"Spec.HMAC_DRBG.Test.Vectors.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"EverCrypt.Hash.fsti.checked"
],
"interface_file": false,
"source_file": "Test.Vectors.fst"
} | [
"total"
] | [
"FStar.List.Tot.Base.map",
"Test.Vectors.chacha20_vector",
"FStar.Pervasives.Native.tuple5",
"Test.Lowstarize.hex_encoded",
"FStar.UInt32.t",
"FStar.Pervasives.Native.Mktuple5",
"Test.Vectors.__proj__Mkchacha20_vector__item__c20_key",
"Test.Vectors.__proj__Mkchacha20_vector__item__c20_iv",
"Test.Vectors.__proj__Mkchacha20_vector__item__c20_ctr",
"Test.Vectors.__proj__Mkchacha20_vector__item__c20_plain",
"Test.Vectors.__proj__Mkchacha20_vector__item__c20_cipher",
"Test.Vectors.chacha20_vectors"
] | [] | module Test.Vectors
open Test.Lowstarize
open EverCrypt.Hash
open Spec.Hash.Definitions
/// Hash algorithms
type hash_alg = EverCrypt.Hash.alg
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
noeq noextract
type hash_vector = {
(* The input [input] is repeated [repeat] times. *)
hash_alg: hash_alg;
input: string;
output: hex_encoded;
repeat: UInt32.t;
}
noextract
let hash_vectors = [{
hash_alg = MD5;
input = "";
output = h"d41d8cd98f00b204e9800998ecf8427e";
repeat = 1ul
}; {
hash_alg = MD5;
input = "a";
output = h"0cc175b9c0f1b6a831c399e269772661";
repeat = 1ul
}; {
hash_alg = MD5;
input = "abc";
output = h"900150983cd24fb0d6963f7d28e17f72";
repeat = 1ul
}; {
hash_alg = MD5;
input = "message digest";
output = h"f96b697d7cb7938d525a2f31aaf161d0";
repeat = 1ul
}; {
hash_alg = MD5;
input = "abcdefghijklmnopqrstuvwxyz";
output = h"c3fcd3d76192e4007dfb496cca67e13b";
repeat = 1ul
}; {
hash_alg = MD5;
input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
output = h"d174ab98d277d9f5a5611c2c9f419d9f";
repeat = 1ul
}; {
hash_alg = MD5;
input = "12345678901234567890123456789012345678901234567890123456789012345678901234567890";
output = h"57edf4a22be3c955ac49da2e2107b67a";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "abc";
output = h"a9993e364706816aba3e25717850c26c9cd0d89d";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h"84983e441c3bd26ebaae4aa1f95129e5e54670f1";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "a";
output = h"34aa973cd4c4daa4f61eeb2bdbad27316534016f";
repeat = 1000000ul
}; {
hash_alg = SHA1;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"dea356a2cddd90c7a7ecedc5ebb563934f460452";
repeat = 10ul
}; {
hash_alg = SHA2_256;
input = "abc";
output = h"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad";
repeat = 1ul
}; {
hash_alg = SHA2_256;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h"248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1";
repeat = 1ul
}; {
hash_alg = SHA2_256;
input = "a";
output = h"cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0";
repeat = 1000000ul
}; {
hash_alg = SHA2_256;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"594847328451bdfa85056225462cc1d867d877fb388df0ce35f25ab5562bfbb5";
repeat = 10ul
}; {
hash_alg = SHA2_256;
input = "\x19";
output = h"68aa2e2ee5dff96e3355e6c7ee373e3d6a4e17f75f9518d843709c0c9bc3e3d4";
repeat = 1ul
};(* {
hash_alg = SHA2_256;
// 2018.05.26: Don't know how to encode byte literals in strings; this doesn't work
// as in OCaml
input = "\xe3\xd7\x25\x70\xdc\xdd\x78\x7c\xe3\x88\x7a\xb2\xcd\x68\x46\x52";
output = h"175ee69b02ba9b58e2b0a5fd13819cea573f3940a94f825128cf4209beabb4e8";
repeat = 1ul
}; *){
hash_alg = SHA2_384;
input = "abc";
output = h"cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7";
repeat = 1ul
}; {
hash_alg = SHA2_384;
input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output = h"09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039";
repeat = 1ul
}; {
hash_alg = SHA2_384;
input = "a";
output = h"9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985";
repeat = 1000000ul
}; {
hash_alg = SHA2_384;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"2fc64a4f500ddb6828f6a3430b8dd72a368eb7f3a8322a70bc84275b9c0b3ab00d27a5cc3c2d224aa6b61a0d79fb4596";
repeat = 10ul
}; {
hash_alg = SHA2_512;
input = "abc";
output = h"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f";
repeat = 1ul
}; {
hash_alg = SHA2_512;
input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output = h"8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909";
repeat = 1ul
}; {
hash_alg = SHA2_512;
input = "a";
output = h"e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b";
repeat = 1000000ul
}; {
hash_alg = SHA2_512;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"89d05ba632c699c31231ded4ffc127d5a894dad412c0e024db872d1abd2ba8141a0f85072a9be1e2aa04cf33c765cb510813a39cd5a84c4acaa64d3f3fb7bae9";
repeat = 10ul
}
]
noextract
let hash_vectors_tmp = List.Tot.map (fun h ->
h.hash_alg, h.input, h.output, h.repeat
) hash_vectors
// 2018.08.06 SZ: I can't verify this in interactive mode but verifies from the command-line
%splice[] (lowstarize_toplevel "hash_vectors_tmp" "hash_vectors_low")
/// HMAC
noeq noextract
type hmac_vector = {
ha: hash_alg;
key: hex_encoded;
data: hex_encoded;
output: hex_encoded;
}
// selected test vectors from
// https://tools.ietf.org/html/rfc4231#section-4.2
// pls extend me!
noextract
let hmac_vectors = [{
ha = SHA2_256;
key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
data = h"4869205468657265";
output = h"b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7";
}; {
ha = SHA2_384;
key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
data = h"4869205468657265";
output = h"afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6";
}]
noextract
let hmac_vectors_tmp = List.Tot.map (fun h ->
h.ha, h.key, h.data, h.output
) hmac_vectors
%splice[] (lowstarize_toplevel "hmac_vectors_tmp" "hmac_vectors_low")
/// HMAC_DRBG
noextract
let hmac_drbg_vectors_tmp =
let open Spec.HMAC_DRBG.Test.Vectors in
List.Tot.map
(fun x -> x.a, h x.entropy_input, h x.nonce, h x.personalization_string,
h x.entropy_input_reseed, h x.additional_input_reseed,
(h x.additional_input_1, h x.additional_input_2),
h x.returned_bits)
test_vectors
%splice[] (lowstarize_toplevel "hmac_drbg_vectors_tmp" "hmac_drbg_vectors_low")
/// HKDF
/// https://tools.ietf.org/html/rfc5869.html
/// pls extend me! We miss SHA2_384 and SHA2_512 tests
///
/// The test is in 2 steps:
/// prk <- extract sal ikm
/// okm <- expand prk info okmlen
noeq noextract
type hkdf_vector = {
ha: hash_alg;
ikm: hex_encoded; // input key materials
salt: hex_encoded; // input salt
info: hex_encoded; // expansion label
prk: hex_encoded; // extracted pseudo-random key (its length is Spec.Hash.Definitions.hash_len ha)
okm: hex_encoded; // output: expanded key materials (its length is an input)
}
noextract
let hkdf_vectors = [{
// Test Case 1
// Basic test case with SHA-256
ha = SHA2_256;
ikm = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";// (22 octets)
salt = h"000102030405060708090a0b0c";// (13 octets)
info = h"f0f1f2f3f4f5f6f7f8f9";// (10 octets)
prk = h"077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5";// (32 octets)
okm = h"3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865";// (42 octets)
}; {
// Test Case 2
// Test with SHA-256 and longer inputs/outputs
ha = SHA2_256;
ikm = h"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f";// (80 octets)
salt = h"606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf";// (80 octets)
info = h"b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff";// (80 octets)
prk = h"06a6b88c5853361a06104c9ceb35b45cef760014904671014a193f40c15fc244";// (32 octets)
okm = h"b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87";// (82 octets)
}; {
// Test Case 3
// Test with SHA-256 and zero-length salt/info
ha = SHA2_256;
ikm = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";// (22 octets)
salt = h"";
info = h"";
prk = h"19ef24a32c717b167f33a91d6f648bdf96596776afdb6377ac434c1c293ccb04";// (32 octets)
okm = h"8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d9d201395faa4b61a96c8";// (42 octets)
}]
noextract
let hkdf_vectors_tmp = List.Tot.map (fun h ->
h.ha, h.ikm, h.salt, h.info, h.prk, h.okm
) hkdf_vectors
%splice[] (lowstarize_toplevel "hkdf_vectors_tmp" "hkdf_vectors_low")
//TODO add test_hkdf, test_hkdf_one as for HMAC
/// Cipher block function
type block_cipher =
| AES128
| AES256
// Funky field names to avoid collisions...
noeq noextract
type block_cipher_vector = {
block: block_cipher;
rkey: hex_encoded;
plain: hex_encoded;
enc: hex_encoded;
}
noextract
let block_cipher_vectors = [
{
block = AES128;
rkey = h"2b7e151628aed2a6abf7158809cf4f3c";
plain = h"6bc1bee22e409f96e93d7e117393172a";
enc = h"3ad77bb40d7a3660a89ecaf32466ef97"
}; {
block = AES128;
rkey = h"2b7e151628aed2a6abf7158809cf4f3c";
plain = h"ae2d8a571e03ac9c9eb76fac45af8e51";
enc = h"f5d3d58503b9699de785895a96fdbaaf"
}; {
block = AES128;
rkey = h"2b7e151628aed2a6abf7158809cf4f3c";
plain = h"30c81c46a35ce411e5fbc1191a0a52ef";
enc = h"43b1cd7f598ece23881b00e3ed030688"
}; {
block = AES128;
rkey = h"2b7e151628aed2a6abf7158809cf4f3c";
plain = h"f69f2445df4f9b17ad2b417be66c3710";
enc = h"7b0c785e27e8ad3f8223207104725dd4"
}; {
block = AES256;
rkey = h"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h"6bc1bee22e409f96e93d7e117393172a";
enc = h"f3eed1bdb5d2a03c064b5a7e3db181f8"
}; {
block = AES256;
rkey = h"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h"ae2d8a571e03ac9c9eb76fac45af8e51";
enc = h"591ccb10d410ed26dc5ba74a31362870"
}; {
block = AES256;
rkey = h"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h"30c81c46a35ce411e5fbc1191a0a52ef";
enc = h"b6ed21b99ca6f4f9f153e7b1beafed1d"
}; {
block = AES256;
rkey = h"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h"f69f2445df4f9b17ad2b417be66c3710";
enc = h"23304b7a39f9f3ff067d8d8f9e24ecc7"
}]
noextract
let block_cipher_vectors_tmp = List.Tot.map (fun h ->
h.block, h.rkey, h.plain, h.enc
) block_cipher_vectors
%splice[] (lowstarize_toplevel "block_cipher_vectors_tmp" "block_cipher_vectors_low")
noeq noextract
type chacha20_vector = {
c20_key: hex_encoded;
c20_iv: hex_encoded;
c20_ctr: UInt32.t;
c20_plain: hex_encoded;
c20_cipher: hex_encoded;
}
noextract
let chacha20_vectors = [
{
c20_key = h"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f";
c20_iv = h"000000000000004a00000000";
c20_ctr = 1ul;
c20_plain = h"4c616469657320616e642047656e746c656d656e206f662074686520636c617373206f66202739393a204966204920636f756c64206f6666657220796f75206f6e6c79206f6e652074697020666f7220746865206675747572652c2073756e73637265656e20776f756c642062652069742e";
c20_cipher = h"6e2e359a2568f98041ba0728dd0d6981e97e7aec1d4360c20a27afccfd9fae0bf91b65c5524733ab8f593dabcd62b3571639d624e65152ab8f530c359f0861d807ca0dbf500d6a6156a38e088a22b65e52bc514d16ccf806818ce91ab77937365af90bbf74a35be6b40b8eedf2785e42874d";
}] | false | true | Test.Vectors.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val chacha20_vectors_tmp : Prims.list ((((Test.Lowstarize.hex_encoded * Test.Lowstarize.hex_encoded) * FStar.UInt32.t) *
Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) | [] | Test.Vectors.chacha20_vectors_tmp | {
"file_name": "providers/test/Test.Vectors.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.list ((((Test.Lowstarize.hex_encoded * Test.Lowstarize.hex_encoded) * FStar.UInt32.t) *
Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) | {
"end_col": 18,
"end_line": 354,
"start_col": 27,
"start_line": 352
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test.Lowstarize",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let aead_vectors = [
{ (* rfc7539#page-22 *)
cipher = CHACHA20_POLY1305;
key = h"808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f";
iv = h"070000004041424344454647";
aad = h"50515253c0c1c2c3c4c5c6c7";
tag = h"1ae10b594f09e26a7e902ecbd0600691";
plaintext = h"4c616469657320616e642047656e746c656d656e206f662074686520636c617373206f66202739393a204966204920636f756c64206f6666657220796f75206f6e6c79206f6e652074697020666f7220746865206675747572652c2073756e73637265656e20776f756c642062652069742e";
ciphertext = h"d31a8d34648e60db7b86afbc53ef7ec2a4aded51296e08fea9e2b5a736ee62d63dbea45e8ca9671282fafb69da92728b1a71de0a9e060b2905d6a5b67ecd3b3692ddbd7f2d778b8c9803aee328091b58fab324e4fad675945585808b4831d7bc3ff4def08e4b7a9de576d26586cec64b6116";
};
{
cipher = CHACHA20_POLY1305;
key = h"1c9240a5eb55d38af333888604f6b5f0473917c1402b80099dca5cbc207075c0";
iv = h"000000000102030405060708";
aad = h"f33388860000000000004e91";
tag = h"eead9d67890cbb22392336fea1851f38";
plaintext = h"496e7465726e65742d4472616674732061726520647261667420646f63756d656e74732076616c696420666f722061206d6178696d756d206f6620736978206d6f6e74687320616e64206d617920626520757064617465642c207265706c616365642c206f72206f62736f6c65746564206279206f7468657220646f63756d656e747320617420616e792074696d652e20497420697320696e617070726f70726961746520746f2075736520496e7465726e65742d447261667473206173207265666572656e6365206d6174657269616c206f7220746f2063697465207468656d206f74686572207468616e206173202fe2809c776f726b20696e2070726f67726573732e2fe2809d";
ciphertext = h"64a0861575861af460f062c79be643bd5e805cfd345cf389f108670ac76c8cb24c6cfc18755d43eea09ee94e382d26b0bdb7b73c321b0100d4f03b7f355894cf332f830e710b97ce98c8a84abd0b948114ad176e008d33bd60f982b1ff37c8559797a06ef4f0ef61c186324e2b3506383606907b6a7c02b0f9f6157b53c867e4b9166c767b804d46a59b5216cde7a4e99040c5a40433225ee282a1b0a06c523eaf4534d7f83fa1155b0047718cbc546a0d072b04b3564eea1b422273f548271a0bb2316053fa76991955ebd63159434ecebb4e466dae5a1073a6727627097a1049e617d91d361094fa68f0ff77987130305beaba2eda04df997b714d6c6f2c29a6ad5cb4022b02709b";
};
{
cipher = AES_128_GCM;
key = h"00000000000000000000000000000000";
iv = h"000000000000000000000000";
aad = h"";
tag = h"58e2fccefa7e3061367f1d57a4e7455a";
plaintext = h"";
ciphertext = h"";
};
{
cipher = AES_128_GCM;
key = h"00000000000000000000000000000000";
iv = h"000000000000000000000000";
aad = h"";
tag = h"ab6e47d42cec13bdf53a67b21257bddf";
plaintext = h"00000000000000000000000000000000";
ciphertext = h"0388dace60b6a392f328c2b971b2fe78";
};
{
cipher = AES_128_GCM;
key = h"feffe9928665731c6d6a8f9467308308";
iv = h"cafebabefacedbaddecaf888";
aad = h"";
tag = h"4d5c2af327cd64a62cf35abd2ba6fab4";
plaintext = h"d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b391aafd255";
ciphertext = h"42831ec2217774244b7221b784d0d49ce3aa212f2c02a4e035c17e2329aca12e21d514b25466931c7d8f6a5aac84aa051ba30b396a0aac973d58e091473f5985";
};
{
cipher = AES_128_GCM;
key = h"feffe9928665731c6d6a8f9467308308";
iv = h"cafebabefacedbaddecaf888";
aad = h"feedfacedeadbeeffeedfacedeadbeefabaddad2";
tag = h"5bc94fbc3221a5db94fae95ae7121a47";
plaintext = h"d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39";
ciphertext = h"42831ec2217774244b7221b784d0d49ce3aa212f2c02a4e035c17e2329aca12e21d514b25466931c7d8f6a5aac84aa051ba30b396a0aac973d58e091";
};
{
cipher = AES_128_GCM;
key = h"feffe9928665731c6d6a8f9467308308";
iv = h"cafebabefacedbad";
aad = h"feedfacedeadbeeffeedfacedeadbeefabaddad2";
tag = h"3612d2e79e3b0785561be14aaca2fccb";
plaintext = h"d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39";
ciphertext = h"61353b4c2806934a777ff51fa22a4755699b2a714fcdc6f83766e5f97b6c742373806900e49f24b22b097544d4896b424989b5e1ebac0f07c23f4598";
};
{
cipher = AES_128_GCM;
key = h"feffe9928665731c6d6a8f9467308308";
iv = h"9313225df88406e555909c5aff5269aa6a7a9538534f7da1e4c303d2a318a728c3c0c95156809539fcf0e2429a6b525416aedbf5a0de6a57a637b39b";
aad = h"feedfacedeadbeeffeedfacedeadbeefabaddad2";
tag = h"619cc5aefffe0bfa462af43c1699d050";
plaintext = h"d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39";
ciphertext = h"8ce24998625615b603a033aca13fb894be9112a5c3a211a8ba262a3cca7e2ca701e4a9a4fba43c90ccdcb281d48c7c6fd62875d2aca417034c34aee5";
};
{
cipher = AES_256_GCM;
key = h"0000000000000000000000000000000000000000000000000000000000000000";
iv = h"000000000000000000000000";
aad = h"";
tag = h"530f8afbc74536b9a963b4f1c4cb738b";
plaintext = h"";
ciphertext = h"";
};
{
cipher = AES_256_GCM;
key = h"feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308";
iv = h"cafebabefacedbaddecaf888";
aad = h"";
tag = h"b094dac5d93471bdec1a502270e3cc6c";
plaintext = h"d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b391aafd255";
ciphertext = h"522dc1f099567d07f47f37a32a84427d643a8cdcbfe5c0c97598a2bd2555d1aa8cb08e48590dbb3da7b08b1056828838c5f61e6393ba7a0abcc9f662898015ad";
};
{
cipher = AES_256_GCM;
key = h"feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308";
iv = h"cafebabefacedbaddecaf888";
aad = h"";
tag = h"b094dac5d93471bdec1a502270e3cc6c";
plaintext = h"d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b391aafd255";
ciphertext = h"522dc1f099567d07f47f37a32a84427d643a8cdcbfe5c0c97598a2bd2555d1aa8cb08e48590dbb3da7b08b1056828838c5f61e6393ba7a0abcc9f662898015ad";
};
{
cipher = AES_256_GCM;
key = h"feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308";
iv = h"cafebabefacedbaddecaf888";
aad = h"feedfacedeadbeeffeedfacedeadbeefabaddad2";
tag = h"76fc6ece0f4e1768cddf8853bb2d551b";
plaintext = h"d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39";
ciphertext = h"522dc1f099567d07f47f37a32a84427d643a8cdcbfe5c0c97598a2bd2555d1aa8cb08e48590dbb3da7b08b1056828838c5f61e6393ba7a0abcc9f662";
};
{
cipher = AES_256_GCM;
key = h"feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308";
iv = h"cafebabefacedbad";
aad = h"feedfacedeadbeeffeedfacedeadbeefabaddad2";
tag = h"3a337dbf46a792c45e454913fe2ea8f2";
plaintext = h"d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39";
ciphertext = h"c3762df1ca787d32ae47c13bf19844cbaf1ae14d0b976afac52ff7d79bba9de0feb582d33934a4f0954cc2363bc73f7862ac430e64abe499f47c9b1f";
};
{
cipher = AES_256_GCM;
key = h"feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308";
iv = h"9313225df88406e555909c5aff5269aa6a7a9538534f7da1e4c303d2a318a728c3c0c95156809539fcf0e2429a6b525416aedbf5a0de6a57a637b39b";
aad = h"feedfacedeadbeeffeedfacedeadbeefabaddad2";
tag = h"a44a8266ee1c8eb0c8b5d4cf5ae9f19a";
plaintext = h"d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39";
ciphertext = h"5a8def2f0c9e53f1f75d7853659e2a20eeb2b22aafde6419a058ab4f6f746bf40fc0c3b780f244452da3ebf1c5d82cdea2418997200ef82e44ae7e3f";
};
{
cipher = AES_128_GCM;
key = h"00000000000000000000000000000000";
iv = h"000000000000000000000000";
aad = h"d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b391aafd255522dc1f099567d07f47f37a32a84427d643a8cdcbfe5c0c97598a2bd2555d1aa8cb08e48590dbb3da7b08b1056828838c5f61e6393ba7a0abcc9f662898015ad";
tag = h"5fea793a2d6f974d37e68e0cb8ff9492";
plaintext = h"";
ciphertext = h"";
};
{
cipher = AES_128_GCM;
key = h"00000000000000000000000000000000";
iv = h"000000000000000000000000";
aad = h"";
tag = h"9dd0a376b08e40eb00c35f29f9ea61a4";
plaintext = h"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
ciphertext = h"0388dace60b6a392f328c2b971b2fe78f795aaab494b5923f7fd89ff948bc1e0200211214e7394da2089b6acd093abe0";
};
{
cipher = AES_128_GCM;
key = h"00000000000000000000000000000000";
iv = h"000000000000000000000000";
aad = h"";
tag = h"98885a3a22bd4742fe7b72172193b163";
plaintext = h"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
ciphertext = h"0388dace60b6a392f328c2b971b2fe78f795aaab494b5923f7fd89ff948bc1e0200211214e7394da2089b6acd093abe0c94da219118e297d7b7ebcbcc9c388f28ade7d85a8ee35616f7124a9d5270291";
};
{
cipher = AES_128_GCM;
key = h"00000000000000000000000000000000";
iv = h"000000000000000000000000";
aad = h"";
tag = h"cac45f60e31efd3b5a43b98a22ce1aa1";
plaintext = h"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
ciphertext = h"0388dace60b6a392f328c2b971b2fe78f795aaab494b5923f7fd89ff948bc1e0200211214e7394da2089b6acd093abe0c94da219118e297d7b7ebcbcc9c388f28ade7d85a8ee35616f7124a9d527029195b84d1b96c690ff2f2de30bf2ec89e00253786e126504f0dab90c48a30321de3345e6b0461e7c9e6c6b7afedde83f40";
};
{
cipher = AES_128_GCM;
key = h"00000000000000000000000000000000";
iv = h"ffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
aad = h"";
tag = h"566f8ef683078bfdeeffa869d751a017";
plaintext = h"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
ciphertext = h"56b3373ca9ef6e4a2b64fe1e9a17b61425f10d47a75a5fce13efc6bc784af24f4141bdd48cf7c770887afd573cca5418a9aeffcd7c5ceddfc6a78397b9a85b499da558257267caab2ad0b23ca476a53cb17fb41c4b8b475cb4f3f7165094c229c9e8c4dc0a2a5ff1903e501511221376a1cdb8364c5061a20cae74bc4acd76ceb0abc9fd3217ef9f8c90be402ddf6d8697f4f880dff15bfb7a6b28241ec8fe183c2d59e3f9dfff653c7126f0acb9e64211f42bae12af462b1070bef1ab5e3606";
};
{
cipher = AES_128_GCM;
key = h"00000000000000000000000000000000";
iv = h"ffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
aad = h"";
tag = h"8b307f6b33286d0ab026a9ed3fe1e85f";
plaintext = h"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
ciphertext = h"56b3373ca9ef6e4a2b64fe1e9a17b61425f10d47a75a5fce13efc6bc784af24f4141bdd48cf7c770887afd573cca5418a9aeffcd7c5ceddfc6a78397b9a85b499da558257267caab2ad0b23ca476a53cb17fb41c4b8b475cb4f3f7165094c229c9e8c4dc0a2a5ff1903e501511221376a1cdb8364c5061a20cae74bc4acd76ceb0abc9fd3217ef9f8c90be402ddf6d8697f4f880dff15bfb7a6b28241ec8fe183c2d59e3f9dfff653c7126f0acb9e64211f42bae12af462b1070bef1ab5e3606872ca10dee15b3249b1a1b958f23134c4bccb7d03200bce420a2f8eb66dcf3644d1423c1b5699003c13ecef4bf38a3b60eedc34033bac1902783dc6d89e2e774188a439c7ebcc0672dbda4ddcfb2794613b0be41315ef778708a70ee7d75165c";
};
{
cipher = AES_128_GCM;
key = h"843ffcf5d2b72694d19ed01d01249412";
iv = h"dbcca32ebf9b804617c3aa9e";
aad = h"00000000000000000000000000000000101112131415161718191a1b1c1d1e1f";
tag = h"3b629ccfbc1119b7319e1dce2cd6fd6d";
plaintext = h"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f";
ciphertext = h"6268c6fa2a80b2d137467f092f657ac04d89be2beaa623d61b5a868c8f03ff95d3dcee23ad2f1ab3a6c80eaf4b140eb05de3457f0fbc111a6b43d0763aa422a3013cf1dc37fe417d1fbfc449b75d4cc5";
};
] | let aead_vectors = | false | null | false | [
{
cipher = CHACHA20_POLY1305;
key = h "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f";
iv = h "070000004041424344454647";
aad = h "50515253c0c1c2c3c4c5c6c7";
tag = h "1ae10b594f09e26a7e902ecbd0600691";
plaintext
=
h "4c616469657320616e642047656e746c656d656e206f662074686520636c617373206f66202739393a204966204920636f756c64206f6666657220796f75206f6e6c79206f6e652074697020666f7220746865206675747572652c2073756e73637265656e20776f756c642062652069742e"
;
ciphertext
=
h "d31a8d34648e60db7b86afbc53ef7ec2a4aded51296e08fea9e2b5a736ee62d63dbea45e8ca9671282fafb69da92728b1a71de0a9e060b2905d6a5b67ecd3b3692ddbd7f2d778b8c9803aee328091b58fab324e4fad675945585808b4831d7bc3ff4def08e4b7a9de576d26586cec64b6116"
};
{
cipher = CHACHA20_POLY1305;
key = h "1c9240a5eb55d38af333888604f6b5f0473917c1402b80099dca5cbc207075c0";
iv = h "000000000102030405060708";
aad = h "f33388860000000000004e91";
tag = h "eead9d67890cbb22392336fea1851f38";
plaintext
=
h "496e7465726e65742d4472616674732061726520647261667420646f63756d656e74732076616c696420666f722061206d6178696d756d206f6620736978206d6f6e74687320616e64206d617920626520757064617465642c207265706c616365642c206f72206f62736f6c65746564206279206f7468657220646f63756d656e747320617420616e792074696d652e20497420697320696e617070726f70726961746520746f2075736520496e7465726e65742d447261667473206173207265666572656e6365206d6174657269616c206f7220746f2063697465207468656d206f74686572207468616e206173202fe2809c776f726b20696e2070726f67726573732e2fe2809d"
;
ciphertext
=
h "64a0861575861af460f062c79be643bd5e805cfd345cf389f108670ac76c8cb24c6cfc18755d43eea09ee94e382d26b0bdb7b73c321b0100d4f03b7f355894cf332f830e710b97ce98c8a84abd0b948114ad176e008d33bd60f982b1ff37c8559797a06ef4f0ef61c186324e2b3506383606907b6a7c02b0f9f6157b53c867e4b9166c767b804d46a59b5216cde7a4e99040c5a40433225ee282a1b0a06c523eaf4534d7f83fa1155b0047718cbc546a0d072b04b3564eea1b422273f548271a0bb2316053fa76991955ebd63159434ecebb4e466dae5a1073a6727627097a1049e617d91d361094fa68f0ff77987130305beaba2eda04df997b714d6c6f2c29a6ad5cb4022b02709b"
};
{
cipher = AES_128_GCM;
key = h "00000000000000000000000000000000";
iv = h "000000000000000000000000";
aad = h "";
tag = h "58e2fccefa7e3061367f1d57a4e7455a";
plaintext = h "";
ciphertext = h ""
};
{
cipher = AES_128_GCM;
key = h "00000000000000000000000000000000";
iv = h "000000000000000000000000";
aad = h "";
tag = h "ab6e47d42cec13bdf53a67b21257bddf";
plaintext = h "00000000000000000000000000000000";
ciphertext = h "0388dace60b6a392f328c2b971b2fe78"
};
{
cipher = AES_128_GCM;
key = h "feffe9928665731c6d6a8f9467308308";
iv = h "cafebabefacedbaddecaf888";
aad = h "";
tag = h "4d5c2af327cd64a62cf35abd2ba6fab4";
plaintext
=
h "d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b391aafd255"
;
ciphertext
=
h "42831ec2217774244b7221b784d0d49ce3aa212f2c02a4e035c17e2329aca12e21d514b25466931c7d8f6a5aac84aa051ba30b396a0aac973d58e091473f5985"
};
{
cipher = AES_128_GCM;
key = h "feffe9928665731c6d6a8f9467308308";
iv = h "cafebabefacedbaddecaf888";
aad = h "feedfacedeadbeeffeedfacedeadbeefabaddad2";
tag = h "5bc94fbc3221a5db94fae95ae7121a47";
plaintext
=
h "d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39"
;
ciphertext
=
h "42831ec2217774244b7221b784d0d49ce3aa212f2c02a4e035c17e2329aca12e21d514b25466931c7d8f6a5aac84aa051ba30b396a0aac973d58e091"
};
{
cipher = AES_128_GCM;
key = h "feffe9928665731c6d6a8f9467308308";
iv = h "cafebabefacedbad";
aad = h "feedfacedeadbeeffeedfacedeadbeefabaddad2";
tag = h "3612d2e79e3b0785561be14aaca2fccb";
plaintext
=
h "d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39"
;
ciphertext
=
h "61353b4c2806934a777ff51fa22a4755699b2a714fcdc6f83766e5f97b6c742373806900e49f24b22b097544d4896b424989b5e1ebac0f07c23f4598"
};
{
cipher = AES_128_GCM;
key = h "feffe9928665731c6d6a8f9467308308";
iv
=
h "9313225df88406e555909c5aff5269aa6a7a9538534f7da1e4c303d2a318a728c3c0c95156809539fcf0e2429a6b525416aedbf5a0de6a57a637b39b"
;
aad = h "feedfacedeadbeeffeedfacedeadbeefabaddad2";
tag = h "619cc5aefffe0bfa462af43c1699d050";
plaintext
=
h "d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39"
;
ciphertext
=
h "8ce24998625615b603a033aca13fb894be9112a5c3a211a8ba262a3cca7e2ca701e4a9a4fba43c90ccdcb281d48c7c6fd62875d2aca417034c34aee5"
};
{
cipher = AES_256_GCM;
key = h "0000000000000000000000000000000000000000000000000000000000000000";
iv = h "000000000000000000000000";
aad = h "";
tag = h "530f8afbc74536b9a963b4f1c4cb738b";
plaintext = h "";
ciphertext = h ""
};
{
cipher = AES_256_GCM;
key = h "feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308";
iv = h "cafebabefacedbaddecaf888";
aad = h "";
tag = h "b094dac5d93471bdec1a502270e3cc6c";
plaintext
=
h "d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b391aafd255"
;
ciphertext
=
h "522dc1f099567d07f47f37a32a84427d643a8cdcbfe5c0c97598a2bd2555d1aa8cb08e48590dbb3da7b08b1056828838c5f61e6393ba7a0abcc9f662898015ad"
};
{
cipher = AES_256_GCM;
key = h "feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308";
iv = h "cafebabefacedbaddecaf888";
aad = h "";
tag = h "b094dac5d93471bdec1a502270e3cc6c";
plaintext
=
h "d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b391aafd255"
;
ciphertext
=
h "522dc1f099567d07f47f37a32a84427d643a8cdcbfe5c0c97598a2bd2555d1aa8cb08e48590dbb3da7b08b1056828838c5f61e6393ba7a0abcc9f662898015ad"
};
{
cipher = AES_256_GCM;
key = h "feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308";
iv = h "cafebabefacedbaddecaf888";
aad = h "feedfacedeadbeeffeedfacedeadbeefabaddad2";
tag = h "76fc6ece0f4e1768cddf8853bb2d551b";
plaintext
=
h "d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39"
;
ciphertext
=
h "522dc1f099567d07f47f37a32a84427d643a8cdcbfe5c0c97598a2bd2555d1aa8cb08e48590dbb3da7b08b1056828838c5f61e6393ba7a0abcc9f662"
};
{
cipher = AES_256_GCM;
key = h "feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308";
iv = h "cafebabefacedbad";
aad = h "feedfacedeadbeeffeedfacedeadbeefabaddad2";
tag = h "3a337dbf46a792c45e454913fe2ea8f2";
plaintext
=
h "d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39"
;
ciphertext
=
h "c3762df1ca787d32ae47c13bf19844cbaf1ae14d0b976afac52ff7d79bba9de0feb582d33934a4f0954cc2363bc73f7862ac430e64abe499f47c9b1f"
};
{
cipher = AES_256_GCM;
key = h "feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308";
iv
=
h "9313225df88406e555909c5aff5269aa6a7a9538534f7da1e4c303d2a318a728c3c0c95156809539fcf0e2429a6b525416aedbf5a0de6a57a637b39b"
;
aad = h "feedfacedeadbeeffeedfacedeadbeefabaddad2";
tag = h "a44a8266ee1c8eb0c8b5d4cf5ae9f19a";
plaintext
=
h "d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39"
;
ciphertext
=
h "5a8def2f0c9e53f1f75d7853659e2a20eeb2b22aafde6419a058ab4f6f746bf40fc0c3b780f244452da3ebf1c5d82cdea2418997200ef82e44ae7e3f"
};
{
cipher = AES_128_GCM;
key = h "00000000000000000000000000000000";
iv = h "000000000000000000000000";
aad
=
h "d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b391aafd255522dc1f099567d07f47f37a32a84427d643a8cdcbfe5c0c97598a2bd2555d1aa8cb08e48590dbb3da7b08b1056828838c5f61e6393ba7a0abcc9f662898015ad"
;
tag = h "5fea793a2d6f974d37e68e0cb8ff9492";
plaintext = h "";
ciphertext = h ""
};
{
cipher = AES_128_GCM;
key = h "00000000000000000000000000000000";
iv = h "000000000000000000000000";
aad = h "";
tag = h "9dd0a376b08e40eb00c35f29f9ea61a4";
plaintext
=
h "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
;
ciphertext
=
h "0388dace60b6a392f328c2b971b2fe78f795aaab494b5923f7fd89ff948bc1e0200211214e7394da2089b6acd093abe0"
};
{
cipher = AES_128_GCM;
key = h "00000000000000000000000000000000";
iv = h "000000000000000000000000";
aad = h "";
tag = h "98885a3a22bd4742fe7b72172193b163";
plaintext
=
h "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
;
ciphertext
=
h "0388dace60b6a392f328c2b971b2fe78f795aaab494b5923f7fd89ff948bc1e0200211214e7394da2089b6acd093abe0c94da219118e297d7b7ebcbcc9c388f28ade7d85a8ee35616f7124a9d5270291"
};
{
cipher = AES_128_GCM;
key = h "00000000000000000000000000000000";
iv = h "000000000000000000000000";
aad = h "";
tag = h "cac45f60e31efd3b5a43b98a22ce1aa1";
plaintext
=
h "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
;
ciphertext
=
h "0388dace60b6a392f328c2b971b2fe78f795aaab494b5923f7fd89ff948bc1e0200211214e7394da2089b6acd093abe0c94da219118e297d7b7ebcbcc9c388f28ade7d85a8ee35616f7124a9d527029195b84d1b96c690ff2f2de30bf2ec89e00253786e126504f0dab90c48a30321de3345e6b0461e7c9e6c6b7afedde83f40"
};
{
cipher = AES_128_GCM;
key = h "00000000000000000000000000000000";
iv
=
h "ffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
;
aad = h "";
tag = h "566f8ef683078bfdeeffa869d751a017";
plaintext
=
h "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
;
ciphertext
=
h "56b3373ca9ef6e4a2b64fe1e9a17b61425f10d47a75a5fce13efc6bc784af24f4141bdd48cf7c770887afd573cca5418a9aeffcd7c5ceddfc6a78397b9a85b499da558257267caab2ad0b23ca476a53cb17fb41c4b8b475cb4f3f7165094c229c9e8c4dc0a2a5ff1903e501511221376a1cdb8364c5061a20cae74bc4acd76ceb0abc9fd3217ef9f8c90be402ddf6d8697f4f880dff15bfb7a6b28241ec8fe183c2d59e3f9dfff653c7126f0acb9e64211f42bae12af462b1070bef1ab5e3606"
};
{
cipher = AES_128_GCM;
key = h "00000000000000000000000000000000";
iv
=
h "ffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
;
aad = h "";
tag = h "8b307f6b33286d0ab026a9ed3fe1e85f";
plaintext
=
h "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
;
ciphertext
=
h "56b3373ca9ef6e4a2b64fe1e9a17b61425f10d47a75a5fce13efc6bc784af24f4141bdd48cf7c770887afd573cca5418a9aeffcd7c5ceddfc6a78397b9a85b499da558257267caab2ad0b23ca476a53cb17fb41c4b8b475cb4f3f7165094c229c9e8c4dc0a2a5ff1903e501511221376a1cdb8364c5061a20cae74bc4acd76ceb0abc9fd3217ef9f8c90be402ddf6d8697f4f880dff15bfb7a6b28241ec8fe183c2d59e3f9dfff653c7126f0acb9e64211f42bae12af462b1070bef1ab5e3606872ca10dee15b3249b1a1b958f23134c4bccb7d03200bce420a2f8eb66dcf3644d1423c1b5699003c13ecef4bf38a3b60eedc34033bac1902783dc6d89e2e774188a439c7ebcc0672dbda4ddcfb2794613b0be41315ef778708a70ee7d75165c"
};
{
cipher = AES_128_GCM;
key = h "843ffcf5d2b72694d19ed01d01249412";
iv = h "dbcca32ebf9b804617c3aa9e";
aad = h "00000000000000000000000000000000101112131415161718191a1b1c1d1e1f";
tag = h "3b629ccfbc1119b7319e1dce2cd6fd6d";
plaintext
=
h "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f"
;
ciphertext
=
h "6268c6fa2a80b2d137467f092f657ac04d89be2beaa623d61b5a868c8f03ff95d3dcee23ad2f1ab3a6c80eaf4b140eb05de3457f0fbc111a6b43d0763aa422a3013cf1dc37fe417d1fbfc449b75d4cc5"
}
] | {
"checked_file": "Test.Vectors.fst.checked",
"dependencies": [
"Test.Lowstarize.fst.checked",
"Spec.HMAC_DRBG.Test.Vectors.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"EverCrypt.Hash.fsti.checked"
],
"interface_file": false,
"source_file": "Test.Vectors.fst"
} | [
"total"
] | [
"Prims.Cons",
"Test.Vectors.aead_vector",
"Test.Vectors.Mkaead_vector",
"Test.Vectors.CHACHA20_POLY1305",
"Test.Lowstarize.h",
"Test.Vectors.AES_128_GCM",
"Test.Vectors.AES_256_GCM",
"Prims.Nil"
] | [] | module Test.Vectors
open Test.Lowstarize
open EverCrypt.Hash
open Spec.Hash.Definitions
/// Hash algorithms
type hash_alg = EverCrypt.Hash.alg
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
noeq noextract
type hash_vector = {
(* The input [input] is repeated [repeat] times. *)
hash_alg: hash_alg;
input: string;
output: hex_encoded;
repeat: UInt32.t;
}
noextract
let hash_vectors = [{
hash_alg = MD5;
input = "";
output = h"d41d8cd98f00b204e9800998ecf8427e";
repeat = 1ul
}; {
hash_alg = MD5;
input = "a";
output = h"0cc175b9c0f1b6a831c399e269772661";
repeat = 1ul
}; {
hash_alg = MD5;
input = "abc";
output = h"900150983cd24fb0d6963f7d28e17f72";
repeat = 1ul
}; {
hash_alg = MD5;
input = "message digest";
output = h"f96b697d7cb7938d525a2f31aaf161d0";
repeat = 1ul
}; {
hash_alg = MD5;
input = "abcdefghijklmnopqrstuvwxyz";
output = h"c3fcd3d76192e4007dfb496cca67e13b";
repeat = 1ul
}; {
hash_alg = MD5;
input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
output = h"d174ab98d277d9f5a5611c2c9f419d9f";
repeat = 1ul
}; {
hash_alg = MD5;
input = "12345678901234567890123456789012345678901234567890123456789012345678901234567890";
output = h"57edf4a22be3c955ac49da2e2107b67a";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "abc";
output = h"a9993e364706816aba3e25717850c26c9cd0d89d";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h"84983e441c3bd26ebaae4aa1f95129e5e54670f1";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "a";
output = h"34aa973cd4c4daa4f61eeb2bdbad27316534016f";
repeat = 1000000ul
}; {
hash_alg = SHA1;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"dea356a2cddd90c7a7ecedc5ebb563934f460452";
repeat = 10ul
}; {
hash_alg = SHA2_256;
input = "abc";
output = h"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad";
repeat = 1ul
}; {
hash_alg = SHA2_256;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h"248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1";
repeat = 1ul
}; {
hash_alg = SHA2_256;
input = "a";
output = h"cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0";
repeat = 1000000ul
}; {
hash_alg = SHA2_256;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"594847328451bdfa85056225462cc1d867d877fb388df0ce35f25ab5562bfbb5";
repeat = 10ul
}; {
hash_alg = SHA2_256;
input = "\x19";
output = h"68aa2e2ee5dff96e3355e6c7ee373e3d6a4e17f75f9518d843709c0c9bc3e3d4";
repeat = 1ul
};(* {
hash_alg = SHA2_256;
// 2018.05.26: Don't know how to encode byte literals in strings; this doesn't work
// as in OCaml
input = "\xe3\xd7\x25\x70\xdc\xdd\x78\x7c\xe3\x88\x7a\xb2\xcd\x68\x46\x52";
output = h"175ee69b02ba9b58e2b0a5fd13819cea573f3940a94f825128cf4209beabb4e8";
repeat = 1ul
}; *){
hash_alg = SHA2_384;
input = "abc";
output = h"cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7";
repeat = 1ul
}; {
hash_alg = SHA2_384;
input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output = h"09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039";
repeat = 1ul
}; {
hash_alg = SHA2_384;
input = "a";
output = h"9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985";
repeat = 1000000ul
}; {
hash_alg = SHA2_384;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"2fc64a4f500ddb6828f6a3430b8dd72a368eb7f3a8322a70bc84275b9c0b3ab00d27a5cc3c2d224aa6b61a0d79fb4596";
repeat = 10ul
}; {
hash_alg = SHA2_512;
input = "abc";
output = h"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f";
repeat = 1ul
}; {
hash_alg = SHA2_512;
input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output = h"8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909";
repeat = 1ul
}; {
hash_alg = SHA2_512;
input = "a";
output = h"e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b";
repeat = 1000000ul
}; {
hash_alg = SHA2_512;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"89d05ba632c699c31231ded4ffc127d5a894dad412c0e024db872d1abd2ba8141a0f85072a9be1e2aa04cf33c765cb510813a39cd5a84c4acaa64d3f3fb7bae9";
repeat = 10ul
}
]
noextract
let hash_vectors_tmp = List.Tot.map (fun h ->
h.hash_alg, h.input, h.output, h.repeat
) hash_vectors
// 2018.08.06 SZ: I can't verify this in interactive mode but verifies from the command-line
%splice[] (lowstarize_toplevel "hash_vectors_tmp" "hash_vectors_low")
/// HMAC
noeq noextract
type hmac_vector = {
ha: hash_alg;
key: hex_encoded;
data: hex_encoded;
output: hex_encoded;
}
// selected test vectors from
// https://tools.ietf.org/html/rfc4231#section-4.2
// pls extend me!
noextract
let hmac_vectors = [{
ha = SHA2_256;
key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
data = h"4869205468657265";
output = h"b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7";
}; {
ha = SHA2_384;
key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
data = h"4869205468657265";
output = h"afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6";
}]
noextract
let hmac_vectors_tmp = List.Tot.map (fun h ->
h.ha, h.key, h.data, h.output
) hmac_vectors
%splice[] (lowstarize_toplevel "hmac_vectors_tmp" "hmac_vectors_low")
/// HMAC_DRBG
noextract
let hmac_drbg_vectors_tmp =
let open Spec.HMAC_DRBG.Test.Vectors in
List.Tot.map
(fun x -> x.a, h x.entropy_input, h x.nonce, h x.personalization_string,
h x.entropy_input_reseed, h x.additional_input_reseed,
(h x.additional_input_1, h x.additional_input_2),
h x.returned_bits)
test_vectors
%splice[] (lowstarize_toplevel "hmac_drbg_vectors_tmp" "hmac_drbg_vectors_low")
/// HKDF
/// https://tools.ietf.org/html/rfc5869.html
/// pls extend me! We miss SHA2_384 and SHA2_512 tests
///
/// The test is in 2 steps:
/// prk <- extract sal ikm
/// okm <- expand prk info okmlen
noeq noextract
type hkdf_vector = {
ha: hash_alg;
ikm: hex_encoded; // input key materials
salt: hex_encoded; // input salt
info: hex_encoded; // expansion label
prk: hex_encoded; // extracted pseudo-random key (its length is Spec.Hash.Definitions.hash_len ha)
okm: hex_encoded; // output: expanded key materials (its length is an input)
}
noextract
let hkdf_vectors = [{
// Test Case 1
// Basic test case with SHA-256
ha = SHA2_256;
ikm = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";// (22 octets)
salt = h"000102030405060708090a0b0c";// (13 octets)
info = h"f0f1f2f3f4f5f6f7f8f9";// (10 octets)
prk = h"077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5";// (32 octets)
okm = h"3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865";// (42 octets)
}; {
// Test Case 2
// Test with SHA-256 and longer inputs/outputs
ha = SHA2_256;
ikm = h"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f";// (80 octets)
salt = h"606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf";// (80 octets)
info = h"b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff";// (80 octets)
prk = h"06a6b88c5853361a06104c9ceb35b45cef760014904671014a193f40c15fc244";// (32 octets)
okm = h"b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87";// (82 octets)
}; {
// Test Case 3
// Test with SHA-256 and zero-length salt/info
ha = SHA2_256;
ikm = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";// (22 octets)
salt = h"";
info = h"";
prk = h"19ef24a32c717b167f33a91d6f648bdf96596776afdb6377ac434c1c293ccb04";// (32 octets)
okm = h"8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d9d201395faa4b61a96c8";// (42 octets)
}]
noextract
let hkdf_vectors_tmp = List.Tot.map (fun h ->
h.ha, h.ikm, h.salt, h.info, h.prk, h.okm
) hkdf_vectors
%splice[] (lowstarize_toplevel "hkdf_vectors_tmp" "hkdf_vectors_low")
//TODO add test_hkdf, test_hkdf_one as for HMAC
/// Cipher block function
type block_cipher =
| AES128
| AES256
// Funky field names to avoid collisions...
noeq noextract
type block_cipher_vector = {
block: block_cipher;
rkey: hex_encoded;
plain: hex_encoded;
enc: hex_encoded;
}
noextract
let block_cipher_vectors = [
{
block = AES128;
rkey = h"2b7e151628aed2a6abf7158809cf4f3c";
plain = h"6bc1bee22e409f96e93d7e117393172a";
enc = h"3ad77bb40d7a3660a89ecaf32466ef97"
}; {
block = AES128;
rkey = h"2b7e151628aed2a6abf7158809cf4f3c";
plain = h"ae2d8a571e03ac9c9eb76fac45af8e51";
enc = h"f5d3d58503b9699de785895a96fdbaaf"
}; {
block = AES128;
rkey = h"2b7e151628aed2a6abf7158809cf4f3c";
plain = h"30c81c46a35ce411e5fbc1191a0a52ef";
enc = h"43b1cd7f598ece23881b00e3ed030688"
}; {
block = AES128;
rkey = h"2b7e151628aed2a6abf7158809cf4f3c";
plain = h"f69f2445df4f9b17ad2b417be66c3710";
enc = h"7b0c785e27e8ad3f8223207104725dd4"
}; {
block = AES256;
rkey = h"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h"6bc1bee22e409f96e93d7e117393172a";
enc = h"f3eed1bdb5d2a03c064b5a7e3db181f8"
}; {
block = AES256;
rkey = h"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h"ae2d8a571e03ac9c9eb76fac45af8e51";
enc = h"591ccb10d410ed26dc5ba74a31362870"
}; {
block = AES256;
rkey = h"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h"30c81c46a35ce411e5fbc1191a0a52ef";
enc = h"b6ed21b99ca6f4f9f153e7b1beafed1d"
}; {
block = AES256;
rkey = h"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h"f69f2445df4f9b17ad2b417be66c3710";
enc = h"23304b7a39f9f3ff067d8d8f9e24ecc7"
}]
noextract
let block_cipher_vectors_tmp = List.Tot.map (fun h ->
h.block, h.rkey, h.plain, h.enc
) block_cipher_vectors
%splice[] (lowstarize_toplevel "block_cipher_vectors_tmp" "block_cipher_vectors_low")
noeq noextract
type chacha20_vector = {
c20_key: hex_encoded;
c20_iv: hex_encoded;
c20_ctr: UInt32.t;
c20_plain: hex_encoded;
c20_cipher: hex_encoded;
}
noextract
let chacha20_vectors = [
{
c20_key = h"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f";
c20_iv = h"000000000000004a00000000";
c20_ctr = 1ul;
c20_plain = h"4c616469657320616e642047656e746c656d656e206f662074686520636c617373206f66202739393a204966204920636f756c64206f6666657220796f75206f6e6c79206f6e652074697020666f7220746865206675747572652c2073756e73637265656e20776f756c642062652069742e";
c20_cipher = h"6e2e359a2568f98041ba0728dd0d6981e97e7aec1d4360c20a27afccfd9fae0bf91b65c5524733ab8f593dabcd62b3571639d624e65152ab8f530c359f0861d807ca0dbf500d6a6156a38e088a22b65e52bc514d16ccf806818ce91ab77937365af90bbf74a35be6b40b8eedf2785e42874d";
}]
noextract
let chacha20_vectors_tmp = List.Tot.map (fun h ->
h.c20_key, h.c20_iv, h.c20_ctr, h.c20_plain, h.c20_cipher
) chacha20_vectors
%splice[] (lowstarize_toplevel "chacha20_vectors_tmp" "chacha20_vectors_low")
/// AEAD
type cipher =
| AES_128_GCM
| AES_256_GCM
| CHACHA20_POLY1305
noeq noextract
type aead_vector = {
cipher: cipher;
key: hex_encoded;
iv : hex_encoded;
aad: hex_encoded;
tag: hex_encoded;
plaintext: hex_encoded;
ciphertext: hex_encoded;
} | false | true | Test.Vectors.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val aead_vectors : Prims.list Test.Vectors.aead_vector | [] | Test.Vectors.aead_vectors | {
"file_name": "providers/test/Test.Vectors.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.list Test.Vectors.aead_vector | {
"end_col": 1,
"end_line": 567,
"start_col": 19,
"start_line": 377
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test.Lowstarize",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let hkdf_vectors_tmp = List.Tot.map (fun h ->
h.ha, h.ikm, h.salt, h.info, h.prk, h.okm
) hkdf_vectors | let hkdf_vectors_tmp = | false | null | false | List.Tot.map (fun h -> h.ha, h.ikm, h.salt, h.info, h.prk, h.okm) hkdf_vectors | {
"checked_file": "Test.Vectors.fst.checked",
"dependencies": [
"Test.Lowstarize.fst.checked",
"Spec.HMAC_DRBG.Test.Vectors.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"EverCrypt.Hash.fsti.checked"
],
"interface_file": false,
"source_file": "Test.Vectors.fst"
} | [
"total"
] | [
"FStar.List.Tot.Base.map",
"Test.Vectors.hkdf_vector",
"FStar.Pervasives.Native.tuple6",
"Test.Vectors.hash_alg",
"Test.Lowstarize.hex_encoded",
"FStar.Pervasives.Native.Mktuple6",
"Test.Vectors.__proj__Mkhkdf_vector__item__ha",
"Test.Vectors.__proj__Mkhkdf_vector__item__ikm",
"Test.Vectors.__proj__Mkhkdf_vector__item__salt",
"Test.Vectors.__proj__Mkhkdf_vector__item__info",
"Test.Vectors.__proj__Mkhkdf_vector__item__prk",
"Test.Vectors.__proj__Mkhkdf_vector__item__okm",
"Test.Vectors.hkdf_vectors"
] | [] | module Test.Vectors
open Test.Lowstarize
open EverCrypt.Hash
open Spec.Hash.Definitions
/// Hash algorithms
type hash_alg = EverCrypt.Hash.alg
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
noeq noextract
type hash_vector = {
(* The input [input] is repeated [repeat] times. *)
hash_alg: hash_alg;
input: string;
output: hex_encoded;
repeat: UInt32.t;
}
noextract
let hash_vectors = [{
hash_alg = MD5;
input = "";
output = h"d41d8cd98f00b204e9800998ecf8427e";
repeat = 1ul
}; {
hash_alg = MD5;
input = "a";
output = h"0cc175b9c0f1b6a831c399e269772661";
repeat = 1ul
}; {
hash_alg = MD5;
input = "abc";
output = h"900150983cd24fb0d6963f7d28e17f72";
repeat = 1ul
}; {
hash_alg = MD5;
input = "message digest";
output = h"f96b697d7cb7938d525a2f31aaf161d0";
repeat = 1ul
}; {
hash_alg = MD5;
input = "abcdefghijklmnopqrstuvwxyz";
output = h"c3fcd3d76192e4007dfb496cca67e13b";
repeat = 1ul
}; {
hash_alg = MD5;
input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
output = h"d174ab98d277d9f5a5611c2c9f419d9f";
repeat = 1ul
}; {
hash_alg = MD5;
input = "12345678901234567890123456789012345678901234567890123456789012345678901234567890";
output = h"57edf4a22be3c955ac49da2e2107b67a";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "abc";
output = h"a9993e364706816aba3e25717850c26c9cd0d89d";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h"84983e441c3bd26ebaae4aa1f95129e5e54670f1";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "a";
output = h"34aa973cd4c4daa4f61eeb2bdbad27316534016f";
repeat = 1000000ul
}; {
hash_alg = SHA1;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"dea356a2cddd90c7a7ecedc5ebb563934f460452";
repeat = 10ul
}; {
hash_alg = SHA2_256;
input = "abc";
output = h"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad";
repeat = 1ul
}; {
hash_alg = SHA2_256;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h"248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1";
repeat = 1ul
}; {
hash_alg = SHA2_256;
input = "a";
output = h"cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0";
repeat = 1000000ul
}; {
hash_alg = SHA2_256;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"594847328451bdfa85056225462cc1d867d877fb388df0ce35f25ab5562bfbb5";
repeat = 10ul
}; {
hash_alg = SHA2_256;
input = "\x19";
output = h"68aa2e2ee5dff96e3355e6c7ee373e3d6a4e17f75f9518d843709c0c9bc3e3d4";
repeat = 1ul
};(* {
hash_alg = SHA2_256;
// 2018.05.26: Don't know how to encode byte literals in strings; this doesn't work
// as in OCaml
input = "\xe3\xd7\x25\x70\xdc\xdd\x78\x7c\xe3\x88\x7a\xb2\xcd\x68\x46\x52";
output = h"175ee69b02ba9b58e2b0a5fd13819cea573f3940a94f825128cf4209beabb4e8";
repeat = 1ul
}; *){
hash_alg = SHA2_384;
input = "abc";
output = h"cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7";
repeat = 1ul
}; {
hash_alg = SHA2_384;
input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output = h"09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039";
repeat = 1ul
}; {
hash_alg = SHA2_384;
input = "a";
output = h"9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985";
repeat = 1000000ul
}; {
hash_alg = SHA2_384;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"2fc64a4f500ddb6828f6a3430b8dd72a368eb7f3a8322a70bc84275b9c0b3ab00d27a5cc3c2d224aa6b61a0d79fb4596";
repeat = 10ul
}; {
hash_alg = SHA2_512;
input = "abc";
output = h"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f";
repeat = 1ul
}; {
hash_alg = SHA2_512;
input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output = h"8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909";
repeat = 1ul
}; {
hash_alg = SHA2_512;
input = "a";
output = h"e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b";
repeat = 1000000ul
}; {
hash_alg = SHA2_512;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"89d05ba632c699c31231ded4ffc127d5a894dad412c0e024db872d1abd2ba8141a0f85072a9be1e2aa04cf33c765cb510813a39cd5a84c4acaa64d3f3fb7bae9";
repeat = 10ul
}
]
noextract
let hash_vectors_tmp = List.Tot.map (fun h ->
h.hash_alg, h.input, h.output, h.repeat
) hash_vectors
// 2018.08.06 SZ: I can't verify this in interactive mode but verifies from the command-line
%splice[] (lowstarize_toplevel "hash_vectors_tmp" "hash_vectors_low")
/// HMAC
noeq noextract
type hmac_vector = {
ha: hash_alg;
key: hex_encoded;
data: hex_encoded;
output: hex_encoded;
}
// selected test vectors from
// https://tools.ietf.org/html/rfc4231#section-4.2
// pls extend me!
noextract
let hmac_vectors = [{
ha = SHA2_256;
key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
data = h"4869205468657265";
output = h"b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7";
}; {
ha = SHA2_384;
key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
data = h"4869205468657265";
output = h"afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6";
}]
noextract
let hmac_vectors_tmp = List.Tot.map (fun h ->
h.ha, h.key, h.data, h.output
) hmac_vectors
%splice[] (lowstarize_toplevel "hmac_vectors_tmp" "hmac_vectors_low")
/// HMAC_DRBG
noextract
let hmac_drbg_vectors_tmp =
let open Spec.HMAC_DRBG.Test.Vectors in
List.Tot.map
(fun x -> x.a, h x.entropy_input, h x.nonce, h x.personalization_string,
h x.entropy_input_reseed, h x.additional_input_reseed,
(h x.additional_input_1, h x.additional_input_2),
h x.returned_bits)
test_vectors
%splice[] (lowstarize_toplevel "hmac_drbg_vectors_tmp" "hmac_drbg_vectors_low")
/// HKDF
/// https://tools.ietf.org/html/rfc5869.html
/// pls extend me! We miss SHA2_384 and SHA2_512 tests
///
/// The test is in 2 steps:
/// prk <- extract sal ikm
/// okm <- expand prk info okmlen
noeq noextract
type hkdf_vector = {
ha: hash_alg;
ikm: hex_encoded; // input key materials
salt: hex_encoded; // input salt
info: hex_encoded; // expansion label
prk: hex_encoded; // extracted pseudo-random key (its length is Spec.Hash.Definitions.hash_len ha)
okm: hex_encoded; // output: expanded key materials (its length is an input)
}
noextract
let hkdf_vectors = [{
// Test Case 1
// Basic test case with SHA-256
ha = SHA2_256;
ikm = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";// (22 octets)
salt = h"000102030405060708090a0b0c";// (13 octets)
info = h"f0f1f2f3f4f5f6f7f8f9";// (10 octets)
prk = h"077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5";// (32 octets)
okm = h"3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865";// (42 octets)
}; {
// Test Case 2
// Test with SHA-256 and longer inputs/outputs
ha = SHA2_256;
ikm = h"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f";// (80 octets)
salt = h"606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf";// (80 octets)
info = h"b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff";// (80 octets)
prk = h"06a6b88c5853361a06104c9ceb35b45cef760014904671014a193f40c15fc244";// (32 octets)
okm = h"b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87";// (82 octets)
}; {
// Test Case 3
// Test with SHA-256 and zero-length salt/info
ha = SHA2_256;
ikm = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";// (22 octets)
salt = h"";
info = h"";
prk = h"19ef24a32c717b167f33a91d6f648bdf96596776afdb6377ac434c1c293ccb04";// (32 octets)
okm = h"8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d9d201395faa4b61a96c8";// (42 octets)
}] | false | true | Test.Vectors.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val hkdf_vectors_tmp : Prims.list (((((Test.Vectors.hash_alg * Test.Lowstarize.hex_encoded) * Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) | [] | Test.Vectors.hkdf_vectors_tmp | {
"file_name": "providers/test/Test.Vectors.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.list (((((Test.Vectors.hash_alg * Test.Lowstarize.hex_encoded) * Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) | {
"end_col": 14,
"end_line": 259,
"start_col": 23,
"start_line": 257
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test.Lowstarize",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let hkdf_vectors = [{
// Test Case 1
// Basic test case with SHA-256
ha = SHA2_256;
ikm = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";// (22 octets)
salt = h"000102030405060708090a0b0c";// (13 octets)
info = h"f0f1f2f3f4f5f6f7f8f9";// (10 octets)
prk = h"077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5";// (32 octets)
okm = h"3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865";// (42 octets)
}; {
// Test Case 2
// Test with SHA-256 and longer inputs/outputs
ha = SHA2_256;
ikm = h"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f";// (80 octets)
salt = h"606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf";// (80 octets)
info = h"b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff";// (80 octets)
prk = h"06a6b88c5853361a06104c9ceb35b45cef760014904671014a193f40c15fc244";// (32 octets)
okm = h"b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87";// (82 octets)
}; {
// Test Case 3
// Test with SHA-256 and zero-length salt/info
ha = SHA2_256;
ikm = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";// (22 octets)
salt = h"";
info = h"";
prk = h"19ef24a32c717b167f33a91d6f648bdf96596776afdb6377ac434c1c293ccb04";// (32 octets)
okm = h"8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d9d201395faa4b61a96c8";// (42 octets)
}] | let hkdf_vectors = | false | null | false | [
{
ha = SHA2_256;
ikm = h "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
salt = h "000102030405060708090a0b0c";
info = h "f0f1f2f3f4f5f6f7f8f9";
prk = h "077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5";
okm = h "3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865"
};
{
ha = SHA2_256;
ikm
=
h "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f"
;
salt
=
h "606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf"
;
info
=
h "b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"
;
prk = h "06a6b88c5853361a06104c9ceb35b45cef760014904671014a193f40c15fc244";
okm
=
h "b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87"
};
{
ha = SHA2_256;
ikm = h "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
salt = h "";
info = h "";
prk = h "19ef24a32c717b167f33a91d6f648bdf96596776afdb6377ac434c1c293ccb04";
okm = h "8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d9d201395faa4b61a96c8"
}
] | {
"checked_file": "Test.Vectors.fst.checked",
"dependencies": [
"Test.Lowstarize.fst.checked",
"Spec.HMAC_DRBG.Test.Vectors.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"EverCrypt.Hash.fsti.checked"
],
"interface_file": false,
"source_file": "Test.Vectors.fst"
} | [
"total"
] | [
"Prims.Cons",
"Test.Vectors.hkdf_vector",
"Test.Vectors.Mkhkdf_vector",
"Spec.Hash.Definitions.SHA2_256",
"Test.Lowstarize.h",
"Prims.Nil"
] | [] | module Test.Vectors
open Test.Lowstarize
open EverCrypt.Hash
open Spec.Hash.Definitions
/// Hash algorithms
type hash_alg = EverCrypt.Hash.alg
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
noeq noextract
type hash_vector = {
(* The input [input] is repeated [repeat] times. *)
hash_alg: hash_alg;
input: string;
output: hex_encoded;
repeat: UInt32.t;
}
noextract
let hash_vectors = [{
hash_alg = MD5;
input = "";
output = h"d41d8cd98f00b204e9800998ecf8427e";
repeat = 1ul
}; {
hash_alg = MD5;
input = "a";
output = h"0cc175b9c0f1b6a831c399e269772661";
repeat = 1ul
}; {
hash_alg = MD5;
input = "abc";
output = h"900150983cd24fb0d6963f7d28e17f72";
repeat = 1ul
}; {
hash_alg = MD5;
input = "message digest";
output = h"f96b697d7cb7938d525a2f31aaf161d0";
repeat = 1ul
}; {
hash_alg = MD5;
input = "abcdefghijklmnopqrstuvwxyz";
output = h"c3fcd3d76192e4007dfb496cca67e13b";
repeat = 1ul
}; {
hash_alg = MD5;
input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
output = h"d174ab98d277d9f5a5611c2c9f419d9f";
repeat = 1ul
}; {
hash_alg = MD5;
input = "12345678901234567890123456789012345678901234567890123456789012345678901234567890";
output = h"57edf4a22be3c955ac49da2e2107b67a";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "abc";
output = h"a9993e364706816aba3e25717850c26c9cd0d89d";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h"84983e441c3bd26ebaae4aa1f95129e5e54670f1";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "a";
output = h"34aa973cd4c4daa4f61eeb2bdbad27316534016f";
repeat = 1000000ul
}; {
hash_alg = SHA1;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"dea356a2cddd90c7a7ecedc5ebb563934f460452";
repeat = 10ul
}; {
hash_alg = SHA2_256;
input = "abc";
output = h"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad";
repeat = 1ul
}; {
hash_alg = SHA2_256;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h"248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1";
repeat = 1ul
}; {
hash_alg = SHA2_256;
input = "a";
output = h"cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0";
repeat = 1000000ul
}; {
hash_alg = SHA2_256;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"594847328451bdfa85056225462cc1d867d877fb388df0ce35f25ab5562bfbb5";
repeat = 10ul
}; {
hash_alg = SHA2_256;
input = "\x19";
output = h"68aa2e2ee5dff96e3355e6c7ee373e3d6a4e17f75f9518d843709c0c9bc3e3d4";
repeat = 1ul
};(* {
hash_alg = SHA2_256;
// 2018.05.26: Don't know how to encode byte literals in strings; this doesn't work
// as in OCaml
input = "\xe3\xd7\x25\x70\xdc\xdd\x78\x7c\xe3\x88\x7a\xb2\xcd\x68\x46\x52";
output = h"175ee69b02ba9b58e2b0a5fd13819cea573f3940a94f825128cf4209beabb4e8";
repeat = 1ul
}; *){
hash_alg = SHA2_384;
input = "abc";
output = h"cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7";
repeat = 1ul
}; {
hash_alg = SHA2_384;
input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output = h"09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039";
repeat = 1ul
}; {
hash_alg = SHA2_384;
input = "a";
output = h"9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985";
repeat = 1000000ul
}; {
hash_alg = SHA2_384;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"2fc64a4f500ddb6828f6a3430b8dd72a368eb7f3a8322a70bc84275b9c0b3ab00d27a5cc3c2d224aa6b61a0d79fb4596";
repeat = 10ul
}; {
hash_alg = SHA2_512;
input = "abc";
output = h"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f";
repeat = 1ul
}; {
hash_alg = SHA2_512;
input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output = h"8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909";
repeat = 1ul
}; {
hash_alg = SHA2_512;
input = "a";
output = h"e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b";
repeat = 1000000ul
}; {
hash_alg = SHA2_512;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"89d05ba632c699c31231ded4ffc127d5a894dad412c0e024db872d1abd2ba8141a0f85072a9be1e2aa04cf33c765cb510813a39cd5a84c4acaa64d3f3fb7bae9";
repeat = 10ul
}
]
noextract
let hash_vectors_tmp = List.Tot.map (fun h ->
h.hash_alg, h.input, h.output, h.repeat
) hash_vectors
// 2018.08.06 SZ: I can't verify this in interactive mode but verifies from the command-line
%splice[] (lowstarize_toplevel "hash_vectors_tmp" "hash_vectors_low")
/// HMAC
noeq noextract
type hmac_vector = {
ha: hash_alg;
key: hex_encoded;
data: hex_encoded;
output: hex_encoded;
}
// selected test vectors from
// https://tools.ietf.org/html/rfc4231#section-4.2
// pls extend me!
noextract
let hmac_vectors = [{
ha = SHA2_256;
key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
data = h"4869205468657265";
output = h"b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7";
}; {
ha = SHA2_384;
key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
data = h"4869205468657265";
output = h"afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6";
}]
noextract
let hmac_vectors_tmp = List.Tot.map (fun h ->
h.ha, h.key, h.data, h.output
) hmac_vectors
%splice[] (lowstarize_toplevel "hmac_vectors_tmp" "hmac_vectors_low")
/// HMAC_DRBG
noextract
let hmac_drbg_vectors_tmp =
let open Spec.HMAC_DRBG.Test.Vectors in
List.Tot.map
(fun x -> x.a, h x.entropy_input, h x.nonce, h x.personalization_string,
h x.entropy_input_reseed, h x.additional_input_reseed,
(h x.additional_input_1, h x.additional_input_2),
h x.returned_bits)
test_vectors
%splice[] (lowstarize_toplevel "hmac_drbg_vectors_tmp" "hmac_drbg_vectors_low")
/// HKDF
/// https://tools.ietf.org/html/rfc5869.html
/// pls extend me! We miss SHA2_384 and SHA2_512 tests
///
/// The test is in 2 steps:
/// prk <- extract sal ikm
/// okm <- expand prk info okmlen
noeq noextract
type hkdf_vector = {
ha: hash_alg;
ikm: hex_encoded; // input key materials
salt: hex_encoded; // input salt
info: hex_encoded; // expansion label
prk: hex_encoded; // extracted pseudo-random key (its length is Spec.Hash.Definitions.hash_len ha)
okm: hex_encoded; // output: expanded key materials (its length is an input)
} | false | true | Test.Vectors.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val hkdf_vectors : Prims.list Test.Vectors.hkdf_vector | [] | Test.Vectors.hkdf_vectors | {
"file_name": "providers/test/Test.Vectors.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.list Test.Vectors.hkdf_vector | {
"end_col": 4,
"end_line": 254,
"start_col": 19,
"start_line": 227
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverCrypt.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test.Lowstarize",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let aead_vectors_tmp = List.Tot.map (fun h ->
h.cipher, h.key, h.iv, h.aad, h.tag, h.plaintext, h.ciphertext
) aead_vectors | let aead_vectors_tmp = | false | null | false | List.Tot.map (fun h -> h.cipher, h.key, h.iv, h.aad, h.tag, h.plaintext, h.ciphertext) aead_vectors | {
"checked_file": "Test.Vectors.fst.checked",
"dependencies": [
"Test.Lowstarize.fst.checked",
"Spec.HMAC_DRBG.Test.Vectors.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"EverCrypt.Hash.fsti.checked"
],
"interface_file": false,
"source_file": "Test.Vectors.fst"
} | [
"total"
] | [
"FStar.List.Tot.Base.map",
"Test.Vectors.aead_vector",
"FStar.Pervasives.Native.tuple7",
"Test.Vectors.cipher",
"Test.Lowstarize.hex_encoded",
"FStar.Pervasives.Native.Mktuple7",
"Test.Vectors.__proj__Mkaead_vector__item__cipher",
"Test.Vectors.__proj__Mkaead_vector__item__key",
"Test.Vectors.__proj__Mkaead_vector__item__iv",
"Test.Vectors.__proj__Mkaead_vector__item__aad",
"Test.Vectors.__proj__Mkaead_vector__item__tag",
"Test.Vectors.__proj__Mkaead_vector__item__plaintext",
"Test.Vectors.__proj__Mkaead_vector__item__ciphertext",
"Test.Vectors.aead_vectors"
] | [] | module Test.Vectors
open Test.Lowstarize
open EverCrypt.Hash
open Spec.Hash.Definitions
/// Hash algorithms
type hash_alg = EverCrypt.Hash.alg
#reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
noeq noextract
type hash_vector = {
(* The input [input] is repeated [repeat] times. *)
hash_alg: hash_alg;
input: string;
output: hex_encoded;
repeat: UInt32.t;
}
noextract
let hash_vectors = [{
hash_alg = MD5;
input = "";
output = h"d41d8cd98f00b204e9800998ecf8427e";
repeat = 1ul
}; {
hash_alg = MD5;
input = "a";
output = h"0cc175b9c0f1b6a831c399e269772661";
repeat = 1ul
}; {
hash_alg = MD5;
input = "abc";
output = h"900150983cd24fb0d6963f7d28e17f72";
repeat = 1ul
}; {
hash_alg = MD5;
input = "message digest";
output = h"f96b697d7cb7938d525a2f31aaf161d0";
repeat = 1ul
}; {
hash_alg = MD5;
input = "abcdefghijklmnopqrstuvwxyz";
output = h"c3fcd3d76192e4007dfb496cca67e13b";
repeat = 1ul
}; {
hash_alg = MD5;
input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
output = h"d174ab98d277d9f5a5611c2c9f419d9f";
repeat = 1ul
}; {
hash_alg = MD5;
input = "12345678901234567890123456789012345678901234567890123456789012345678901234567890";
output = h"57edf4a22be3c955ac49da2e2107b67a";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "abc";
output = h"a9993e364706816aba3e25717850c26c9cd0d89d";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h"84983e441c3bd26ebaae4aa1f95129e5e54670f1";
repeat = 1ul
}; {
hash_alg = SHA1;
input = "a";
output = h"34aa973cd4c4daa4f61eeb2bdbad27316534016f";
repeat = 1000000ul
}; {
hash_alg = SHA1;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"dea356a2cddd90c7a7ecedc5ebb563934f460452";
repeat = 10ul
}; {
hash_alg = SHA2_256;
input = "abc";
output = h"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad";
repeat = 1ul
}; {
hash_alg = SHA2_256;
input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
output = h"248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1";
repeat = 1ul
}; {
hash_alg = SHA2_256;
input = "a";
output = h"cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0";
repeat = 1000000ul
}; {
hash_alg = SHA2_256;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"594847328451bdfa85056225462cc1d867d877fb388df0ce35f25ab5562bfbb5";
repeat = 10ul
}; {
hash_alg = SHA2_256;
input = "\x19";
output = h"68aa2e2ee5dff96e3355e6c7ee373e3d6a4e17f75f9518d843709c0c9bc3e3d4";
repeat = 1ul
};(* {
hash_alg = SHA2_256;
// 2018.05.26: Don't know how to encode byte literals in strings; this doesn't work
// as in OCaml
input = "\xe3\xd7\x25\x70\xdc\xdd\x78\x7c\xe3\x88\x7a\xb2\xcd\x68\x46\x52";
output = h"175ee69b02ba9b58e2b0a5fd13819cea573f3940a94f825128cf4209beabb4e8";
repeat = 1ul
}; *){
hash_alg = SHA2_384;
input = "abc";
output = h"cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7";
repeat = 1ul
}; {
hash_alg = SHA2_384;
input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output = h"09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039";
repeat = 1ul
}; {
hash_alg = SHA2_384;
input = "a";
output = h"9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985";
repeat = 1000000ul
}; {
hash_alg = SHA2_384;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"2fc64a4f500ddb6828f6a3430b8dd72a368eb7f3a8322a70bc84275b9c0b3ab00d27a5cc3c2d224aa6b61a0d79fb4596";
repeat = 10ul
}; {
hash_alg = SHA2_512;
input = "abc";
output = h"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f";
repeat = 1ul
}; {
hash_alg = SHA2_512;
input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
output = h"8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909";
repeat = 1ul
}; {
hash_alg = SHA2_512;
input = "a";
output = h"e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b";
repeat = 1000000ul
}; {
hash_alg = SHA2_512;
input = "0123456701234567012345670123456701234567012345670123456701234567";
output = h"89d05ba632c699c31231ded4ffc127d5a894dad412c0e024db872d1abd2ba8141a0f85072a9be1e2aa04cf33c765cb510813a39cd5a84c4acaa64d3f3fb7bae9";
repeat = 10ul
}
]
noextract
let hash_vectors_tmp = List.Tot.map (fun h ->
h.hash_alg, h.input, h.output, h.repeat
) hash_vectors
// 2018.08.06 SZ: I can't verify this in interactive mode but verifies from the command-line
%splice[] (lowstarize_toplevel "hash_vectors_tmp" "hash_vectors_low")
/// HMAC
noeq noextract
type hmac_vector = {
ha: hash_alg;
key: hex_encoded;
data: hex_encoded;
output: hex_encoded;
}
// selected test vectors from
// https://tools.ietf.org/html/rfc4231#section-4.2
// pls extend me!
noextract
let hmac_vectors = [{
ha = SHA2_256;
key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
data = h"4869205468657265";
output = h"b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7";
}; {
ha = SHA2_384;
key = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
data = h"4869205468657265";
output = h"afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6";
}]
noextract
let hmac_vectors_tmp = List.Tot.map (fun h ->
h.ha, h.key, h.data, h.output
) hmac_vectors
%splice[] (lowstarize_toplevel "hmac_vectors_tmp" "hmac_vectors_low")
/// HMAC_DRBG
noextract
let hmac_drbg_vectors_tmp =
let open Spec.HMAC_DRBG.Test.Vectors in
List.Tot.map
(fun x -> x.a, h x.entropy_input, h x.nonce, h x.personalization_string,
h x.entropy_input_reseed, h x.additional_input_reseed,
(h x.additional_input_1, h x.additional_input_2),
h x.returned_bits)
test_vectors
%splice[] (lowstarize_toplevel "hmac_drbg_vectors_tmp" "hmac_drbg_vectors_low")
/// HKDF
/// https://tools.ietf.org/html/rfc5869.html
/// pls extend me! We miss SHA2_384 and SHA2_512 tests
///
/// The test is in 2 steps:
/// prk <- extract sal ikm
/// okm <- expand prk info okmlen
noeq noextract
type hkdf_vector = {
ha: hash_alg;
ikm: hex_encoded; // input key materials
salt: hex_encoded; // input salt
info: hex_encoded; // expansion label
prk: hex_encoded; // extracted pseudo-random key (its length is Spec.Hash.Definitions.hash_len ha)
okm: hex_encoded; // output: expanded key materials (its length is an input)
}
noextract
let hkdf_vectors = [{
// Test Case 1
// Basic test case with SHA-256
ha = SHA2_256;
ikm = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";// (22 octets)
salt = h"000102030405060708090a0b0c";// (13 octets)
info = h"f0f1f2f3f4f5f6f7f8f9";// (10 octets)
prk = h"077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5";// (32 octets)
okm = h"3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865";// (42 octets)
}; {
// Test Case 2
// Test with SHA-256 and longer inputs/outputs
ha = SHA2_256;
ikm = h"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f";// (80 octets)
salt = h"606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf";// (80 octets)
info = h"b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff";// (80 octets)
prk = h"06a6b88c5853361a06104c9ceb35b45cef760014904671014a193f40c15fc244";// (32 octets)
okm = h"b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87";// (82 octets)
}; {
// Test Case 3
// Test with SHA-256 and zero-length salt/info
ha = SHA2_256;
ikm = h"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";// (22 octets)
salt = h"";
info = h"";
prk = h"19ef24a32c717b167f33a91d6f648bdf96596776afdb6377ac434c1c293ccb04";// (32 octets)
okm = h"8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d9d201395faa4b61a96c8";// (42 octets)
}]
noextract
let hkdf_vectors_tmp = List.Tot.map (fun h ->
h.ha, h.ikm, h.salt, h.info, h.prk, h.okm
) hkdf_vectors
%splice[] (lowstarize_toplevel "hkdf_vectors_tmp" "hkdf_vectors_low")
//TODO add test_hkdf, test_hkdf_one as for HMAC
/// Cipher block function
type block_cipher =
| AES128
| AES256
// Funky field names to avoid collisions...
noeq noextract
type block_cipher_vector = {
block: block_cipher;
rkey: hex_encoded;
plain: hex_encoded;
enc: hex_encoded;
}
noextract
let block_cipher_vectors = [
{
block = AES128;
rkey = h"2b7e151628aed2a6abf7158809cf4f3c";
plain = h"6bc1bee22e409f96e93d7e117393172a";
enc = h"3ad77bb40d7a3660a89ecaf32466ef97"
}; {
block = AES128;
rkey = h"2b7e151628aed2a6abf7158809cf4f3c";
plain = h"ae2d8a571e03ac9c9eb76fac45af8e51";
enc = h"f5d3d58503b9699de785895a96fdbaaf"
}; {
block = AES128;
rkey = h"2b7e151628aed2a6abf7158809cf4f3c";
plain = h"30c81c46a35ce411e5fbc1191a0a52ef";
enc = h"43b1cd7f598ece23881b00e3ed030688"
}; {
block = AES128;
rkey = h"2b7e151628aed2a6abf7158809cf4f3c";
plain = h"f69f2445df4f9b17ad2b417be66c3710";
enc = h"7b0c785e27e8ad3f8223207104725dd4"
}; {
block = AES256;
rkey = h"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h"6bc1bee22e409f96e93d7e117393172a";
enc = h"f3eed1bdb5d2a03c064b5a7e3db181f8"
}; {
block = AES256;
rkey = h"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h"ae2d8a571e03ac9c9eb76fac45af8e51";
enc = h"591ccb10d410ed26dc5ba74a31362870"
}; {
block = AES256;
rkey = h"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h"30c81c46a35ce411e5fbc1191a0a52ef";
enc = h"b6ed21b99ca6f4f9f153e7b1beafed1d"
}; {
block = AES256;
rkey = h"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
plain = h"f69f2445df4f9b17ad2b417be66c3710";
enc = h"23304b7a39f9f3ff067d8d8f9e24ecc7"
}]
noextract
let block_cipher_vectors_tmp = List.Tot.map (fun h ->
h.block, h.rkey, h.plain, h.enc
) block_cipher_vectors
%splice[] (lowstarize_toplevel "block_cipher_vectors_tmp" "block_cipher_vectors_low")
noeq noextract
type chacha20_vector = {
c20_key: hex_encoded;
c20_iv: hex_encoded;
c20_ctr: UInt32.t;
c20_plain: hex_encoded;
c20_cipher: hex_encoded;
}
noextract
let chacha20_vectors = [
{
c20_key = h"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f";
c20_iv = h"000000000000004a00000000";
c20_ctr = 1ul;
c20_plain = h"4c616469657320616e642047656e746c656d656e206f662074686520636c617373206f66202739393a204966204920636f756c64206f6666657220796f75206f6e6c79206f6e652074697020666f7220746865206675747572652c2073756e73637265656e20776f756c642062652069742e";
c20_cipher = h"6e2e359a2568f98041ba0728dd0d6981e97e7aec1d4360c20a27afccfd9fae0bf91b65c5524733ab8f593dabcd62b3571639d624e65152ab8f530c359f0861d807ca0dbf500d6a6156a38e088a22b65e52bc514d16ccf806818ce91ab77937365af90bbf74a35be6b40b8eedf2785e42874d";
}]
noextract
let chacha20_vectors_tmp = List.Tot.map (fun h ->
h.c20_key, h.c20_iv, h.c20_ctr, h.c20_plain, h.c20_cipher
) chacha20_vectors
%splice[] (lowstarize_toplevel "chacha20_vectors_tmp" "chacha20_vectors_low")
/// AEAD
type cipher =
| AES_128_GCM
| AES_256_GCM
| CHACHA20_POLY1305
noeq noextract
type aead_vector = {
cipher: cipher;
key: hex_encoded;
iv : hex_encoded;
aad: hex_encoded;
tag: hex_encoded;
plaintext: hex_encoded;
ciphertext: hex_encoded;
}
noextract
let aead_vectors = [
{ (* rfc7539#page-22 *)
cipher = CHACHA20_POLY1305;
key = h"808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f";
iv = h"070000004041424344454647";
aad = h"50515253c0c1c2c3c4c5c6c7";
tag = h"1ae10b594f09e26a7e902ecbd0600691";
plaintext = h"4c616469657320616e642047656e746c656d656e206f662074686520636c617373206f66202739393a204966204920636f756c64206f6666657220796f75206f6e6c79206f6e652074697020666f7220746865206675747572652c2073756e73637265656e20776f756c642062652069742e";
ciphertext = h"d31a8d34648e60db7b86afbc53ef7ec2a4aded51296e08fea9e2b5a736ee62d63dbea45e8ca9671282fafb69da92728b1a71de0a9e060b2905d6a5b67ecd3b3692ddbd7f2d778b8c9803aee328091b58fab324e4fad675945585808b4831d7bc3ff4def08e4b7a9de576d26586cec64b6116";
};
{
cipher = CHACHA20_POLY1305;
key = h"1c9240a5eb55d38af333888604f6b5f0473917c1402b80099dca5cbc207075c0";
iv = h"000000000102030405060708";
aad = h"f33388860000000000004e91";
tag = h"eead9d67890cbb22392336fea1851f38";
plaintext = h"496e7465726e65742d4472616674732061726520647261667420646f63756d656e74732076616c696420666f722061206d6178696d756d206f6620736978206d6f6e74687320616e64206d617920626520757064617465642c207265706c616365642c206f72206f62736f6c65746564206279206f7468657220646f63756d656e747320617420616e792074696d652e20497420697320696e617070726f70726961746520746f2075736520496e7465726e65742d447261667473206173207265666572656e6365206d6174657269616c206f7220746f2063697465207468656d206f74686572207468616e206173202fe2809c776f726b20696e2070726f67726573732e2fe2809d";
ciphertext = h"64a0861575861af460f062c79be643bd5e805cfd345cf389f108670ac76c8cb24c6cfc18755d43eea09ee94e382d26b0bdb7b73c321b0100d4f03b7f355894cf332f830e710b97ce98c8a84abd0b948114ad176e008d33bd60f982b1ff37c8559797a06ef4f0ef61c186324e2b3506383606907b6a7c02b0f9f6157b53c867e4b9166c767b804d46a59b5216cde7a4e99040c5a40433225ee282a1b0a06c523eaf4534d7f83fa1155b0047718cbc546a0d072b04b3564eea1b422273f548271a0bb2316053fa76991955ebd63159434ecebb4e466dae5a1073a6727627097a1049e617d91d361094fa68f0ff77987130305beaba2eda04df997b714d6c6f2c29a6ad5cb4022b02709b";
};
{
cipher = AES_128_GCM;
key = h"00000000000000000000000000000000";
iv = h"000000000000000000000000";
aad = h"";
tag = h"58e2fccefa7e3061367f1d57a4e7455a";
plaintext = h"";
ciphertext = h"";
};
{
cipher = AES_128_GCM;
key = h"00000000000000000000000000000000";
iv = h"000000000000000000000000";
aad = h"";
tag = h"ab6e47d42cec13bdf53a67b21257bddf";
plaintext = h"00000000000000000000000000000000";
ciphertext = h"0388dace60b6a392f328c2b971b2fe78";
};
{
cipher = AES_128_GCM;
key = h"feffe9928665731c6d6a8f9467308308";
iv = h"cafebabefacedbaddecaf888";
aad = h"";
tag = h"4d5c2af327cd64a62cf35abd2ba6fab4";
plaintext = h"d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b391aafd255";
ciphertext = h"42831ec2217774244b7221b784d0d49ce3aa212f2c02a4e035c17e2329aca12e21d514b25466931c7d8f6a5aac84aa051ba30b396a0aac973d58e091473f5985";
};
{
cipher = AES_128_GCM;
key = h"feffe9928665731c6d6a8f9467308308";
iv = h"cafebabefacedbaddecaf888";
aad = h"feedfacedeadbeeffeedfacedeadbeefabaddad2";
tag = h"5bc94fbc3221a5db94fae95ae7121a47";
plaintext = h"d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39";
ciphertext = h"42831ec2217774244b7221b784d0d49ce3aa212f2c02a4e035c17e2329aca12e21d514b25466931c7d8f6a5aac84aa051ba30b396a0aac973d58e091";
};
{
cipher = AES_128_GCM;
key = h"feffe9928665731c6d6a8f9467308308";
iv = h"cafebabefacedbad";
aad = h"feedfacedeadbeeffeedfacedeadbeefabaddad2";
tag = h"3612d2e79e3b0785561be14aaca2fccb";
plaintext = h"d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39";
ciphertext = h"61353b4c2806934a777ff51fa22a4755699b2a714fcdc6f83766e5f97b6c742373806900e49f24b22b097544d4896b424989b5e1ebac0f07c23f4598";
};
{
cipher = AES_128_GCM;
key = h"feffe9928665731c6d6a8f9467308308";
iv = h"9313225df88406e555909c5aff5269aa6a7a9538534f7da1e4c303d2a318a728c3c0c95156809539fcf0e2429a6b525416aedbf5a0de6a57a637b39b";
aad = h"feedfacedeadbeeffeedfacedeadbeefabaddad2";
tag = h"619cc5aefffe0bfa462af43c1699d050";
plaintext = h"d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39";
ciphertext = h"8ce24998625615b603a033aca13fb894be9112a5c3a211a8ba262a3cca7e2ca701e4a9a4fba43c90ccdcb281d48c7c6fd62875d2aca417034c34aee5";
};
{
cipher = AES_256_GCM;
key = h"0000000000000000000000000000000000000000000000000000000000000000";
iv = h"000000000000000000000000";
aad = h"";
tag = h"530f8afbc74536b9a963b4f1c4cb738b";
plaintext = h"";
ciphertext = h"";
};
{
cipher = AES_256_GCM;
key = h"feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308";
iv = h"cafebabefacedbaddecaf888";
aad = h"";
tag = h"b094dac5d93471bdec1a502270e3cc6c";
plaintext = h"d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b391aafd255";
ciphertext = h"522dc1f099567d07f47f37a32a84427d643a8cdcbfe5c0c97598a2bd2555d1aa8cb08e48590dbb3da7b08b1056828838c5f61e6393ba7a0abcc9f662898015ad";
};
{
cipher = AES_256_GCM;
key = h"feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308";
iv = h"cafebabefacedbaddecaf888";
aad = h"";
tag = h"b094dac5d93471bdec1a502270e3cc6c";
plaintext = h"d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b391aafd255";
ciphertext = h"522dc1f099567d07f47f37a32a84427d643a8cdcbfe5c0c97598a2bd2555d1aa8cb08e48590dbb3da7b08b1056828838c5f61e6393ba7a0abcc9f662898015ad";
};
{
cipher = AES_256_GCM;
key = h"feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308";
iv = h"cafebabefacedbaddecaf888";
aad = h"feedfacedeadbeeffeedfacedeadbeefabaddad2";
tag = h"76fc6ece0f4e1768cddf8853bb2d551b";
plaintext = h"d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39";
ciphertext = h"522dc1f099567d07f47f37a32a84427d643a8cdcbfe5c0c97598a2bd2555d1aa8cb08e48590dbb3da7b08b1056828838c5f61e6393ba7a0abcc9f662";
};
{
cipher = AES_256_GCM;
key = h"feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308";
iv = h"cafebabefacedbad";
aad = h"feedfacedeadbeeffeedfacedeadbeefabaddad2";
tag = h"3a337dbf46a792c45e454913fe2ea8f2";
plaintext = h"d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39";
ciphertext = h"c3762df1ca787d32ae47c13bf19844cbaf1ae14d0b976afac52ff7d79bba9de0feb582d33934a4f0954cc2363bc73f7862ac430e64abe499f47c9b1f";
};
{
cipher = AES_256_GCM;
key = h"feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308";
iv = h"9313225df88406e555909c5aff5269aa6a7a9538534f7da1e4c303d2a318a728c3c0c95156809539fcf0e2429a6b525416aedbf5a0de6a57a637b39b";
aad = h"feedfacedeadbeeffeedfacedeadbeefabaddad2";
tag = h"a44a8266ee1c8eb0c8b5d4cf5ae9f19a";
plaintext = h"d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39";
ciphertext = h"5a8def2f0c9e53f1f75d7853659e2a20eeb2b22aafde6419a058ab4f6f746bf40fc0c3b780f244452da3ebf1c5d82cdea2418997200ef82e44ae7e3f";
};
{
cipher = AES_128_GCM;
key = h"00000000000000000000000000000000";
iv = h"000000000000000000000000";
aad = h"d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b391aafd255522dc1f099567d07f47f37a32a84427d643a8cdcbfe5c0c97598a2bd2555d1aa8cb08e48590dbb3da7b08b1056828838c5f61e6393ba7a0abcc9f662898015ad";
tag = h"5fea793a2d6f974d37e68e0cb8ff9492";
plaintext = h"";
ciphertext = h"";
};
{
cipher = AES_128_GCM;
key = h"00000000000000000000000000000000";
iv = h"000000000000000000000000";
aad = h"";
tag = h"9dd0a376b08e40eb00c35f29f9ea61a4";
plaintext = h"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
ciphertext = h"0388dace60b6a392f328c2b971b2fe78f795aaab494b5923f7fd89ff948bc1e0200211214e7394da2089b6acd093abe0";
};
{
cipher = AES_128_GCM;
key = h"00000000000000000000000000000000";
iv = h"000000000000000000000000";
aad = h"";
tag = h"98885a3a22bd4742fe7b72172193b163";
plaintext = h"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
ciphertext = h"0388dace60b6a392f328c2b971b2fe78f795aaab494b5923f7fd89ff948bc1e0200211214e7394da2089b6acd093abe0c94da219118e297d7b7ebcbcc9c388f28ade7d85a8ee35616f7124a9d5270291";
};
{
cipher = AES_128_GCM;
key = h"00000000000000000000000000000000";
iv = h"000000000000000000000000";
aad = h"";
tag = h"cac45f60e31efd3b5a43b98a22ce1aa1";
plaintext = h"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
ciphertext = h"0388dace60b6a392f328c2b971b2fe78f795aaab494b5923f7fd89ff948bc1e0200211214e7394da2089b6acd093abe0c94da219118e297d7b7ebcbcc9c388f28ade7d85a8ee35616f7124a9d527029195b84d1b96c690ff2f2de30bf2ec89e00253786e126504f0dab90c48a30321de3345e6b0461e7c9e6c6b7afedde83f40";
};
{
cipher = AES_128_GCM;
key = h"00000000000000000000000000000000";
iv = h"ffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
aad = h"";
tag = h"566f8ef683078bfdeeffa869d751a017";
plaintext = h"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
ciphertext = h"56b3373ca9ef6e4a2b64fe1e9a17b61425f10d47a75a5fce13efc6bc784af24f4141bdd48cf7c770887afd573cca5418a9aeffcd7c5ceddfc6a78397b9a85b499da558257267caab2ad0b23ca476a53cb17fb41c4b8b475cb4f3f7165094c229c9e8c4dc0a2a5ff1903e501511221376a1cdb8364c5061a20cae74bc4acd76ceb0abc9fd3217ef9f8c90be402ddf6d8697f4f880dff15bfb7a6b28241ec8fe183c2d59e3f9dfff653c7126f0acb9e64211f42bae12af462b1070bef1ab5e3606";
};
{
cipher = AES_128_GCM;
key = h"00000000000000000000000000000000";
iv = h"ffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
aad = h"";
tag = h"8b307f6b33286d0ab026a9ed3fe1e85f";
plaintext = h"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
ciphertext = h"56b3373ca9ef6e4a2b64fe1e9a17b61425f10d47a75a5fce13efc6bc784af24f4141bdd48cf7c770887afd573cca5418a9aeffcd7c5ceddfc6a78397b9a85b499da558257267caab2ad0b23ca476a53cb17fb41c4b8b475cb4f3f7165094c229c9e8c4dc0a2a5ff1903e501511221376a1cdb8364c5061a20cae74bc4acd76ceb0abc9fd3217ef9f8c90be402ddf6d8697f4f880dff15bfb7a6b28241ec8fe183c2d59e3f9dfff653c7126f0acb9e64211f42bae12af462b1070bef1ab5e3606872ca10dee15b3249b1a1b958f23134c4bccb7d03200bce420a2f8eb66dcf3644d1423c1b5699003c13ecef4bf38a3b60eedc34033bac1902783dc6d89e2e774188a439c7ebcc0672dbda4ddcfb2794613b0be41315ef778708a70ee7d75165c";
};
{
cipher = AES_128_GCM;
key = h"843ffcf5d2b72694d19ed01d01249412";
iv = h"dbcca32ebf9b804617c3aa9e";
aad = h"00000000000000000000000000000000101112131415161718191a1b1c1d1e1f";
tag = h"3b629ccfbc1119b7319e1dce2cd6fd6d";
plaintext = h"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f";
ciphertext = h"6268c6fa2a80b2d137467f092f657ac04d89be2beaa623d61b5a868c8f03ff95d3dcee23ad2f1ab3a6c80eaf4b140eb05de3457f0fbc111a6b43d0763aa422a3013cf1dc37fe417d1fbfc449b75d4cc5";
};
] | false | true | Test.Vectors.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val aead_vectors_tmp : Prims.list ((((((Test.Vectors.cipher * Test.Lowstarize.hex_encoded) * Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) | [] | Test.Vectors.aead_vectors_tmp | {
"file_name": "providers/test/Test.Vectors.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.list ((((((Test.Vectors.cipher * Test.Lowstarize.hex_encoded) * Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) *
Test.Lowstarize.hex_encoded) | {
"end_col": 14,
"end_line": 572,
"start_col": 23,
"start_line": 570
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Spec.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let scale128 = s:nat{s <= 67108864} | let scale128 = | false | null | false | s: nat{s <= 67108864} | {
"checked_file": "Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual"
] | [] | module Hacl.Spec.Curve25519.Field51.Definition
open Lib.Sequence
open Lib.IntTypes
open Spec.Curve25519
#reset-options "--z3rlimit 20"
let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64)
let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128) | false | true | Hacl.Spec.Curve25519.Field51.Definition.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val scale128 : Type0 | [] | Hacl.Spec.Curve25519.Field51.Definition.scale128 | {
"file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 35,
"end_line": 13,
"start_col": 15,
"start_line": 13
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Spec.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128) | let felem_wide5 = | false | null | false | ((((uint128 * uint128) * uint128) * uint128) * uint128) | {
"checked_file": "Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst"
} | [
"total"
] | [
"FStar.Pervasives.Native.tuple5",
"Lib.IntTypes.uint128"
] | [] | module Hacl.Spec.Curve25519.Field51.Definition
open Lib.Sequence
open Lib.IntTypes
open Spec.Curve25519
#reset-options "--z3rlimit 20" | false | true | Hacl.Spec.Curve25519.Field51.Definition.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val felem_wide5 : Type0 | [] | Hacl.Spec.Curve25519.Field51.Definition.felem_wide5 | {
"file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 67,
"end_line": 10,
"start_col": 18,
"start_line": 10
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let max51 = pow51 - 1 | let max51 = | false | null | false | pow51 - 1 | {
"checked_file": "Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst"
} | [
"total"
] | [
"Prims.op_Subtraction",
"Hacl.Spec.Curve25519.Field51.Definition.pow51"
] | [] | module Hacl.Spec.Curve25519.Field51.Definition
open Lib.Sequence
open Lib.IntTypes
open Spec.Curve25519
#reset-options "--z3rlimit 20"
let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64)
let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128)
let scale64 = s:nat{s <= 8192}
let scale128 = s:nat{s <= 67108864}
let nat5 = (nat * nat * nat * nat * nat)
let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192}
let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864}
let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x)
let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x)
open FStar.Mul
let ( <=* ) (x:nat5) (y:nat5) : Type =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 <= y1) /\
(x2 <= y2) /\
(x3 <= y3) /\
(x4 <= y4) /\
(x5 <= y5)
let ( +* ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 + y1 ,
x2 + y2 ,
x3 + y3 ,
x4 + y4 ,
x5 + y5)
let ( ** ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 * y1 ,
x2 * y2 ,
x3 * y3 ,
x4 * y4 ,
x5 * y5)
val lemma_mul_le_scale64: a:nat -> b:nat ->
Lemma
(requires a <= 8192 /\ b <= 8192)
(ensures a * b <= 67108864)
let lemma_mul_le_scale64 a b =
let open FStar.Math.Lemmas in
lemma_mult_le_left a b 8192; // a * b <= a * 8192
lemma_mult_le_right 8192 a 8192; // a * 8192 <= 8192 * 8192
assert (a * b <= 8192 * 8192);
assert_norm (8192 * 8192 = 67108864)
#set-options "--z3rlimit 100"
let ( *^ ) (x:scale64) (y:scale64_5) : scale128_5 =
let (y1,y2,y3,y4,y5) = y in
lemma_mul_le_scale64 x y1;
lemma_mul_le_scale64 x y2;
lemma_mul_le_scale64 x y3;
lemma_mul_le_scale64 x y4;
lemma_mul_le_scale64 x y5;
(x * y1 ,
x * y2 ,
x * y3 ,
x * y4 ,
x * y5)
[@"opaque_to_smt"]
let pow51: (pow51: pos { pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51 }) =
let pow51: pos = normalize_term (pow2 51) in
assert_norm (pow51 > 0);
assert_norm (pow51 == pow2 51);
assert_norm (pow2 64 == 8192 * pow51);
assert_norm (pow2 128 == 67108864 * pow51 * pow51);
pow51 | false | true | Hacl.Spec.Curve25519.Field51.Definition.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val max51 : Prims.int | [] | Hacl.Spec.Curve25519.Field51.Definition.max51 | {
"file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.int | {
"end_col": 21,
"end_line": 90,
"start_col": 12,
"start_line": 90
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Spec.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let scale64 = s:nat{s <= 8192} | let scale64 = | false | null | false | s: nat{s <= 8192} | {
"checked_file": "Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst"
} | [
"total"
] | [
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual"
] | [] | module Hacl.Spec.Curve25519.Field51.Definition
open Lib.Sequence
open Lib.IntTypes
open Spec.Curve25519
#reset-options "--z3rlimit 20"
let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64)
let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128) | false | true | Hacl.Spec.Curve25519.Field51.Definition.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val scale64 : Type0 | [] | Hacl.Spec.Curve25519.Field51.Definition.scale64 | {
"file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 30,
"end_line": 12,
"start_col": 14,
"start_line": 12
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Spec.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64) | let felem5 = | false | null | false | ((((uint64 * uint64) * uint64) * uint64) * uint64) | {
"checked_file": "Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst"
} | [
"total"
] | [
"FStar.Pervasives.Native.tuple5",
"Lib.IntTypes.uint64"
] | [] | module Hacl.Spec.Curve25519.Field51.Definition
open Lib.Sequence
open Lib.IntTypes
open Spec.Curve25519
#reset-options "--z3rlimit 20" | false | true | Hacl.Spec.Curve25519.Field51.Definition.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val felem5 : Type0 | [] | Hacl.Spec.Curve25519.Field51.Definition.felem5 | {
"file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 57,
"end_line": 9,
"start_col": 13,
"start_line": 9
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let felem_fits1 (x:uint64) (m:scale64) =
uint_v x <= m * max51 | let felem_fits1 (x: uint64) (m: scale64) = | false | null | false | uint_v x <= m * max51 | {
"checked_file": "Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst"
} | [
"total"
] | [
"Lib.IntTypes.uint64",
"Hacl.Spec.Curve25519.Field51.Definition.scale64",
"Prims.op_LessThanOrEqual",
"Lib.IntTypes.uint_v",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"FStar.Mul.op_Star",
"Hacl.Spec.Curve25519.Field51.Definition.max51",
"Prims.bool"
] | [] | module Hacl.Spec.Curve25519.Field51.Definition
open Lib.Sequence
open Lib.IntTypes
open Spec.Curve25519
#reset-options "--z3rlimit 20"
let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64)
let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128)
let scale64 = s:nat{s <= 8192}
let scale128 = s:nat{s <= 67108864}
let nat5 = (nat * nat * nat * nat * nat)
let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192}
let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864}
let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x)
let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x)
open FStar.Mul
let ( <=* ) (x:nat5) (y:nat5) : Type =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 <= y1) /\
(x2 <= y2) /\
(x3 <= y3) /\
(x4 <= y4) /\
(x5 <= y5)
let ( +* ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 + y1 ,
x2 + y2 ,
x3 + y3 ,
x4 + y4 ,
x5 + y5)
let ( ** ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 * y1 ,
x2 * y2 ,
x3 * y3 ,
x4 * y4 ,
x5 * y5)
val lemma_mul_le_scale64: a:nat -> b:nat ->
Lemma
(requires a <= 8192 /\ b <= 8192)
(ensures a * b <= 67108864)
let lemma_mul_le_scale64 a b =
let open FStar.Math.Lemmas in
lemma_mult_le_left a b 8192; // a * b <= a * 8192
lemma_mult_le_right 8192 a 8192; // a * 8192 <= 8192 * 8192
assert (a * b <= 8192 * 8192);
assert_norm (8192 * 8192 = 67108864)
#set-options "--z3rlimit 100"
let ( *^ ) (x:scale64) (y:scale64_5) : scale128_5 =
let (y1,y2,y3,y4,y5) = y in
lemma_mul_le_scale64 x y1;
lemma_mul_le_scale64 x y2;
lemma_mul_le_scale64 x y3;
lemma_mul_le_scale64 x y4;
lemma_mul_le_scale64 x y5;
(x * y1 ,
x * y2 ,
x * y3 ,
x * y4 ,
x * y5)
[@"opaque_to_smt"]
let pow51: (pow51: pos { pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51 }) =
let pow51: pos = normalize_term (pow2 51) in
assert_norm (pow51 > 0);
assert_norm (pow51 == pow2 51);
assert_norm (pow2 64 == 8192 * pow51);
assert_norm (pow2 128 == 67108864 * pow51 * pow51);
pow51
inline_for_extraction noextract
let max51 = pow51 - 1
inline_for_extraction noextract
let mask51 : x:uint64{v x == pow2 51 - 1} =
assert_norm (pow2 51 - 1 == 0x7ffffffffffff);
u64 0x7ffffffffffff | false | true | Hacl.Spec.Curve25519.Field51.Definition.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val felem_fits1 : x: Lib.IntTypes.uint64 -> m: Hacl.Spec.Curve25519.Field51.Definition.scale64 -> Prims.bool | [] | Hacl.Spec.Curve25519.Field51.Definition.felem_fits1 | {
"file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Lib.IntTypes.uint64 -> m: Hacl.Spec.Curve25519.Field51.Definition.scale64 -> Prims.bool | {
"end_col": 23,
"end_line": 98,
"start_col": 2,
"start_line": 98
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Spec.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192} | let scale64_5 = | false | null | false | x:
nat5
{ let x1, x2, x3, x4, x5 = x in
x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192 } | {
"checked_file": "Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst"
} | [
"total"
] | [
"Hacl.Spec.Curve25519.Field51.Definition.nat5",
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual"
] | [] | module Hacl.Spec.Curve25519.Field51.Definition
open Lib.Sequence
open Lib.IntTypes
open Spec.Curve25519
#reset-options "--z3rlimit 20"
let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64)
let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128)
let scale64 = s:nat{s <= 8192}
let scale128 = s:nat{s <= 67108864}
let nat5 = (nat * nat * nat * nat * nat) | false | true | Hacl.Spec.Curve25519.Field51.Definition.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val scale64_5 : Type0 | [] | Hacl.Spec.Curve25519.Field51.Definition.scale64_5 | {
"file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 76,
"end_line": 17,
"start_col": 16,
"start_line": 16
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let felem_wide_fits1 (x:uint128) (m:scale128) =
uint_v x <= m * max51 * max51 | let felem_wide_fits1 (x: uint128) (m: scale128) = | false | null | false | uint_v x <= (m * max51) * max51 | {
"checked_file": "Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst"
} | [
"total"
] | [
"Lib.IntTypes.uint128",
"Hacl.Spec.Curve25519.Field51.Definition.scale128",
"Prims.op_LessThanOrEqual",
"Lib.IntTypes.uint_v",
"Lib.IntTypes.U128",
"Lib.IntTypes.SEC",
"FStar.Mul.op_Star",
"Hacl.Spec.Curve25519.Field51.Definition.max51",
"Prims.bool"
] | [] | module Hacl.Spec.Curve25519.Field51.Definition
open Lib.Sequence
open Lib.IntTypes
open Spec.Curve25519
#reset-options "--z3rlimit 20"
let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64)
let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128)
let scale64 = s:nat{s <= 8192}
let scale128 = s:nat{s <= 67108864}
let nat5 = (nat * nat * nat * nat * nat)
let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192}
let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864}
let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x)
let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x)
open FStar.Mul
let ( <=* ) (x:nat5) (y:nat5) : Type =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 <= y1) /\
(x2 <= y2) /\
(x3 <= y3) /\
(x4 <= y4) /\
(x5 <= y5)
let ( +* ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 + y1 ,
x2 + y2 ,
x3 + y3 ,
x4 + y4 ,
x5 + y5)
let ( ** ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 * y1 ,
x2 * y2 ,
x3 * y3 ,
x4 * y4 ,
x5 * y5)
val lemma_mul_le_scale64: a:nat -> b:nat ->
Lemma
(requires a <= 8192 /\ b <= 8192)
(ensures a * b <= 67108864)
let lemma_mul_le_scale64 a b =
let open FStar.Math.Lemmas in
lemma_mult_le_left a b 8192; // a * b <= a * 8192
lemma_mult_le_right 8192 a 8192; // a * 8192 <= 8192 * 8192
assert (a * b <= 8192 * 8192);
assert_norm (8192 * 8192 = 67108864)
#set-options "--z3rlimit 100"
let ( *^ ) (x:scale64) (y:scale64_5) : scale128_5 =
let (y1,y2,y3,y4,y5) = y in
lemma_mul_le_scale64 x y1;
lemma_mul_le_scale64 x y2;
lemma_mul_le_scale64 x y3;
lemma_mul_le_scale64 x y4;
lemma_mul_le_scale64 x y5;
(x * y1 ,
x * y2 ,
x * y3 ,
x * y4 ,
x * y5)
[@"opaque_to_smt"]
let pow51: (pow51: pos { pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51 }) =
let pow51: pos = normalize_term (pow2 51) in
assert_norm (pow51 > 0);
assert_norm (pow51 == pow2 51);
assert_norm (pow2 64 == 8192 * pow51);
assert_norm (pow2 128 == 67108864 * pow51 * pow51);
pow51
inline_for_extraction noextract
let max51 = pow51 - 1
inline_for_extraction noextract
let mask51 : x:uint64{v x == pow2 51 - 1} =
assert_norm (pow2 51 - 1 == 0x7ffffffffffff);
u64 0x7ffffffffffff
let felem_fits1 (x:uint64) (m:scale64) =
uint_v x <= m * max51 | false | true | Hacl.Spec.Curve25519.Field51.Definition.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val felem_wide_fits1 : x: Lib.IntTypes.uint128 -> m: Hacl.Spec.Curve25519.Field51.Definition.scale128 -> Prims.bool | [] | Hacl.Spec.Curve25519.Field51.Definition.felem_wide_fits1 | {
"file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Lib.IntTypes.uint128 -> m: Hacl.Spec.Curve25519.Field51.Definition.scale128 -> Prims.bool | {
"end_col": 31,
"end_line": 101,
"start_col": 2,
"start_line": 101
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Spec.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let nat5 = (nat * nat * nat * nat * nat) | let nat5 = | false | null | false | ((((nat * nat) * nat) * nat) * nat) | {
"checked_file": "Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst"
} | [
"total"
] | [
"FStar.Pervasives.Native.tuple5",
"Prims.nat"
] | [] | module Hacl.Spec.Curve25519.Field51.Definition
open Lib.Sequence
open Lib.IntTypes
open Spec.Curve25519
#reset-options "--z3rlimit 20"
let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64)
let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128)
let scale64 = s:nat{s <= 8192} | false | true | Hacl.Spec.Curve25519.Field51.Definition.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val nat5 : Type0 | [] | Hacl.Spec.Curve25519.Field51.Definition.nat5 | {
"file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 40,
"end_line": 14,
"start_col": 11,
"start_line": 14
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Spec.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864} | let scale128_5 = | false | null | false | x:
nat5
{ let x1, x2, x3, x4, x5 = x in
x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864 } | {
"checked_file": "Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst"
} | [
"total"
] | [
"Hacl.Spec.Curve25519.Field51.Definition.nat5",
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual"
] | [] | module Hacl.Spec.Curve25519.Field51.Definition
open Lib.Sequence
open Lib.IntTypes
open Spec.Curve25519
#reset-options "--z3rlimit 20"
let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64)
let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128)
let scale64 = s:nat{s <= 8192}
let scale128 = s:nat{s <= 67108864}
let nat5 = (nat * nat * nat * nat * nat)
let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in | false | true | Hacl.Spec.Curve25519.Field51.Definition.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val scale128_5 : Type0 | [] | Hacl.Spec.Curve25519.Field51.Definition.scale128_5 | {
"file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 98,
"end_line": 19,
"start_col": 17,
"start_line": 18
} |
|
Prims.Tot | val s64x5 (x: scale64) : scale64_5 | [
{
"abbrev": false,
"full_module": "Spec.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x) | val s64x5 (x: scale64) : scale64_5
let s64x5 (x: scale64) : scale64_5 = | false | null | false | (x, x, x, x, x) | {
"checked_file": "Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst"
} | [
"total"
] | [
"Hacl.Spec.Curve25519.Field51.Definition.scale64",
"FStar.Pervasives.Native.Mktuple5",
"Prims.nat",
"Hacl.Spec.Curve25519.Field51.Definition.scale64_5"
] | [] | module Hacl.Spec.Curve25519.Field51.Definition
open Lib.Sequence
open Lib.IntTypes
open Spec.Curve25519
#reset-options "--z3rlimit 20"
let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64)
let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128)
let scale64 = s:nat{s <= 8192}
let scale128 = s:nat{s <= 67108864}
let nat5 = (nat * nat * nat * nat * nat)
let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192}
let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864} | false | true | Hacl.Spec.Curve25519.Field51.Definition.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val s64x5 (x: scale64) : scale64_5 | [] | Hacl.Spec.Curve25519.Field51.Definition.s64x5 | {
"file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Hacl.Spec.Curve25519.Field51.Definition.scale64
-> Hacl.Spec.Curve25519.Field51.Definition.scale64_5 | {
"end_col": 47,
"end_line": 21,
"start_col": 36,
"start_line": 21
} |
Prims.Tot | val s128x5 (x: scale128) : scale128_5 | [
{
"abbrev": false,
"full_module": "Spec.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x) | val s128x5 (x: scale128) : scale128_5
let s128x5 (x: scale128) : scale128_5 = | false | null | false | (x, x, x, x, x) | {
"checked_file": "Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst"
} | [
"total"
] | [
"Hacl.Spec.Curve25519.Field51.Definition.scale128",
"FStar.Pervasives.Native.Mktuple5",
"Prims.nat",
"Hacl.Spec.Curve25519.Field51.Definition.scale128_5"
] | [] | module Hacl.Spec.Curve25519.Field51.Definition
open Lib.Sequence
open Lib.IntTypes
open Spec.Curve25519
#reset-options "--z3rlimit 20"
let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64)
let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128)
let scale64 = s:nat{s <= 8192}
let scale128 = s:nat{s <= 67108864}
let nat5 = (nat * nat * nat * nat * nat)
let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192}
let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864} | false | true | Hacl.Spec.Curve25519.Field51.Definition.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val s128x5 (x: scale128) : scale128_5 | [] | Hacl.Spec.Curve25519.Field51.Definition.s128x5 | {
"file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Hacl.Spec.Curve25519.Field51.Definition.scale128
-> Hacl.Spec.Curve25519.Field51.Definition.scale128_5 | {
"end_col": 50,
"end_line": 22,
"start_col": 39,
"start_line": 22
} |
Prims.Tot | val pow51:(pow51:
pos{pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51}) | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let pow51: (pow51: pos { pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51 }) =
let pow51: pos = normalize_term (pow2 51) in
assert_norm (pow51 > 0);
assert_norm (pow51 == pow2 51);
assert_norm (pow2 64 == 8192 * pow51);
assert_norm (pow2 128 == 67108864 * pow51 * pow51);
pow51 | val pow51:(pow51:
pos{pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51})
let pow51:(pow51:
pos{pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51}) = | false | null | false | let pow51:pos = normalize_term (pow2 51) in
assert_norm (pow51 > 0);
assert_norm (pow51 == pow2 51);
assert_norm (pow2 64 == 8192 * pow51);
assert_norm (pow2 128 == (67108864 * pow51) * pow51);
pow51 | {
"checked_file": "Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst"
} | [
"total"
] | [
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"Prims.pow2",
"FStar.Mul.op_Star",
"Prims.pos",
"Prims.b2t",
"Prims.op_GreaterThan",
"FStar.Pervasives.normalize_term"
] | [] | module Hacl.Spec.Curve25519.Field51.Definition
open Lib.Sequence
open Lib.IntTypes
open Spec.Curve25519
#reset-options "--z3rlimit 20"
let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64)
let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128)
let scale64 = s:nat{s <= 8192}
let scale128 = s:nat{s <= 67108864}
let nat5 = (nat * nat * nat * nat * nat)
let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192}
let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864}
let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x)
let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x)
open FStar.Mul
let ( <=* ) (x:nat5) (y:nat5) : Type =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 <= y1) /\
(x2 <= y2) /\
(x3 <= y3) /\
(x4 <= y4) /\
(x5 <= y5)
let ( +* ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 + y1 ,
x2 + y2 ,
x3 + y3 ,
x4 + y4 ,
x5 + y5)
let ( ** ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 * y1 ,
x2 * y2 ,
x3 * y3 ,
x4 * y4 ,
x5 * y5)
val lemma_mul_le_scale64: a:nat -> b:nat ->
Lemma
(requires a <= 8192 /\ b <= 8192)
(ensures a * b <= 67108864)
let lemma_mul_le_scale64 a b =
let open FStar.Math.Lemmas in
lemma_mult_le_left a b 8192; // a * b <= a * 8192
lemma_mult_le_right 8192 a 8192; // a * 8192 <= 8192 * 8192
assert (a * b <= 8192 * 8192);
assert_norm (8192 * 8192 = 67108864)
#set-options "--z3rlimit 100"
let ( *^ ) (x:scale64) (y:scale64_5) : scale128_5 =
let (y1,y2,y3,y4,y5) = y in
lemma_mul_le_scale64 x y1;
lemma_mul_le_scale64 x y2;
lemma_mul_le_scale64 x y3;
lemma_mul_le_scale64 x y4;
lemma_mul_le_scale64 x y5;
(x * y1 ,
x * y2 ,
x * y3 ,
x * y4 ,
x * y5) | false | false | Hacl.Spec.Curve25519.Field51.Definition.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val pow51:(pow51:
pos{pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51}) | [] | Hacl.Spec.Curve25519.Field51.Definition.pow51 | {
"file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | pow51:
Prims.pos
{ Prims.pow2 64 == 8192 * pow51 /\ Prims.pow2 128 == (67108864 * pow51) * pow51 /\
pow51 == Prims.pow2 51 } | {
"end_col": 7,
"end_line": 87,
"start_col": 113,
"start_line": 81
} |
FStar.Pervasives.Lemma | val lemma_mul_le_scale64: a:nat -> b:nat ->
Lemma
(requires a <= 8192 /\ b <= 8192)
(ensures a * b <= 67108864) | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let lemma_mul_le_scale64 a b =
let open FStar.Math.Lemmas in
lemma_mult_le_left a b 8192; // a * b <= a * 8192
lemma_mult_le_right 8192 a 8192; // a * 8192 <= 8192 * 8192
assert (a * b <= 8192 * 8192);
assert_norm (8192 * 8192 = 67108864) | val lemma_mul_le_scale64: a:nat -> b:nat ->
Lemma
(requires a <= 8192 /\ b <= 8192)
(ensures a * b <= 67108864)
let lemma_mul_le_scale64 a b = | false | null | true | let open FStar.Math.Lemmas in
lemma_mult_le_left a b 8192;
lemma_mult_le_right 8192 a 8192;
assert (a * b <= 8192 * 8192);
assert_norm (8192 * 8192 = 67108864) | {
"checked_file": "Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst"
} | [
"lemma"
] | [
"Prims.nat",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"FStar.Mul.op_Star",
"Prims.unit",
"Prims._assert",
"Prims.op_LessThanOrEqual",
"FStar.Math.Lemmas.lemma_mult_le_right",
"FStar.Math.Lemmas.lemma_mult_le_left"
] | [] | module Hacl.Spec.Curve25519.Field51.Definition
open Lib.Sequence
open Lib.IntTypes
open Spec.Curve25519
#reset-options "--z3rlimit 20"
let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64)
let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128)
let scale64 = s:nat{s <= 8192}
let scale128 = s:nat{s <= 67108864}
let nat5 = (nat * nat * nat * nat * nat)
let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192}
let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864}
let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x)
let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x)
open FStar.Mul
let ( <=* ) (x:nat5) (y:nat5) : Type =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 <= y1) /\
(x2 <= y2) /\
(x3 <= y3) /\
(x4 <= y4) /\
(x5 <= y5)
let ( +* ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 + y1 ,
x2 + y2 ,
x3 + y3 ,
x4 + y4 ,
x5 + y5)
let ( ** ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 * y1 ,
x2 * y2 ,
x3 * y3 ,
x4 * y4 ,
x5 * y5)
val lemma_mul_le_scale64: a:nat -> b:nat ->
Lemma
(requires a <= 8192 /\ b <= 8192)
(ensures a * b <= 67108864) | false | false | Hacl.Spec.Curve25519.Field51.Definition.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val lemma_mul_le_scale64: a:nat -> b:nat ->
Lemma
(requires a <= 8192 /\ b <= 8192)
(ensures a * b <= 67108864) | [] | Hacl.Spec.Curve25519.Field51.Definition.lemma_mul_le_scale64 | {
"file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | a: Prims.nat -> b: Prims.nat
-> FStar.Pervasives.Lemma (requires a <= 8192 /\ b <= 8192) (ensures a * b <= 67108864) | {
"end_col": 38,
"end_line": 63,
"start_col": 2,
"start_line": 59
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let felem_fits5 (f:felem5) (m:scale64_5) =
let (x1,x2,x3,x4,x5) = f in
let (m1,m2,m3,m4,m5) = m in
felem_fits1 x1 m1 /\
felem_fits1 x2 m2 /\
felem_fits1 x3 m3 /\
felem_fits1 x4 m4 /\
felem_fits1 x5 m5 | let felem_fits5 (f: felem5) (m: scale64_5) = | false | null | false | let x1, x2, x3, x4, x5 = f in
let m1, m2, m3, m4, m5 = m in
felem_fits1 x1 m1 /\ felem_fits1 x2 m2 /\ felem_fits1 x3 m3 /\ felem_fits1 x4 m4 /\
felem_fits1 x5 m5 | {
"checked_file": "Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst"
} | [
"total"
] | [
"Hacl.Spec.Curve25519.Field51.Definition.felem5",
"Hacl.Spec.Curve25519.Field51.Definition.scale64_5",
"Lib.IntTypes.uint64",
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Hacl.Spec.Curve25519.Field51.Definition.felem_fits1",
"Prims.logical"
] | [] | module Hacl.Spec.Curve25519.Field51.Definition
open Lib.Sequence
open Lib.IntTypes
open Spec.Curve25519
#reset-options "--z3rlimit 20"
let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64)
let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128)
let scale64 = s:nat{s <= 8192}
let scale128 = s:nat{s <= 67108864}
let nat5 = (nat * nat * nat * nat * nat)
let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192}
let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864}
let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x)
let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x)
open FStar.Mul
let ( <=* ) (x:nat5) (y:nat5) : Type =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 <= y1) /\
(x2 <= y2) /\
(x3 <= y3) /\
(x4 <= y4) /\
(x5 <= y5)
let ( +* ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 + y1 ,
x2 + y2 ,
x3 + y3 ,
x4 + y4 ,
x5 + y5)
let ( ** ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 * y1 ,
x2 * y2 ,
x3 * y3 ,
x4 * y4 ,
x5 * y5)
val lemma_mul_le_scale64: a:nat -> b:nat ->
Lemma
(requires a <= 8192 /\ b <= 8192)
(ensures a * b <= 67108864)
let lemma_mul_le_scale64 a b =
let open FStar.Math.Lemmas in
lemma_mult_le_left a b 8192; // a * b <= a * 8192
lemma_mult_le_right 8192 a 8192; // a * 8192 <= 8192 * 8192
assert (a * b <= 8192 * 8192);
assert_norm (8192 * 8192 = 67108864)
#set-options "--z3rlimit 100"
let ( *^ ) (x:scale64) (y:scale64_5) : scale128_5 =
let (y1,y2,y3,y4,y5) = y in
lemma_mul_le_scale64 x y1;
lemma_mul_le_scale64 x y2;
lemma_mul_le_scale64 x y3;
lemma_mul_le_scale64 x y4;
lemma_mul_le_scale64 x y5;
(x * y1 ,
x * y2 ,
x * y3 ,
x * y4 ,
x * y5)
[@"opaque_to_smt"]
let pow51: (pow51: pos { pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51 }) =
let pow51: pos = normalize_term (pow2 51) in
assert_norm (pow51 > 0);
assert_norm (pow51 == pow2 51);
assert_norm (pow2 64 == 8192 * pow51);
assert_norm (pow2 128 == 67108864 * pow51 * pow51);
pow51
inline_for_extraction noextract
let max51 = pow51 - 1
inline_for_extraction noextract
let mask51 : x:uint64{v x == pow2 51 - 1} =
assert_norm (pow2 51 - 1 == 0x7ffffffffffff);
u64 0x7ffffffffffff
let felem_fits1 (x:uint64) (m:scale64) =
uint_v x <= m * max51
let felem_wide_fits1 (x:uint128) (m:scale128) =
uint_v x <= m * max51 * max51 | false | true | Hacl.Spec.Curve25519.Field51.Definition.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val felem_fits5 : f: Hacl.Spec.Curve25519.Field51.Definition.felem5 ->
m: Hacl.Spec.Curve25519.Field51.Definition.scale64_5
-> Prims.logical | [] | Hacl.Spec.Curve25519.Field51.Definition.felem_fits5 | {
"file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
f: Hacl.Spec.Curve25519.Field51.Definition.felem5 ->
m: Hacl.Spec.Curve25519.Field51.Definition.scale64_5
-> Prims.logical | {
"end_col": 19,
"end_line": 110,
"start_col": 42,
"start_line": 103
} |
|
Prims.GTot | val feval_wide (f: felem_wide5) : GTot elem | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let feval_wide (f:felem_wide5) : GTot elem = (wide_as_nat5 f) % prime | val feval_wide (f: felem_wide5) : GTot elem
let feval_wide (f: felem_wide5) : GTot elem = | false | null | false | (wide_as_nat5 f) % prime | {
"checked_file": "Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst"
} | [
"sometrivial"
] | [
"Hacl.Spec.Curve25519.Field51.Definition.felem_wide5",
"Prims.op_Modulus",
"Hacl.Spec.Curve25519.Field51.Definition.wide_as_nat5",
"Spec.Curve25519.prime",
"Spec.Curve25519.elem"
] | [] | module Hacl.Spec.Curve25519.Field51.Definition
open Lib.Sequence
open Lib.IntTypes
open Spec.Curve25519
#reset-options "--z3rlimit 20"
let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64)
let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128)
let scale64 = s:nat{s <= 8192}
let scale128 = s:nat{s <= 67108864}
let nat5 = (nat * nat * nat * nat * nat)
let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192}
let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864}
let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x)
let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x)
open FStar.Mul
let ( <=* ) (x:nat5) (y:nat5) : Type =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 <= y1) /\
(x2 <= y2) /\
(x3 <= y3) /\
(x4 <= y4) /\
(x5 <= y5)
let ( +* ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 + y1 ,
x2 + y2 ,
x3 + y3 ,
x4 + y4 ,
x5 + y5)
let ( ** ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 * y1 ,
x2 * y2 ,
x3 * y3 ,
x4 * y4 ,
x5 * y5)
val lemma_mul_le_scale64: a:nat -> b:nat ->
Lemma
(requires a <= 8192 /\ b <= 8192)
(ensures a * b <= 67108864)
let lemma_mul_le_scale64 a b =
let open FStar.Math.Lemmas in
lemma_mult_le_left a b 8192; // a * b <= a * 8192
lemma_mult_le_right 8192 a 8192; // a * 8192 <= 8192 * 8192
assert (a * b <= 8192 * 8192);
assert_norm (8192 * 8192 = 67108864)
#set-options "--z3rlimit 100"
let ( *^ ) (x:scale64) (y:scale64_5) : scale128_5 =
let (y1,y2,y3,y4,y5) = y in
lemma_mul_le_scale64 x y1;
lemma_mul_le_scale64 x y2;
lemma_mul_le_scale64 x y3;
lemma_mul_le_scale64 x y4;
lemma_mul_le_scale64 x y5;
(x * y1 ,
x * y2 ,
x * y3 ,
x * y4 ,
x * y5)
[@"opaque_to_smt"]
let pow51: (pow51: pos { pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51 }) =
let pow51: pos = normalize_term (pow2 51) in
assert_norm (pow51 > 0);
assert_norm (pow51 == pow2 51);
assert_norm (pow2 64 == 8192 * pow51);
assert_norm (pow2 128 == 67108864 * pow51 * pow51);
pow51
inline_for_extraction noextract
let max51 = pow51 - 1
inline_for_extraction noextract
let mask51 : x:uint64{v x == pow2 51 - 1} =
assert_norm (pow2 51 - 1 == 0x7ffffffffffff);
u64 0x7ffffffffffff
let felem_fits1 (x:uint64) (m:scale64) =
uint_v x <= m * max51
let felem_wide_fits1 (x:uint128) (m:scale128) =
uint_v x <= m * max51 * max51
let felem_fits5 (f:felem5) (m:scale64_5) =
let (x1,x2,x3,x4,x5) = f in
let (m1,m2,m3,m4,m5) = m in
felem_fits1 x1 m1 /\
felem_fits1 x2 m2 /\
felem_fits1 x3 m3 /\
felem_fits1 x4 m4 /\
felem_fits1 x5 m5
let felem_wide_fits5 (f:felem_wide5) (m:scale128_5) =
let (x1,x2,x3,x4,x5) = f in
let (m1,m2,m3,m4,m5) = m in
felem_wide_fits1 x1 m1 /\
felem_wide_fits1 x2 m2 /\
felem_wide_fits1 x3 m3 /\
felem_wide_fits1 x4 m4 /\
felem_wide_fits1 x5 m5
noextract
val as_nat5: f:felem5 -> GTot nat
let as_nat5 f =
let (s0, s1, s2, s3, s4) = f in
uint_v s0 + (uint_v s1 * pow51) + (uint_v s2 * pow51 * pow51) +
(uint_v s3 * pow51 * pow51 * pow51) + (uint_v s4 * pow51 * pow51 * pow51 * pow51)
noextract
val wide_as_nat5: f:felem_wide5 -> GTot nat
let wide_as_nat5 f =
let (s0, s1, s2, s3, s4) = f in
uint_v s0 + (uint_v s1 * pow51) + (uint_v s2 * pow51 * pow51) +
(uint_v s3 * pow51 * pow51 * pow51) + (uint_v s4 * pow51 * pow51 * pow51 * pow51) | false | false | Hacl.Spec.Curve25519.Field51.Definition.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val feval_wide (f: felem_wide5) : GTot elem | [] | Hacl.Spec.Curve25519.Field51.Definition.feval_wide | {
"file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | f: Hacl.Spec.Curve25519.Field51.Definition.felem_wide5 -> Prims.GTot Spec.Curve25519.elem | {
"end_col": 69,
"end_line": 136,
"start_col": 45,
"start_line": 136
} |
Prims.Tot | val op_Plus_Star (x y: nat5) : nat5 | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let ( +* ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 + y1 ,
x2 + y2 ,
x3 + y3 ,
x4 + y4 ,
x5 + y5) | val op_Plus_Star (x y: nat5) : nat5
let op_Plus_Star (x y: nat5) : nat5 = | false | null | false | let x1, x2, x3, x4, x5 = x in
let y1, y2, y3, y4, y5 = y in
(x1 + y1, x2 + y2, x3 + y3, x4 + y4, x5 + y5) | {
"checked_file": "Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst"
} | [
"total"
] | [
"Hacl.Spec.Curve25519.Field51.Definition.nat5",
"Prims.nat",
"FStar.Pervasives.Native.Mktuple5",
"Prims.op_Addition"
] | [] | module Hacl.Spec.Curve25519.Field51.Definition
open Lib.Sequence
open Lib.IntTypes
open Spec.Curve25519
#reset-options "--z3rlimit 20"
let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64)
let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128)
let scale64 = s:nat{s <= 8192}
let scale128 = s:nat{s <= 67108864}
let nat5 = (nat * nat * nat * nat * nat)
let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192}
let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864}
let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x)
let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x)
open FStar.Mul
let ( <=* ) (x:nat5) (y:nat5) : Type =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 <= y1) /\
(x2 <= y2) /\
(x3 <= y3) /\
(x4 <= y4) /\
(x5 <= y5) | false | true | Hacl.Spec.Curve25519.Field51.Definition.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Plus_Star (x y: nat5) : nat5 | [] | Hacl.Spec.Curve25519.Field51.Definition.op_Plus_Star | {
"file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Hacl.Spec.Curve25519.Field51.Definition.nat5 -> y: Hacl.Spec.Curve25519.Field51.Definition.nat5
-> Hacl.Spec.Curve25519.Field51.Definition.nat5 | {
"end_col": 11,
"end_line": 42,
"start_col": 37,
"start_line": 35
} |
Prims.GTot | val feval (f: felem5) : GTot elem | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let feval (f:felem5) : GTot elem = (as_nat5 f) % prime | val feval (f: felem5) : GTot elem
let feval (f: felem5) : GTot elem = | false | null | false | (as_nat5 f) % prime | {
"checked_file": "Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst"
} | [
"sometrivial"
] | [
"Hacl.Spec.Curve25519.Field51.Definition.felem5",
"Prims.op_Modulus",
"Hacl.Spec.Curve25519.Field51.Definition.as_nat5",
"Spec.Curve25519.prime",
"Spec.Curve25519.elem"
] | [] | module Hacl.Spec.Curve25519.Field51.Definition
open Lib.Sequence
open Lib.IntTypes
open Spec.Curve25519
#reset-options "--z3rlimit 20"
let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64)
let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128)
let scale64 = s:nat{s <= 8192}
let scale128 = s:nat{s <= 67108864}
let nat5 = (nat * nat * nat * nat * nat)
let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192}
let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864}
let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x)
let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x)
open FStar.Mul
let ( <=* ) (x:nat5) (y:nat5) : Type =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 <= y1) /\
(x2 <= y2) /\
(x3 <= y3) /\
(x4 <= y4) /\
(x5 <= y5)
let ( +* ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 + y1 ,
x2 + y2 ,
x3 + y3 ,
x4 + y4 ,
x5 + y5)
let ( ** ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 * y1 ,
x2 * y2 ,
x3 * y3 ,
x4 * y4 ,
x5 * y5)
val lemma_mul_le_scale64: a:nat -> b:nat ->
Lemma
(requires a <= 8192 /\ b <= 8192)
(ensures a * b <= 67108864)
let lemma_mul_le_scale64 a b =
let open FStar.Math.Lemmas in
lemma_mult_le_left a b 8192; // a * b <= a * 8192
lemma_mult_le_right 8192 a 8192; // a * 8192 <= 8192 * 8192
assert (a * b <= 8192 * 8192);
assert_norm (8192 * 8192 = 67108864)
#set-options "--z3rlimit 100"
let ( *^ ) (x:scale64) (y:scale64_5) : scale128_5 =
let (y1,y2,y3,y4,y5) = y in
lemma_mul_le_scale64 x y1;
lemma_mul_le_scale64 x y2;
lemma_mul_le_scale64 x y3;
lemma_mul_le_scale64 x y4;
lemma_mul_le_scale64 x y5;
(x * y1 ,
x * y2 ,
x * y3 ,
x * y4 ,
x * y5)
[@"opaque_to_smt"]
let pow51: (pow51: pos { pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51 }) =
let pow51: pos = normalize_term (pow2 51) in
assert_norm (pow51 > 0);
assert_norm (pow51 == pow2 51);
assert_norm (pow2 64 == 8192 * pow51);
assert_norm (pow2 128 == 67108864 * pow51 * pow51);
pow51
inline_for_extraction noextract
let max51 = pow51 - 1
inline_for_extraction noextract
let mask51 : x:uint64{v x == pow2 51 - 1} =
assert_norm (pow2 51 - 1 == 0x7ffffffffffff);
u64 0x7ffffffffffff
let felem_fits1 (x:uint64) (m:scale64) =
uint_v x <= m * max51
let felem_wide_fits1 (x:uint128) (m:scale128) =
uint_v x <= m * max51 * max51
let felem_fits5 (f:felem5) (m:scale64_5) =
let (x1,x2,x3,x4,x5) = f in
let (m1,m2,m3,m4,m5) = m in
felem_fits1 x1 m1 /\
felem_fits1 x2 m2 /\
felem_fits1 x3 m3 /\
felem_fits1 x4 m4 /\
felem_fits1 x5 m5
let felem_wide_fits5 (f:felem_wide5) (m:scale128_5) =
let (x1,x2,x3,x4,x5) = f in
let (m1,m2,m3,m4,m5) = m in
felem_wide_fits1 x1 m1 /\
felem_wide_fits1 x2 m2 /\
felem_wide_fits1 x3 m3 /\
felem_wide_fits1 x4 m4 /\
felem_wide_fits1 x5 m5
noextract
val as_nat5: f:felem5 -> GTot nat
let as_nat5 f =
let (s0, s1, s2, s3, s4) = f in
uint_v s0 + (uint_v s1 * pow51) + (uint_v s2 * pow51 * pow51) +
(uint_v s3 * pow51 * pow51 * pow51) + (uint_v s4 * pow51 * pow51 * pow51 * pow51)
noextract
val wide_as_nat5: f:felem_wide5 -> GTot nat
let wide_as_nat5 f =
let (s0, s1, s2, s3, s4) = f in
uint_v s0 + (uint_v s1 * pow51) + (uint_v s2 * pow51 * pow51) +
(uint_v s3 * pow51 * pow51 * pow51) + (uint_v s4 * pow51 * pow51 * pow51 * pow51) | false | false | Hacl.Spec.Curve25519.Field51.Definition.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val feval (f: felem5) : GTot elem | [] | Hacl.Spec.Curve25519.Field51.Definition.feval | {
"file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | f: Hacl.Spec.Curve25519.Field51.Definition.felem5 -> Prims.GTot Spec.Curve25519.elem | {
"end_col": 54,
"end_line": 135,
"start_col": 35,
"start_line": 135
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let felem_wide_fits5 (f:felem_wide5) (m:scale128_5) =
let (x1,x2,x3,x4,x5) = f in
let (m1,m2,m3,m4,m5) = m in
felem_wide_fits1 x1 m1 /\
felem_wide_fits1 x2 m2 /\
felem_wide_fits1 x3 m3 /\
felem_wide_fits1 x4 m4 /\
felem_wide_fits1 x5 m5 | let felem_wide_fits5 (f: felem_wide5) (m: scale128_5) = | false | null | false | let x1, x2, x3, x4, x5 = f in
let m1, m2, m3, m4, m5 = m in
felem_wide_fits1 x1 m1 /\ felem_wide_fits1 x2 m2 /\ felem_wide_fits1 x3 m3 /\ felem_wide_fits1 x4 m4 /\
felem_wide_fits1 x5 m5 | {
"checked_file": "Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst"
} | [
"total"
] | [
"Hacl.Spec.Curve25519.Field51.Definition.felem_wide5",
"Hacl.Spec.Curve25519.Field51.Definition.scale128_5",
"Lib.IntTypes.uint128",
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Hacl.Spec.Curve25519.Field51.Definition.felem_wide_fits1",
"Prims.logical"
] | [] | module Hacl.Spec.Curve25519.Field51.Definition
open Lib.Sequence
open Lib.IntTypes
open Spec.Curve25519
#reset-options "--z3rlimit 20"
let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64)
let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128)
let scale64 = s:nat{s <= 8192}
let scale128 = s:nat{s <= 67108864}
let nat5 = (nat * nat * nat * nat * nat)
let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192}
let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864}
let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x)
let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x)
open FStar.Mul
let ( <=* ) (x:nat5) (y:nat5) : Type =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 <= y1) /\
(x2 <= y2) /\
(x3 <= y3) /\
(x4 <= y4) /\
(x5 <= y5)
let ( +* ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 + y1 ,
x2 + y2 ,
x3 + y3 ,
x4 + y4 ,
x5 + y5)
let ( ** ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 * y1 ,
x2 * y2 ,
x3 * y3 ,
x4 * y4 ,
x5 * y5)
val lemma_mul_le_scale64: a:nat -> b:nat ->
Lemma
(requires a <= 8192 /\ b <= 8192)
(ensures a * b <= 67108864)
let lemma_mul_le_scale64 a b =
let open FStar.Math.Lemmas in
lemma_mult_le_left a b 8192; // a * b <= a * 8192
lemma_mult_le_right 8192 a 8192; // a * 8192 <= 8192 * 8192
assert (a * b <= 8192 * 8192);
assert_norm (8192 * 8192 = 67108864)
#set-options "--z3rlimit 100"
let ( *^ ) (x:scale64) (y:scale64_5) : scale128_5 =
let (y1,y2,y3,y4,y5) = y in
lemma_mul_le_scale64 x y1;
lemma_mul_le_scale64 x y2;
lemma_mul_le_scale64 x y3;
lemma_mul_le_scale64 x y4;
lemma_mul_le_scale64 x y5;
(x * y1 ,
x * y2 ,
x * y3 ,
x * y4 ,
x * y5)
[@"opaque_to_smt"]
let pow51: (pow51: pos { pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51 }) =
let pow51: pos = normalize_term (pow2 51) in
assert_norm (pow51 > 0);
assert_norm (pow51 == pow2 51);
assert_norm (pow2 64 == 8192 * pow51);
assert_norm (pow2 128 == 67108864 * pow51 * pow51);
pow51
inline_for_extraction noextract
let max51 = pow51 - 1
inline_for_extraction noextract
let mask51 : x:uint64{v x == pow2 51 - 1} =
assert_norm (pow2 51 - 1 == 0x7ffffffffffff);
u64 0x7ffffffffffff
let felem_fits1 (x:uint64) (m:scale64) =
uint_v x <= m * max51
let felem_wide_fits1 (x:uint128) (m:scale128) =
uint_v x <= m * max51 * max51
let felem_fits5 (f:felem5) (m:scale64_5) =
let (x1,x2,x3,x4,x5) = f in
let (m1,m2,m3,m4,m5) = m in
felem_fits1 x1 m1 /\
felem_fits1 x2 m2 /\
felem_fits1 x3 m3 /\
felem_fits1 x4 m4 /\
felem_fits1 x5 m5 | false | true | Hacl.Spec.Curve25519.Field51.Definition.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val felem_wide_fits5 : f: Hacl.Spec.Curve25519.Field51.Definition.felem_wide5 ->
m: Hacl.Spec.Curve25519.Field51.Definition.scale128_5
-> Prims.logical | [] | Hacl.Spec.Curve25519.Field51.Definition.felem_wide_fits5 | {
"file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
f: Hacl.Spec.Curve25519.Field51.Definition.felem_wide5 ->
m: Hacl.Spec.Curve25519.Field51.Definition.scale128_5
-> Prims.logical | {
"end_col": 24,
"end_line": 119,
"start_col": 53,
"start_line": 112
} |
|
Prims.Tot | val op_Star_Star (x y: nat5) : nat5 | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let ( ** ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 * y1 ,
x2 * y2 ,
x3 * y3 ,
x4 * y4 ,
x5 * y5) | val op_Star_Star (x y: nat5) : nat5
let op_Star_Star (x y: nat5) : nat5 = | false | null | false | let x1, x2, x3, x4, x5 = x in
let y1, y2, y3, y4, y5 = y in
(x1 * y1, x2 * y2, x3 * y3, x4 * y4, x5 * y5) | {
"checked_file": "Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst"
} | [
"total"
] | [
"Hacl.Spec.Curve25519.Field51.Definition.nat5",
"Prims.nat",
"FStar.Pervasives.Native.Mktuple5",
"FStar.Mul.op_Star"
] | [] | module Hacl.Spec.Curve25519.Field51.Definition
open Lib.Sequence
open Lib.IntTypes
open Spec.Curve25519
#reset-options "--z3rlimit 20"
let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64)
let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128)
let scale64 = s:nat{s <= 8192}
let scale128 = s:nat{s <= 67108864}
let nat5 = (nat * nat * nat * nat * nat)
let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192}
let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864}
let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x)
let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x)
open FStar.Mul
let ( <=* ) (x:nat5) (y:nat5) : Type =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 <= y1) /\
(x2 <= y2) /\
(x3 <= y3) /\
(x4 <= y4) /\
(x5 <= y5)
let ( +* ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 + y1 ,
x2 + y2 ,
x3 + y3 ,
x4 + y4 ,
x5 + y5) | false | true | Hacl.Spec.Curve25519.Field51.Definition.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Star_Star (x y: nat5) : nat5 | [] | Hacl.Spec.Curve25519.Field51.Definition.op_Star_Star | {
"file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Hacl.Spec.Curve25519.Field51.Definition.nat5 -> y: Hacl.Spec.Curve25519.Field51.Definition.nat5
-> Hacl.Spec.Curve25519.Field51.Definition.nat5 | {
"end_col": 11,
"end_line": 51,
"start_col": 37,
"start_line": 44
} |
Prims.Tot | val op_Star_Hat (x: scale64) (y: scale64_5) : scale128_5 | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let ( *^ ) (x:scale64) (y:scale64_5) : scale128_5 =
let (y1,y2,y3,y4,y5) = y in
lemma_mul_le_scale64 x y1;
lemma_mul_le_scale64 x y2;
lemma_mul_le_scale64 x y3;
lemma_mul_le_scale64 x y4;
lemma_mul_le_scale64 x y5;
(x * y1 ,
x * y2 ,
x * y3 ,
x * y4 ,
x * y5) | val op_Star_Hat (x: scale64) (y: scale64_5) : scale128_5
let op_Star_Hat (x: scale64) (y: scale64_5) : scale128_5 = | false | null | false | let y1, y2, y3, y4, y5 = y in
lemma_mul_le_scale64 x y1;
lemma_mul_le_scale64 x y2;
lemma_mul_le_scale64 x y3;
lemma_mul_le_scale64 x y4;
lemma_mul_le_scale64 x y5;
(x * y1, x * y2, x * y3, x * y4, x * y5) | {
"checked_file": "Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst"
} | [
"total"
] | [
"Hacl.Spec.Curve25519.Field51.Definition.scale64",
"Hacl.Spec.Curve25519.Field51.Definition.scale64_5",
"Prims.nat",
"FStar.Pervasives.Native.Mktuple5",
"FStar.Mul.op_Star",
"Prims.unit",
"Hacl.Spec.Curve25519.Field51.Definition.lemma_mul_le_scale64",
"Hacl.Spec.Curve25519.Field51.Definition.scale128_5"
] | [] | module Hacl.Spec.Curve25519.Field51.Definition
open Lib.Sequence
open Lib.IntTypes
open Spec.Curve25519
#reset-options "--z3rlimit 20"
let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64)
let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128)
let scale64 = s:nat{s <= 8192}
let scale128 = s:nat{s <= 67108864}
let nat5 = (nat * nat * nat * nat * nat)
let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192}
let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864}
let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x)
let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x)
open FStar.Mul
let ( <=* ) (x:nat5) (y:nat5) : Type =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 <= y1) /\
(x2 <= y2) /\
(x3 <= y3) /\
(x4 <= y4) /\
(x5 <= y5)
let ( +* ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 + y1 ,
x2 + y2 ,
x3 + y3 ,
x4 + y4 ,
x5 + y5)
let ( ** ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 * y1 ,
x2 * y2 ,
x3 * y3 ,
x4 * y4 ,
x5 * y5)
val lemma_mul_le_scale64: a:nat -> b:nat ->
Lemma
(requires a <= 8192 /\ b <= 8192)
(ensures a * b <= 67108864)
let lemma_mul_le_scale64 a b =
let open FStar.Math.Lemmas in
lemma_mult_le_left a b 8192; // a * b <= a * 8192
lemma_mult_le_right 8192 a 8192; // a * 8192 <= 8192 * 8192
assert (a * b <= 8192 * 8192);
assert_norm (8192 * 8192 = 67108864)
#set-options "--z3rlimit 100" | false | true | Hacl.Spec.Curve25519.Field51.Definition.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val op_Star_Hat (x: scale64) (y: scale64_5) : scale128_5 | [] | Hacl.Spec.Curve25519.Field51.Definition.op_Star_Hat | {
"file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
x: Hacl.Spec.Curve25519.Field51.Definition.scale64 ->
y: Hacl.Spec.Curve25519.Field51.Definition.scale64_5
-> Hacl.Spec.Curve25519.Field51.Definition.scale128_5 | {
"end_col": 10,
"end_line": 78,
"start_col": 51,
"start_line": 67
} |
Prims.Tot | val mask51:x: uint64{v x == pow2 51 - 1} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let mask51 : x:uint64{v x == pow2 51 - 1} =
assert_norm (pow2 51 - 1 == 0x7ffffffffffff);
u64 0x7ffffffffffff | val mask51:x: uint64{v x == pow2 51 - 1}
let mask51:x: uint64{v x == pow2 51 - 1} = | false | null | false | assert_norm (pow2 51 - 1 == 0x7ffffffffffff);
u64 0x7ffffffffffff | {
"checked_file": "Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst"
} | [
"total"
] | [
"Lib.IntTypes.u64",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"Prims.op_Subtraction",
"Prims.pow2"
] | [] | module Hacl.Spec.Curve25519.Field51.Definition
open Lib.Sequence
open Lib.IntTypes
open Spec.Curve25519
#reset-options "--z3rlimit 20"
let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64)
let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128)
let scale64 = s:nat{s <= 8192}
let scale128 = s:nat{s <= 67108864}
let nat5 = (nat * nat * nat * nat * nat)
let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192}
let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864}
let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x)
let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x)
open FStar.Mul
let ( <=* ) (x:nat5) (y:nat5) : Type =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 <= y1) /\
(x2 <= y2) /\
(x3 <= y3) /\
(x4 <= y4) /\
(x5 <= y5)
let ( +* ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 + y1 ,
x2 + y2 ,
x3 + y3 ,
x4 + y4 ,
x5 + y5)
let ( ** ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 * y1 ,
x2 * y2 ,
x3 * y3 ,
x4 * y4 ,
x5 * y5)
val lemma_mul_le_scale64: a:nat -> b:nat ->
Lemma
(requires a <= 8192 /\ b <= 8192)
(ensures a * b <= 67108864)
let lemma_mul_le_scale64 a b =
let open FStar.Math.Lemmas in
lemma_mult_le_left a b 8192; // a * b <= a * 8192
lemma_mult_le_right 8192 a 8192; // a * 8192 <= 8192 * 8192
assert (a * b <= 8192 * 8192);
assert_norm (8192 * 8192 = 67108864)
#set-options "--z3rlimit 100"
let ( *^ ) (x:scale64) (y:scale64_5) : scale128_5 =
let (y1,y2,y3,y4,y5) = y in
lemma_mul_le_scale64 x y1;
lemma_mul_le_scale64 x y2;
lemma_mul_le_scale64 x y3;
lemma_mul_le_scale64 x y4;
lemma_mul_le_scale64 x y5;
(x * y1 ,
x * y2 ,
x * y3 ,
x * y4 ,
x * y5)
[@"opaque_to_smt"]
let pow51: (pow51: pos { pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51 }) =
let pow51: pos = normalize_term (pow2 51) in
assert_norm (pow51 > 0);
assert_norm (pow51 == pow2 51);
assert_norm (pow2 64 == 8192 * pow51);
assert_norm (pow2 128 == 67108864 * pow51 * pow51);
pow51
inline_for_extraction noextract
let max51 = pow51 - 1
inline_for_extraction noextract | false | false | Hacl.Spec.Curve25519.Field51.Definition.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val mask51:x: uint64{v x == pow2 51 - 1} | [] | Hacl.Spec.Curve25519.Field51.Definition.mask51 | {
"file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | x: Lib.IntTypes.int_t Lib.IntTypes.U64 Lib.IntTypes.SEC {Lib.IntTypes.v x == Prims.pow2 51 - 1} | {
"end_col": 21,
"end_line": 95,
"start_col": 2,
"start_line": 94
} |
Prims.GTot | val wide_as_nat5: f:felem_wide5 -> GTot nat | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let wide_as_nat5 f =
let (s0, s1, s2, s3, s4) = f in
uint_v s0 + (uint_v s1 * pow51) + (uint_v s2 * pow51 * pow51) +
(uint_v s3 * pow51 * pow51 * pow51) + (uint_v s4 * pow51 * pow51 * pow51 * pow51) | val wide_as_nat5: f:felem_wide5 -> GTot nat
let wide_as_nat5 f = | false | null | false | let s0, s1, s2, s3, s4 = f in
uint_v s0 + (uint_v s1 * pow51) + ((uint_v s2 * pow51) * pow51) +
(((uint_v s3 * pow51) * pow51) * pow51) +
((((uint_v s4 * pow51) * pow51) * pow51) * pow51) | {
"checked_file": "Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst"
} | [
"sometrivial"
] | [
"Hacl.Spec.Curve25519.Field51.Definition.felem_wide5",
"Lib.IntTypes.uint128",
"Prims.op_Addition",
"Lib.IntTypes.uint_v",
"Lib.IntTypes.U128",
"Lib.IntTypes.SEC",
"FStar.Mul.op_Star",
"Hacl.Spec.Curve25519.Field51.Definition.pow51",
"Prims.nat"
] | [] | module Hacl.Spec.Curve25519.Field51.Definition
open Lib.Sequence
open Lib.IntTypes
open Spec.Curve25519
#reset-options "--z3rlimit 20"
let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64)
let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128)
let scale64 = s:nat{s <= 8192}
let scale128 = s:nat{s <= 67108864}
let nat5 = (nat * nat * nat * nat * nat)
let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192}
let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864}
let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x)
let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x)
open FStar.Mul
let ( <=* ) (x:nat5) (y:nat5) : Type =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 <= y1) /\
(x2 <= y2) /\
(x3 <= y3) /\
(x4 <= y4) /\
(x5 <= y5)
let ( +* ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 + y1 ,
x2 + y2 ,
x3 + y3 ,
x4 + y4 ,
x5 + y5)
let ( ** ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 * y1 ,
x2 * y2 ,
x3 * y3 ,
x4 * y4 ,
x5 * y5)
val lemma_mul_le_scale64: a:nat -> b:nat ->
Lemma
(requires a <= 8192 /\ b <= 8192)
(ensures a * b <= 67108864)
let lemma_mul_le_scale64 a b =
let open FStar.Math.Lemmas in
lemma_mult_le_left a b 8192; // a * b <= a * 8192
lemma_mult_le_right 8192 a 8192; // a * 8192 <= 8192 * 8192
assert (a * b <= 8192 * 8192);
assert_norm (8192 * 8192 = 67108864)
#set-options "--z3rlimit 100"
let ( *^ ) (x:scale64) (y:scale64_5) : scale128_5 =
let (y1,y2,y3,y4,y5) = y in
lemma_mul_le_scale64 x y1;
lemma_mul_le_scale64 x y2;
lemma_mul_le_scale64 x y3;
lemma_mul_le_scale64 x y4;
lemma_mul_le_scale64 x y5;
(x * y1 ,
x * y2 ,
x * y3 ,
x * y4 ,
x * y5)
[@"opaque_to_smt"]
let pow51: (pow51: pos { pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51 }) =
let pow51: pos = normalize_term (pow2 51) in
assert_norm (pow51 > 0);
assert_norm (pow51 == pow2 51);
assert_norm (pow2 64 == 8192 * pow51);
assert_norm (pow2 128 == 67108864 * pow51 * pow51);
pow51
inline_for_extraction noextract
let max51 = pow51 - 1
inline_for_extraction noextract
let mask51 : x:uint64{v x == pow2 51 - 1} =
assert_norm (pow2 51 - 1 == 0x7ffffffffffff);
u64 0x7ffffffffffff
let felem_fits1 (x:uint64) (m:scale64) =
uint_v x <= m * max51
let felem_wide_fits1 (x:uint128) (m:scale128) =
uint_v x <= m * max51 * max51
let felem_fits5 (f:felem5) (m:scale64_5) =
let (x1,x2,x3,x4,x5) = f in
let (m1,m2,m3,m4,m5) = m in
felem_fits1 x1 m1 /\
felem_fits1 x2 m2 /\
felem_fits1 x3 m3 /\
felem_fits1 x4 m4 /\
felem_fits1 x5 m5
let felem_wide_fits5 (f:felem_wide5) (m:scale128_5) =
let (x1,x2,x3,x4,x5) = f in
let (m1,m2,m3,m4,m5) = m in
felem_wide_fits1 x1 m1 /\
felem_wide_fits1 x2 m2 /\
felem_wide_fits1 x3 m3 /\
felem_wide_fits1 x4 m4 /\
felem_wide_fits1 x5 m5
noextract
val as_nat5: f:felem5 -> GTot nat
let as_nat5 f =
let (s0, s1, s2, s3, s4) = f in
uint_v s0 + (uint_v s1 * pow51) + (uint_v s2 * pow51 * pow51) +
(uint_v s3 * pow51 * pow51 * pow51) + (uint_v s4 * pow51 * pow51 * pow51 * pow51)
noextract | false | false | Hacl.Spec.Curve25519.Field51.Definition.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val wide_as_nat5: f:felem_wide5 -> GTot nat | [] | Hacl.Spec.Curve25519.Field51.Definition.wide_as_nat5 | {
"file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | f: Hacl.Spec.Curve25519.Field51.Definition.felem_wide5 -> Prims.GTot Prims.nat | {
"end_col": 85,
"end_line": 133,
"start_col": 20,
"start_line": 130
} |
Prims.GTot | val as_nat5: f:felem5 -> GTot nat | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field51",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | false | let as_nat5 f =
let (s0, s1, s2, s3, s4) = f in
uint_v s0 + (uint_v s1 * pow51) + (uint_v s2 * pow51 * pow51) +
(uint_v s3 * pow51 * pow51 * pow51) + (uint_v s4 * pow51 * pow51 * pow51 * pow51) | val as_nat5: f:felem5 -> GTot nat
let as_nat5 f = | false | null | false | let s0, s1, s2, s3, s4 = f in
uint_v s0 + (uint_v s1 * pow51) + ((uint_v s2 * pow51) * pow51) +
(((uint_v s3 * pow51) * pow51) * pow51) +
((((uint_v s4 * pow51) * pow51) * pow51) * pow51) | {
"checked_file": "Hacl.Spec.Curve25519.Field51.Definition.fst.checked",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Curve25519.Field51.Definition.fst"
} | [
"sometrivial"
] | [
"Hacl.Spec.Curve25519.Field51.Definition.felem5",
"Lib.IntTypes.uint64",
"Prims.op_Addition",
"Lib.IntTypes.uint_v",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"FStar.Mul.op_Star",
"Hacl.Spec.Curve25519.Field51.Definition.pow51",
"Prims.nat"
] | [] | module Hacl.Spec.Curve25519.Field51.Definition
open Lib.Sequence
open Lib.IntTypes
open Spec.Curve25519
#reset-options "--z3rlimit 20"
let felem5 = (uint64 * uint64 * uint64 * uint64 * uint64)
let felem_wide5 = (uint128 * uint128 * uint128 * uint128 * uint128)
let scale64 = s:nat{s <= 8192}
let scale128 = s:nat{s <= 67108864}
let nat5 = (nat * nat * nat * nat * nat)
let scale64_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 8192 /\ x2 <= 8192 /\ x3 <= 8192 /\ x4 <= 8192 /\ x5 <= 8192}
let scale128_5 = x:nat5{let (x1,x2,x3,x4,x5) = x in
x1 <= 67108864 /\ x2 <= 67108864 /\ x3 <= 67108864 /\ x4 <= 67108864 /\ x5 <= 67108864}
let s64x5 (x:scale64) : scale64_5 = (x,x,x,x,x)
let s128x5 (x:scale128) : scale128_5 = (x,x,x,x,x)
open FStar.Mul
let ( <=* ) (x:nat5) (y:nat5) : Type =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 <= y1) /\
(x2 <= y2) /\
(x3 <= y3) /\
(x4 <= y4) /\
(x5 <= y5)
let ( +* ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 + y1 ,
x2 + y2 ,
x3 + y3 ,
x4 + y4 ,
x5 + y5)
let ( ** ) (x:nat5) (y:nat5) : nat5 =
let (x1,x2,x3,x4,x5) = x in
let (y1,y2,y3,y4,y5) = y in
(x1 * y1 ,
x2 * y2 ,
x3 * y3 ,
x4 * y4 ,
x5 * y5)
val lemma_mul_le_scale64: a:nat -> b:nat ->
Lemma
(requires a <= 8192 /\ b <= 8192)
(ensures a * b <= 67108864)
let lemma_mul_le_scale64 a b =
let open FStar.Math.Lemmas in
lemma_mult_le_left a b 8192; // a * b <= a * 8192
lemma_mult_le_right 8192 a 8192; // a * 8192 <= 8192 * 8192
assert (a * b <= 8192 * 8192);
assert_norm (8192 * 8192 = 67108864)
#set-options "--z3rlimit 100"
let ( *^ ) (x:scale64) (y:scale64_5) : scale128_5 =
let (y1,y2,y3,y4,y5) = y in
lemma_mul_le_scale64 x y1;
lemma_mul_le_scale64 x y2;
lemma_mul_le_scale64 x y3;
lemma_mul_le_scale64 x y4;
lemma_mul_le_scale64 x y5;
(x * y1 ,
x * y2 ,
x * y3 ,
x * y4 ,
x * y5)
[@"opaque_to_smt"]
let pow51: (pow51: pos { pow2 64 == 8192 * pow51 /\ pow2 128 == 67108864 * pow51 * pow51 /\ pow51 == pow2 51 }) =
let pow51: pos = normalize_term (pow2 51) in
assert_norm (pow51 > 0);
assert_norm (pow51 == pow2 51);
assert_norm (pow2 64 == 8192 * pow51);
assert_norm (pow2 128 == 67108864 * pow51 * pow51);
pow51
inline_for_extraction noextract
let max51 = pow51 - 1
inline_for_extraction noextract
let mask51 : x:uint64{v x == pow2 51 - 1} =
assert_norm (pow2 51 - 1 == 0x7ffffffffffff);
u64 0x7ffffffffffff
let felem_fits1 (x:uint64) (m:scale64) =
uint_v x <= m * max51
let felem_wide_fits1 (x:uint128) (m:scale128) =
uint_v x <= m * max51 * max51
let felem_fits5 (f:felem5) (m:scale64_5) =
let (x1,x2,x3,x4,x5) = f in
let (m1,m2,m3,m4,m5) = m in
felem_fits1 x1 m1 /\
felem_fits1 x2 m2 /\
felem_fits1 x3 m3 /\
felem_fits1 x4 m4 /\
felem_fits1 x5 m5
let felem_wide_fits5 (f:felem_wide5) (m:scale128_5) =
let (x1,x2,x3,x4,x5) = f in
let (m1,m2,m3,m4,m5) = m in
felem_wide_fits1 x1 m1 /\
felem_wide_fits1 x2 m2 /\
felem_wide_fits1 x3 m3 /\
felem_wide_fits1 x4 m4 /\
felem_wide_fits1 x5 m5
noextract | false | false | Hacl.Spec.Curve25519.Field51.Definition.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val as_nat5: f:felem5 -> GTot nat | [] | Hacl.Spec.Curve25519.Field51.Definition.as_nat5 | {
"file_name": "code/curve25519/Hacl.Spec.Curve25519.Field51.Definition.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | f: Hacl.Spec.Curve25519.Field51.Definition.felem5 -> Prims.GTot Prims.nat | {
"end_col": 85,
"end_line": 126,
"start_col": 15,
"start_line": 123
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.